From 2c1062e4433dcadd5ad90a7a757235b182cab128 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 3 Mar 2010 21:12:20 +0000 Subject: [PATCH 0001/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * a first draft implementation --- .../org.eclipse.e4.tools.emf.ui/.classpath | 7 + bundles/org.eclipse.e4.tools.emf.ui/.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 8 + .../.settings/org.eclipse.pde.core.prefs | 4 + .../META-INF/MANIFEST.MF | 25 + .../org.eclipse.e4.tools.emf.ui/about.html | 45 + .../build.properties | 12 + .../icons/application.png | Bin 0 -> 464 bytes .../icons/application_double.png | Bin 0 -> 533 bytes .../icons/application_form.png | Bin 0 -> 467 bytes .../icons/application_form_edit.png | Bin 0 -> 714 bytes .../icons/application_view_icons.png | Bin 0 -> 476 bytes .../org.eclipse.e4.tools.emf.ui/icons/cog.png | Bin 0 -> 512 bytes .../icons/package_go.png | Bin 0 -> 898 bytes .../plugin.properties | 8 + .../tools/emf/ui/common/IModelResource.java | 22 + .../tools/emf/ui/common/XMIModelResource.java | 72 ++ .../component/AbstractComponentEditor.java | 23 + .../emf/ui/internal/ShadowComposite.java | 1094 +++++++++++++++++ .../common/ComponentLabelProvider.java | 141 +++ .../emf/ui/internal/common/ModelEditor.java | 233 ++++ .../emf/ui/internal/common/VirtualEntry.java | 78 ++ .../common/component/ApplicationEditor.java | 53 + .../component/ModelComponentEditor.java | 151 +++ .../component/ModelComponentsEditor.java | 51 + .../component/PartDescriptorEditor.java | 37 + .../internal/common/component/PartEditor.java | 206 ++++ .../ui/internal/wbe/ExtensionModelEditor.java | 5 + .../internal/wbm/ApplicationModelEditor.java | 16 + 29 files changed, 2319 insertions(+) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/.classpath create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/.project create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.core.prefs create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/about.html create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/build.properties create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application_double.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application_form.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application_form_edit.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application_view_icons.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/cog.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/package_go.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/plugin.properties create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ShadowComposite.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbe/ExtensionModelEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.classpath b/bundles/org.eclipse.e4.tools.emf.ui/.classpath new file mode 100644 index 0000000000..304e86186a --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.project b/bundles/org.eclipse.e4.tools.emf.ui/.project new file mode 100644 index 0000000000..3848d4ae08 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/.project @@ -0,0 +1,28 @@ + + + org.eclipse.e4.tools.emf.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..04d8a38777 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Tue Mar 02 18:39:11 CET 2010 +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/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 0000000000..81bd2f274f --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,4 @@ +#Tue Mar 02 18:39:11 CET 2010 +eclipse.preferences.version=1 +pluginProject.extensions=false +resolve.requirebundle=false diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..39de767f68 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -0,0 +1,25 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.e4.tools.emf.ui;singleton:=true +Bundle-Version: 1.0.0 +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", + org.eclipse.core.databinding.property;bundle-version="1.2.100", + org.eclipse.e4.ui.model.workbench;bundle-version="0.9.1", + org.eclipse.emf.databinding;bundle-version="1.2.0", + org.eclipse.jface.databinding;bundle-version="1.4.0", + org.eclipse.jface;bundle-version="3.6.0", + org.eclipse.emf.edit;bundle-version="2.6.0", + org.eclipse.equinox.common;bundle-version="3.6.0" +Bundle-ActivationPolicy: lazy +Import-Package: javax.inject;version="1.0.0" +Export-Package: org.eclipse.e4.tools.emf.ui.common, + org.eclipse.e4.tools.emf.ui.common.component, + org.eclipse.e4.tools.emf.ui.internal.common;x-internal:=true, + org.eclipse.e4.tools.emf.ui.internal.common.component;x-internal:=true, + org.eclipse.e4.tools.emf.ui.internal.wbe;x-internal:=true, + org.eclipse.e4.tools.emf.ui.internal.wbm;x-internal:=true diff --git a/bundles/org.eclipse.e4.tools.emf.ui/about.html b/bundles/org.eclipse.e4.tools.emf.ui/about.html new file mode 100644 index 0000000000..c1343aa318 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/about.html @@ -0,0 +1,45 @@ + + + + +About + + +

About This Content

+ +

December 3, 2009

+

License

+ +

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 http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

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 http://www.eclipse.org.

+ +

Third Party Content

+ +

The Content includes items from third parties as set out below. If you did not +receive this Content directly from the Eclipse Foundation, the following is provided for informational +purposes only, and you should look to the Redistributor’s license for terms and conditions of use.

+ +

Silk icon set Version 1.3

+

+This plugin contains icons from the Silk icon set created by Mark James. The original files can +be found at: +

+

The license can be found at:

+ + + + \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/build.properties b/bundles/org.eclipse.e4.tools.emf.ui/build.properties new file mode 100644 index 0000000000..6cf6ee0dc7 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/build.properties @@ -0,0 +1,12 @@ + +# +# +# +# $Id$ + +bin.includes = .,\ + META-INF/,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin/ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/application.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/application.png new file mode 100644 index 0000000000000000000000000000000000000000..1dee9e366094e87db68c606d0522d72d4b939818 GIT binary patch literal 464 zcmV;>0WbcEP)8e6`gpm!y1M!N^ZV(=IC*t) z{^;nqJv-tM$9J1L2QJ2DN!#51=1_l@G`2=6e0lehL%sic%`_4--LFM}IF!KzJCseW zq1I3__Z40|e?qyK1__gzP(qrBf-G7SQbQ`#Lw94WVe(o`qg+f4hy;Qju)q#I(9{`% zQmAGomzhQ!b|gq>KqL@IkO~$=Koi}a$u6d07kiS}NoYVMJjAeZpaB*;wwcDdEbK@K zNP;B7RzhQ|H9AlUO<`J>m1(5R)Pb-iLBb@7Jp)}LHdAb-VVgYxVoTzGoqu{~a>6uj zeqCRFI9pC#h09bGwy9;oHcp6(RB%jeY^F=Ll!S+9JkVe4nDG7tJMQiP0000 zld+0ZK^TRQ&AxX;a%I->Ls?9Vv(;_9E)=9HE>13WHNsnHAS>LKQkMbVH_QE8X!1!(q^p{6+N_ X4^=JUQP|Z100000NkvXXu0mjfgEH)N literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/application_form.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/application_form.png new file mode 100644 index 0000000000000000000000000000000000000000..807b862cfc087b70dcdd971af3ac92688484e998 GIT binary patch literal 467 zcmV;^0WAKBP)4nWfMy23V#h*$3p-!?D%AI~T5+JJ;5Qi)|`;Y?)XOj2U`VS70o zp1%L~Y4f1;U-b7MEOk38OU$EtImvzCpiEkKCg)@3^{;h@nc_6NuOBn7?ZF9Ev4w3+ zWiSxI_v2&k@_b{1R8kdeGLx;rFK&F@c}mqZ4YwJO$7q^VC6&nL^Y#-6g9F*zM-oa= z70W0^1X#=%!t{DQE-wCJ^Pd1r08&yFDUlL$EtoM3e+;?Hv-Nc(QI%=il9}v$`OS^N z)(TbAG~DLw><`m+N>!Xf5_@kR0j83~eKLh5sv-%=fC#``TU}jaG#UW`VS>Ph2!jLJ zROR&N$x3B;J002ov JPDHLkV1im=zqMscT0g(~ZNI{bH#Y_Utm11j?0+FF&hK-qRX-TePYY3~f zgtoM;)~2M+AJew!(sr+7^KN&$cgxoJcJAGZGzzQ(AD(j#=leYm&p8hTfchUO*=18r zr!~koJq|$qh+zB()q@3G>7PU6y;(H$c~Nhe#3lU)C~l9VR_BJ=;N(S}WT3GGbJ~$L zY!^k>SWYq!Z~hmmJ4PWHsEvN4)9Gy^Z?)wOR0E3;1OdDR51!|xxx?Z3jR~6$3lGcS zw`wrecMQ|rMHQ4-uw*icvKH@8Qe-U(ejNgB1!Gqt;e8II!iaktI@}570bpEkH@7b5obwc$sUX75)sc{ zLoV$^I#`Q!&qeqKv2}x;Q6ZOcK?qbLvr>-a zyc(hY)2O@Nn=hiGX9AH(WK#{q_3OcQFyqRCxB{6^XTi-jVaae3jL(UZMoZqHPUiu` zFod;2WZ-*e#Qe)flJ*;9mgV@eat;ZSNkD%BUpZPjbEd(ZH>lOVM>tFq!k`K6p&rZ) zt12-&(V<8oA9F-Oc!oCq@PvQW{0``D3AONE*fZt6-G6K6?>+q?gw;DtTL1t607*qoM6N<$g3ymi=>Px# literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/application_view_icons.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/application_view_icons.png new file mode 100644 index 0000000000000000000000000000000000000000..6a93cdaa78cc42caed19920ae622af7e35f6067a GIT binary patch literal 476 zcmV<20VDp2P)yh(bgPr6Nj-nT19X7DZ8zeUKOl_Tl|>1YLMH z=jlD?b+Sb_xgR_*#(SP~INR$20GAV7?rFuloUPPDd!HchGLr8gZI>aqRf53gD~KB} z;7=4_D*g<@>Ld7K_aG;3>sUvEaJphdb1M87A#!by06TZW*wPh{Ku&%@CmC6|-~wsq zjb0RsMFKOF(Fjbu5Fwh)ru|I#tR-Lz>qIaxcgh90?Z1KrCWc|y!1T|aZ~=a*-(Ag4 zSPUtVz{2m+IDzS#IpP9w-9EN;RO;3eG#U+?z$0h4Kv;Wfk8B+i3#{n6-UibhNOQqt z?12jeFM)^6#o@C#4HjCL*d?a8z!%N)t>y1HEak5ffl*Zzs?{nz*J?G;G`=UdUjg$j zC=)9;^kAC{HL0z0x7{1P|EQ`>eA9tOij?;P^H=75o6^EkKQu SuK{QP0000CQDsH?WF>AIFt zQuJ}i;w2$ZUU#3SZ6RY0Gw;kZ&ol1~2ky^QZ(fom$=jNJZt!z7w_pH~wdQ;R)Gh%BbQFCx+Nm!4SuS-vkr`vhhrX zM*>w%e+v~?m@q~ImPAgtLkR_3U<2F8LP3W5=LJ*ZN|S5p#sf4YFr$p~Q~Z*0Ngxf2 zjk#J#<7EAlhzlrV53~GF&pIzcCN_lz9@05UeoUXiK%N z#x+4o*i_c|6_Uu1+&TIho?3@y4k-#b8Y_o94zW*B3a1ne2-Y5s0uke$$|@=}OP-i= zNYZQA=>PrZu0MfSL=b8UhD_={W4IY1{b{)U)*gc45xtL%IYLY&hF;d`@GzI&7H&D# zh;z_BX$#hqh@q?AY3sJTod2%*Yd)_>YM0#q&ixGuh+PQsneK)F0000yqPWur#3F*- zi1-H*6GJgONgz~1E;+_Oe@~@VF-1Iy-=*@ zV9T!Kgk#%59lVt}Zj7B_)9wTKYBy6YEwPxKqOdeGuEw0%cVhe}Yj*hPSBMNYZ5yz{ z4STT*%d9TVV4NauDND$z(%QKb>=kMr>ckh0lFuesOioc=Nq^^8BQNYYbk1@M%M`O? zh?6H&UZR}Ol3%#RzJX5(MAktmg_e?7`2>w^4^!6w)4$9==U0)EV$}u1A)*bPRF?jv zHdar4EJB1b*f+rh!M+8R159x8%Qjd0I{0j+|69pUC)f(>!P(OTs8c~;XuVtXzfO>s`m zrjW9YI38*Yel_NvP&FVfNEx)sn-kxIx;WzEcpe*LJBYXLr(llS6I0o+c9O z0L_4N7u$0%Dx~ks;fjYRF0OIOR}1uPI!MtibK=J3pihiBTv)jD>R%(Llj(_XFa#mG z6Wg=#j7Q7*PFmM*W@B9!ftm;#qU}sCT;|&KtBZ%Fe#3()Pk+9@Sw&8%k=NQD>92qN zkFT*E2S*%i&!MYvH;;DpF?sU}zb4Mlls)au3~BX$XZr12Z?_sbts>8Fec~0Xl1q`9 zxyH%T#p<5UCqrY2(J4oGEHk9ens22BN3dYXATM07*qoM6N<$g3xBAZ~y=R literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/plugin.properties b/bundles/org.eclipse.e4.tools.emf.ui/plugin.properties new file mode 100644 index 0000000000..14a799fbca --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/plugin.properties @@ -0,0 +1,8 @@ + +# +# +# +# $Id$ + +pluginName = EMFUI Model +providerName = www.example.org diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java new file mode 100644 index 0000000000..e47b866b8c --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.common; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.emf.edit.domain.EditingDomain; + +public interface IModelResource { + public IObservableList getRoot(); + public boolean isSaveable(); + public IStatus save(); + public EditingDomain getEditingDomain(); +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java new file mode 100644 index 0000000000..7d7510a6d9 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.common; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.common.command.BasicCommandStack; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; +import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; + +public class XMIModelResource implements IModelResource { + private EditingDomain editingDomain; + private Resource resource; + + public XMIModelResource(String uri) { + ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( + ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + ResourceSet resourceSet = new ResourceSetImpl(); + BasicCommandStack commandStack = new BasicCommandStack(); + editingDomain = new AdapterFactoryEditingDomain(adapterFactory, + commandStack, resourceSet); + resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap() + .put(Resource.Factory.Registry.DEFAULT_EXTENSION, + new XMIResourceFactoryImpl()); + resource = resourceSet.getResource(URI.createURI(uri), true); + } + + public IObservableList getRoot() { + WritableList list = new WritableList(); + list.add(resource.getContents().get(0)); + return list; + } + + public EditingDomain getEditingDomain() { + return editingDomain; + } + + public boolean isSaveable() { + return true; + } + + public IStatus save() { + Map map = new HashMap(); + try { + resource.save(map); + } catch (Exception e) { + // TODO: handle exception + } + + return Status.OK_STATUS; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java new file mode 100644 index 0000000000..24ba71f6bd --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.common.component; + +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public abstract class AbstractComponentEditor { +// public abstract boolean canHandle(Object object); + public abstract Image getImage(Display display); + public abstract String getLabel(); + public abstract String getDescription(); + public abstract Composite getEditor(Composite parent, Object object); +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ShadowComposite.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ShadowComposite.java new file mode 100644 index 0000000000..ed5f6137eb --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ShadowComposite.java @@ -0,0 +1,1094 @@ +package org.eclipse.e4.tools.emf.ui.internal; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.graphics.PaletteData; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.Region; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class ShadowComposite extends Composite { + // Constants for circle drawing + final static int LEFT_TOP = 0; + final static int LEFT_BOTTOM = 1; + final static int RIGHT_TOP = 2; + final static int RIGHT_BOTTOM = 3; + + // drop shadow constants + final static int SIDE_DROP_WIDTH = 3; + final static int BOTTOM_DROP_WIDTH = 5; + + // keylines + final static int OUTER_KEYLINE = 2; + final static int INNER_KEYLINE = 1; + final static int TOP_KEYLINE = 2; + + static final int CORNER_SIZE = 24; + + static final String E4_SHADOW_IMAGE = "org.eclipse.e4.renderer.comp_image"; //$NON-NLS-1$ + + int marginWidth; + int marginHeight; + + static int[] shape; + + static int[] shadow = { 0x02fefefe, 0x03fefefe, 0x05fefefe, 0x06fdfdfd, + 0x08fdfdfd, 0x0bfcfcfc, 0x0dfcfcfc, 0x10fbfbfb, 0x13fafafa, + 0x17f9f9f9, 0x1af9f9f9, 0x1df8f8f8, 0x20f7f7f7, 0x23f6f6f6, + 0x26f6f6f6, 0x28f5f5f5, 0x29f5f5f5, 0x2bf4f4f4, 0x2cf4f4f4, + 0x2df4f4f4, 0x2df4f4f4, 0x2ef4f4f4, 0x2ef4f4f4, 0x2ef4f4f4, + 0x2ff4f4f4, 0x2ff3f3f3, 0x2ff3f3f3, 0x2ff3f3f3, 0x2ff3f3f3, + 0x2ff3f3f3, 0x2ff3f3f3, 0x2ff3f3f3, 0x2ff3f3f3, 0x2ff3f3f3, + 0x2ff3f3f3, 0x2ff4f4f4, 0x2ef4f4f4, 0x2ef4f4f4, 0x2ef4f4f4, + 0x2df4f4f4, 0x2df4f4f4, 0x2cf4f4f4, 0x2bf4f4f4, 0x29f5f5f5, + 0x28f5f5f5, 0x26f6f6f6, 0x23f6f6f6, 0x20f7f7f7, 0x1df8f8f8, + 0x1af9f9f9, 0x17f9f9f9, 0x13fafafa, 0x10fbfbfb, 0x0dfcfcfc, + 0x0bfcfcfc, 0x08fdfdfd, 0x06fdfdfd, 0x05fefefe, 0x03fefefe, + 0x02fefefe, 0x03fefefe, 0x05fefefe, 0x07fdfdfd, 0x09fdfdfd, + 0x0cfcfcfc, 0x0ffbfbfb, 0x13fafafa, 0x17f9f9f9, 0x1bf8f8f8, + 0x1ff7f7f7, 0x23f6f6f6, 0x27f5f5f5, 0x2bf4f4f4, 0x2ff3f3f3, + 0x32f3f3f3, 0x35f2f2f2, 0x37f1f1f1, 0x39f1f1f1, 0x3af1f1f1, + 0x3bf0f0f0, 0x3cf0f0f0, 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, + 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, + 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, + 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, + 0x3cf0f0f0, 0x3bf0f0f0, 0x3af1f1f1, 0x39f1f1f1, 0x37f1f1f1, + 0x35f2f2f2, 0x32f3f3f3, 0x2ff3f3f3, 0x2bf4f4f4, 0x27f5f5f5, + 0x23f6f6f6, 0x1ff7f7f7, 0x1bf8f8f8, 0x17f9f9f9, 0x13fafafa, + 0x0ffbfbfb, 0x0cfcfcfc, 0x09fdfdfd, 0x07fdfdfd, 0x05fefefe, + 0x03fefefe, 0x05fefefe, 0x07fdfdfd, 0x09fdfdfd, 0x0dfcfcfc, + 0x10fbfbfb, 0x15fafafa, 0x19f9f9f9, 0x1ef8f8f8, 0x24f6f6f6, + 0x29f5f5f5, 0x2ff4f4f4, 0x34f2f2f2, 0x39f1f1f1, 0x3df0f0f0, + 0x41efefef, 0x44eeeeee, 0x47ededed, 0x49ededed, 0x4bededed, + 0x4cececec, 0x4dececec, 0x4dececec, 0x4eececec, 0x4eececec, + 0x4eececec, 0x4eececec, 0x4eececec, 0x4fececec, 0x4fececec, + 0x4fececec, 0x4fececec, 0x4fececec, 0x4fececec, 0x4eececec, + 0x4eececec, 0x4eececec, 0x4eececec, 0x4eececec, 0x4dececec, + 0x4dececec, 0x4cececec, 0x4bededed, 0x49ededed, 0x47ededed, + 0x44eeeeee, 0x41efefef, 0x3df0f0f0, 0x39f1f1f1, 0x34f2f2f2, + 0x2ff4f4f4, 0x29f5f5f5, 0x24f6f6f6, 0x1ef8f8f8, 0x19f9f9f9, + 0x15fafafa, 0x10fbfbfb, 0x0dfcfcfc, 0x09fdfdfd, 0x07fdfdfd, + 0x05fefefe, 0x07fdfdfd, 0x09fdfdfd, 0x0dfcfcfc, 0x11fbfbfb, + 0x16fafafa, 0x1bf8f8f8, 0x21f7f7f7, 0x27f5f5f5, 0x2ef4f4f4, + 0x35f2f2f2, 0x3cf0f0f0, 0x42efefef, 0x48ededed, 0x4dececec, + 0x51ebebeb, 0x55eaeaea, 0x58e9e9e9, 0x5be9e9e9, 0x5de8e8e8, + 0x5ee8e8e8, 0x5fe7e7e7, 0x60e7e7e7, 0x61e7e7e7, 0x61e7e7e7, + 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, + 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, + 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x60e7e7e7, + 0x5fe7e7e7, 0x5ee8e8e8, 0x5de8e8e8, 0x5be9e9e9, 0x58e9e9e9, + 0x55eaeaea, 0x51ebebeb, 0x4dececec, 0x48ededed, 0x42efefef, + 0x3cf0f0f0, 0x35f2f2f2, 0x2ef4f4f4, 0x27f5f5f5, 0x21f7f7f7, + 0x1bf8f8f8, 0x16fafafa, 0x11fbfbfb, 0x0dfcfcfc, 0x09fdfdfd, + 0x07fdfdfd, 0x09fdfdfd, 0x0dfcfcfc, 0x11fbfbfb, 0x16fafafa, + 0x1cf8f8f8, 0x23f6f6f6, 0x2af5f5f5, 0x32f3f3f3, 0x3af1f1f1, + 0x42efefef, 0x4aededed, 0x51ebebeb, 0x58e9e9e9, 0x5ee8e8e8, + 0x64e6e6e6, 0x68e5e5e5, 0x6ce4e4e4, 0x6ee4e4e4, 0x70e3e3e3, + 0x72e3e3e3, 0x73e3e3e3, 0x74e2e2e2, 0x75e2e2e2, 0x75e2e2e2, + 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, + 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, + 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x74e2e2e2, + 0x73e3e3e3, 0x72e3e3e3, 0x70e3e3e3, 0x6ee4e4e4, 0x6ce4e4e4, + 0x68e5e5e5, 0x64e6e6e6, 0x5ee8e8e8, 0x58e9e9e9, 0x51ebebeb, + 0x4aededed, 0x42efefef, 0x3af1f1f1, 0x32f3f3f3, 0x2af5f5f5, + 0x23f6f6f6, 0x1cf8f8f8, 0x16fafafa, 0x11fbfbfb, 0x0dfcfcfc, + 0x09fdfdfd, 0x0cfcfcfc, 0x10fbfbfb, 0x16fafafa, 0x1cf8f8f8, + 0x23f6f6f6, 0x2cf4f4f4, 0x35f2f2f2, 0x3ef0f0f0, 0x48ededed, + 0x51ebebeb, 0x5ae9e9e9, 0x62e7e7e7, 0x6ae5e5e5, 0x71e3e3e3, + 0x77e2e2e2, 0x7be1e1e1, 0x7fe0e0e0, 0x82dfdfdf, 0x85dedede, + 0x86dedede, 0x88dedede, 0x88dddddd, 0x89dddddd, 0x89dddddd, + 0x89dddddd, 0x8adddddd, 0x8adddddd, 0x8adddddd, 0x8adddddd, + 0x8adddddd, 0x8adddddd, 0x8adddddd, 0x8adddddd, 0x8adddddd, + 0x8adddddd, 0x89dddddd, 0x89dddddd, 0x89dddddd, 0x88dddddd, + 0x88dedede, 0x86dedede, 0x85dedede, 0x82dfdfdf, 0x7fe0e0e0, + 0x7be1e1e1, 0x77e2e2e2, 0x71e3e3e3, 0x6ae5e5e5, 0x62e7e7e7, + 0x5ae9e9e9, 0x51ebebeb, 0x48ededed, 0x3ef0f0f0, 0x35f2f2f2, + 0x2cf4f4f4, 0x23f6f6f6, 0x1cf8f8f8, 0x16fafafa, 0x10fbfbfb, + 0x0cfcfcfc, 0x0ffbfbfb, 0x14fafafa, 0x1bf8f8f8, 0x23f6f6f6, + 0x2cf4f4f4, 0x35f2f2f2, 0x40efefef, 0x4bededed, 0x56eaeaea, + 0x60e7e7e7, 0x6ae5e5e5, 0x74e2e2e2, 0x7ce0e0e0, 0x83dfdfdf, + 0x8adddddd, 0x8fdcdcdc, 0x93dbdbdb, 0x96dadada, 0x98d9d9d9, + 0x9ad9d9d9, 0x9bd9d9d9, 0x9cd8d8d8, 0x9dd8d8d8, 0x9dd8d8d8, + 0x9dd8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, + 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, + 0x9ed8d8d8, 0x9dd8d8d8, 0x9dd8d8d8, 0x9dd8d8d8, 0x9cd8d8d8, + 0x9bd9d9d9, 0x9ad9d9d9, 0x98d9d9d9, 0x96dadada, 0x93dbdbdb, + 0x8fdcdcdc, 0x8adddddd, 0x83dfdfdf, 0x7ce0e0e0, 0x74e2e2e2, + 0x6ae5e5e5, 0x60e7e7e7, 0x56eaeaea, 0x4bededed, 0x40efefef, + 0x35f2f2f2, 0x2cf4f4f4, 0x23f6f6f6, 0x1bf8f8f8, 0x14fafafa, + 0x0ffbfbfb, 0x13fafafa, 0x19f9f9f9, 0x21f7f7f7, 0x2af5f5f5, + 0x35f2f2f2, 0x40efefef, 0x4cececec, 0x58e9e9e9, 0x64e6e6e6, + 0x70e3e3e3, 0x7be1e1e1, 0x85dedede, 0x8edcdcdc, 0x96dadada, + 0x9cd8d8d8, 0xa2d7d7d7, 0xa6d6d6d6, 0xa9d5d5d5, 0xabd5d5d5, + 0xadd4d4d4, 0xaed4d4d4, 0xafd4d4d4, 0xb0d4d4d4, 0xb0d3d3d3, + 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, + 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, + 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d4d4d4, 0xafd4d4d4, + 0xaed4d4d4, 0xadd4d4d4, 0xabd5d5d5, 0xa9d5d5d5, 0xa6d6d6d6, + 0xa2d7d7d7, 0x9cd8d8d8, 0x96dadada, 0x8edcdcdc, 0x85dedede, + 0x7be1e1e1, 0x70e3e3e3, 0x64e6e6e6, 0x58e9e9e9, 0x4cececec, + 0x40efefef, 0x35f2f2f2, 0x2af5f5f5, 0x21f7f7f7, 0x19f9f9f9, + 0x13fafafa, 0x16f9f9f9, 0x1ef8f8f8, 0x27f5f5f5, 0x32f3f3f3, + 0x3ef0f0f0, 0x4bededed, 0x58e9e9e9, 0x66e6e6e6, 0x73e3e3e3, + 0x80dfdfdf, 0x8bdddddd, 0x96dadada, 0x9fd8d8d8, 0xa7d6d6d6, + 0xaed4d4d4, 0xb3d3d3d3, 0xb7d2d2d2, 0xbad1d1d1, 0xbdd0d0d0, + 0xbed0d0d0, 0xc0d0d0d0, 0xc0cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, + 0xc1cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, 0xc2cfcfcf, 0xc2cfcfcf, + 0xc2cfcfcf, 0xc2cfcfcf, 0xc2cfcfcf, 0xc2cfcfcf, 0xc1cfcfcf, + 0xc1cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, 0xc0cfcfcf, + 0xc0d0d0d0, 0xbed0d0d0, 0xbdd0d0d0, 0xbad1d1d1, 0xb7d2d2d2, + 0xb3d3d3d3, 0xaed4d4d4, 0xa7d6d6d6, 0x9fd8d8d8, 0x96dadada, + 0x8bdddddd, 0x80dfdfdf, 0x73e3e3e3, 0x66e6e6e6, 0x58e9e9e9, + 0x4bededed, 0x3ef0f0f0, 0x32f3f3f3, 0x27f5f5f5, 0x1ef8f8f8, + 0x16f9f9f9, 0x1bf8f8f8, 0x24f6f6f6, 0x2ef4f4f4, 0x3af1f1f1, + 0x47ededed, 0x56eaeaea, 0x64e6e6e6, 0x73e3e3e3, 0x81dfdfdf, + 0x8fdcdcdc, 0x9bd9d9d9, 0xa6d6d6d6, 0xafd4d4d4, 0xb7d2d2d2, + 0xbed0d0d0, 0xc3cfcfcf, 0xc7cecece, 0xcacdcdcd, 0xcccdcdcd, + 0xcecccccc, 0xcfcccccc, 0xcfcccccc, 0xd0cccccc, 0xd0cccccc, + 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, + 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, + 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xcfcccccc, + 0xcfcccccc, 0xcecccccc, 0xcccdcdcd, 0xcacdcdcd, 0xc7cecece, + 0xc3cfcfcf, 0xbed0d0d0, 0xb7d2d2d2, 0xafd4d4d4, 0xa6d6d6d6, + 0x9bd9d9d9, 0x8fdcdcdc, 0x81dfdfdf, 0x73e3e3e3, 0x64e6e6e6, + 0x56eaeaea, 0x47ededed, 0x3af1f1f1, 0x2ef4f4f4, 0x24f6f6f6, + 0x1bf8f8f8, 0x1ff7f7f7, 0x29f5f5f5, 0x35f2f2f2, 0x42efefef, + 0x51ebebeb, 0x60e7e7e7, 0x70e3e3e3, 0x80dfdfdf, 0x8fdcdcdc, + 0x9cd8d8d8, 0xa9d5d5d5, 0xb4d2d2d2, 0xbdd0d0d0, 0xc5cecece, + 0xcbcdcdcd, 0xd0cccccc, 0xd4cbcbcb, 0xd7cacaca, 0xd9c9c9c9, + 0xdac9c9c9, 0xdbc9c9c9, 0xdcc9c9c9, 0xdcc9c9c9, 0xdcc9c9c9, + 0xddc9c9c9, 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, + 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, + 0xddc8c8c8, 0xddc9c9c9, 0xdcc9c9c9, 0xdcc9c9c9, 0xdcc9c9c9, + 0xdbc9c9c9, 0xdac9c9c9, 0xd9c9c9c9, 0xd7cacaca, 0xd4cbcbcb, + 0xd0cccccc, 0xcbcdcdcd, 0xc5cecece, 0xbdd0d0d0, 0xb4d2d2d2, + 0xa9d5d5d5, 0x9cd8d8d8, 0x8fdcdcdc, 0x80dfdfdf, 0x70e3e3e3, + 0x60e7e7e7, 0x51ebebeb, 0x42efefef, 0x35f2f2f2, 0x29f5f5f5, + 0x1ff7f7f7, 0x23f6f6f6, 0x2ff4f4f4, 0x3bf0f0f0, 0x4aededed, + 0x5ae9e9e9, 0x6ae5e5e5, 0x7be0e0e0, 0x8bdcdcdc, 0x9bd9d9d9, + 0xa9d5d5d5, 0xb6d2d2d2, 0xc0cfcfcf, 0xcacdcdcd, 0xd1cbcbcb, + 0xd7cacaca, 0xdcc9c9c9, 0xdfc8c8c8, 0xe1c7c7c7, 0xe3c7c7c7, + 0xe5c7c7c7, 0xe5c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, + 0xe6c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, + 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, + 0xe7c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, + 0xe5c6c6c6, 0xe5c7c7c7, 0xe3c7c7c7, 0xe1c7c7c7, 0xdfc8c8c8, + 0xdcc9c9c9, 0xd7cacaca, 0xd1cbcbcb, 0xcacdcdcd, 0xc0cfcfcf, + 0xb6d2d2d2, 0xa9d5d5d5, 0x9bd9d9d9, 0x8bdcdcdc, 0x7be0e0e0, + 0x6ae5e5e5, 0x5ae9e9e9, 0x4aededed, 0x3bf0f0f0, 0x2ff4f4f4, + 0x23f6f6f6, 0x27f5f5f5, 0x34f2f2f2, 0x42efefef, 0x51ebebeb, + 0x62e7e7e7, 0x74e2e2e2, 0x85dedede, 0x96dadada, 0xa6d6d6d6, + 0xb4d2d2d2, 0xc1cfcfcf, 0xcbcdcdcd, 0xd4cbcbcb, 0xdbc9c9c9, + 0xe0c8c8c8, 0xe5c7c7c7, 0xe8c6c6c6, 0xeac5c5c5, 0xecc5c5c5, + 0xedc5c5c5, 0xedc4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, + 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, + 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, + 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, + 0xedc4c4c4, 0xedc5c5c5, 0xecc5c5c5, 0xeac5c5c5, 0xe8c6c6c6, + 0xe5c7c7c7, 0xe0c8c8c8, 0xdbc9c9c9, 0xd4cbcbcb, 0xcbcdcdcd, + 0xc1cfcfcf, 0xb4d2d2d2, 0xa6d6d6d6, 0x96dadada, 0x85dedede, + 0x74e2e2e2, 0x62e7e7e7, 0x51ebebeb, 0x42efefef, 0x34f2f2f2, + 0x27f5f5f5, 0x2bf4f4f4, 0x39f1f1f1, 0x47ededed, 0x58e9e9e9, + 0x6ae5e5e5, 0x7ce0e0e0, 0x8edcdcdc, 0x9fd8d8d8, 0xafd4d4d4, + 0xbdd0d0d0, 0xcacdcdcd, 0xd4cbcbcb, 0xdcc9c9c9, 0xe3c7c7c7, + 0xe8c6c6c6, 0xecc5c5c5, 0xefc4c4c4, 0xf0c4c4c4, 0xf2c3c3c3, + 0xf3c3c3c3, 0xf3c3c3c3, 0xf3c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, + 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, + 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, + 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf3c3c3c3, + 0xf3c3c3c3, 0xf3c3c3c3, 0xf2c3c3c3, 0xf0c4c4c4, 0xefc4c4c4, + 0xecc5c5c5, 0xe8c6c6c6, 0xe3c7c7c7, 0xdcc9c9c9, 0xd4cbcbcb, + 0xcacdcdcd, 0xbdd0d0d0, 0xafd4d4d4, 0x9fd8d8d8, 0x8edcdcdc, + 0x7ce0e0e0, 0x6ae5e5e5, 0x58e9e9e9, 0x47ededed, 0x39f1f1f1, + 0x2bf4f4f4, 0x2ff4f4f4, 0x3df0f0f0, 0x4dececec, 0x5ee8e8e8, + 0x71e3e3e3, 0x84dfdfdf, 0x96dadada, 0xa7d6d6d6, 0xb7d2d2d2, + 0xc5cecece, 0xd1cbcbcb, 0xdbc9c9c9, 0xe3c7c7c7, 0xe9c6c6c6, + 0xeec4c4c4, 0xf1c4c4c4, 0xf4c3c3c3, 0xf5c2c2c2, 0xf6c2c2c2, + 0xf7c2c2c2, 0xf7c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, + 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, + 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, + 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, + 0xf7c2c2c2, 0xf7c2c2c2, 0xf6c2c2c2, 0xf5c2c2c2, 0xf4c3c3c3, + 0xf1c4c4c4, 0xeec4c4c4, 0xe9c6c6c6, 0xe3c7c7c7, 0xdbc9c9c9, + 0xd1cbcbcb, 0xc5cecece, 0xb7d2d2d2, 0xa7d6d6d6, 0x96dadada, + 0x84dfdfdf, 0x71e3e3e3, 0x5ee8e8e8, 0x4dececec, 0x3df0f0f0, + 0x2ff4f4f4, 0x32f3f3f3, 0x41efefef, 0x51ebebeb, 0x63e6e6e6, + 0x77e2e2e2, 0x8adddddd, 0x9cd8d8d8, 0xaed4d4d4, 0xbdd0d0d0, + 0xcbcdcdcd, 0xd7cacaca, 0xe0c7c7c7, 0xe8c6c6c6, 0xeec4c4c4, + 0xf2c3c3c3, 0xf5c3c3c3, 0xf7c2c2c2, 0xf8c2c2c2, 0xf9c1c1c1, + 0xfac1c1c1, 0xfac1c1c1, 0xfac1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, + 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, + 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, + 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfac1c1c1, + 0xfac1c1c1, 0xfac1c1c1, 0xf9c1c1c1, 0xf8c2c2c2, 0xf7c2c2c2, + 0xf5c3c3c3, 0xf2c3c3c3, 0xeec4c4c4, 0xe8c6c6c6, 0xe0c7c7c7, + 0xd7cacaca, 0xcbcdcdcd, 0xbdd0d0d0, 0xaed4d4d4, 0x9cd8d8d8, + 0x8adddddd, 0x77e2e2e2, 0x63e6e6e6, 0x51ebebeb, 0x41efefef, + 0x32f3f3f3, 0x34f2f2f2, 0x44eeeeee, 0x55eaeaea, 0x68e5e5e5, + 0x7be1e1e1, 0x8fdcdcdc, 0xa1d7d7d7, 0xb3d3d3d3, 0xc2cfcfcf, + 0xd0cbcbcb, 0xdcc9c9c9, 0xe4c6c6c6, 0xecc5c5c5, 0xf1c4c4c4, + 0xf5c3c3c3, 0xf8c2c2c2, 0xfac1c1c1, 0xfac1c1c1, 0xfcc1c1c1, + 0xfcc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, + 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, + 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, + 0xfdc1c1c1, 0xfdc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, + 0xfcc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, 0xfac1c1c1, 0xfac1c1c1, + 0xf8c2c2c2, 0xf5c3c3c3, 0xf1c4c4c4, 0xecc5c5c5, 0xe4c6c6c6, + 0xdcc9c9c9, 0xd0cbcbcb, 0xc2cfcfcf, 0xb3d3d3d3, 0xa1d7d7d7, + 0x8fdcdcdc, 0x7be1e1e1, 0x68e5e5e5, 0x55eaeaea, 0x44eeeeee, + 0x34f2f2f2, 0x37f2f2f2, 0x47eeeeee, 0x58e9e9e9, 0x6be4e4e4, + 0x7fe0e0e0, 0x93dbdbdb, 0xa5d6d6d6, 0xb7d2d2d2, 0xc6cecece, + 0xd4cacaca, 0xdfc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf3c3c3c3, + 0xf7c2c2c2, 0xfac2c2c2, 0xfbc1c1c1, 0xfcc1c1c1, 0xfdc0c0c0, + 0xfdc0c0c0, 0xfdc0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc0c0c0, 0xfdc0c0c0, 0xfdc0c0c0, 0xfcc1c1c1, 0xfbc1c1c1, + 0xfac2c2c2, 0xf7c2c2c2, 0xf3c3c3c3, 0xeec4c4c4, 0xe7c6c6c6, + 0xdfc8c8c8, 0xd4cacaca, 0xc6cecece, 0xb7d2d2d2, 0xa5d6d6d6, + 0x93dbdbdb, 0x7fe0e0e0, 0x6be4e4e4, 0x58e9e9e9, 0x47eeeeee, + 0x37f2f2f2, 0x38f1f1f1, 0x49ededed, 0x5be9e9e9, 0x6ee4e4e4, + 0x82dfdfdf, 0x96dadada, 0xa9d5d5d5, 0xbbd1d1d1, 0xc9cecece, + 0xd7cacaca, 0xe2c7c7c7, 0xeac5c5c5, 0xf0c4c4c4, 0xf5c3c3c3, + 0xf9c2c2c2, 0xfbc1c1c1, 0xfcc0c0c0, 0xfdc0c0c0, 0xfec0c0c0, + 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfdc0c0c0, 0xfcc0c0c0, + 0xfbc1c1c1, 0xf9c2c2c2, 0xf5c3c3c3, 0xf0c4c4c4, 0xeac5c5c5, + 0xe2c7c7c7, 0xd7cacaca, 0xc9cecece, 0xbbd1d1d1, 0xa9d5d5d5, + 0x96dadada, 0x82dfdfdf, 0x6ee4e4e4, 0x5be9e9e9, 0x49ededed, + 0x38f1f1f1, 0x3af1f1f1, 0x4bededed, 0x5de8e8e8, 0x70e3e3e3, + 0x85dedede, 0x99d9d9d9, 0xabd4d4d4, 0xbdd0d0d0, 0xcccdcdcd, + 0xd9c9c9c9, 0xe4c7c7c7, 0xebc5c5c5, 0xf2c4c4c4, 0xf6c2c2c2, + 0xfac1c1c1, 0xfcc1c1c1, 0xfdc0c0c0, 0xfdc0c0c0, 0xfec0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfdc0c0c0, 0xfdc0c0c0, + 0xfcc1c1c1, 0xfac1c1c1, 0xf6c2c2c2, 0xf2c4c4c4, 0xebc5c5c5, + 0xe4c7c7c7, 0xd9c9c9c9, 0xcccdcdcd, 0xbdd0d0d0, 0xabd4d4d4, + 0x99d9d9d9, 0x85dedede, 0x70e3e3e3, 0x5de8e8e8, 0x4bededed, + 0x3af1f1f1, 0x3bf1f1f1, 0x4cededed, 0x5ee8e8e8, 0x72e3e3e3, + 0x87dedede, 0x9ad9d9d9, 0xadd4d4d4, 0xbfd0d0d0, 0xcdcdcdcd, + 0xdac9c9c9, 0xe5c7c7c7, 0xecc4c4c4, 0xf3c3c3c3, 0xf7c2c2c2, + 0xfac1c1c1, 0xfcc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfcc1c1c1, 0xfac1c1c1, 0xf7c2c2c2, 0xf3c3c3c3, 0xecc4c4c4, + 0xe5c7c7c7, 0xdac9c9c9, 0xcdcdcdcd, 0xbfd0d0d0, 0xadd4d4d4, + 0x9ad9d9d9, 0x87dedede, 0x72e3e3e3, 0x5ee8e8e8, 0x4cededed, + 0x3bf1f1f1, 0x3cf0f0f0, 0x4dececec, 0x5fe7e7e7, 0x73e3e3e3, + 0x88dedede, 0x9cd9d9d9, 0xaed4d4d4, 0xc0cfcfcf, 0xcecccccc, + 0xdbc8c8c8, 0xe6c6c6c6, 0xedc4c4c4, 0xf3c3c3c3, 0xf7c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf7c2c2c2, 0xf3c3c3c3, 0xedc4c4c4, + 0xe6c6c6c6, 0xdbc8c8c8, 0xcecccccc, 0xc0cfcfcf, 0xaed4d4d4, + 0x9cd9d9d9, 0x88dedede, 0x73e3e3e3, 0x5fe7e7e7, 0x4dececec, + 0x3cf0f0f0, 0x3cf0f0f0, 0x4eececec, 0x60e7e7e7, 0x74e2e2e2, + 0x89dddddd, 0x9dd8d8d8, 0xafd3d3d3, 0xc1cfcfcf, 0xcfcccccc, + 0xdcc8c8c8, 0xe6c6c6c6, 0xedc4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xedc4c4c4, + 0xe6c6c6c6, 0xdcc8c8c8, 0xcfcccccc, 0xc1cfcfcf, 0xafd3d3d3, + 0x9dd8d8d8, 0x89dddddd, 0x74e2e2e2, 0x60e7e7e7, 0x4eececec, + 0x3cf0f0f0, 0x3cf0f0f0, 0x4eececec, 0x60e7e7e7, 0x74e2e2e2, + 0x89dddddd, 0x9dd8d8d8, 0xafd3d3d3, 0xc1cfcfcf, 0xcfcccccc, + 0xdcc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, + 0xe7c6c6c6, 0xdcc8c8c8, 0xcfcccccc, 0xc1cfcfcf, 0xafd3d3d3, + 0x9dd8d8d8, 0x89dddddd, 0x74e2e2e2, 0x60e7e7e7, 0x4eececec, + 0x3cf0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, + 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, + 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, + 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, + 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, + 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, + 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, + 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, + 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, + 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, + 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, + 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, + 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, + 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, + 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, + 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, + 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, + 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, + 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, + 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, + 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, + 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, + 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, + 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, + 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, + 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, + 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, + 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, + 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, + 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, + 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, + 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, + 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, + 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, + 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, + 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, + 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, + 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, + 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, + 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, + 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, + 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, + 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, + 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, + 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, + 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, + 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, + 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, + 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, + 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, + 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, + 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, + 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, + 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, + 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, + 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, + 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, + 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, + 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, + 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, + 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, + 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, + 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, + 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, + 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, + 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, + 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, + 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, + 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, + 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, + 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, + 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, + 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, + 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, + 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, + 0x3df0f0f0, 0x3cf0f0f0, 0x4eececec, 0x60e7e7e7, 0x74e2e2e2, + 0x89dddddd, 0x9dd8d8d8, 0xafd3d3d3, 0xc1cfcfcf, 0xcfcccccc, + 0xdcc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, + 0xe7c6c6c6, 0xdcc8c8c8, 0xcfcccccc, 0xc1cfcfcf, 0xafd3d3d3, + 0x9dd8d8d8, 0x89dddddd, 0x74e2e2e2, 0x60e7e7e7, 0x4eececec, + 0x3cf0f0f0, 0x3cf0f0f0, 0x4eececec, 0x60e7e7e7, 0x74e2e2e2, + 0x89dddddd, 0x9dd8d8d8, 0xafd3d3d3, 0xc1cfcfcf, 0xcfcccccc, + 0xdcc8c8c8, 0xe6c6c6c6, 0xedc4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xedc4c4c4, + 0xe6c6c6c6, 0xdcc8c8c8, 0xcfcccccc, 0xc1cfcfcf, 0xafd3d3d3, + 0x9dd8d8d8, 0x89dddddd, 0x74e2e2e2, 0x60e7e7e7, 0x4eececec, + 0x3cf0f0f0, 0x3cf0f0f0, 0x4dececec, 0x5fe8e8e8, 0x73e3e3e3, + 0x88dedede, 0x9cd9d9d9, 0xaed4d4d4, 0xc0d0d0d0, 0xcecccccc, + 0xdbc8c8c8, 0xe6c6c6c6, 0xedc4c4c4, 0xf3c3c3c3, 0xf7c2c2c2, + 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfdc1c1c1, 0xfbc1c1c1, 0xf7c2c2c2, 0xf3c3c3c3, 0xedc4c4c4, + 0xe6c6c6c6, 0xdbc8c8c8, 0xcecccccc, 0xc0d0d0d0, 0xaed4d4d4, + 0x9cd9d9d9, 0x88dedede, 0x73e3e3e3, 0x5fe8e8e8, 0x4dececec, + 0x3cf0f0f0, 0x3bf1f1f1, 0x4cededed, 0x5ee8e8e8, 0x72e3e3e3, + 0x86dedede, 0x9ad9d9d9, 0xadd4d4d4, 0xbfd0d0d0, 0xcdcdcdcd, + 0xdac9c9c9, 0xe5c7c7c7, 0xecc4c4c4, 0xf2c3c3c3, 0xf7c2c2c2, + 0xfac1c1c1, 0xfcc1c1c1, 0xfdc0c0c0, 0xfec0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, + 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfdc0c0c0, + 0xfcc1c1c1, 0xfac1c1c1, 0xf7c2c2c2, 0xf2c3c3c3, 0xecc4c4c4, + 0xe5c7c7c7, 0xdac9c9c9, 0xcdcdcdcd, 0xbfd0d0d0, 0xadd4d4d4, + 0x9ad9d9d9, 0x86dedede, 0x72e3e3e3, 0x5ee8e8e8, 0x4cededed, + 0x3bf1f1f1, 0x3af1f1f1, 0x4bededed, 0x5de8e8e8, 0x70e3e3e3, + 0x85dedede, 0x99d9d9d9, 0xabd4d4d4, 0xbdd0d0d0, 0xcbcdcdcd, + 0xd9c9c9c9, 0xe3c7c7c7, 0xebc5c5c5, 0xf1c4c4c4, 0xf6c3c3c3, + 0xf9c1c1c1, 0xfcc1c1c1, 0xfdc0c0c0, 0xfdc0c0c0, 0xfec0c0c0, + 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfdc0c0c0, 0xfdc0c0c0, + 0xfcc1c1c1, 0xf9c1c1c1, 0xf6c3c3c3, 0xf1c4c4c4, 0xebc5c5c5, + 0xe3c7c7c7, 0xd9c9c9c9, 0xcbcdcdcd, 0xbdd0d0d0, 0xabd4d4d4, + 0x99d9d9d9, 0x85dedede, 0x70e3e3e3, 0x5de8e8e8, 0x4bededed, + 0x3af1f1f1, 0x38f1f1f1, 0x49ededed, 0x5be9e9e9, 0x6ee4e4e4, + 0x82dfdfdf, 0x96dadada, 0xa8d5d5d5, 0xbad1d1d1, 0xc9cecece, + 0xd7cacaca, 0xe1c7c7c7, 0xe9c5c5c5, 0xf0c4c4c4, 0xf4c3c3c3, + 0xf8c2c2c2, 0xfac2c2c2, 0xfcc1c1c1, 0xfcc0c0c0, 0xfdc0c0c0, + 0xfdc0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, + 0xfec0c0c0, 0xfdc0c0c0, 0xfdc0c0c0, 0xfcc0c0c0, 0xfcc1c1c1, + 0xfac2c2c2, 0xf8c2c2c2, 0xf4c3c3c3, 0xf0c4c4c4, 0xe9c5c5c5, + 0xe1c7c7c7, 0xd7cacaca, 0xc9cecece, 0xbad1d1d1, 0xa8d5d5d5, + 0x96dadada, 0x82dfdfdf, 0x6ee4e4e4, 0x5be9e9e9, 0x49ededed, + 0x38f1f1f1, 0x37f2f2f2, 0x47eeeeee, 0x58e9e9e9, 0x6be5e5e5, + 0x7fe0e0e0, 0x93dbdbdb, 0xa5d6d6d6, 0xb7d2d2d2, 0xc6cecece, + 0xd3cacaca, 0xdec8c8c8, 0xe7c6c6c6, 0xeec5c5c5, 0xf2c3c3c3, + 0xf6c2c2c2, 0xf9c2c2c2, 0xfac1c1c1, 0xfbc1c1c1, 0xfcc1c1c1, + 0xfcc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, 0xfdc1c1c1, + 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, + 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, + 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, + 0xfcc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, 0xfbc1c1c1, 0xfac1c1c1, + 0xf9c2c2c2, 0xf6c2c2c2, 0xf2c3c3c3, 0xeec5c5c5, 0xe7c6c6c6, + 0xdec8c8c8, 0xd3cacaca, 0xc6cecece, 0xb7d2d2d2, 0xa5d6d6d6, + 0x93dbdbdb, 0x7fe0e0e0, 0x6be5e5e5, 0x58e9e9e9, 0x47eeeeee, + 0x37f2f2f2, 0x34f2f2f2, 0x44eeeeee, 0x55eaeaea, 0x67e5e5e5, + 0x7be1e1e1, 0x8edcdcdc, 0xa1d7d7d7, 0xb3d3d3d3, 0xc2cfcfcf, + 0xcfcccccc, 0xdbc9c9c9, 0xe3c7c7c7, 0xeac5c5c5, 0xf0c4c4c4, + 0xf3c3c3c3, 0xf6c3c3c3, 0xf8c2c2c2, 0xf9c1c1c1, 0xfac1c1c1, + 0xfac1c1c1, 0xfac1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, + 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, + 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, + 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, + 0xfac1c1c1, 0xfac1c1c1, 0xfac1c1c1, 0xf9c1c1c1, 0xf8c2c2c2, + 0xf6c3c3c3, 0xf3c3c3c3, 0xf0c4c4c4, 0xeac5c5c5, 0xe3c7c7c7, + 0xdbc9c9c9, 0xcfcccccc, 0xc2cfcfcf, 0xb3d3d3d3, 0xa1d7d7d7, + 0x8edcdcdc, 0x7be1e1e1, 0x67e5e5e5, 0x55eaeaea, 0x44eeeeee, + 0x34f2f2f2, 0x32f3f3f3, 0x41efefef, 0x51ebebeb, 0x63e7e7e7, + 0x76e2e2e2, 0x89dddddd, 0x9bd8d8d8, 0xadd4d4d4, 0xbcd1d1d1, + 0xcacdcdcd, 0xd5cacaca, 0xdec8c8c8, 0xe6c6c6c6, 0xebc5c5c5, + 0xf0c4c4c4, 0xf3c3c3c3, 0xf5c2c2c2, 0xf6c2c2c2, 0xf7c2c2c2, + 0xf7c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, + 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, + 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, + 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, + 0xf8c2c2c2, 0xf7c2c2c2, 0xf7c2c2c2, 0xf6c2c2c2, 0xf5c2c2c2, + 0xf3c3c3c3, 0xf0c4c4c4, 0xebc5c5c5, 0xe6c6c6c6, 0xdec8c8c8, + 0xd5cacaca, 0xcacdcdcd, 0xbcd1d1d1, 0xadd4d4d4, 0x9bd8d8d8, + 0x89dddddd, 0x76e2e2e2, 0x63e7e7e7, 0x51ebebeb, 0x41efefef, + 0x32f3f3f3, 0x2ef4f4f4, 0x3df0f0f0, 0x4cececec, 0x5ee8e8e8, + 0x70e3e3e3, 0x83dfdfdf, 0x94dadada, 0xa6d6d6d6, 0xb5d2d2d2, + 0xc3cfcfcf, 0xcfcccccc, 0xd8c9c9c9, 0xe0c8c8c8, 0xe6c6c6c6, + 0xeac5c5c5, 0xeec5c5c5, 0xf0c4c4c4, 0xf1c3c3c3, 0xf3c3c3c3, + 0xf3c3c3c3, 0xf3c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, + 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, + 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, + 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, + 0xf3c3c3c3, 0xf3c3c3c3, 0xf3c3c3c3, 0xf1c3c3c3, 0xf0c4c4c4, + 0xeec5c5c5, 0xeac5c5c5, 0xe6c6c6c6, 0xe0c8c8c8, 0xd8c9c9c9, + 0xcfcccccc, 0xc3cfcfcf, 0xb5d2d2d2, 0xa6d6d6d6, 0x94dadada, + 0x83dfdfdf, 0x70e3e3e3, 0x5ee8e8e8, 0x4cececec, 0x3df0f0f0, + 0x2ef4f4f4, 0x2bf4f4f4, 0x38f1f1f1, 0x47eeeeee, 0x57e9e9e9, + 0x69e5e5e5, 0x7be1e1e1, 0x8cdcdcdc, 0x9dd8d8d8, 0xadd4d4d4, + 0xbbd1d1d1, 0xc7cecece, 0xd0cbcbcb, 0xd8cacaca, 0xdfc8c8c8, + 0xe3c7c7c7, 0xe7c6c6c6, 0xeac5c5c5, 0xebc5c5c5, 0xedc5c5c5, + 0xedc4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, + 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, + 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, + 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, + 0xeec4c4c4, 0xedc4c4c4, 0xedc5c5c5, 0xebc5c5c5, 0xeac5c5c5, + 0xe7c6c6c6, 0xe3c7c7c7, 0xdfc8c8c8, 0xd8cacaca, 0xd0cbcbcb, + 0xc7cecece, 0xbbd1d1d1, 0xadd4d4d4, 0x9dd8d8d8, 0x8cdcdcdc, + 0x7be1e1e1, 0x69e5e5e5, 0x57e9e9e9, 0x47eeeeee, 0x38f1f1f1, + 0x2bf4f4f4, 0x27f5f5f5, 0x33f2f2f2, 0x41efefef, 0x50ebebeb, + 0x61e7e7e7, 0x72e3e3e3, 0x83dedede, 0x94dadada, 0xa3d7d7d7, + 0xb0d3d3d3, 0xbcd0d0d0, 0xc6cecece, 0xcfcccccc, 0xd5cacaca, + 0xdac9c9c9, 0xdec8c8c8, 0xe1c7c7c7, 0xe3c7c7c7, 0xe4c7c7c7, + 0xe5c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, + 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, + 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, + 0xe7c6c6c6, 0xe7c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, + 0xe6c6c6c6, 0xe5c6c6c6, 0xe4c7c7c7, 0xe3c7c7c7, 0xe1c7c7c7, + 0xdec8c8c8, 0xdac9c9c9, 0xd5cacaca, 0xcfcccccc, 0xc6cecece, + 0xbcd0d0d0, 0xb0d3d3d3, 0xa3d7d7d7, 0x94dadada, 0x83dedede, + 0x72e3e3e3, 0x61e7e7e7, 0x50ebebeb, 0x41efefef, 0x33f2f2f2, + 0x27f5f5f5, 0x23f6f6f6, 0x2ef4f4f4, 0x3bf1f1f1, 0x49ededed, + 0x58e9e9e9, 0x68e5e5e5, 0x78e1e1e1, 0x88dddddd, 0x97dadada, + 0xa5d6d6d6, 0xb0d3d3d3, 0xbbd1d1d1, 0xc3cfcfcf, 0xcacdcdcd, + 0xcfcccccc, 0xd3cbcbcb, 0xd7cacaca, 0xd9c9c9c9, 0xdac9c9c9, + 0xdbc9c9c9, 0xdcc9c9c9, 0xdcc9c9c9, 0xdcc9c9c9, 0xddc9c9c9, + 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, + 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, + 0xddc8c8c8, 0xddc8c8c8, 0xddc9c9c9, 0xdcc9c9c9, 0xdcc9c9c9, + 0xdcc9c9c9, 0xdbc9c9c9, 0xdac9c9c9, 0xd9c9c9c9, 0xd7cacaca, + 0xd3cbcbcb, 0xcfcccccc, 0xcacdcdcd, 0xc3cfcfcf, 0xbbd1d1d1, + 0xb0d3d3d3, 0xa5d6d6d6, 0x97dadada, 0x88dddddd, 0x78e1e1e1, + 0x68e5e5e5, 0x58e9e9e9, 0x49ededed, 0x3bf1f1f1, 0x2ef4f4f4, + 0x23f6f6f6, 0x1ef7f7f7, 0x28f5f5f5, 0x34f2f2f2, 0x41efefef, + 0x4fececec, 0x5ee8e8e8, 0x6de4e4e4, 0x7ce0e0e0, 0x8adddddd, + 0x97dadada, 0xa3d7d7d7, 0xadd4d4d4, 0xb5d2d2d2, 0xbcd1d1d1, + 0xc2cfcfcf, 0xc6cecece, 0xc9cdcdcd, 0xcccdcdcd, 0xcdcccccc, + 0xcecccccc, 0xcfcccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, + 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, + 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, + 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, + 0xcfcccccc, 0xcecccccc, 0xcdcccccc, 0xcccdcdcd, 0xc9cdcdcd, + 0xc6cecece, 0xc2cfcfcf, 0xbcd1d1d1, 0xb5d2d2d2, 0xadd4d4d4, + 0xa3d7d7d7, 0x97dadada, 0x8adddddd, 0x7ce0e0e0, 0x6de4e4e4, + 0x5ee8e8e8, 0x4fececec, 0x41efefef, 0x34f2f2f2, 0x28f5f5f5, + 0x1ef7f7f7, 0x1af9f9f9, 0x23f6f6f6, 0x2df4f4f4, 0x39f1f1f1, + 0x45eeeeee, 0x53ebebeb, 0x61e7e7e7, 0x6fe4e4e4, 0x7ce0e0e0, + 0x88dddddd, 0x93dbdbdb, 0x9dd8d8d8, 0xa6d6d6d6, 0xadd4d4d4, + 0xb2d3d3d3, 0xb7d2d2d2, 0xbad1d1d1, 0xbdd0d0d0, 0xbed0d0d0, + 0xbfd0d0d0, 0xc0cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, + 0xc1cfcfcf, 0xc1cfcfcf, 0xc2cfcfcf, 0xc2cfcfcf, 0xc2cfcfcf, + 0xc2cfcfcf, 0xc2cfcfcf, 0xc2cfcfcf, 0xc2cfcfcf, 0xc2cfcfcf, + 0xc1cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, + 0xc0cfcfcf, 0xbfd0d0d0, 0xbed0d0d0, 0xbdd0d0d0, 0xbad1d1d1, + 0xb7d2d2d2, 0xb2d3d3d3, 0xadd4d4d4, 0xa6d6d6d6, 0x9dd8d8d8, + 0x93dbdbdb, 0x88dddddd, 0x7ce0e0e0, 0x6fe4e4e4, 0x61e7e7e7, + 0x53ebebeb, 0x45eeeeee, 0x39f1f1f1, 0x2df4f4f4, 0x23f6f6f6, + 0x1af9f9f9, 0x16fafafa, 0x1df8f8f8, 0x26f6f6f6, 0x30f3f3f3, + 0x3cf0f0f0, 0x48ededed, 0x54eaeaea, 0x61e7e7e7, 0x6de4e4e4, + 0x79e1e1e1, 0x83dfdfdf, 0x8ddcdcdc, 0x95dadada, 0x9bd9d9d9, + 0xa1d7d7d7, 0xa5d6d6d6, 0xa9d5d5d5, 0xabd5d5d5, 0xadd4d4d4, + 0xaed4d4d4, 0xafd4d4d4, 0xb0d4d4d4, 0xb0d3d3d3, 0xb0d3d3d3, + 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, + 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, + 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d4d4d4, + 0xafd4d4d4, 0xaed4d4d4, 0xadd4d4d4, 0xabd5d5d5, 0xa9d5d5d5, + 0xa5d6d6d6, 0xa1d7d7d7, 0x9bd9d9d9, 0x95dadada, 0x8ddcdcdc, + 0x83dfdfdf, 0x79e1e1e1, 0x6de4e4e4, 0x61e7e7e7, 0x54eaeaea, + 0x48ededed, 0x3cf0f0f0, 0x30f3f3f3, 0x26f6f6f6, 0x1df8f8f8, + 0x16fafafa, 0x12fbfbfb, 0x18f9f9f9, 0x20f7f7f7, 0x28f5f5f5, + 0x32f3f3f3, 0x3df0f0f0, 0x48ededed, 0x53eaeaea, 0x5ee8e8e8, + 0x68e5e5e5, 0x72e3e3e3, 0x7be1e1e1, 0x82dfdfdf, 0x89dddddd, + 0x8edcdcdc, 0x93dbdbdb, 0x96dadada, 0x98d9d9d9, 0x9ad9d9d9, + 0x9bd9d9d9, 0x9cd8d8d8, 0x9dd8d8d8, 0x9dd8d8d8, 0x9dd8d8d8, + 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, + 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, + 0x9ed8d8d8, 0x9ed8d8d8, 0x9dd8d8d8, 0x9dd8d8d8, 0x9dd8d8d8, + 0x9cd8d8d8, 0x9bd9d9d9, 0x9ad9d9d9, 0x98d9d9d9, 0x96dadada, + 0x93dbdbdb, 0x8edcdcdc, 0x89dddddd, 0x82dfdfdf, 0x7be1e1e1, + 0x72e3e3e3, 0x68e5e5e5, 0x5ee8e8e8, 0x53eaeaea, 0x48ededed, + 0x3df0f0f0, 0x32f3f3f3, 0x28f5f5f5, 0x20f7f7f7, 0x18f9f9f9, + 0x12fbfbfb, 0x0efbfbfb, 0x14fafafa, 0x1af9f9f9, 0x21f7f7f7, + 0x29f5f5f5, 0x32f3f3f3, 0x3cf0f0f0, 0x45eeeeee, 0x4febebeb, + 0x58e9e9e9, 0x61e7e7e7, 0x69e5e5e5, 0x70e3e3e3, 0x76e2e2e2, + 0x7be1e1e1, 0x7fe0e0e0, 0x82dfdfdf, 0x85dedede, 0x86dedede, + 0x87dedede, 0x88dddddd, 0x89dddddd, 0x89dddddd, 0x89dddddd, + 0x8adddddd, 0x8adddddd, 0x8adddddd, 0x8adddddd, 0x8adddddd, + 0x8adddddd, 0x8adddddd, 0x8adddddd, 0x8adddddd, 0x8adddddd, + 0x8adddddd, 0x8adddddd, 0x89dddddd, 0x89dddddd, 0x89dddddd, + 0x88dddddd, 0x87dedede, 0x86dedede, 0x85dedede, 0x82dfdfdf, + 0x7fe0e0e0, 0x7be1e1e1, 0x76e2e2e2, 0x70e3e3e3, 0x69e5e5e5, + 0x61e7e7e7, 0x58e9e9e9, 0x4febebeb, 0x45eeeeee, 0x3cf0f0f0, + 0x32f3f3f3, 0x29f5f5f5, 0x21f7f7f7, 0x1af9f9f9, 0x14fafafa, + 0x0efbfbfb, 0x0bfcfcfc, 0x0ffbfbfb, 0x14fafafa, 0x1af8f8f8, + 0x21f7f7f7, 0x29f5f5f5, 0x30f3f3f3, 0x39f1f1f1, 0x41efefef, + 0x49ededed, 0x51ebebeb, 0x58e9e9e9, 0x5ee8e8e8, 0x63e6e6e6, + 0x68e5e5e5, 0x6be4e4e4, 0x6ee4e4e4, 0x70e3e3e3, 0x72e3e3e3, + 0x73e3e3e3, 0x74e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, + 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, + 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, + 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, + 0x74e2e2e2, 0x73e3e3e3, 0x72e3e3e3, 0x70e3e3e3, 0x6ee4e4e4, + 0x6be4e4e4, 0x68e5e5e5, 0x63e6e6e6, 0x5ee8e8e8, 0x58e9e9e9, + 0x51ebebeb, 0x49ededed, 0x41efefef, 0x39f1f1f1, 0x30f3f3f3, + 0x29f5f5f5, 0x21f7f7f7, 0x1af8f8f8, 0x14fafafa, 0x0ffbfbfb, + 0x0bfcfcfc, 0x09fdfdfd, 0x0cfcfcfc, 0x10fbfbfb, 0x14fafafa, + 0x1af9f9f9, 0x20f7f7f7, 0x26f6f6f6, 0x2df4f4f4, 0x34f2f2f2, + 0x3bf0f0f0, 0x41efefef, 0x47ededed, 0x4cececec, 0x51ebebeb, + 0x55eaeaea, 0x58e9e9e9, 0x5be9e9e9, 0x5de8e8e8, 0x5ee8e8e8, + 0x5fe7e7e7, 0x60e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, + 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, + 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, + 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, + 0x60e7e7e7, 0x5fe7e7e7, 0x5ee8e8e8, 0x5de8e8e8, 0x5be9e9e9, + 0x58e9e9e9, 0x55eaeaea, 0x51ebebeb, 0x4cececec, 0x47ededed, + 0x41efefef, 0x3bf0f0f0, 0x34f2f2f2, 0x2df4f4f4, 0x26f6f6f6, + 0x20f7f7f7, 0x1af9f9f9, 0x14fafafa, 0x10fbfbfb, 0x0cfcfcfc, + 0x09fdfdfd, 0x06fdfdfd, 0x09fdfdfd, 0x0cfcfcfc, 0x0ffbfbfb, + 0x14fafafa, 0x18f9f9f9, 0x1df8f8f8, 0x23f6f6f6, 0x28f5f5f5, + 0x2ef4f4f4, 0x33f2f2f2, 0x38f1f1f1, 0x3df0f0f0, 0x41efefef, + 0x44eeeeee, 0x47eeeeee, 0x49ededed, 0x4bededed, 0x4cececec, + 0x4dececec, 0x4dececec, 0x4eececec, 0x4eececec, 0x4eececec, + 0x4eececec, 0x4eececec, 0x4fececec, 0x4fececec, 0x4fececec, + 0x4fececec, 0x4fececec, 0x4fececec, 0x4fececec, 0x4fececec, + 0x4eececec, 0x4eececec, 0x4eececec, 0x4eececec, 0x4eececec, + 0x4dececec, 0x4dececec, 0x4cececec, 0x4bededed, 0x49ededed, + 0x47eeeeee, 0x44eeeeee, 0x41efefef, 0x3df0f0f0, 0x38f1f1f1, + 0x33f2f2f2, 0x2ef4f4f4, 0x28f5f5f5, 0x23f6f6f6, 0x1df8f8f8, + 0x18f9f9f9, 0x14fafafa, 0x0ffbfbfb, 0x0cfcfcfc, 0x09fdfdfd, + 0x06fdfdfd, }; + + Image shadowImage; + + public ShadowComposite(Composite parent, int style) { + super(parent, style); + addPaintListener(new PaintListener() { + + public void paintControl(PaintEvent e) { + Point size = getSize(); + Rectangle bodyRect = new Rectangle(0, 0, size.x, size.y); + drawTabBody(e.gc, bodyRect, 0); + drawTabHeader(e.gc, bodyRect, 0); + } + }); + } + + @Override + public Rectangle getClientArea() { + Rectangle area = super.getClientArea(); + return new Rectangle(15, 15, area.width - 30, area.height - 30); + } + + + + void drawTabHeader(GC gc, Rectangle bounds, int state) { + // gc.setClipping(bounds.x, bounds.y, bounds.width, + // parent.getTabHeight() + 1); + + int[] points = new int[1024]; + int index = 0; + int radius = CORNER_SIZE / 2; +// int marginWidth = parent.marginWidth; +// int marginHeight = parent.marginHeight; + int delta = INNER_KEYLINE + OUTER_KEYLINE + 2 * SIDE_DROP_WIDTH + 2 + * marginWidth; + int width = bounds.width - delta; + int height = bounds.height - INNER_KEYLINE - OUTER_KEYLINE - 2 + * marginHeight - BOTTOM_DROP_WIDTH; + int circX = bounds.x + delta / 2 + radius; + int circY = bounds.y + radius; + + // Fill in background + Region clipping = new Region(); + gc.getClipping(clipping); + Region region = new Region(); + region.add(shape); + region.intersect(clipping); + gc.setClipping(region); + +// int header = 3; // TODO: this needs to be added to computeTrim for +// // HEADER +// Rectangle trim = computeTrim(PART_HEADER, state, 0, 0, 0, 0); +// trim.width = bounds.width - trim.width; +// trim.height = (parent.getTabHeight() + 1 + header) - trim.height; +// trim.x = -trim.x; +// trim.y = -trim.y; +// +// draw(PART_BACKGROUND, SWT.NONE, trim, gc); + + gc.setClipping(clipping); + clipping.dispose(); + region.dispose(); + + int[] ltt = drawCircle(circX + 1, circY + 1, radius, LEFT_TOP); + System.arraycopy(ltt, 0, points, index, ltt.length); + index += ltt.length; + + int[] lbb = drawCircle(circX + 1, circY + height - (radius * 2) - 2, + radius, LEFT_BOTTOM); + System.arraycopy(lbb, 0, points, index, lbb.length); + index += lbb.length; + + int[] rb = drawCircle(circX + width - (radius * 2) - 2, circY + height + - (radius * 2) - 2, radius, RIGHT_BOTTOM); + System.arraycopy(rb, 0, points, index, rb.length); + index += rb.length; + + int[] rt = drawCircle(circX + width - (radius * 2) - 2, circY + 1, + radius, RIGHT_TOP); + System.arraycopy(rt, 0, points, index, rt.length); + index += rt.length; + points[index++] = points[0]; + points[index++] = points[1]; + + int[] tempPoints = new int[index]; + System.arraycopy(points, 0, tempPoints, 0, index); + + // White Keyline + // gc.setAntialias(SWT.ON); + gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE)); + gc.drawPolyline(tempPoints); + + ltt = drawCircle(circX + 2, circY + 2, radius, LEFT_TOP); + System.arraycopy(ltt, 0, points, index, ltt.length); + gc.drawPolyline(ltt); + + rt = drawCircle(circX + width - (radius * 2) - 3, circY + 2, radius, + RIGHT_TOP); + System.arraycopy(rt, 0, points, index, rt.length); + gc.drawPolyline(rt); + + int rtLength = rt.length; + gc.drawLine(rt[rtLength - 2], rt[rtLength - 1], ltt[0], ltt[1]); + + Color borderBlue = new Color(gc.getDevice(), 190, 216, 237); + gc.setForeground(borderBlue); + gc.drawPolyline(shape); + borderBlue.dispose(); + } + + void drawTabBody(GC gc, Rectangle bounds, int state) { + int[] points = new int[1024]; + int index = 0; + int radius = CORNER_SIZE / 2; +// int marginWidth = parent.marginWidth; +// int marginHeight = parent.marginHeight; + int delta = INNER_KEYLINE + OUTER_KEYLINE + 2 * SIDE_DROP_WIDTH + 2 + * marginWidth; + int width = bounds.width - delta; + int height = bounds.height - INNER_KEYLINE - OUTER_KEYLINE - 2 + * marginHeight - BOTTOM_DROP_WIDTH; + + int circX = bounds.x + delta / 2 + radius; + int circY = bounds.y + radius; + + // Body + index = 0; + int[] ltt = drawCircle(circX, circY, radius, LEFT_TOP); + System.arraycopy(ltt, 0, points, index, ltt.length); + index += ltt.length; + + int[] lbb = drawCircle(circX, circY + height - (radius * 2), radius, + LEFT_BOTTOM); + System.arraycopy(lbb, 0, points, index, lbb.length); + index += lbb.length; + + int[] rb = drawCircle(circX + width - (radius * 2), circY + height + - (radius * 2), radius, RIGHT_BOTTOM); + System.arraycopy(rb, 0, points, index, rb.length); + index += rb.length; + + int[] rt = drawCircle(circX + width - (radius * 2), circY, radius, + RIGHT_TOP); + System.arraycopy(rt, 0, points, index, rt.length); + index += rt.length; + points[index++] = circX; + points[index++] = circY - radius; + + int[] tempPoints = new int[index]; + System.arraycopy(points, 0, tempPoints, 0, index); + shape = tempPoints; + gc.fillPolygon(shape); + + // Fill in parent background for non-rectangular shape + Region r = new Region(); + r.add(bounds); + r.subtract(shape); + gc.setBackground(getParent().getBackground()); + Display display = getDisplay(); + Region clipping = new Region(); + gc.getClipping(clipping); + r.intersect(clipping); + gc.setClipping(r); + Rectangle mappedBounds = display + .map(this, getParent(), bounds); + getParent().drawBackground(gc, bounds.x, bounds.y, bounds.width, + bounds.height, mappedBounds.x, mappedBounds.y); + + // Shadow + drawShadow(display, bounds, gc); + + gc.setClipping(clipping); + clipping.dispose(); + r.dispose(); + } + + static int[] drawCircle(int xC, int yC, int r, int circlePart) { + int x = 0, y = r, u = 1, v = 2 * r - 1, e = 0; + int[] points = new int[1024]; + int[] pointsMirror = new int[1024]; + int loop = 0; + int loopMirror = 0; + while (x < y) { + if (circlePart == RIGHT_BOTTOM) { + points[loop++] = xC + x; + points[loop++] = yC + y; + } + if (circlePart == RIGHT_TOP) { + points[loop++] = xC + y; + points[loop++] = yC - x; + } + if (circlePart == LEFT_TOP) { + points[loop++] = xC - x; + points[loop++] = yC - y; + } + if (circlePart == LEFT_BOTTOM) { + points[loop++] = xC - y; + points[loop++] = yC + x; + } + x++; + e += u; + u += 2; + if (v < 2 * e) { + y--; + e -= v; + v -= 2; + } + if (x > y) + break; + if (circlePart == RIGHT_BOTTOM) { + pointsMirror[loopMirror++] = xC + y; + pointsMirror[loopMirror++] = yC + x; + } + if (circlePart == RIGHT_TOP) { + pointsMirror[loopMirror++] = xC + x; + pointsMirror[loopMirror++] = yC - y; + } + if (circlePart == LEFT_TOP) { + pointsMirror[loopMirror++] = xC - y; + pointsMirror[loopMirror++] = yC - x; + } + if (circlePart == LEFT_BOTTOM) { + pointsMirror[loopMirror++] = xC - x; + pointsMirror[loopMirror++] = yC + y; + } + // grow? + if ((loop + 1) > points.length) { + int length = points.length * 2; + int[] newPointTable = new int[length]; + int[] newPointTableMirror = new int[length]; + System.arraycopy(points, 0, newPointTable, 0, points.length); + points = newPointTable; + System.arraycopy(pointsMirror, 0, newPointTableMirror, 0, + pointsMirror.length); + pointsMirror = newPointTableMirror; + } + } + int[] finalArray = new int[loop + loopMirror]; + System.arraycopy(points, 0, finalArray, 0, loop); + for (int i = loopMirror - 1, j = loop; i > 0; i = i - 2, j = j + 2) { + int tempY = pointsMirror[i]; + int tempX = pointsMirror[i - 1]; + finalArray[j] = tempX; + finalArray[j + 1] = tempY; + } + return finalArray; + } + + void drawShadow(final Display display, Rectangle bounds, GC gc) { + if (shadowImage == null) + createShadow(display); + int x = bounds.x; + int y = bounds.y; + int SIZE = shadowImage.getBounds().width / 3; + // top left + gc.drawImage(shadowImage, 0, 0, SIZE, SIZE, 0, 0, SIZE, 20); + int fillHeight = bounds.height - SIZE * 2; + int fillWidth = bounds.width + 5 - SIZE * 2; + + int xFill = 0; + for (int i = SIZE; i < fillHeight; i += SIZE) { + xFill = i; + gc.drawImage(shadowImage, 0, SIZE, SIZE, SIZE, 0, i, SIZE, SIZE); + } + + // Pad the rest of the shadow + gc.drawImage(shadowImage, 0, SIZE, SIZE, fillHeight - xFill, 0, xFill + + SIZE, SIZE, fillHeight - xFill); + + // bl + gc.drawImage(shadowImage, 0, 40, 20, 20, 0, y + bounds.height - SIZE, + 20, 20); + int yFill = 0; + for (int i = SIZE; i <= fillWidth; i += SIZE) { + yFill = i; + gc.drawImage(shadowImage, SIZE, SIZE * 2, SIZE, SIZE, i, y + + bounds.height - SIZE, SIZE, SIZE); + } + // Pad the rest of the shadow + gc.drawImage(shadowImage, SIZE, SIZE * 2, fillWidth - yFill, SIZE, + yFill + SIZE, y + bounds.height - SIZE, fillWidth - yFill, SIZE); + + // br + gc.drawImage(shadowImage, SIZE * 2, SIZE * 2, SIZE, SIZE, x + + bounds.width - SIZE + 5, y + bounds.height - SIZE, SIZE, SIZE); + + // tr + gc.drawImage(shadowImage, SIZE * 2, 0, SIZE, SIZE, x + bounds.width + - SIZE + 5, y, SIZE, SIZE); + + xFill = 0; + for (int i = SIZE; i < fillHeight; i += SIZE) { + xFill = i; + gc.drawImage(shadowImage, SIZE * 2, SIZE, SIZE, SIZE, x + + bounds.width - SIZE + 5, i, SIZE, SIZE); + } + + // Pad the rest of the shadow + gc.drawImage(shadowImage, SIZE * 2, SIZE, SIZE, fillHeight - xFill, x + + bounds.width - SIZE + 5, xFill + SIZE, SIZE, fillHeight + - xFill); + } + + void createShadow(final Display display) { + Object obj = display.getData(E4_SHADOW_IMAGE); + if (obj != null) { + shadowImage = (Image) obj; + } else { + ImageData data = new ImageData(60, 60, 32, new PaletteData( + 0xFF0000, 0xFF00, 0xFF)); + for (int y = 0, index = 0; y < 60; y++) { + for (int x = 0; x < 60; x++) { + data.setPixel(x, y, shadow[index] & 0xFFFFFF); + data.setAlpha(x, y, (shadow[index] >> 24) & 0xFF); + index++; + } + } + shadowImage = new Image(display, data); + display.setData(E4_SHADOW_IMAGE, shadowImage); + display.disposeExec(new Runnable() { + public void run() { + Object obj = display.getData(E4_SHADOW_IMAGE); + if (obj != null) { + Image tmp = (Image) obj; + tmp.dispose(); + display.setData(E4_SHADOW_IMAGE, null); + } + } + }); + } + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java new file mode 100644 index 0000000000..2030f986bc --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java @@ -0,0 +1,141 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common; + +import org.eclipse.e4.ui.model.application.MModelComponent; +import org.eclipse.e4.ui.model.application.MModelComponents; +import org.eclipse.e4.ui.model.application.MPart; +import org.eclipse.e4.ui.model.application.MPartDescriptor; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.jface.viewers.StyledString.Styler; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.TextStyle; + +public class ComponentLabelProvider extends StyledCellLabelProvider { + private Image modelComponentsImage; + private Image modelComonentImage; + private Image partsImage; + private Image menusImage; + private Image partImage; + private Image partDescriptorImage; + + @Override + public void update(final ViewerCell cell) { + if( cell.getElement() instanceof MModelComponents ) { + cell.setText("Model Components"); + if( modelComponentsImage == null ) { + modelComponentsImage = new Image(cell.getControl().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/application_view_icons.png")); + } + cell.setImage(modelComponentsImage); + } else if( cell.getElement() instanceof MModelComponent ) { + MModelComponent m = (MModelComponent) cell.getElement(); + StyledString styledString = new StyledString("Model Component", null); + String decoration = " - " + m.getParentID(); + Styler styler = new Styler() { + + @Override + public void applyStyles(TextStyle textStyle) { + textStyle.foreground = cell.getControl().getDisplay().getSystemColor(SWT.COLOR_GRAY); + } + }; + + styledString.append(decoration, styler); + cell.setText(styledString.getString()); + cell.setStyleRanges(styledString.getStyleRanges()); + if( modelComonentImage == null ) { + modelComonentImage = new Image(cell.getControl().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/package_go.png")); + } + cell.setImage(modelComonentImage); + } else if( cell.getElement() instanceof VirtualEntry ) { + String s = cell.getElement().toString(); + cell.setText(s); + if( "Parts".equals(s) ) { + if( partsImage == null ) { + partsImage = new Image(cell.getControl().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/application_double.png")); + } + cell.setImage(partsImage); + } else if( "Menus".equals(s) ) { + if( menusImage == null ) { + menusImage = new Image(cell.getControl().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/cog.png")); + } + cell.setImage(menusImage); + } + } else if( cell.getElement() instanceof MPart ) { + MPart part = (MPart) cell.getElement(); + String label; + if( cell.getElement() instanceof MPartDescriptor ) { + label = "Part Descriptor"; + if( partDescriptorImage == null ) { + partDescriptorImage = new Image(cell.getControl().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/application_form_edit.png")); + } + cell.setImage(partImage); + } else { + label = "Part"; + if( partImage == null ) { + partImage = new Image(cell.getControl().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/application_form.png")); + } + cell.setImage(partImage); + } + StyledString styledString = new StyledString(label, null); + String decoration = " - " + part.getLabel(); + Styler styler = new Styler() { + + @Override + public void applyStyles(TextStyle textStyle) { + textStyle.foreground = cell.getControl().getDisplay().getSystemColor(SWT.COLOR_GRAY); + } + }; + + styledString.append(decoration, styler); + cell.setText(styledString.getString()); + cell.setStyleRanges(styledString.getStyleRanges()); + } else { + cell.setText(cell.getElement()+""); + } + } + + @Override + public void dispose() { + if( modelComponentsImage != null ) { + modelComponentsImage.dispose(); + modelComponentsImage = null; + } + + if( modelComonentImage != null ) { + modelComonentImage.dispose(); + modelComonentImage = null; + } + + if( partsImage != null ) { + partsImage.dispose(); + partsImage = null; + } + + if( menusImage != null ) { + menusImage.dispose(); + menusImage = null; + } + + if( partImage != null ) { + partImage.dispose(); + partImage = null; + } + + if( partDescriptorImage != null ) { + partDescriptorImage.dispose(); + partDescriptorImage = null; + } + super.dispose(); + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java new file mode 100644 index 0000000000..dee4839762 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -0,0 +1,233 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common; + +import java.util.HashMap; +import java.util.Map; + +import javax.inject.Inject; + +import org.eclipse.core.databinding.observable.IObservable; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ShadowComposite; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ApplicationEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ModelComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ModelComponentsEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.PartDescriptorEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.PartEditor; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MModelComponent; +import org.eclipse.e4.ui.model.application.MModelComponents; +import org.eclipse.e4.ui.model.application.MPart; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider; +import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.SashForm; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; + +public class ModelEditor { + private static final int VIRTUAL_MENU = 1; + private static final int VIRTUAL_PART = 2; + private static final int VIRTUAL_HANDLER = 3; + private static final int VIRTUAL_BINDING = 4; + + private Map editorMap = new HashMap(); +// private List editors = new ArrayList(); + + private TreeViewer viewer; + private IModelResource modelProvider; + + @Inject + public ModelEditor(Composite composite, IModelResource modelProvider) { + this.modelProvider = modelProvider; + registerDefaultEditors(); + SashForm form = new SashForm(composite, SWT.HORIZONTAL); + form.setBackground(form.getDisplay().getSystemColor(SWT.COLOR_WHITE)); + + viewer = createTreeViewerArea(form); + + Composite parent = new Composite(form,SWT.NONE); + parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); + FillLayout l = new FillLayout(); + l.marginWidth=5; + parent.setLayout(l); + + ShadowComposite editingArea = new ShadowComposite(parent,SWT.NONE); + GridLayout gl = new GridLayout(); + gl.marginTop=0; + gl.marginHeight=0; + editingArea.setLayout(gl); + editingArea.setBackgroundMode(SWT.INHERIT_DEFAULT); + editingArea.setData("org.eclipse.e4.ui.css.CssClassName","contentContainer"); + + Composite headerContainer = new Composite(editingArea,SWT.NONE); + headerContainer.setBackgroundMode(SWT.INHERIT_DEFAULT); + headerContainer.setData("org.eclipse.e4.ui.css.CssClassName", "headerSectionContainer"); + headerContainer.setLayout(new GridLayout(2, false)); + headerContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + final Label iconLabel = new Label(headerContainer,SWT.NONE); + iconLabel.setLayoutData(new GridData(20, 20)); + + final Label textLabel = new Label(headerContainer, SWT.NONE); + textLabel.setData("org.eclipse.e4.ui.css.CssClassName", "sectionHeader"); + textLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + final Composite contentContainer = new Composite(editingArea,SWT.NONE); + contentContainer.setLayoutData(new GridData(GridData.FILL_BOTH)); + final StackLayout layout = new StackLayout(); + contentContainer.setLayout(layout); + + viewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + if( ! event.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection) event.getSelection(); + if( s.getFirstElement() instanceof EObject ) { + EObject obj = (EObject) s.getFirstElement(); + AbstractComponentEditor editor = editorMap.get(obj.eClass()); + if( editor != null ) { + textLabel.setText(editor.getLabel()); + iconLabel.setImage(editor.getImage(iconLabel.getDisplay())); + Composite comp = editor.getEditor(contentContainer, s.getFirstElement()); + comp.setBackgroundMode(SWT.INHERIT_DEFAULT); + layout.topControl = comp; + contentContainer.layout(true); + } + } + } + } + }); + + form.setWeights(new int[] { 1 , 2 }); + } + + private TreeViewer createTreeViewerArea(Composite parent) { + parent = new Composite(parent,SWT.NONE); + parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); + FillLayout l = new FillLayout(); + l.marginWidth=5; + parent.setLayout(l); + ShadowComposite editingArea = new ShadowComposite(parent,SWT.NONE); + editingArea.setLayout(new FillLayout()); + TreeViewer viewer = new TreeViewer(editingArea); + viewer.setLabelProvider(new ComponentLabelProvider()); + ObservableListTreeContentProvider contentProvider = new ObservableListTreeContentProvider( + new ObservableFactoryImpl(), new TreeStructureAdvisorImpl()); + viewer.setContentProvider(contentProvider); + viewer.setInput(modelProvider.getRoot()); + + return viewer; + } + + private void registerDefaultEditors() { + registerEditor( MApplicationPackage.Literals.APPLICATION, new ApplicationEditor()); + registerEditor( MApplicationPackage.Literals.MODEL_COMPONENTS, new ModelComponentsEditor()); + registerEditor( MApplicationPackage.Literals.MODEL_COMPONENT, new ModelComponentEditor()); + registerEditor( MApplicationPackage.Literals.PART, new PartEditor()); + registerEditor( MApplicationPackage.Literals.PART_DESCRIPTOR, new PartDescriptorEditor()); + } + + public void registerEditor(EClass eClass, AbstractComponentEditor editor) { + editorMap.put(eClass, editor); + } + + private static class TreeStructureAdvisorImpl extends TreeStructureAdvisor { + + } + + private static class ObservableFactoryImpl implements IObservableFactory { + private IListProperty MODEL_COMPONENTS__COMPONENTS = EMFProperties.list(MApplicationPackage.Literals.MODEL_COMPONENTS__COMPONENTS); + private IListProperty MODEL_COMPONENT__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.MODEL_COMPONENT__CHILDREN); + private IListProperty PART__MENUS = EMFProperties.list(MApplicationPackage.Literals.PART__MENUS); + private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); + private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); + + public IObservable createObservable(Object target) { + if( target instanceof IObservableList ) { + return (IObservable) target; + } else if( target instanceof MModelComponents ) { + return MODEL_COMPONENTS__COMPONENTS.observe(target); + } else if( target instanceof MModelComponent ) { + WritableList list = new WritableList(); + list.add(new VirtualEntry( VIRTUAL_MENU, MODEL_COMPONENT__CHILDREN, target, "Menus") { + + @Override + protected boolean accepted(Object o) { + return false; + } + + }); + list.add(new VirtualEntry( VIRTUAL_PART, MODEL_COMPONENT__CHILDREN, target, "Parts") { + + @Override + protected boolean accepted(Object o) { + return o instanceof MPart; + } + + }); + return list; + } else if( target instanceof VirtualEntry ) { + return ((VirtualEntry)target).getList(); + } else if( target instanceof MPart ) { + WritableList list = new WritableList(); + list.add(new VirtualEntry( VIRTUAL_MENU, PART__MENUS, target, "Menus") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + list.add(new VirtualEntry( VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, target, "Handlers") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + list.add(new VirtualEntry( VIRTUAL_BINDING, BINDING_CONTAINER__BINDINGS, target, "Bindings") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + return list; + } + + // TODO Auto-generated method stub + return null; + } + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java new file mode 100644 index 0000000000..a045a7657b --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java @@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.databinding.observable.Diffs; +import org.eclipse.core.databinding.observable.list.IListChangeListener; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.ListChangeEvent; +import org.eclipse.core.databinding.observable.list.ListDiff; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.databinding.property.list.IListProperty; + +public abstract class VirtualEntry { + private int id; + private Object originalParent; + private String label; + private IObservableList list; + + public VirtualEntry(int id, IListProperty property, Object originalParent, String label) { + this.id = id; + this.originalParent = originalParent; + this.label = label; + this.list = new WritableList(); + IObservableList origList = property.observe(originalParent); + list.addAll(cleanedList(origList)); + + origList.addListChangeListener(new IListChangeListener() { + + public void handleListChange(ListChangeEvent event) { + List clean = cleanedList(event.getObservableList()); + ListDiff diff = Diffs.computeListDiff(VirtualEntry.this.list, clean); + diff.applyTo(VirtualEntry.this.list); + } + }); + } + + private List cleanedList(IObservableList list) { + List l = new ArrayList(list.size()); + + for( Object o : list ) { + if( accepted((M) o) ) { + l.add(o); + } + } + + return l; + } + + protected abstract boolean accepted(M o); + + public IObservableList getList() { + return list; + } + + public Object getOriginalParent() { + return originalParent; + } + + public int getId() { + return id; + } + + @Override + public String toString() { + return label; + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java new file mode 100644 index 0000000000..0e59ccdf8e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -0,0 +1,53 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class ApplicationEditor extends AbstractComponentEditor { + private Composite composite; + private WritableValue master = new WritableValue(); + private Image image; + private DataBindingContext context; + + @Override + public Image getImage(Display display) { + if( image == null ) { + image = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/application.png")); + } + + return image; + } + + @Override + public String getLabel() { + return "Application"; + } + + @Override + public String getDescription() { + return "Application bla, bla, bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new DataBindingContext(); + composite = createForm(parent,context, master); + } + master.setValue(object); + return composite; + } + + protected Composite createForm(Composite parent, DataBindingContext context, IObservableValue master) { + parent = new Composite(parent,SWT.NONE); + + return parent; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java new file mode 100644 index 0000000000..0b7fe77d34 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -0,0 +1,151 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class ModelComponentEditor extends AbstractComponentEditor { + private Composite composite; + private WritableValue master = new WritableValue(); + private Image image; + private DataBindingContext context; + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new DataBindingContext(); + composite = createForm(parent); + } + master.setValue(object); + return composite; + } + + public void dispose() { + if( image != null ) { + image.dispose(); + image = null; + } + + if( composite != null ) { + composite.dispose(); + composite = null; + } + + if( context != null ) { + context.dispose(); + context = null; + } + } + + private Composite createForm(Composite parent) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IValueProperty textProp = WidgetProperties.text(); + + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Tags"); + + t = new Text(parent, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + + l = new Label(parent, SWT.NONE); + ListViewer viewer = new ListViewer(parent); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + gd.heightHint = 130; + viewer.getList().setLayoutData(gd); + + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Parent-Id"); + + t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.MODEL_COMPONENT__PARENT_ID).observeDetail(master)); + + Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setText("Find ..."); + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Position in Parent"); + + t = new Text(parent, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.MODEL_COMPONENT__POSITION_IN_PARENT).observeDetail(master)); + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Processor"); + + t = new Text(parent, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.MODEL_COMPONENT__PROCESSOR).observeDetail(master)); + + return parent; + } + + @Override + public Image getImage(Display display) { + if( image == null ) { + image = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/package_go.png")); + } + return image; + } + + @Override + public String getLabel() { + return "Model Component"; + } + + @Override + public String getDescription() { + return "The model component ... bla bla bla"; + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java new file mode 100644 index 0000000000..3e036d7490 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java @@ -0,0 +1,51 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class ModelComponentsEditor extends AbstractComponentEditor { + private Composite composite; + private WritableValue master = new WritableValue(); + private Image image; + private DataBindingContext context; + + @Override + public Image getImage(Display display) { + if( image == null ) { + image = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/application_view_icons.png")); + } + return image; + } + + @Override + public String getLabel() { + return "Model Components"; + } + + @Override + public String getDescription() { + return "Some bla bla bla bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new DataBindingContext(); + composite = createForm(parent); + } + master.setValue(object); + return composite; + } + + private Composite createForm(Composite parent) { + parent = new Composite(parent, SWT.NONE); + + return parent; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java new file mode 100644 index 0000000000..a4c5748a7e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -0,0 +1,37 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class PartDescriptorEditor extends PartEditor { + + @Override + protected Composite createForm(Composite parent, DataBindingContext context, IObservableValue master) { + Composite comp = super.createForm(parent,context,master); + + IValueProperty textProp = WidgetProperties.text(); + + Label l = new Label(parent, SWT.NONE); + l.setText("Label"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + + // ------------------------------------------------------------ + + + return comp; + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java new file mode 100644 index 0000000000..1dc0ae914c --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -0,0 +1,206 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class PartEditor extends AbstractComponentEditor { + private Composite composite; + private WritableValue master = new WritableValue(); + private Image image; + private DataBindingContext context; + + @Override + public Image getImage(Display display) { + if( image == null ) { + image = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/application_form.png")); + } + + return image; + } + + @Override + public String getLabel() { + return "Part Descriptor"; + } + + @Override + public String getDescription() { + return "Part Descriptor Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new DataBindingContext(); + composite = createForm(parent,context, master); + } + master.setValue(object); + return composite; + } + + protected Composite createForm(Composite parent, DataBindingContext context, IObservableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IValueProperty textProp = WidgetProperties.text(); + + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Tags"); + + t = new Text(parent, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + + l = new Label(parent, SWT.NONE); + ListViewer viewer = new ListViewer(parent); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + gd.heightHint = 80; + viewer.getList().setLayoutData(gd); + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Label"); + + t = new Text(parent, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Tooltip"); + + t = new Text(parent, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Icon URI"); + + t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + + Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setText("Find ..."); + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Class URI"); + + t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); + + b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setText("Find ..."); + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Variables"); + + t = new Text(parent, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + + l = new Label(parent, SWT.NONE); + viewer = new ListViewer(parent); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + gd.heightHint = 80; + viewer.getList().setLayoutData(gd); + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Properties"); + + t = new Text(parent, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + + l = new Label(parent, SWT.NONE); + TableViewer tableviewer = new TableViewer(parent); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + gd.heightHint = 80; + tableviewer.getTable().setHeaderVisible(true); + tableviewer.getControl().setLayoutData(gd); + + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Key"); + column.getColumn().setWidth(200); + + column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Value"); + column.getColumn().setWidth(200); + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText(""); + + Composite booleanContainer = new Composite(parent,SWT.NONE); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + booleanContainer.setBackgroundMode(SWT.INHERIT_DEFAULT); + booleanContainer.setLayoutData(gd); + booleanContainer.setLayout(new GridLayout(4,false)); + + Button checkbox = new Button(booleanContainer, SWT.CHECK); + checkbox.setText("to render"); + + checkbox = new Button(booleanContainer, SWT.CHECK); + checkbox.setText("on Top"); + + checkbox = new Button(booleanContainer, SWT.CHECK); + checkbox.setText("visible"); + + checkbox = new Button(booleanContainer, SWT.CHECK); + checkbox.setText("closeable"); + + return parent; + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbe/ExtensionModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbe/ExtensionModelEditor.java new file mode 100644 index 0000000000..34636af5e0 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbe/ExtensionModelEditor.java @@ -0,0 +1,5 @@ +package org.eclipse.e4.tools.emf.ui.internal.wbe; + +public class ExtensionModelEditor { + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java new file mode 100644 index 0000000000..d140e5bddf --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java @@ -0,0 +1,16 @@ +package org.eclipse.e4.tools.emf.ui.internal.wbm; + +import javax.inject.Inject; + +import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.swt.widgets.Composite; + +public class ApplicationModelEditor extends ModelEditor { + @Inject + public ApplicationModelEditor(Composite composite, + IModelResource modelProvider) { + super(composite, modelProvider); + } + +} From ce8afad6b956a9a7fe3d535b46c088ddec4d64c3 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 3 Mar 2010 22:42:00 +0000 Subject: [PATCH 0002/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * more editor dummies --- .../icons/application_xp.png | Bin 0 -> 426 bytes .../component/AbstractComponentEditor.java | 9 +- .../emf/ui/internal/ShadowComposite.java | 11 ++ .../common/ComponentLabelProvider.java | 83 +++++------- .../emf/ui/internal/common/ModelEditor.java | 100 ++++---------- .../common/component/ApplicationEditor.java | 74 ++++++++++- .../common/component/BindingEditor.java | 72 ++++++++++ .../common/component/CommandEditor.java | 72 ++++++++++ .../common/component/HandlerEditor.java | 72 ++++++++++ .../component/ModelComponentEditor.java | 43 +++++- .../component/ModelComponentsEditor.java | 31 ++++- .../component/PartDescriptorEditor.java | 10 ++ .../internal/common/component/PartEditor.java | 65 ++++++++- .../common/component/WindowEditor.java | 124 ++++++++++++++++++ .../ui/internal/wbe/ExtensionModelEditor.java | 10 ++ .../internal/wbm/ApplicationModelEditor.java | 10 ++ 16 files changed, 654 insertions(+), 132 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application_xp.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/application_xp.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/application_xp.png new file mode 100644 index 0000000000000000000000000000000000000000..d22860a3166820b8fdad71c6505a40580af14b2f GIT binary patch literal 426 zcmV;b0agBqP)wtp^MwsrC67-bFzu!t;6Q^%|k2MJ$kfh*aj@vhNOIJ zWFxBVQIH79u!vw98!Ll~y$OKnm}QK5wtxPNU<+B6{mDR{T_7M%l&baHE>bEbHX04+ zn+OzZ0e^b{APT{9E#RmJ5)l*`)B%#z1i)YI - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java index 2030f986bc..e6b497f55b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java @@ -10,10 +10,12 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MModelComponent; import org.eclipse.e4.ui.model.application.MModelComponents; import org.eclipse.e4.ui.model.application.MPart; import org.eclipse.e4.ui.model.application.MPartDescriptor; +import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.viewers.StyledCellLabelProvider; import org.eclipse.jface.viewers.StyledString; import org.eclipse.jface.viewers.ViewerCell; @@ -30,33 +32,41 @@ public class ComponentLabelProvider extends StyledCellLabelProvider { private Image partImage; private Image partDescriptorImage; + private ModelEditor editor; + + public ComponentLabelProvider(ModelEditor editor) { + this.editor = editor; + } + @Override public void update(final ViewerCell cell) { - if( cell.getElement() instanceof MModelComponents ) { - cell.setText("Model Components"); - if( modelComponentsImage == null ) { - modelComponentsImage = new Image(cell.getControl().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/application_view_icons.png")); - } - cell.setImage(modelComponentsImage); - } else if( cell.getElement() instanceof MModelComponent ) { - MModelComponent m = (MModelComponent) cell.getElement(); - StyledString styledString = new StyledString("Model Component", null); - String decoration = " - " + m.getParentID(); - Styler styler = new Styler() { + if( cell.getElement() instanceof EObject ) { - @Override - public void applyStyles(TextStyle textStyle) { - textStyle.foreground = cell.getControl().getDisplay().getSystemColor(SWT.COLOR_GRAY); - } - }; + EObject o = (EObject) cell.getElement(); + AbstractComponentEditor elementEditor = editor.getEditor(o.eClass()); + if( elementEditor != null ) { + String label = elementEditor.getLabel(o); + String detailText = elementEditor.getDetailLabel(o); + if( detailText == null ) { + cell.setText(label); + } else { + StyledString styledString = new StyledString(label, null); + Styler styler = new Styler() { + + @Override + public void applyStyles(TextStyle textStyle) { + textStyle.foreground = cell.getControl().getDisplay().getSystemColor(SWT.COLOR_GRAY); + } + }; - styledString.append(decoration, styler); - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - if( modelComonentImage == null ) { - modelComonentImage = new Image(cell.getControl().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/package_go.png")); + styledString.append(" - " + detailText, styler); + cell.setText(styledString.getString()); + cell.setStyleRanges(styledString.getStyleRanges()); + } + cell.setImage(elementEditor.getImage(cell.getControl().getDisplay())); + } else { + cell.setText(cell.getElement().toString()); } - cell.setImage(modelComonentImage); } else if( cell.getElement() instanceof VirtualEntry ) { String s = cell.getElement().toString(); cell.setText(s); @@ -71,35 +81,6 @@ public void applyStyles(TextStyle textStyle) { } cell.setImage(menusImage); } - } else if( cell.getElement() instanceof MPart ) { - MPart part = (MPart) cell.getElement(); - String label; - if( cell.getElement() instanceof MPartDescriptor ) { - label = "Part Descriptor"; - if( partDescriptorImage == null ) { - partDescriptorImage = new Image(cell.getControl().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/application_form_edit.png")); - } - cell.setImage(partImage); - } else { - label = "Part"; - if( partImage == null ) { - partImage = new Image(cell.getControl().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/application_form.png")); - } - cell.setImage(partImage); - } - StyledString styledString = new StyledString(label, null); - String decoration = " - " + part.getLabel(); - Styler styler = new Styler() { - - @Override - public void applyStyles(TextStyle textStyle) { - textStyle.foreground = cell.getControl().getDisplay().getSystemColor(SWT.COLOR_GRAY); - } - }; - - styledString.append(decoration, styler); - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); } else { cell.setText(cell.getElement()+""); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index dee4839762..ebb125c65f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -17,22 +17,20 @@ import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory; -import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ShadowComposite; import org.eclipse.e4.tools.emf.ui.internal.common.component.ApplicationEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.BindingEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.CommandEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.HandlerEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ModelComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ModelComponentsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PartDescriptorEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PartEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MModelComponent; -import org.eclipse.e4.ui.model.application.MModelComponents; -import org.eclipse.e4.ui.model.application.MPart; -import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider; @@ -51,10 +49,12 @@ import org.eclipse.swt.widgets.Label; public class ModelEditor { - private static final int VIRTUAL_MENU = 1; - private static final int VIRTUAL_PART = 2; - private static final int VIRTUAL_HANDLER = 3; - private static final int VIRTUAL_BINDING = 4; + public static final int VIRTUAL_MENU = 1; + public static final int VIRTUAL_PART = 2; + public static final int VIRTUAL_HANDLER = 3; + public static final int VIRTUAL_BINDING = 4; + public static final int VIRTUAL_COMMAND = 5; + public static final int VIRTUAL_WINDOWS = 6; private Map editorMap = new HashMap(); // private List editors = new ArrayList(); @@ -73,6 +73,8 @@ public ModelEditor(Composite composite, IModelResource modelProvider) { Composite parent = new Composite(form,SWT.NONE); parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); + parent.setBackgroundMode(SWT.INHERIT_DEFAULT); +// parent.setData("org.eclipse.e4.ui.css.CssClassName","contentContainer"); FillLayout l = new FillLayout(); l.marginWidth=5; parent.setLayout(l); @@ -83,7 +85,7 @@ public ModelEditor(Composite composite, IModelResource modelProvider) { gl.marginHeight=0; editingArea.setLayout(gl); editingArea.setBackgroundMode(SWT.INHERIT_DEFAULT); - editingArea.setData("org.eclipse.e4.ui.css.CssClassName","contentContainer"); +// editingArea.setData("org.eclipse.e4.ui.css.CssClassName","contentContainer"); Composite headerContainer = new Composite(editingArea,SWT.NONE); headerContainer.setBackgroundMode(SWT.INHERIT_DEFAULT); @@ -112,7 +114,7 @@ public void selectionChanged(SelectionChangedEvent event) { EObject obj = (EObject) s.getFirstElement(); AbstractComponentEditor editor = editorMap.get(obj.eClass()); if( editor != null ) { - textLabel.setText(editor.getLabel()); + textLabel.setText(editor.getLabel(obj)); iconLabel.setImage(editor.getImage(iconLabel.getDisplay())); Composite comp = editor.getEditor(contentContainer, s.getFirstElement()); comp.setBackgroundMode(SWT.INHERIT_DEFAULT); @@ -136,7 +138,7 @@ private TreeViewer createTreeViewerArea(Composite parent) { ShadowComposite editingArea = new ShadowComposite(parent,SWT.NONE); editingArea.setLayout(new FillLayout()); TreeViewer viewer = new TreeViewer(editingArea); - viewer.setLabelProvider(new ComponentLabelProvider()); + viewer.setLabelProvider(new ComponentLabelProvider(this)); ObservableListTreeContentProvider contentProvider = new ObservableListTreeContentProvider( new ObservableFactoryImpl(), new TreeStructureAdvisorImpl()); viewer.setContentProvider(contentProvider); @@ -151,82 +153,38 @@ private void registerDefaultEditors() { registerEditor( MApplicationPackage.Literals.MODEL_COMPONENT, new ModelComponentEditor()); registerEditor( MApplicationPackage.Literals.PART, new PartEditor()); registerEditor( MApplicationPackage.Literals.PART_DESCRIPTOR, new PartDescriptorEditor()); + registerEditor( MApplicationPackage.Literals.KEY_BINDING, new BindingEditor()); + registerEditor( MApplicationPackage.Literals.HANDLER, new HandlerEditor()); + registerEditor( MApplicationPackage.Literals.COMMAND,new CommandEditor()); + registerEditor( MApplicationPackage.Literals.WINDOW, new WindowEditor()); } public void registerEditor(EClass eClass, AbstractComponentEditor editor) { editorMap.put(eClass, editor); } + public AbstractComponentEditor getEditor(EClass eClass) { + return editorMap.get(eClass); + } + private static class TreeStructureAdvisorImpl extends TreeStructureAdvisor { } - private static class ObservableFactoryImpl implements IObservableFactory { - private IListProperty MODEL_COMPONENTS__COMPONENTS = EMFProperties.list(MApplicationPackage.Literals.MODEL_COMPONENTS__COMPONENTS); - private IListProperty MODEL_COMPONENT__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.MODEL_COMPONENT__CHILDREN); - private IListProperty PART__MENUS = EMFProperties.list(MApplicationPackage.Literals.PART__MENUS); - private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); - private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); + private class ObservableFactoryImpl implements IObservableFactory { public IObservable createObservable(Object target) { if( target instanceof IObservableList ) { return (IObservable) target; - } else if( target instanceof MModelComponents ) { - return MODEL_COMPONENTS__COMPONENTS.observe(target); - } else if( target instanceof MModelComponent ) { - WritableList list = new WritableList(); - list.add(new VirtualEntry( VIRTUAL_MENU, MODEL_COMPONENT__CHILDREN, target, "Menus") { - - @Override - protected boolean accepted(Object o) { - return false; - } - - }); - list.add(new VirtualEntry( VIRTUAL_PART, MODEL_COMPONENT__CHILDREN, target, "Parts") { - - @Override - protected boolean accepted(Object o) { - return o instanceof MPart; - } - - }); - return list; } else if( target instanceof VirtualEntry ) { return ((VirtualEntry)target).getList(); - } else if( target instanceof MPart ) { - WritableList list = new WritableList(); - list.add(new VirtualEntry( VIRTUAL_MENU, PART__MENUS, target, "Menus") { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry( VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, target, "Handlers") { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry( VIRTUAL_BINDING, BINDING_CONTAINER__BINDINGS, target, "Bindings") { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - return list; + } else { + AbstractComponentEditor editor = editorMap.get(((EObject)target).eClass()); + if( editor != null ) { + return editor.getChildList(target); + } } - // TODO Auto-generated method stub return null; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 0e59ccdf8e..029aac4ac7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -1,9 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; @@ -15,6 +32,11 @@ public class ApplicationEditor extends AbstractComponentEditor { private Image image; private DataBindingContext context; + private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); + private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); + private IListProperty APPLICATION__COMMANDS = EMFProperties.list(MApplicationPackage.Literals.APPLICATION__COMMANDS); + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + @Override public Image getImage(Display display) { if( image == null ) { @@ -25,12 +47,12 @@ public Image getImage(Display display) { } @Override - public String getLabel() { + public String getLabel(Object element) { return "Application"; } @Override - public String getDescription() { + public String getDescription(Object element) { return "Application bla, bla, bla"; } @@ -50,4 +72,52 @@ protected Composite createForm(Composite parent, DataBindingContext context, IOb return parent; } + @Override + public IObservableList getChildList(Object element) { + WritableList list = new WritableList(); + list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING, BINDING_CONTAINER__BINDINGS, element, "Bindings") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_COMMAND, APPLICATION__COMMANDS, element, "Commands") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOWS, ELEMENT_CONTAINER__CHILDREN, element, "Windows") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + return list; + } + + @Override + public String getDetailLabel(Object element) { + // TODO Auto-generated method stub + return null; + } + } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingEditor.java new file mode 100644 index 0000000000..35a44c2d7e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingEditor.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class BindingEditor extends AbstractComponentEditor { + private Composite composite; + private WritableValue master = new WritableValue(); + private Image image; + private DataBindingContext context; + + @Override + public Image getImage(Display display) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getLabel(Object element) { + return "Binding"; + } + + @Override + public String getDescription(Object element) { + return "Binding bla bla bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new DataBindingContext(); + composite = createForm(parent,context, master); + } + master.setValue(object); + return composite; + } + + private Composite createForm(Composite parent, DataBindingContext context2, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getDetailLabel(Object element) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java new file mode 100644 index 0000000000..ee262cf8f9 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class CommandEditor extends AbstractComponentEditor { + private Composite composite; + private WritableValue master = new WritableValue(); + private Image image; + private DataBindingContext context; + + @Override + public Image getImage(Display display) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getLabel(Object element) { + return "Command"; + } + + @Override + public String getDescription(Object element) { + return "Command bla bla bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new DataBindingContext(); + composite = createForm(parent,context, master); + } + master.setValue(object); + return composite; + } + + private Composite createForm(Composite parent, DataBindingContext context2, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getDetailLabel(Object element) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java new file mode 100644 index 0000000000..500dcc94d0 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class HandlerEditor extends AbstractComponentEditor { + private Composite composite; + private WritableValue master = new WritableValue(); + private Image image; + private DataBindingContext context; + + @Override + public Image getImage(Display display) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getLabel(Object element) { + return "Handler"; + } + + @Override + public String getDescription(Object element) { + return "Handler bla bla bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new DataBindingContext(); + composite = createForm(parent,context, master); + } + master.setValue(object); + return composite; + } + + private Composite createForm(Composite parent, DataBindingContext context2, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getDetailLabel(Object element) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index 0b7fe77d34..ffde3a8e5d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -11,10 +11,18 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component; import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MMenu; +import org.eclipse.e4.ui.model.application.MModelComponent; +import org.eclipse.e4.ui.model.application.MPart; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.viewers.ListViewer; @@ -34,6 +42,8 @@ public class ModelComponentEditor extends AbstractComponentEditor { private Image image; private DataBindingContext context; + private IListProperty MODEL_COMPONENT__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.MODEL_COMPONENT__CHILDREN); + @Override public Composite getEditor(Composite parent, Object object) { if( composite == null ) { @@ -140,12 +150,41 @@ public Image getImage(Display display) { } @Override - public String getLabel() { + public String getLabel(Object element) { return "Model Component"; } @Override - public String getDescription() { + public String getDescription(Object element) { return "The model component ... bla bla bla"; } + + @Override + public IObservableList getChildList(Object element) { + WritableList list = new WritableList(); + list.add(new VirtualEntry( ModelEditor.VIRTUAL_MENU, MODEL_COMPONENT__CHILDREN, element, "Menus") { + + @Override + protected boolean accepted(Object o) { + return o instanceof MMenu; + } + + }); + list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART, MODEL_COMPONENT__CHILDREN, element, "Parts") { + + @Override + protected boolean accepted(Object o) { + return o instanceof MPart; + } + + }); + return list; + } + + @Override + public String getDetailLabel(Object element) { + MModelComponent o = (MModelComponent) element; + return "parentId: " + o.getParentID(); + } + } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java index 3e036d7490..5c91d8b0d2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java @@ -1,14 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; public class ModelComponentsEditor extends AbstractComponentEditor { + private IListProperty MODEL_COMPONENTS__COMPONENTS = EMFProperties.list(MApplicationPackage.Literals.MODEL_COMPONENTS__COMPONENTS); + private Composite composite; private WritableValue master = new WritableValue(); private Image image; @@ -23,12 +39,12 @@ public Image getImage(Display display) { } @Override - public String getLabel() { + public String getLabel(Object element) { return "Model Components"; } @Override - public String getDescription() { + public String getDescription(Object element) { return "Some bla bla bla bla"; } @@ -48,4 +64,15 @@ private Composite createForm(Composite parent) { return parent; } + @Override + public IObservableList getChildList(Object element) { + return MODEL_COMPONENTS__COMPONENTS.observe(element); + } + + @Override + public String getDetailLabel(Object element) { + // TODO Auto-generated method stub + return null; + } + } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index a4c5748a7e..03852d09fa 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; import org.eclipse.core.databinding.DataBindingContext; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 1dc0ae914c..9c964cd837 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -1,11 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MPart; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.viewers.ListViewer; @@ -27,6 +43,11 @@ public class PartEditor extends AbstractComponentEditor { private Image image; private DataBindingContext context; + private IListProperty PART__MENUS = EMFProperties.list(MApplicationPackage.Literals.PART__MENUS); + private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); + private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); + + @Override public Image getImage(Display display) { if( image == null ) { @@ -37,12 +58,12 @@ public Image getImage(Display display) { } @Override - public String getLabel() { + public String getLabel(Object element) { return "Part Descriptor"; } @Override - public String getDescription() { + public String getDescription(Object element) { return "Part Descriptor Bla Bla Bla Bla"; } @@ -203,4 +224,44 @@ protected Composite createForm(Composite parent, DataBindingContext context, IOb return parent; } + + @Override + public IObservableList getChildList(Object element) { + WritableList list = new WritableList(); + list.add(new VirtualEntry( ModelEditor.VIRTUAL_MENU, PART__MENUS, element, "Menus") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING, BINDING_CONTAINER__BINDINGS, element, "Bindings") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + return list; + } + + @Override + public String getDetailLabel(Object element) { + MPart o = (MPart) element; + return o.getLabel(); + } + } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java new file mode 100644 index 0000000000..764933ebe0 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -0,0 +1,124 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MWindow; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class WindowEditor extends AbstractComponentEditor { + private Composite composite; + private WritableValue master = new WritableValue(); + private Image image; + private DataBindingContext context; + + private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); + private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); + private IListProperty APPLICATION__COMMANDS = EMFProperties.list(MApplicationPackage.Literals.APPLICATION__COMMANDS); + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + + + @Override + public Image getImage(Display display) { + if( image == null ) { + image = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/application_xp.png")); + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "Window"; + } + + @Override + public String getDescription(Object element) { + return "Window bla bla bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new DataBindingContext(); + composite = createForm(parent,context, master); + } + master.setValue(object); + return composite; + } + + private Composite createForm(Composite parent, DataBindingContext context2, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + WritableList list = new WritableList(); + list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING, BINDING_CONTAINER__BINDINGS, element, "Bindings") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_COMMAND, APPLICATION__COMMANDS, element, "Commands") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOWS, ELEMENT_CONTAINER__CHILDREN, element, "Controls") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + return list; + } + + @Override + public String getDetailLabel(Object element) { + return ((MWindow)element).getLabel(); + } + + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbe/ExtensionModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbe/ExtensionModelEditor.java index 34636af5e0..6ddbfedab2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbe/ExtensionModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbe/ExtensionModelEditor.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.wbe; public class ExtensionModelEditor { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java index d140e5bddf..ea7dfd9e39 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.wbm; import javax.inject.Inject; From edfa9bb068d21842ace6d15f2b878924eb329d04 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 4 Mar 2010 22:03:16 +0000 Subject: [PATCH 0003/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * more editor dummies --- .../icons/application_osx.png | Bin 0 -> 487 bytes .../icons/application_tile_horizontal.png | Bin 0 -> 432 bytes .../icons/application_tile_vertical.png | Bin 0 -> 492 bytes .../icons/brick.png | Bin 0 -> 452 bytes .../icons/brick_go.png | Bin 0 -> 790 bytes .../icons/brick_link.png | Bin 0 -> 764 bytes .../icons/lightning_go.png | Bin 0 -> 739 bytes .../icons/link.png | Bin 0 -> 343 bytes .../org.eclipse.e4.tools.emf.ui/icons/tab.png | Bin 0 -> 323 bytes .../component/AbstractComponentEditor.java | 3 +- .../common/ComponentLabelProvider.java | 7 +- .../emf/ui/internal/common/ModelEditor.java | 17 +++- .../common/component/ApplicationEditor.java | 4 +- .../common/component/BindingEditor.java | 9 +- .../common/component/CommandEditor.java | 9 +- .../component/DirectToolItemEditor.java | 37 ++++++++ .../component/HandledToolItemEditor.java | 37 ++++++++ .../common/component/HandlerEditor.java | 8 +- .../component/ModelComponentEditor.java | 2 +- .../component/ModelComponentsEditor.java | 2 +- .../internal/common/component/PartEditor.java | 2 +- .../component/PartSashContainerEditor.java | 81 ++++++++++++++++++ .../common/component/PartStackEditor.java | 68 +++++++++++++++ .../common/component/ToolBarEditor.java | 66 ++++++++++++++ .../common/component/ToolItemEditor.java | 75 ++++++++++++++++ .../common/component/WindowEditor.java | 2 +- .../common/component/WindowTrimEditor.java | 67 +++++++++++++++ 27 files changed, 472 insertions(+), 24 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application_osx.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application_tile_horizontal.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application_tile_vertical.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/brick.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/brick_go.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/brick_link.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/lightning_go.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/link.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/tab.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/application_osx.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/application_osx.png new file mode 100644 index 0000000000000000000000000000000000000000..9f022ece86d73715c7e45c6702c1c87560b8ba23 GIT binary patch literal 487 zcmV-B1Y!m%PGQ6x$c z#f9@AK!Oh=jElv$CqBcNDKEr@t}K+jhk=(*)=6Nf9`DW>GPMDbI$#A zadnmXt6lDNZUb=D%3-T`<7 zxtL}GCkYVlWRqqF51NHf9Yl>2gOi8|vh54F$BDrs0>$iLAcx_0~HSm3sN|U6QrN-pa}fa=>kAy*54Rm aM*ISgWgjfIBP3%00000 zld)=4K@^6+dv{}4Y=qQeVU@}tM6j^36YGGDjg6qBwU$%~R)ORVZ1Ms&K0^u{3%3Y@ zASi3DyPIt8obw-xdy|`4NnAWIGt8O8$DIG4DI$UwJ0D*?ez>}QJd2wWgoGrLH>*j= z98)mhgioKpzkdJr=^j8I;L-Z(Zf|K&t}H=B5I{sb07Vc1ist;z*mi*qFilZT>JuWO zErKAB$a3eP@ytuw=mWR~n@?`DXuN!PLcxWsZyk?Al4tUtK7 z)>|I1a-*~AvhwpT{I2S?3@|=ZSPdwe5?6tW?r-ok|b$oDQj8FV%kZPq;(MWOV8?8;<)(iP}>hNMU> z7fbz%jjlr7h8uuoQ~J6}n}@Y@PdTk=)PxO{%7zmL?dchpZX*~n;I{!C>*(8cU;q(~ zAS%Po_@naEU!xidrBXD?;hN|x^%W|Ij)0y*r5vi|?W&Fub(NqJ@z0o=Ozp{gHSP{di*#8D&?(h#;bi2r7yUe@M_9Z^R^1th67Ma+}U=ey(q{ z%~>)Q;cRVlbJ5&n%2W)U;$S+(K9zyBt*3JiDKhoI1BdsV_j#W8ea|5PNIG0D*E5U7 z66xyd`pdxfEVk3#Z2_~{oMA8+{vd6!m|m|xvLnHN#V}P%QJ}ZC7h_{%NTpIpCX*N) z9py20#_q7Y8;&>uWnbT_HZwDW?(S{`gFz0H$;4x6j@CIrPfw4Q0-;cdD>8V!URbSG z=yW;`wr4TsCXq;BWMl*^N3B-t2~|o=OiaM<_ahJpa7Ct`zBU{U4GqERbi!`8L#0wB z2(>4zt*v2UVF6Q9Q<$Ef2CWa1larf{*nVJO0ORB1u-R-J!^6X9Z*P}~(P-oZD=RBl zUS7uR>@2tI^Z7P=z*NiL=b=!07GJ;F;BYv&+qSkgi8YWDNRou5r6t5-F+?H}uF6Vt zyWL!|xHA_|Ew^z?c?$jZJ}#hCDkVZ^`#Thr?l%iM7ujJ_6Bn65+CbO^3N2U=TO*NG^KHr9~2xj9}2BVoNL)#c(-Kn}D29Z&q=YesW_ z1q5#+N<j%go#9EE}){AAsopP$F#;vyc>dRg+DzH&5tDMkI~BGgzO zpw?OprK=8iJM(bj2}y1~Nv&3!q0wmS>1=;_JRaOpord8@GsN$&Aq+M`<9R_z9zo%% zMUi*~S=A(Vw36g(`wJZ%9oclg;tfR>uC^RQep3c6y*z+>+KZ4oYfzw*A+wr94_A^i zJAS4O&<@KK3WZ%Rm%C}Ru4UKliQgCUky%9|H2LJNzi~HE%kkq?dvUOmWNnTA1HB~u UMVP_&o&W#<07*qoM6N<$f>=0SnE(I) literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/brick_link.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/brick_link.png new file mode 100644 index 0000000000000000000000000000000000000000..9ebf013a23a56653655a736a7e149deb7365ea03 GIT binary patch literal 764 zcmV&SR3v>A``^efOSo-hEdApp;^Jd;9y!%1UfzX6Bh- z%-mbG|0Na{7Ruai_Y+DEb1s+b!*9k%Q!whMxjtZKA*?o;i1g&jy0@( zaU=-@d-h+o%gal6JRXEXA&L3`d2 z%jIxzZ~*p9O-;EJp_Ds0If38rM<5W8ic~K>FOK&2_p!CLg^i63OioVb6k$)zWHLx3 z5;!|M!}<9+#QSi1dRlbEcxPt^;cysUuU8@%3}RwpLRIGG<|IKnoyP6$Eh3SKw7a*r zSDXP=IYc&YZf;7@?fCe($^l9ORaJ3wbAx0uiC8QqRr$2t-Cfy8%XCI3B%pxJW>XdM zw~zPt_s}#A@pxQ5Ly)4szaMtH9lgE1SXx@b+S(fW`ub$fYPE8J7#bSNDzme*Ub07{ zQKV8SjEs!%0@v5ql8ggm!@$6Rbi^E8vBqpRM-}l+@5OSMrl+TWj*gC^qoV@>u{fQb zov5v?g~?>X@bEC&+uLPaQ&Ypn-y~^mZA}+f(&2EFH8eE%dU|@ENpN*_1-)L6_4Rc* zFuq@`IjX9vp1QiaK9ZojyZhnQURP99d=u;%37VRkpwsD4U0sd3x;hEQB&e^i|3QN0 z=H|Os1fRqaw!?#igLmS4HE!G3*ce(`TF}ZgH#N0snj1RZ=5O!&o^!gea_a6n@WA=tJm=FUBKRM1W*hOrV~>U9f`~wv z0Tu|Y=)%0J6Hoe^LggC>gr#M3MGJ%lAchdF!VuE253mxEF{r-t40G)#`jbf6HD_`WwU$M6V#vcM2*Q#qvS~OkA~o z2X+9Mdw=9?o+sdf%>_z*h8O~qfunFgSf^kugh83b=D^9J(VPUr{K(}ELQD!`%%7PJ z?Ct=T=ZB$^(QAR`p;x)CV4LkdROfK{`n>)VP_cHf(h#k|mIYVoX~ZK>M2OYH#R7NA zC|vQRGY(=1aUytrq|_-S?Jn~~ebu-#6>{G$ z;Iu>2K>%gc%R!i`>EriVc(@Y%d9-x~vXMRtlG+efgGAvu^>|a(&{& zi#?t96Q26xH5Wm`ASN&bGl?jQ3$~$m>`Ow7tFbhel@i4YmQkqm)z}W~Y{bXOcjySeo>2x3)2;HwxvuqoCi6>( zE1z8&OJ>Jv@7Yr}`zB9kxMNB&8m3!icqK{XA4Z;5)n(h+sJMkx;HE>i-atjR|2L6A V!PJ$`dXYaZs9=SbAto%g@>T~?_bH&lTUn@`uo|1bXE{eSR(AO)ESb=V4`uk}mK|39Px&03WLbv~pzk+s7D@lK^ zn+aB+sp)&Y_x-B3>;6ywU--WQNUr<8>TU0P-|L#1U&;A)67w(+> pDf@fM7q9#F25QXo3rUI;002ro52U44e~JJA002ovPDHLkV1l;_q@Mr) literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/tab.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/tab.png new file mode 100644 index 0000000000000000000000000000000000000000..3d8207fd74e73ed0a61793834ecbd358a209b9c9 GIT binary patch literal 323 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i<@^>lFzu{fRl=l_3uX4QtyMkj+0 zY#SOnetv##&Ac*9!Aw2qzO90ukB`rtBTS+*)~sK@Qd3Wl>6w91lc$EXqw|d(p7rtj zL#=9mJql4^&ui$IAYgxZvAe!x-T!~wAEkwbV}v;l|IpFV;kk6_P=alNz5|0Yv$3)9 z;rsjlKkS;w>nL%6C&hSi8{-+bv^22=Ol%^&FHDS$JJJrBFsN`$`tyH2>+-h(-T}M` zbIkMa)w8ljvf0|^Ry - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; + +public class DirectToolItemEditor extends ToolItemEditor { + private Image image; + + @Override + public Image getImage(Object element, Display display) { + if( image == null ) { + image = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/brick_go.png")); + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "Direct Tool Item"; + } + + @Override + public String getDescription(Object element) { + return "Direct Tool Item bla bla bla"; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java new file mode 100644 index 0000000000..aa34b41e77 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; + +public class HandledToolItemEditor extends ToolItemEditor { + private Image image; + + @Override + public Image getImage(Object element, Display display) { + if( image == null ) { + image = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/brick_link.png")); + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "Handled Tool Item"; + } + + @Override + public String getDescription(Object element) { + return "Handled Tool Item bla bla bla"; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 500dcc94d0..114cfb7f37 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -26,9 +26,11 @@ public class HandlerEditor extends AbstractComponentEditor { private DataBindingContext context; @Override - public Image getImage(Display display) { - // TODO Auto-generated method stub - return null; + public Image getImage(Object element, Display display) { + if( image == null ) { + image = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/cog.png")); + } + return image; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index ffde3a8e5d..792df05256 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -142,7 +142,7 @@ private Composite createForm(Composite parent) { } @Override - public Image getImage(Display display) { + public Image getImage(Object element, Display display) { if( image == null ) { image = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/package_go.png")); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java index 5c91d8b0d2..df3e65261b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java @@ -31,7 +31,7 @@ public class ModelComponentsEditor extends AbstractComponentEditor { private DataBindingContext context; @Override - public Image getImage(Display display) { + public Image getImage(Object element, Display display) { if( image == null ) { image = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/application_view_icons.png")); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 9c964cd837..1432c066b1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -49,7 +49,7 @@ public class PartEditor extends AbstractComponentEditor { @Override - public Image getImage(Display display) { + public Image getImage(Object element, Display display) { if( image == null ) { image = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/application_form.png")); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java new file mode 100644 index 0000000000..8d07add564 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -0,0 +1,81 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MPartSashContainer; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class PartSashContainerEditor extends AbstractComponentEditor { + private Composite composite; + private WritableValue master = new WritableValue(); + private Image vImage; + private Image hImage; + private DataBindingContext context; + + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + + @Override + public Image getImage(Object element, Display display) { + boolean horizontal = ((MPartSashContainer)element).isHorizontal(); + + if( vImage == null && ! horizontal ) { + vImage = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/application_tile_vertical.png")); + } + + if( hImage == null && horizontal ) { + hImage = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/application_tile_horizontal.png")); + } + + if( horizontal ) { + return hImage; + } else { + return vImage; + } + } + + @Override + public String getLabel(Object element) { + return "Sash"; + } + + @Override + public String getDescription(Object element) { + return "Sash bla bla bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new DataBindingContext(); + composite = createForm(parent,context, master); + } + master.setValue(object); + return composite; + } + + private Composite createForm(Composite parent, DataBindingContext context2, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return ELEMENT_CONTAINER__CHILDREN.observe(element); + } + + @Override + public String getDetailLabel(Object element) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java new file mode 100644 index 0000000000..2485db33d7 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -0,0 +1,68 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class PartStackEditor extends AbstractComponentEditor { + private Composite composite; + private WritableValue master = new WritableValue(); + private Image image; + private DataBindingContext context; + + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + + @Override + public Image getImage(Object element, Display display) { + if( image == null ) { + image = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/tab.png")); + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "Stack"; + } + + @Override + public String getDescription(Object element) { + return "Stack bla bla bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new DataBindingContext(); + composite = createForm(parent,context, master); + } + master.setValue(object); + return composite; + } + + private Composite createForm(Composite parent, DataBindingContext context2, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return ELEMENT_CONTAINER__CHILDREN.observe(element); + } + + @Override + public String getDetailLabel(Object element) { + // TODO Auto-generated method stub + return null; + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java new file mode 100644 index 0000000000..5f4c9aad4e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -0,0 +1,66 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class ToolBarEditor extends AbstractComponentEditor { + private Composite composite; + private WritableValue master = new WritableValue(); + private Image image; + private DataBindingContext context; + + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + + @Override + public Image getImage(Object element, Display display) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getLabel(Object element) { + return "Toolbar"; + } + + @Override + public String getDescription(Object element) { + return "Toolbar bla bla bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new DataBindingContext(); + composite = createForm(parent,context, master); + } + master.setValue(object); + return composite; + } + + private Composite createForm(Composite parent, DataBindingContext context2, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return ELEMENT_CONTAINER__CHILDREN.observe(element); + } + + @Override + public String getDetailLabel(Object element) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java new file mode 100644 index 0000000000..7774e94881 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class ToolItemEditor extends AbstractComponentEditor { + private Composite composite; + private WritableValue master = new WritableValue(); + private Image image; + private DataBindingContext context; + + @Override + public Image getImage(Object element, Display display) { + if( image == null ) { + image = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/brick.png")); + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "Tool Item"; + } + + @Override + public String getDescription(Object element) { + return "Tool Item bla bla bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new DataBindingContext(); + composite = createForm(parent,context, master); + } + master.setValue(object); + return composite; + } + + private Composite createForm(Composite parent, DataBindingContext context2, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getDetailLabel(Object element) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 764933ebe0..f9567273e2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -39,7 +39,7 @@ public class WindowEditor extends AbstractComponentEditor { @Override - public Image getImage(Display display) { + public Image getImage(Object element, Display display) { if( image == null ) { image = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/application_xp.png")); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java new file mode 100644 index 0000000000..52cedcd89a --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java @@ -0,0 +1,67 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class WindowTrimEditor extends AbstractComponentEditor { + private Composite composite; + private WritableValue master = new WritableValue(); + private Image image; + private DataBindingContext context; + + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + + + @Override + public Image getImage(Object element, Display display) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getLabel(Object element) { + return "Window Trim"; + } + + @Override + public String getDescription(Object element) { + return "Window Trim bla bla bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new DataBindingContext(); + composite = createForm(parent,context, master); + } + master.setValue(object); + return composite; + } + + private Composite createForm(Composite parent, DataBindingContext context2, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return ELEMENT_CONTAINER__CHILDREN.observe(element); + } + + @Override + public String getDetailLabel(Object element) { + // TODO Auto-generated method stub + return null; + } + +} From e1a2e485e04c997a9c89192f8ceeb811c94088c7 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 5 Mar 2010 19:25:49 +0000 Subject: [PATCH 0004/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixed label --- .../e4/tools/emf/ui/internal/common/component/PartEditor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 1432c066b1..9786752f8d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -59,12 +59,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Part Descriptor"; + return "Part"; } @Override public String getDescription(Object element) { - return "Part Descriptor Bla Bla Bla Bla"; + return "Part Bla Bla Bla Bla"; } @Override From 5e75af9d88d76492455ffc394ebca4badf74aa5d Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 7 Mar 2010 09:30:34 +0000 Subject: [PATCH 0005/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * using icons from model.workbench.edit --- .../META-INF/MANIFEST.MF | 6 ++++-- .../icons/application.png | Bin 464 -> 0 bytes .../icons/application_double.png | Bin 533 -> 0 bytes .../icons/application_form.png | Bin 467 -> 0 bytes .../icons/application_form_edit.png | Bin 714 -> 0 bytes .../icons/application_osx.png | Bin 487 -> 0 bytes .../icons/application_tile_horizontal.png | Bin 432 -> 0 bytes .../icons/application_tile_vertical.png | Bin 492 -> 0 bytes .../icons/application_view_icons.png | Bin 476 -> 0 bytes .../icons/application_xp.png | Bin 426 -> 0 bytes .../icons/brick.png | Bin 452 -> 0 bytes .../icons/brick_go.png | Bin 790 -> 0 bytes .../icons/brick_link.png | Bin 764 -> 0 bytes .../org.eclipse.e4.tools.emf.ui/icons/cog.png | Bin 512 -> 0 bytes .../icons/lightning_go.png | Bin 739 -> 0 bytes .../icons/link.png | Bin 343 -> 0 bytes .../icons/package_go.png | Bin 898 -> 0 bytes .../org.eclipse.e4.tools.emf.ui/icons/tab.png | Bin 323 -> 0 bytes .../component/AbstractComponentEditor.java | 20 ++++++++++++++++++ .../emf/ui/internal/common/ModelEditor.java | 4 ++-- .../common/component/ApplicationEditor.java | 10 ++++++++- .../common/component/CommandEditor.java | 10 ++++++++- .../component/DirectToolItemEditor.java | 13 ------------ .../component/HandledToolItemEditor.java | 13 ------------ .../common/component/HandlerEditor.java | 10 ++++++++- ...ndingEditor.java => KeyBindingEditor.java} | 12 +++++++++-- .../internal/common/component/PartEditor.java | 10 ++++++++- .../component/PartSashContainerEditor.java | 17 +++++++++++++-- .../common/component/PartStackEditor.java | 10 ++++++++- .../common/component/ToolBarEditor.java | 14 ++++++++++-- .../common/component/ToolItemEditor.java | 10 ++++++++- .../common/component/WindowEditor.java | 10 ++++++++- 32 files changed, 126 insertions(+), 43 deletions(-) delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application_double.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application_form.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application_form_edit.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application_osx.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application_tile_horizontal.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application_tile_vertical.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application_view_icons.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/application_xp.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/brick.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/brick_go.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/brick_link.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/cog.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/lightning_go.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/link.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/package_go.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/tab.png rename bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/{BindingEditor.java => KeyBindingEditor.java} (84%) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 39de767f68..a4ff5c96f0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -14,9 +14,11 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.jface.databinding;bundle-version="1.4.0", org.eclipse.jface;bundle-version="3.6.0", org.eclipse.emf.edit;bundle-version="2.6.0", - org.eclipse.equinox.common;bundle-version="3.6.0" + org.eclipse.equinox.common;bundle-version="3.6.0", + org.eclipse.e4.ui.model.workbench.edit;bundle-version="0.9.1" Bundle-ActivationPolicy: lazy -Import-Package: javax.inject;version="1.0.0" +Import-Package: javax.inject;version="1.0.0", + org.osgi.framework;version="1.5.0" Export-Package: org.eclipse.e4.tools.emf.ui.common, org.eclipse.e4.tools.emf.ui.common.component, org.eclipse.e4.tools.emf.ui.internal.common;x-internal:=true, diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/application.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/application.png deleted file mode 100644 index 1dee9e366094e87db68c606d0522d72d4b939818..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 464 zcmV;>0WbcEP)8e6`gpm!y1M!N^ZV(=IC*t) z{^;nqJv-tM$9J1L2QJ2DN!#51=1_l@G`2=6e0lehL%sic%`_4--LFM}IF!KzJCseW zq1I3__Z40|e?qyK1__gzP(qrBf-G7SQbQ`#Lw94WVe(o`qg+f4hy;Qju)q#I(9{`% zQmAGomzhQ!b|gq>KqL@IkO~$=Koi}a$u6d07kiS}NoYVMJjAeZpaB*;wwcDdEbK@K zNP;B7RzhQ|H9AlUO<`J>m1(5R)Pb-iLBb@7Jp)}LHdAb-VVgYxVoTzGoqu{~a>6uj zeqCRFI9pC#h09bGwy9;oHcp6(RB%jeY^F=Ll!S+9JkVe4nDG7tJMQiP0000 zld+0ZK^TRQ&AxX;a%I->Ls?9Vv(;_9E)=9HE>13WHNsnHAS>LKQkMbVH_QE8X!1!(q^p{6+N_ X4^=JUQP|Z100000NkvXXu0mjfgEH)N diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/application_form.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/application_form.png deleted file mode 100644 index 807b862cfc087b70dcdd971af3ac92688484e998..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 467 zcmV;^0WAKBP)4nWfMy23V#h*$3p-!?D%AI~T5+JJ;5Qi)|`;Y?)XOj2U`VS70o zp1%L~Y4f1;U-b7MEOk38OU$EtImvzCpiEkKCg)@3^{;h@nc_6NuOBn7?ZF9Ev4w3+ zWiSxI_v2&k@_b{1R8kdeGLx;rFK&F@c}mqZ4YwJO$7q^VC6&nL^Y#-6g9F*zM-oa= z70W0^1X#=%!t{DQE-wCJ^Pd1r08&yFDUlL$EtoM3e+;?Hv-Nc(QI%=il9}v$`OS^N z)(TbAG~DLw><`m+N>!Xf5_@kR0j83~eKLh5sv-%=fC#``TU}jaG#UW`VS>Ph2!jLJ zROR&N$x3B;J002ov JPDHLkV1im=zqMscT0g(~ZNI{bH#Y_Utm11j?0+FF&hK-qRX-TePYY3~f zgtoM;)~2M+AJew!(sr+7^KN&$cgxoJcJAGZGzzQ(AD(j#=leYm&p8hTfchUO*=18r zr!~koJq|$qh+zB()q@3G>7PU6y;(H$c~Nhe#3lU)C~l9VR_BJ=;N(S}WT3GGbJ~$L zY!^k>SWYq!Z~hmmJ4PWHsEvN4)9Gy^Z?)wOR0E3;1OdDR51!|xxx?Z3jR~6$3lGcS zw`wrecMQ|rMHQ4-uw*icvKH@8Qe-U(ejNgB1!Gqt;e8II!iaktI@}570bpEkH@7b5obwc$sUX75)sc{ zLoV$^I#`Q!&qeqKv2}x;Q6ZOcK?qbLvr>-a zyc(hY)2O@Nn=hiGX9AH(WK#{q_3OcQFyqRCxB{6^XTi-jVaae3jL(UZMoZqHPUiu` zFod;2WZ-*e#Qe)flJ*;9mgV@eat;ZSNkD%BUpZPjbEd(ZH>lOVM>tFq!k`K6p&rZ) zt12-&(V<8oA9F-Oc!oCq@PvQW{0``D3AONE*fZt6-G6K6?>+q?gw;DtTL1t607*qoM6N<$g3ymi=>Px# diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/application_osx.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/application_osx.png deleted file mode 100644 index 9f022ece86d73715c7e45c6702c1c87560b8ba23..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 487 zcmV-B1Y!m%PGQ6x$c z#f9@AK!Oh=jElv$CqBcNDKEr@t}K+jhk=(*)=6Nf9`DW>GPMDbI$#A zadnmXt6lDNZUb=D%3-T`<7 zxtL}GCkYVlWRqqF51NHf9Yl>2gOi8|vh54F$BDrs0>$iLAcx_0~HSm3sN|U6QrN-pa}fa=>kAy*54Rm aM*ISgWgjfIBP3%00000 zld)=4K@^6+dv{}4Y=qQeVU@}tM6j^36YGGDjg6qBwU$%~R)ORVZ1Ms&K0^u{3%3Y@ zASi3DyPIt8obw-xdy|`4NnAWIGt8O8$DIG4DI$UwJ0D*?ez>}QJd2wWgoGrLH>*j= z98)mhgioKpzkdJr=^j8I;L-Z(Zf|K&t}H=B5I{sb07Vc1ist;z*mi*qFilZT>JuWO zErKAB$a3eP@ytuw=mWR~n@?`DXuN!PLcxWsZyk?Al4tUtK7 z)>|I1a-*~AvhwpT{I2S?3@|=ZSyh(bgPr6Nj-nT19X7DZ8zeUKOl_Tl|>1YLMH z=jlD?b+Sb_xgR_*#(SP~INR$20GAV7?rFuloUPPDd!HchGLr8gZI>aqRf53gD~KB} z;7=4_D*g<@>Ld7K_aG;3>sUvEaJphdb1M87A#!by06TZW*wPh{Ku&%@CmC6|-~wsq zjb0RsMFKOF(Fjbu5Fwh)ru|I#tR-Lz>qIaxcgh90?Z1KrCWc|y!1T|aZ~=a*-(Ag4 zSPUtVz{2m+IDzS#IpP9w-9EN;RO;3eG#U+?z$0h4Kv;Wfk8B+i3#{n6-UibhNOQqt z?12jeFM)^6#o@C#4HjCL*d?a8z!%N)t>y1HEak5ffl*Zzs?{nz*J?G;G`=UdUjg$j zC=)9;^kAC{HL0z0x7{1P|EQ`>eA9tOij?;P^H=75o6^EkKQu SuK{QP0000wtp^MwsrC67-bFzu!t;6Q^%|k2MJ$kfh*aj@vhNOIJ zWFxBVQIH79u!vw98!Ll~y$OKnm}QK5wtxPNU<+B6{mDR{T_7M%l&baHE>bEbHX04+ zn+OzZ0e^b{APT{9E#RmJ5)l*`)B%#z1i)YIPdwe5?6tW?r-ok|b$oDQj8FV%kZPq;(MWOV8?8;<)(iP}>hNMU> z7fbz%jjlr7h8uuoQ~J6}n}@Y@PdTk=)PxO{%7zmL?dchpZX*~n;I{!C>*(8cU;q(~ zAS%Po_@naEU!xidrBXD?;hN|x^%W|Ij)0y*r5vi|?W&Fub(NqJ@z0o=Ozp{gHSP{di*#8D&?(h#;bi2r7yUe@M_9Z^R^1th67Ma+}U=ey(q{ z%~>)Q;cRVlbJ5&n%2W)U;$S+(K9zyBt*3JiDKhoI1BdsV_j#W8ea|5PNIG0D*E5U7 z66xyd`pdxfEVk3#Z2_~{oMA8+{vd6!m|m|xvLnHN#V}P%QJ}ZC7h_{%NTpIpCX*N) z9py20#_q7Y8;&>uWnbT_HZwDW?(S{`gFz0H$;4x6j@CIrPfw4Q0-;cdD>8V!URbSG z=yW;`wr4TsCXq;BWMl*^N3B-t2~|o=OiaM<_ahJpa7Ct`zBU{U4GqERbi!`8L#0wB z2(>4zt*v2UVF6Q9Q<$Ef2CWa1larf{*nVJO0ORB1u-R-J!^6X9Z*P}~(P-oZD=RBl zUS7uR>@2tI^Z7P=z*NiL=b=!07GJ;F;BYv&+qSkgi8YWDNRou5r6t5-F+?H}uF6Vt zyWL!|xHA_|Ew^z?c?$jZJ}#hCDkVZ^`#Thr?l%iM7ujJ_6Bn65+CbO^3N2U=TO*NG^KHr9~2xj9}2BVoNL)#c(-Kn}D29Z&q=YesW_ z1q5#+N<j%go#9EE}){AAsopP$F#;vyc>dRg+DzH&5tDMkI~BGgzO zpw?OprK=8iJM(bj2}y1~Nv&3!q0wmS>1=;_JRaOpord8@GsN$&Aq+M`<9R_z9zo%% zMUi*~S=A(Vw36g(`wJZ%9oclg;tfR>uC^RQep3c6y*z+>+KZ4oYfzw*A+wr94_A^i zJAS4O&<@KK3WZ%Rm%C}Ru4UKliQgCUky%9|H2LJNzi~HE%kkq?dvUOmWNnTA1HB~u UMVP_&o&W#<07*qoM6N<$f>=0SnE(I) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/brick_link.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/brick_link.png deleted file mode 100644 index 9ebf013a23a56653655a736a7e149deb7365ea03..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 764 zcmV&SR3v>A``^efOSo-hEdApp;^Jd;9y!%1UfzX6Bh- z%-mbG|0Na{7Ruai_Y+DEb1s+b!*9k%Q!whMxjtZKA*?o;i1g&jy0@( zaU=-@d-h+o%gal6JRXEXA&L3`d2 z%jIxzZ~*p9O-;EJp_Ds0If38rM<5W8ic~K>FOK&2_p!CLg^i63OioVb6k$)zWHLx3 z5;!|M!}<9+#QSi1dRlbEcxPt^;cysUuU8@%3}RwpLRIGG<|IKnoyP6$Eh3SKw7a*r zSDXP=IYc&YZf;7@?fCe($^l9ORaJ3wbAx0uiC8QqRr$2t-Cfy8%XCI3B%pxJW>XdM zw~zPt_s}#A@pxQ5Ly)4szaMtH9lgE1SXx@b+S(fW`ub$fYPE8J7#bSNDzme*Ub07{ zQKV8SjEs!%0@v5ql8ggm!@$6Rbi^E8vBqpRM-}l+@5OSMrl+TWj*gC^qoV@>u{fQb zov5v?g~?>X@bEC&+uLPaQ&Ypn-y~^mZA}+f(&2EFH8eE%dU|@ENpN*_1-)L6_4Rc* zFuq@`IjX9vp1QiaK9ZojyZhnQURP99d=u;%37VRkpwsD4U0sd3x;hEQB&e^i|3QN0 z=H|Os1fRqaw!?#igLmS4HE!G3*ce(`TF}CQDsH?WF>AIFt zQuJ}i;w2$ZUU#3SZ6RY0Gw;kZ&ol1~2ky^QZ(fom$=jNJZt!z7w_pH~wdQ;R)Gh%BbQFCx+Nm!4SuS-vkr`vhhrX zM*>w%e+v~?m@q~ImPAgtLkR_3U<2F8LP3W5=LJ*ZN|S5p#sf4YFr$p~Q~Z*0Ngxf2 zjk#J#<7EAlhzlrV53~GF&pIzcCN_lz9@05UeoUXiK%N z#x+4o*i_c|6_Uu1+&TIho?3@y4k-#b8Y_o94zW*B3a1ne2-Y5s0uke$$|@=}OP-i= zNYZQA=>PrZu0MfSL=b8UhD_={W4IY1{b{)U)*gc45xtL%IYLY&hF;d`@GzI&7H&D# zh;z_BX$#hqh@q?AY3sJTod2%*Yd)_>YM0#q&ixGuh+PQsneK)F0000ZgH#N0snj1RZ=5O!&o^!gea_a6n@WA=tJm=FUBKRM1W*hOrV~>U9f`~wv z0Tu|Y=)%0J6Hoe^LggC>gr#M3MGJ%lAchdF!VuE253mxEF{r-t40G)#`jbf6HD_`WwU$M6V#vcM2*Q#qvS~OkA~o z2X+9Mdw=9?o+sdf%>_z*h8O~qfunFgSf^kugh83b=D^9J(VPUr{K(}ELQD!`%%7PJ z?Ct=T=ZB$^(QAR`p;x)CV4LkdROfK{`n>)VP_cHf(h#k|mIYVoX~ZK>M2OYH#R7NA zC|vQRGY(=1aUytrq|_-S?Jn~~ebu-#6>{G$ z;Iu>2K>%gc%R!i`>EriVc(@Y%d9-x~vXMRtlG+efgGAvu^>|a(&{& zi#?t96Q26xH5Wm`ASN&bGl?jQ3$~$m>`Ow7tFbhel@i4YmQkqm)z}W~Y{bXOcjySeo>2x3)2;HwxvuqoCi6>( zE1z8&OJ>Jv@7Yr}`zB9kxMNB&8m3!icqK{XA4Z;5)n(h+sJMkx;HE>i-atjR|2L6A V!PJ$`dXYaZs9=SbAto%g@>T~?_bH&lTUn@`uo|1bXE{eSR(AO)ESb=V4`uk}mK|39Px&03WLbv~pzk+s7D@lK^ zn+aB+sp)&Y_x-B3>;6ywU--WQNUr<8>TU0P-|L#1U&;A)67w(+> pDf@fM7q9#F25QXo3rUI;002ro52U44e~JJA002ovPDHLkV1l;_q@Mr) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/package_go.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/package_go.png deleted file mode 100644 index aace63ad6f91537268eb6e9bf328743da7c631c6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 898 zcmV-|1AY97P)yqPWur#3F*- zi1-H*6GJgONgz~1E;+_Oe@~@VF-1Iy-=*@ zV9T!Kgk#%59lVt}Zj7B_)9wTKYBy6YEwPxKqOdeGuEw0%cVhe}Yj*hPSBMNYZ5yz{ z4STT*%d9TVV4NauDND$z(%QKb>=kMr>ckh0lFuesOioc=Nq^^8BQNYYbk1@M%M`O? zh?6H&UZR}Ol3%#RzJX5(MAktmg_e?7`2>w^4^!6w)4$9==U0)EV$}u1A)*bPRF?jv zHdar4EJB1b*f+rh!M+8R159x8%Qjd0I{0j+|69pUC)f(>!P(OTs8c~;XuVtXzfO>s`m zrjW9YI38*Yel_NvP&FVfNEx)sn-kxIx;WzEcpe*LJBYXLr(llS6I0o+c9O z0L_4N7u$0%Dx~ks;fjYRF0OIOR}1uPI!MtibK=J3pihiBTv)jD>R%(Llj(_XFa#mG z6Wg=#j7Q7*PFmM*W@B9!ftm;#qU}sCT;|&KtBZ%Fe#3()Pk+9@Sw&8%k=NQD>92qN zkFT*E2S*%i&!MYvH;;DpF?sU}zb4Mlls)au3~BX$XZr12Z?_sbts>8Fec~0Xl1q`9 zxyH%T#p<5UCqrY2(J4oGEHk9ens22BN3dYXATM07*qoM6N<$g3xBAZ~y=R diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/tab.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/tab.png deleted file mode 100644 index 3d8207fd74e73ed0a61793834ecbd358a209b9c9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 323 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i<@^>lFzu{fRl=l_3uX4QtyMkj+0 zY#SOnetv##&Ac*9!Aw2qzO90ukB`rtBTS+*)~sK@Qd3Wl>6w91lc$EXqw|d(p7rtj zL#=9mJql4^&ui$IAYgxZvAe!x-T!~wAEkwbV}v;l|IpFV;kk6_P=alNz5|0Yv$3)9 z;rsjlKkS;w>nL%6C&hSi8{-+bv^22=Ol%^&FHDS$JJJrBFsN`$`tyH2>+-h(-T}M` zbIkMa)w8ljvf0|^Ry Date: Sun, 7 Mar 2010 11:51:02 +0000 Subject: [PATCH 0006/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * implemented toolitem and using editing domain --- .../.settings/org.eclipse.jdt.core.prefs | 260 +++++++++++++++++- .../.settings/org.eclipse.jdt.ui.prefs | 4 + .../META-INF/MANIFEST.MF | 3 +- .../component/AbstractComponentEditor.java | 11 + .../emf/ui/internal/common/ModelEditor.java | 32 +-- .../common/component/ApplicationEditor.java | 7 + .../common/component/CommandEditor.java | 7 + .../component/DirectToolItemEditor.java | 54 ++++ .../component/HandledToolItemEditor.java | 55 ++++ .../common/component/HandlerEditor.java | 7 + .../common/component/KeyBindingEditor.java | 7 + .../component/ModelComponentEditor.java | 18 +- .../component/ModelComponentsEditor.java | 7 + .../component/PartDescriptorEditor.java | 9 +- .../internal/common/component/PartEditor.java | 100 ++++--- .../component/PartSashContainerEditor.java | 7 + .../common/component/PartStackEditor.java | 7 + .../common/component/ToolBarEditor.java | 7 + .../common/component/ToolItemEditor.java | 136 ++++++++- .../common/component/WindowEditor.java | 16 +- .../common/component/WindowTrimEditor.java | 21 +- 21 files changed, 674 insertions(+), 101 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs index 04d8a38777..44c830d92b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,4 @@ -#Tue Mar 02 18:39:11 CET 2010 +#Sun Mar 07 11:22:58 CET 2010 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 @@ -6,3 +6,261 @@ 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 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=0 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=80 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000000..87e3873ea0 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,4 @@ +#Sun Mar 07 11:22:19 CET 2010 +eclipse.preferences.version=1 +formatter_profile=_custom +formatter_settings_version=11 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index a4ff5c96f0..91f26e4d5e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.jface;bundle-version="3.6.0", org.eclipse.emf.edit;bundle-version="2.6.0", org.eclipse.equinox.common;bundle-version="3.6.0", - org.eclipse.e4.ui.model.workbench.edit;bundle-version="0.9.1" + org.eclipse.e4.ui.model.workbench.edit;bundle-version="0.9.1", + org.eclipse.emf.databinding.edit;bundle-version="1.2.0" Bundle-ActivationPolicy: lazy Import-Package: javax.inject;version="1.0.0", org.osgi.framework;version="1.5.0" diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index f5cbc2cb24..76e37ceebc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -16,11 +16,22 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.runtime.FileLocator; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; public abstract class AbstractComponentEditor { + private EditingDomain editingDomain; + + public AbstractComponentEditor(EditingDomain editingDomain) { + this.editingDomain = editingDomain; + } + + public EditingDomain getEditingDomain() { + return editingDomain; + } + public abstract Image getImage(Object element,Display display); public abstract String getLabel(Object element); public abstract String getDetailLabel(Object element); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 0053cfa9f5..011f7c0a4e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -156,22 +156,22 @@ private TreeViewer createTreeViewerArea(Composite parent) { } private void registerDefaultEditors() { - registerEditor( MApplicationPackage.Literals.APPLICATION, new ApplicationEditor()); - registerEditor( MApplicationPackage.Literals.MODEL_COMPONENTS, new ModelComponentsEditor()); - registerEditor( MApplicationPackage.Literals.MODEL_COMPONENT, new ModelComponentEditor()); - registerEditor( MApplicationPackage.Literals.PART, new PartEditor()); - registerEditor( MApplicationPackage.Literals.PART_DESCRIPTOR, new PartDescriptorEditor()); - registerEditor( MApplicationPackage.Literals.KEY_BINDING, new KeyBindingEditor()); - registerEditor( MApplicationPackage.Literals.HANDLER, new HandlerEditor()); - registerEditor( MApplicationPackage.Literals.COMMAND,new CommandEditor()); - registerEditor( MApplicationPackage.Literals.WINDOW, new WindowEditor()); - registerEditor( MApplicationPackage.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor()); - registerEditor( MApplicationPackage.Literals.PART_STACK, new PartStackEditor()); - registerEditor( MApplicationPackage.Literals.WINDOW_TRIM, new WindowTrimEditor()); - registerEditor( MApplicationPackage.Literals.TOOL_BAR, new ToolBarEditor()); - registerEditor( MApplicationPackage.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor()); - registerEditor( MApplicationPackage.Literals.HANDLED_TOOL_ITEM, new HandledToolItemEditor()); - registerEditor( MApplicationPackage.Literals.TOOL_ITEM, new ToolItemEditor()); + registerEditor( MApplicationPackage.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.MODEL_COMPONENTS, new ModelComponentsEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.MODEL_COMPONENT, new ModelComponentEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.PART, new PartEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.COMMAND,new CommandEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.PART_STACK, new PartStackEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.WINDOW_TRIM, new WindowTrimEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.TOOL_BAR, new ToolBarEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.HANDLED_TOOL_ITEM, new HandledToolItemEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.TOOL_ITEM, new ToolItemEditor(modelProvider.getEditingDomain())); } public void registerEditor(EClass eClass, AbstractComponentEditor editor) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index eeaceba0cb..a3d9c923c5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -24,12 +24,14 @@ import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; public class ApplicationEditor extends AbstractComponentEditor { + private Composite composite; private WritableValue master = new WritableValue(); private Image image; @@ -40,6 +42,11 @@ public class ApplicationEditor extends AbstractComponentEditor { private IListProperty APPLICATION__COMMANDS = EMFProperties.list(MApplicationPackage.Literals.APPLICATION__COMMANDS); private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + public ApplicationEditor(EditingDomain editingDomain) { + super(editingDomain); + // TODO Auto-generated constructor stub + } + @Override public Image getImage(Object element, Display display) { if( image == null ) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 030e4bfd4c..0d4413e6f9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -17,17 +17,24 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; public class CommandEditor extends AbstractComponentEditor { + private Composite composite; private WritableValue master = new WritableValue(); private Image image; private DataBindingContext context; + public CommandEditor(EditingDomain editingDomain) { + super(editingDomain); + // TODO Auto-generated constructor stub + } + @Override public Image getImage(Object element, Display display) { if( image == null ) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index f396ddbc33..391adf7425 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -10,7 +10,61 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + public class DirectToolItemEditor extends ToolItemEditor { + private Image image; + + public DirectToolItemEditor(EditingDomain editingDomain) { + super(editingDomain); + } + + @Override + public Image getImage(Object element, Display display) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/DirectToolItem.gif")); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + + @Override + protected void createSubTypeFormElements(Composite parent, DataBindingContext context, WritableValue master) { + IValueProperty textProp = WidgetProperties.text(); + + Label l = new Label(parent, SWT.NONE); + l.setText("Class URI"); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observe(t), EMFEditProperties.value( getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); + + Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setText("Find ..."); + } @Override public String getLabel(Object element) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index 31f037b725..d26bbe0ece 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -10,7 +10,62 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + public class HandledToolItemEditor extends ToolItemEditor { + private Image image; + + public HandledToolItemEditor(EditingDomain editingDomain) { + super(editingDomain); + } + + @Override + public Image getImage(Object element, Display display) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/HandledToolItem.gif")); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + protected void createSubTypeFormElements(Composite parent, DataBindingContext context, WritableValue master) { + IValueProperty textProp = WidgetProperties.text(); + + Label l = new Label(parent, SWT.NONE); + l.setText("Command"); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + t.setEnabled(false); + context.bindValue(textProp.observe(t), EMFEditProperties.value( getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLED_ITEM__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(master)); + + Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setText("Find ..."); + } @Override public String getLabel(Object element) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 87e1a1466e..77a46f65b9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -17,6 +17,7 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; @@ -28,6 +29,12 @@ public class HandlerEditor extends AbstractComponentEditor { private Image image; private DataBindingContext context; + public HandlerEditor(EditingDomain editingDomain) { + super(editingDomain); + // TODO Auto-generated constructor stub + } + + @Override public Image getImage(Object element, Display display) { if( image == null ) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 797d79587e..2b64686b18 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -17,17 +17,24 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; public class KeyBindingEditor extends AbstractComponentEditor { + private Composite composite; private WritableValue master = new WritableValue(); private Image image; private DataBindingContext context; + public KeyBindingEditor(EditingDomain editingDomain) { + super(editingDomain); + // TODO Auto-generated constructor stub + } + @Override public Image getImage(Object element, Display display) { if( image == null ) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index 792df05256..4953469824 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -24,6 +24,8 @@ import org.eclipse.e4.ui.model.application.MModelComponent; import org.eclipse.e4.ui.model.application.MPart; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.viewers.ListViewer; import org.eclipse.swt.SWT; @@ -37,12 +39,18 @@ import org.eclipse.swt.widgets.Text; public class ModelComponentEditor extends AbstractComponentEditor { + private Composite composite; private WritableValue master = new WritableValue(); private Image image; private DataBindingContext context; - private IListProperty MODEL_COMPONENT__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.MODEL_COMPONENT__CHILDREN); + private IListProperty MODEL_COMPONENT__CHILDREN = EMFProperties.list( MApplicationPackage.Literals.MODEL_COMPONENT__CHILDREN); + + public ModelComponentEditor(EditingDomain editingDomain) { + super(editingDomain); + // TODO Auto-generated constructor stub + } @Override public Composite getEditor(Composite parent, Object object) { @@ -84,7 +92,7 @@ private Composite createForm(Composite parent) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); // ------------------------------------------------------------ @@ -111,7 +119,7 @@ private Composite createForm(Composite parent) { t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.MODEL_COMPONENT__PARENT_ID).observeDetail(master)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__PARENT_ID).observeDetail(master)); Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setText("Find ..."); @@ -125,7 +133,7 @@ private Composite createForm(Composite parent) { gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.MODEL_COMPONENT__POSITION_IN_PARENT).observeDetail(master)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__POSITION_IN_PARENT).observeDetail(master)); // ------------------------------------------------------------ @@ -136,7 +144,7 @@ private Composite createForm(Composite parent) { gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.MODEL_COMPONENT__PROCESSOR).observeDetail(master)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__PROCESSOR).observeDetail(master)); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java index df3e65261b..a8292c952f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java @@ -17,12 +17,14 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; public class ModelComponentsEditor extends AbstractComponentEditor { + private IListProperty MODEL_COMPONENTS__COMPONENTS = EMFProperties.list(MApplicationPackage.Literals.MODEL_COMPONENTS__COMPONENTS); private Composite composite; @@ -30,6 +32,11 @@ public class ModelComponentsEditor extends AbstractComponentEditor { private Image image; private DataBindingContext context; + public ModelComponentsEditor(EditingDomain editingDomain) { + super(editingDomain); + // TODO Auto-generated constructor stub + } + @Override public Image getImage(Object element, Display display) { if( image == null ) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 03852d09fa..00c1fd8213 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -14,7 +14,8 @@ import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; @@ -24,6 +25,10 @@ public class PartDescriptorEditor extends PartEditor { + public PartDescriptorEditor(EditingDomain editingDomain) { + super(editingDomain); + } + @Override protected Composite createForm(Composite parent, DataBindingContext context, IObservableValue master) { Composite comp = super.createForm(parent,context,master); @@ -37,7 +42,7 @@ protected Composite createForm(Composite parent, DataBindingContext context, IOb GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 070ff15a56..48a7d5c836 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -26,6 +26,8 @@ import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MPart; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.viewers.ListViewer; import org.eclipse.jface.viewers.TableViewer; @@ -41,6 +43,7 @@ import org.eclipse.swt.widgets.Text; public class PartEditor extends AbstractComponentEditor { + private Composite composite; private WritableValue master = new WritableValue(); private Image image; @@ -50,6 +53,10 @@ public class PartEditor extends AbstractComponentEditor { private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); + public PartEditor(EditingDomain editingDomain) { + super(editingDomain); + // TODO Auto-generated constructor stub + } @Override public Image getImage(Object element, Display display) { @@ -98,24 +105,7 @@ protected Composite createForm(Composite parent, DataBindingContext context, IOb GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); - - // ------------------------------------------------------------ - - l = new Label(parent, SWT.NONE); - l.setText("Tags"); - - t = new Text(parent, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - t.setLayoutData(gd); - - l = new Label(parent, SWT.NONE); - ListViewer viewer = new ListViewer(parent); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - gd.heightHint = 80; - viewer.getList().setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); // ------------------------------------------------------------ @@ -126,7 +116,7 @@ protected Composite createForm(Composite parent, DataBindingContext context, IOb gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); // ------------------------------------------------------------ @@ -137,7 +127,7 @@ protected Composite createForm(Composite parent, DataBindingContext context, IOb gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); // ------------------------------------------------------------ @@ -146,7 +136,7 @@ protected Composite createForm(Composite parent, DataBindingContext context, IOb t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setText("Find ..."); @@ -158,7 +148,7 @@ protected Composite createForm(Composite parent, DataBindingContext context, IOb t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observe(t), EMFProperties.value(MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setText("Find ..."); @@ -166,14 +156,21 @@ protected Composite createForm(Composite parent, DataBindingContext context, IOb // ------------------------------------------------------------ l = new Label(parent, SWT.NONE); - l.setText("Variables"); + l.setText("Tags"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); - t = new Text(parent, SWT.BORDER); + ListViewer viewer = new ListViewer(parent); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; - t.setLayoutData(gd); + gd.heightHint = 80; + viewer.getList().setLayoutData(gd); + + // ------------------------------------------------------------ l = new Label(parent, SWT.NONE); + l.setText("Variables"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + viewer = new ListViewer(parent); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; @@ -184,13 +181,8 @@ protected Composite createForm(Composite parent, DataBindingContext context, IOb l = new Label(parent, SWT.NONE); l.setText("Properties"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); - t = new Text(parent, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - t.setLayoutData(gd); - - l = new Label(parent, SWT.NONE); TableViewer tableviewer = new TableViewer(parent); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; @@ -206,29 +198,29 @@ protected Composite createForm(Composite parent, DataBindingContext context, IOb column.getColumn().setText("Value"); column.getColumn().setWidth(200); - // ------------------------------------------------------------ - - l = new Label(parent, SWT.NONE); - l.setText(""); - - Composite booleanContainer = new Composite(parent,SWT.NONE); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - booleanContainer.setBackgroundMode(SWT.INHERIT_DEFAULT); - booleanContainer.setLayoutData(gd); - booleanContainer.setLayout(new GridLayout(4,false)); - - Button checkbox = new Button(booleanContainer, SWT.CHECK); - checkbox.setText("to render"); - - checkbox = new Button(booleanContainer, SWT.CHECK); - checkbox.setText("on Top"); - - checkbox = new Button(booleanContainer, SWT.CHECK); - checkbox.setText("visible"); - - checkbox = new Button(booleanContainer, SWT.CHECK); - checkbox.setText("closeable"); +// // ------------------------------------------------------------ +// +// l = new Label(parent, SWT.NONE); +// l.setText(""); +// +// Composite booleanContainer = new Composite(parent,SWT.NONE); +// gd = new GridData(GridData.FILL_HORIZONTAL); +// gd.horizontalSpan=2; +// booleanContainer.setBackgroundMode(SWT.INHERIT_DEFAULT); +// booleanContainer.setLayoutData(gd); +// booleanContainer.setLayout(new GridLayout(4,false)); +// +// Button checkbox = new Button(booleanContainer, SWT.CHECK); +// checkbox.setText("to render"); +// +// checkbox = new Button(booleanContainer, SWT.CHECK); +// checkbox.setText("on Top"); +// +// checkbox = new Button(booleanContainer, SWT.CHECK); +// checkbox.setText("visible"); +// +// checkbox = new Button(booleanContainer, SWT.CHECK); +// checkbox.setText("closeable"); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 28a72bab53..3c20d9927b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -11,12 +11,14 @@ import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MPartSashContainer; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; public class PartSashContainerEditor extends AbstractComponentEditor { + private Composite composite; private WritableValue master = new WritableValue(); private Image vImage; @@ -25,6 +27,11 @@ public class PartSashContainerEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + public PartSashContainerEditor(EditingDomain editingDomain) { + super(editingDomain); + // TODO Auto-generated constructor stub + } + @Override public Image getImage(Object element, Display display) { boolean horizontal = ((MPartSashContainer)element).isHorizontal(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 44dbd7ef5d..3e1067a279 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -10,12 +10,14 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; public class PartStackEditor extends AbstractComponentEditor { + private Composite composite; private WritableValue master = new WritableValue(); private Image image; @@ -23,6 +25,11 @@ public class PartStackEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + public PartStackEditor(EditingDomain editingDomain) { + super(editingDomain); + // TODO Auto-generated constructor stub + } + @Override public Image getImage(Object element, Display display) { if( image == null ) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 3f18a01239..e5abf9271b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -10,12 +10,14 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; public class ToolBarEditor extends AbstractComponentEditor { + private Composite composite; private WritableValue master = new WritableValue(); private Image image; @@ -23,6 +25,11 @@ public class ToolBarEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + public ToolBarEditor(EditingDomain editingDomain) { + super(editingDomain); + // TODO Auto-generated constructor stub + } + @Override public Image getImage(Object element, Display display) { if( image == null ) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index c5df70979d..42789a9bd3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -15,12 +15,30 @@ import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.ItemType; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MToolItem; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ViewerProperties; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class ToolItemEditor extends AbstractComponentEditor { private Composite composite; @@ -28,11 +46,15 @@ public class ToolItemEditor extends AbstractComponentEditor { private Image image; private DataBindingContext context; + public ToolItemEditor(EditingDomain editingDomain) { + super(editingDomain); + } + @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ToolItem.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ToolItem_separator.gif")); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -44,30 +66,115 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Tool Item"; + return "Separator"; } @Override public String getDescription(Object element) { - return "Tool Item bla bla bla"; + return "Separator bla bla bla"; } @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new DataBindingContext(); - composite = createForm(parent,context, master); + composite = createForm(parent, context, master); } master.setValue(object); return composite; } - private Composite createForm(Composite parent, DataBindingContext context2, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); + private Composite createForm(Composite parent, DataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IValueProperty textProp = WidgetProperties.text(); + + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); + + if( this.getClass() != ToolItemEditor.class ) { + createFormSubTypeForm(parent, context, master); + } + return parent; } + private void createFormSubTypeForm(Composite parent, DataBindingContext context, WritableValue master) { + IValueProperty textProp = WidgetProperties.text(); + + // ------------------------------------------------------------ + + Label l = new Label(parent, SWT.NONE); + l.setText("Type"); + + StructuredViewer viewer = new ComboViewer(parent); + viewer.setContentProvider(new ArrayContentProvider()); + viewer.setInput(new ItemType[] { ItemType.CHECK, ItemType.PUSH, ItemType.RADIO }); + GridData gd = new GridData(); + gd.horizontalSpan = 2; + viewer.getControl().setLayoutData(gd); + IObservableValue itemTypeObs = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ITEM__TYPE).observeDetail(master); + context.bindValue(ViewerProperties.singleSelection().observe(viewer), itemTypeObs); + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Label"); + + Text t = new Text(parent, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Tooltip"); + + t = new Text(parent, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Icon URI"); + + t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText("Find ..."); + // ------------------------------------------------------------ + createSubTypeFormElements(parent, context, master); + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Tags"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + + viewer = new ListViewer(parent); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + gd.heightHint = 80; + viewer.getControl().setLayoutData(gd); + } + + protected void createSubTypeFormElements(Composite parent, DataBindingContext context, WritableValue master) { + + } + @Override public IObservableList getChildList(Object element) { // TODO Auto-generated method stub @@ -76,7 +183,16 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { - // TODO Auto-generated method stub + MToolItem item = (MToolItem) element; + if (item.getType() == ItemType.SEPARATOR) { + return null; + } else { + if (item.getLabel() != null && item.getLabel().trim().length() > 0) { + return item.getLabel(); + } else if (item.getTooltip() != null && item.getTooltip().trim().length() > 0) { + return item.getTooltip(); + } + } return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index dbeb0f196b..35b5690f5c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -24,12 +24,14 @@ import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MWindow; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; public class WindowEditor extends AbstractComponentEditor { + private Composite composite; private WritableValue master = new WritableValue(); private Image image; @@ -37,9 +39,12 @@ public class WindowEditor extends AbstractComponentEditor { private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); - private IListProperty APPLICATION__COMMANDS = EMFProperties.list(MApplicationPackage.Literals.APPLICATION__COMMANDS); private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + public WindowEditor(EditingDomain editingDomain) { + super(editingDomain); + // TODO Auto-generated constructor stub + } @Override public Image getImage(Object element, Display display) { @@ -102,15 +107,6 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_COMMAND, APPLICATION__COMMANDS, element, "Commands") { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOWS, ELEMENT_CONTAINER__CHILDREN, element, "Controls") { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java index 52cedcd89a..dd544728c5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java @@ -1,5 +1,8 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import java.net.MalformedURLException; +import java.net.URL; + import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -7,12 +10,14 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; public class WindowTrimEditor extends AbstractComponentEditor { + private Composite composite; private WritableValue master = new WritableValue(); private Image image; @@ -20,11 +25,23 @@ public class WindowTrimEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + public WindowTrimEditor(EditingDomain editingDomain) { + super(editingDomain); + // TODO Auto-generated constructor stub + } @Override public Image getImage(Object element, Display display) { - // TODO Auto-generated method stub - return null; + if( image == null ) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/WindowTrim.gif")); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; } @Override From b138387a3cfa215c648ca0e77b86cc11437f78d2 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 7 Mar 2010 11:52:38 +0000 Subject: [PATCH 0007/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixed copyright --- .../emf/ui/internal/common/ComponentLabelProvider.java | 4 ---- .../e4/tools/emf/ui/internal/common/VirtualEntry.java | 1 + .../common/component/PartSashContainerEditor.java | 10 ++++++++++ .../ui/internal/common/component/PartStackEditor.java | 10 ++++++++++ .../ui/internal/common/component/ToolBarEditor.java | 10 ++++++++++ .../ui/internal/common/component/WindowTrimEditor.java | 10 ++++++++++ 6 files changed, 41 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java index 2c87d163b8..5d898c46c7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java @@ -11,10 +11,6 @@ package org.eclipse.e4.tools.emf.ui.internal.common; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.ui.model.application.MModelComponent; -import org.eclipse.e4.ui.model.application.MModelComponents; -import org.eclipse.e4.ui.model.application.MPart; -import org.eclipse.e4.ui.model.application.MPartDescriptor; import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.viewers.StyledCellLabelProvider; import org.eclipse.jface.viewers.StyledString; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java index a045a7657b..abd4625833 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java @@ -45,6 +45,7 @@ public void handleListChange(ListChangeEvent event) { }); } + @SuppressWarnings("unchecked") private List cleanedList(IObservableList list) { List l = new ArrayList(list.size()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 3c20d9927b..be11560eae 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; import java.net.MalformedURLException; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 3e1067a279..f350b0c743 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; import java.net.MalformedURLException; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index e5abf9271b..e13175ed2f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; import java.net.MalformedURLException; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java index dd544728c5..cc08c9d605 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; import java.net.MalformedURLException; From bd3d26c9181c7c64ec2065da623361514ff025c9 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 7 Mar 2010 15:23:27 +0000 Subject: [PATCH 0008/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * implemented tags editing * implemented handled item parameters editing --- .../icons/full/obj16/arrow_down.png | Bin 0 -> 379 bytes .../icons/full/obj16/arrow_up.png | Bin 0 -> 372 bytes .../icons/full/obj16/table_add.png | Bin 0 -> 663 bytes .../icons/full/obj16/table_delete.png | Bin 0 -> 660 bytes .../icons/full/obj16/zoom.png | Bin 0 -> 692 bytes .../component/AbstractComponentEditor.java | 34 +++ .../component/DirectToolItemEditor.java | 2 + .../component/HandledToolItemEditor.java | 169 +++++++++++++- .../common/component/ToolItemEditor.java | 209 +++++++++++++----- 9 files changed, 362 insertions(+), 52 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/arrow_down.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/arrow_up.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/table_add.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/table_delete.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/zoom.png diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/arrow_down.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/arrow_down.png new file mode 100644 index 0000000000000000000000000000000000000000..2c4e279377bf348f9cf53894e76bb673ccf067bd GIT binary patch literal 379 zcmV->0fhdEP)RB*?~^j!LKVQ>(O&A{Xr%)RXLn#U zs4LtZ6rCMFY5|B2$)yG$6aaIF6w#wHUuW*nL5>vZR zlg{G&%mT~|kL3ei%GW0*UOHUMs5XI$4uxe-L?I@SAefq*207}Iqtjm#e5*fP53AiC z)C|RQfwzxx<#_WfANRGZx{+tFDl8~Q?;~Ve=lM^*8UTTnVL?HTDz8uta0D@d28E9S z_)i8aLz^UE6PPKymi;2GJ`34{eIia-CtfAt0H61rk0 SPTNud0000^@R5;6} zlTS!gQ5431?~i{f-N>j^(nf@gnz4vsG~1*?ZHy3tqD@4b(p4K*Q47IE5Jb6XVMKux zSz4`PETXXnBWf%+CAA199Uoz1qRzYL-WG3|8Cw}$xO|**x!?Kjch9kmG5pVR0q(w9 zyl4z(#pnjDHKIXjjfh6HL5VKef+&M%{dV9~Q`7~}#`N_>t3&@%`O>}Fa6y4+9Re8t zdK;w`N)*0U_~I8)RN<_@bpYR&iV}jrhm*U`Y^eJ3s=`-N^gu)dFp|h@h@g9a4Y^VR zl_vl=(O$>>$$5?+s4wJ3lk@b%im{hnU9Z3wjW!0?fzdY^9LMHiGJ|DuWY zbD??rW^(>tPcVS%SR9MiGCsAy(P-T|1*P$9I*U?zy#k}bwc+Wz1so?p2yy^dAKl^m z`~=G@i>&!Ma%=m5);xjI7-J}N;PBpB;wg{LNU<%hjSaIT2|5l&X{c%9#mpGVPmhW9 z4qve$=sEz$wuq-Z0OBc+c*^7Xw8#6;4`|sLL2MziwF|L)Vtd*E&Ibfa1s>SY842M! z0d_`0914f#Z3A& zsdR$=u3HQ~J58li0kE3?1v7bhwSU`zl2002ovPDHLkV1n}7B%A;M literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/table_delete.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/table_delete.png new file mode 100644 index 0000000000000000000000000000000000000000..b85916d921ec08675f9e41f18c0fbfd7f2124d8c GIT binary patch literal 660 zcmV;F0&D$=P)Q?2k`9nO>z?V zkm+%pXeD(;$AS7ZfflT_L=+s|TT1_EiiW!ITMXX4Mag6@HO(#LRPSW@V;_Y>1H5R6 zv<447v{ZFFVUNY*Dm}RIv2nDFsh1@_Tuj zC17D*VH8v8SFpp^y1wjLHB#VfgRc!n3%(Jw(bShWQjmB~tT+!(MOc{COw72}B6pni uj`Q&8s8!`!6#=Xdf;B0000m+BBgry{~j2fHLegbHP( zrgXNbr0}2;^nywdjLjZe?uxtrd3D(pZH@fFFc0{BW_~jxoO1w7-VX;6vK@ROA$$R6 zEmo;Ht-Mj|>5jUy{bQ^V5@53LRI8AgLpUm|m+15sqcz@QtVSo|oz7ArM8?pIn+>gN z0b=4_b5O|4A*;Q+vc9Vqr~%3V155*NV~@gTz}KSUiKB-uJzjMZ>5%Q#n24H!V{ zTY(LLAE*NAHZ}C#wnj%Bw5OFIkRhkkAW#kDC3j9Wm0YXRaXlyyp>#mVfYG)eC;@ab zDb=T-BCAY4LI(Z@GOTr2V_A{pRwSmz+8Be>CjAw(=gnbVWAeguvZa93JmL(EDxv1m z0OP4q=fpAK1Mq!C2`OkEn37o;m#wF#(t(8Pu#S?2f#x<~4EO{@fmm`p9veD6RZ_jp z@Au4};q&`XuKEYgIiB4((kgxOs#YdqJw0fY>9^K_agEu5+$#k;w#%I2N>n_?)YIqu z`tq&#_^p?-%K*U0^}|7+9U(&k0?s;=r=uCZ%)H9_edH8wK}gB(nUB1FFk+2Ol%BXV zHoFY`D~2x|2 IMAGE_MAP = new HashMap(); + private static final String[] IMAGES = { + "/icons/full/obj16/zoom.png", + "/icons/full/obj16/table_add.png", + "/icons/full/obj16/table_delete.png", + "/icons/full/obj16/arrow_up.png", + "/icons/full/obj16/arrow_down.png", + }; + + protected static final int SEARCH_IMAGE = 0; + protected static final int TABLE_ADD_IMAGE = 1; + protected static final int TABLE_DELETE_IMAGE = 2; + protected static final int ARROW_UP = 3; + protected static final int ARROW_DOWN = 4; + public AbstractComponentEditor(EditingDomain editingDomain) { this.editingDomain = editingDomain; } @@ -32,6 +49,23 @@ public EditingDomain getEditingDomain() { return editingDomain; } + protected Image getImage( Display d, int id) { + Image img = IMAGE_MAP.get(id); + if( img == null ) { + try { + InputStream in = AbstractComponentEditor.class.getClassLoader().getResourceAsStream(IMAGES[id]); + img = new Image(d, in); + IMAGE_MAP.put(id, img); + in.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return img; + } + public abstract Image getImage(Object element,Display display); public abstract String getLabel(Object element); public abstract String getDetailLabel(Object element); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index 391adf7425..0851af1f53 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -64,6 +64,8 @@ protected void createSubTypeFormElements(Composite parent, DataBindingContext co Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setText("Find ..."); + b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index d26bbe0ece..535e52bca9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -16,14 +16,36 @@ import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MHandledItem; +import org.eclipse.e4.ui.model.application.MParameter; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.ColumnViewerEditor; +import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; +import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.viewers.TableViewerEditor; +import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; @@ -52,7 +74,7 @@ public Image getImage(Object element, Display display) { } @Override - protected void createSubTypeFormElements(Composite parent, DataBindingContext context, WritableValue master) { + protected void createSubTypeFormElements(Composite parent, DataBindingContext context, final WritableValue master) { IValueProperty textProp = WidgetProperties.text(); Label l = new Label(parent, SWT.NONE); @@ -65,6 +87,151 @@ protected void createSubTypeFormElements(Composite parent, DataBindingContext co Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setText("Find ..."); + b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Parameters"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + + final TableViewer tableviewer = new TableViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 120; + tableviewer.getTable().setHeaderVisible(true); + tableviewer.getControl().setLayoutData(gd); + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS); + + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Tag"); + column.getColumn().setWidth(200); + column.setEditingSupport(new EditingSupport(tableviewer) { + private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); + + @Override + protected void setValue(Object element, Object value) { + ((MParameter)element).setTag((String) value); + } + + @Override + protected Object getValue(Object element) { + String val = ((MParameter)element).getTag(); + return val == null ? "" : val; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return cellEditor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + + column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Value"); + column.getColumn().setWidth(200); + column.setEditingSupport(new EditingSupport(tableviewer) { + private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); + + @Override + protected void setValue(Object element, Object value) { + ((MParameter)element).setValue((String) value); + } + + @Override + protected Object getValue(Object element) { + String val = ((MParameter)element).getValue(); + return val == null ? "" : val; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return cellEditor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + + ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(tableviewer) { + @Override + protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { + boolean singleSelect = ((IStructuredSelection)tableviewer.getSelection()).size() == 1; + boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent)event.sourceEvent).button == 1; + + return singleSelect && (isLeftDoubleMouseSelect + || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC + || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); + } + }; + TableViewerEditor.create(tableviewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); + + ViewerSupport.bind(tableviewer, prop.observeDetail(master), new IValueProperty[] { + EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__TAG), + EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__VALUE) + }); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MHandledItem item = (MHandledItem) master.getValue(); + MParameter param = MApplicationFactory.eINSTANCE.createParameter(); + Command cmd = AddCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS, param); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + tableviewer.editElement(param, 0); + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent e) { + IStructuredSelection s = (IStructuredSelection) tableviewer.getSelection(); + if( !s.isEmpty() ) { + MHandledItem item = (MHandledItem) master.getValue(); + Command cmd = RemoveCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS, s.toList()); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + + }); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 42789a9bd3..f7e4a38479 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -12,6 +12,7 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.Arrays; import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -20,17 +21,28 @@ import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.ItemType; +import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MToolItem; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.databinding.viewers.ViewerProperties; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -99,76 +111,171 @@ private Composite createForm(Composite parent, DataBindingContext context, Writa t.setLayoutData(gd); context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); - if( this.getClass() != ToolItemEditor.class ) { + if (this.getClass() != ToolItemEditor.class) { createFormSubTypeForm(parent, context, master); } return parent; } - private void createFormSubTypeForm(Composite parent, DataBindingContext context, WritableValue master) { + private void createFormSubTypeForm(Composite parent, DataBindingContext context, final WritableValue master) { IValueProperty textProp = WidgetProperties.text(); // ------------------------------------------------------------ - - Label l = new Label(parent, SWT.NONE); - l.setText("Type"); - - StructuredViewer viewer = new ComboViewer(parent); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setInput(new ItemType[] { ItemType.CHECK, ItemType.PUSH, ItemType.RADIO }); - GridData gd = new GridData(); - gd.horizontalSpan = 2; - viewer.getControl().setLayoutData(gd); - IObservableValue itemTypeObs = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ITEM__TYPE).observeDetail(master); - context.bindValue(ViewerProperties.singleSelection().observe(viewer), itemTypeObs); + { + Label l = new Label(parent, SWT.NONE); + l.setText("Type"); + + ComboViewer viewer = new ComboViewer(parent); + viewer.setContentProvider(new ArrayContentProvider()); + viewer.setInput(new ItemType[] { ItemType.CHECK, ItemType.PUSH, ItemType.RADIO }); + GridData gd = new GridData(); + gd.horizontalSpan = 2; + viewer.getControl().setLayoutData(gd); + IObservableValue itemTypeObs = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ITEM__TYPE).observeDetail(master); + context.bindValue(ViewerProperties.singleSelection().observe(viewer), itemTypeObs); + } // ------------------------------------------------------------ - - l = new Label(parent, SWT.NONE); - l.setText("Label"); - - Text t = new Text(parent, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + { + Label l = new Label(parent, SWT.NONE); + l.setText("Label"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + } // ------------------------------------------------------------ - - l = new Label(parent, SWT.NONE); - l.setText("Tooltip"); - - t = new Text(parent, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + { + Label l = new Label(parent, SWT.NONE); + l.setText("Tooltip"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + } // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Icon URI"); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText("Find ..."); + b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + } - l = new Label(parent, SWT.NONE); - l.setText("Icon URI"); - - t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText("Find ..."); // ------------------------------------------------------------ + createSubTypeFormElements(parent, context, master); + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Tags"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + + final Text tagText = new Text(parent, SWT.BORDER); + tagText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + tagText.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { + handleAddText(tagText); + } + } + }); + + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText("Add"); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + handleAddText(tagText); + } + }); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + + l = new Label(parent, SWT.NONE); + final TableViewer viewer = new TableViewer(parent); + viewer.setContentProvider(new ObservableListContentProvider()); + viewer.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + return element.toString(); + } + }); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 120; + viewer.getControl().setLayoutData(gd); + + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__TAGS); + viewer.setInput(prop.observeDetail(master)); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if( ! s.isEmpty() ) { + MApplicationElement appEl = (MApplicationElement) master.getValue(); + Command cmd = RemoveCommand.create(getEditingDomain(), appEl, MApplicationPackage.Literals.APPLICATION_ELEMENT__TAGS, s.toList()); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + } - l = new Label(parent, SWT.NONE); - l.setText("Tags"); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + private void handleAddText(Text tagText) { + if (tagText.getText().trim().length() > 0) { + String[] tags = tagText.getText().split(";"); + for( int i = 0; i < tags.length;i++ ) { + tags[i] = tags[i].trim(); + } - viewer = new ListViewer(parent); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - gd.heightHint = 80; - viewer.getControl().setLayoutData(gd); + MApplicationElement appEl = (MApplicationElement) master.getValue(); + Command cmd = AddCommand.create(getEditingDomain(), appEl, MApplicationPackage.Literals.APPLICATION_ELEMENT__TAGS, Arrays.asList(tags)); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + tagText.setText(""); + } } protected void createSubTypeFormElements(Composite parent, DataBindingContext context, WritableValue master) { From 07694b1b5b4a5670372702fa462b36307ff927b1 Mon Sep 17 00:00:00 2001 From: Boris Bokowski Date: Sun, 7 Mar 2010 16:59:29 +0000 Subject: [PATCH 0009/1286] Bug 304937 - tooling: JDT code completion and templates for dependency injection --- .../.classpath | 7 + .../.project | 28 +++ .../.settings/org.eclipse.jdt.core.prefs | 8 + .../META-INF/MANIFEST.MF | 12 ++ .../build.properties | 7 + .../icons/full/elcl16/e4assist_co.gif | Bin 0 -> 225 bytes .../plugin.xml | 47 ++++ .../tools/jdt/templates/E4ContextType.java | 47 ++++ .../E4TemplateCompletionProposalComputer.java | 204 ++++++++++++++++++ .../templates/default-e4templates.properties | 0 .../templates/default-e4templates.xml | 59 +++++ 11 files changed, 419 insertions(+) create mode 100644 bundles/org.eclipse.e4.tools.jdt.templates/.classpath create mode 100644 bundles/org.eclipse.e4.tools.jdt.templates/.project create mode 100644 bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.jdt.core.prefs create mode 100644 bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF create mode 100644 bundles/org.eclipse.e4.tools.jdt.templates/build.properties create mode 100644 bundles/org.eclipse.e4.tools.jdt.templates/icons/full/elcl16/e4assist_co.gif create mode 100644 bundles/org.eclipse.e4.tools.jdt.templates/plugin.xml create mode 100644 bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4ContextType.java create mode 100644 bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java create mode 100644 bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.properties create mode 100644 bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/.classpath b/bundles/org.eclipse.e4.tools.jdt.templates/.classpath new file mode 100644 index 0000000000..64c5e31b7a --- /dev/null +++ b/bundles/org.eclipse.e4.tools.jdt.templates/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/.project b/bundles/org.eclipse.e4.tools.jdt.templates/.project new file mode 100644 index 0000000000..e0303cd31a --- /dev/null +++ b/bundles/org.eclipse.e4.tools.jdt.templates/.project @@ -0,0 +1,28 @@ + + + org.eclipse.e4.tools.jdt.templates + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..5a797383d3 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Sat Mar 06 23:33:15 EST 2010 +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/bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..1a967cb340 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: e4 Templates +Bundle-SymbolicName: org.eclipse.e4.tools.jdt.templates;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.jdt.ui;bundle-version="3.6.0", + org.eclipse.ui.editors;bundle-version="3.6.0", + org.eclipse.jface.text;bundle-version="3.6.0", + org.eclipse.jdt.core;bundle-version="3.6.0", + org.eclipse.core.runtime;bundle-version="3.6.0" +Export-Package: org.eclipse.e4.internal.tools.jdt.templates diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/build.properties b/bundles/org.eclipse.e4.tools.jdt.templates/build.properties new file mode 100644 index 0000000000..3337a4a309 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.jdt.templates/build.properties @@ -0,0 +1,7 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + templates/,\ + icons/ diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/icons/full/elcl16/e4assist_co.gif b/bundles/org.eclipse.e4.tools.jdt.templates/icons/full/elcl16/e4assist_co.gif new file mode 100644 index 0000000000000000000000000000000000000000..150a1f7ef5fc55282a3b7f82b54e36c25c4983f2 GIT binary patch literal 225 zcmZ?wbhEHb6krfwIKsf-;1N(!P|;A(&`~j=qhUeAgcTDyHgrr_(J^Digc%EFOxQ7F z#)1=ddS8mBQO2r8D#m*Y&TP5#S%b}xqtT?lr=!5*Pp86^B}JTyirN=4wpbR$th>Se z;FW^uy6A!(j!_xsZ+~c-a)Ig6``o4$i}b@BmmGU|<-bHWiq|W%wzYS(sdcL + + + + + + + + + + + + + + + + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4ContextType.java b/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4ContextType.java new file mode 100644 index 0000000000..1fdf5ff922 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4ContextType.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2007, 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation (adapted from JDT's SWTContextType) + *******************************************************************************/ +package org.eclipse.e4.internal.tools.jdt.templates; + +import org.eclipse.jdt.internal.corext.template.java.AbstractJavaContextType; +import org.eclipse.jdt.internal.corext.template.java.JavaContext; + +/** + * The context type for templates inside e4 code. + * The same class is used for several context types: + *
+ *
  • templates for all Java code locations
  • + *
  • templates for member locations
  • + *
  • templates for statement locations
  • + *
    + */ +public class E4ContextType extends AbstractJavaContextType { + + /** + * The context type id for templates working on all Java code locations in e4 projects + */ + public static final String ID_ALL= "e4"; //$NON-NLS-1$ + + /** + * The context type id for templates working on member locations in e4 projects + */ + public static final String ID_MEMBERS= "e4-members"; //$NON-NLS-1$ + + /** + * The context type id for templates working on statement locations in e4 projects + */ + public static final String ID_STATEMENTS= "e4-statements"; //$NON-NLS-1$ + + protected void initializeContext(JavaContext context) { + if (!getId().equals(E4ContextType.ID_ALL)) { // a specific context must also allow the templates that work everywhere + context.addCompatibleContextType(E4ContextType.ID_ALL); + } + } +} diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java b/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java new file mode 100644 index 0000000000..cadf6bfc7c --- /dev/null +++ b/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java @@ -0,0 +1,204 @@ +/******************************************************************************* + * Copyright (c) 2007, 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation (adapted from JDT's SWTTemplateCompletionProposalComputer) + *******************************************************************************/ +package org.eclipse.e4.internal.tools.jdt.templates; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jdt.core.CompletionContext; +import org.eclipse.jdt.core.ElementChangedEvent; +import org.eclipse.jdt.core.ICompilationUnit; +import org.eclipse.jdt.core.IElementChangedListener; +import org.eclipse.jdt.core.IJavaElementDelta; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.IType; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.internal.ui.JavaPlugin; +import org.eclipse.jdt.internal.ui.text.java.AbstractTemplateCompletionProposalComputer; +import org.eclipse.jdt.internal.ui.text.template.contentassist.TemplateEngine; +import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext; +import org.eclipse.jface.text.templates.ContextTypeRegistry; +import org.eclipse.jface.text.templates.TemplateContextType; + +/** + * Computer that computes the template proposals for the E4 context type. + * + */ +public class E4TemplateCompletionProposalComputer extends AbstractTemplateCompletionProposalComputer { + + /** + * The name of org.eclipse.e4.core.services.IDisposable used to detect + * if a project uses e4. + */ + private static final String E4_TYPE_NAME= "org.eclipse.e4.core.services.IDisposable"; //$NON-NLS-1$ + + + /** + * Listener that resets the cached java project if its build path changes. + */ + private final class BuildPathChangeListener implements IElementChangedListener { + + public void elementChanged(ElementChangedEvent event) { + IJavaProject javaProject= getCachedJavaProject(); + if (javaProject == null) + return; + + IJavaElementDelta[] children= event.getDelta().getChangedChildren(); + for (int i= 0; i < children.length; i++) { + IJavaElementDelta child= children[i]; + if (javaProject.equals(child.getElement())) { + if (isClasspathChange(child)) { + setCachedJavaProject(null); + } + } + } + } + + /** + * Does the delta indicate a classpath change? + * @param delta the delta to inspect + * @return true if classpath has changed + */ + private boolean isClasspathChange(IJavaElementDelta delta) { + int flags= delta.getFlags(); + if (isClasspathChangeFlag(flags)) + return true; + + if ((flags & IJavaElementDelta.F_CHILDREN) != 0) { + IJavaElementDelta[] children= delta.getAffectedChildren(); + for (int i= 0; i < children.length; i++) { + if (isClasspathChangeFlag(children[i].getFlags())) + return true; + } + } + + return false; + } + + /** + * Do the flags indicate a classpath change? + * @param flags the flags to inspect + * @return true if the flag flags a classpath change + */ + private boolean isClasspathChangeFlag(int flags) { + if ((flags & IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED) != 0) + return true; + + if ((flags & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0) + return true; + + if ((flags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0) + return true; + + if ((flags & IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED) != 0) + return true; + + return false; + } + } + + + /** + * Engine used to compute the proposals for this computer + */ + private final TemplateEngine fE4TemplateEngine; + private final TemplateEngine fE4MembersTemplateEngine; + private final TemplateEngine fE4StatementsTemplateEngine; + + /** + * The Java project of the compilation unit for which a template + * engine has been computed last time if any + */ + private IJavaProject fCachedJavaProject; + /** + * Is org.eclipse.e4.core.services.IDisposable on class path of fJavaProject. Invalid + * if fJavaProject is false. + */ + private boolean fIsE4OnClasspath; + + public E4TemplateCompletionProposalComputer() { + ContextTypeRegistry templateContextRegistry= JavaPlugin.getDefault().getTemplateContextRegistry(); + fE4TemplateEngine= createTemplateEngine(templateContextRegistry, E4ContextType.ID_ALL); + fE4MembersTemplateEngine= createTemplateEngine(templateContextRegistry, E4ContextType.ID_MEMBERS); + fE4StatementsTemplateEngine= createTemplateEngine(templateContextRegistry, E4ContextType.ID_STATEMENTS); + + JavaCore.addElementChangedListener(new BuildPathChangeListener()); + } + + private static TemplateEngine createTemplateEngine(ContextTypeRegistry templateContextRegistry, String contextTypeId) { + TemplateContextType contextType= templateContextRegistry.getContextType(contextTypeId); + Assert.isNotNull(contextType); + return new TemplateEngine(contextType); + } + + protected TemplateEngine computeCompletionEngine(JavaContentAssistInvocationContext context) { + ICompilationUnit unit= context.getCompilationUnit(); + if (unit == null) + return null; + + IJavaProject javaProject= unit.getJavaProject(); + if (javaProject == null) + return null; + + if (isE4OnClasspath(javaProject)) { + CompletionContext coreContext= context.getCoreContext(); + if (coreContext != null) { + int tokenLocation= coreContext.getTokenLocation(); + if ((tokenLocation & CompletionContext.TL_MEMBER_START) != 0) { + return fE4MembersTemplateEngine; + } + if ((tokenLocation & CompletionContext.TL_STATEMENT_START) != 0) { + return fE4StatementsTemplateEngine; + } + } + return fE4TemplateEngine; + } + + return null; + } + + /** + * Tells whether E4 is on the given project's class path. + * + * @param javaProject the Java project + * @return true if the given project's class path + */ + private synchronized boolean isE4OnClasspath(IJavaProject javaProject) { + if (!javaProject.equals(fCachedJavaProject)) { + fCachedJavaProject= javaProject; + try { + IType type= javaProject.findType(E4_TYPE_NAME); + fIsE4OnClasspath= type != null; + } catch (JavaModelException e) { + fIsE4OnClasspath= false; + } + } + return fIsE4OnClasspath; + } + + /** + * Returns the cached Java project. + * + * @return the cached Java project or null if none + */ + private synchronized IJavaProject getCachedJavaProject() { + return fCachedJavaProject; + } + + /** + * Set the cached Java project. + * + * @param project or null to reset the cache + */ + private synchronized void setCachedJavaProject(IJavaProject project) { + fCachedJavaProject= project; + } + +} diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.properties b/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml b/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml new file mode 100644 index 0000000000..33dd080869 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 0ebc285e2d2075883c62bd490f4b9d3b13c29691 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 8 Mar 2010 23:26:59 +0000 Subject: [PATCH 0010/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * some more editors started to implement --- .../component/AbstractComponentEditor.java | 19 +- .../emf/ui/internal/common/ModelEditor.java | 2 +- .../common/component/ApplicationEditor.java | 15 +- .../common/component/CommandEditor.java | 175 +++++++++++-- .../common/component/ControlFactory.java | 126 ++++++++++ .../component/DirectToolItemEditor.java | 4 +- .../component/HandledToolItemEditor.java | 4 +- .../common/component/HandlerEditor.java | 82 +++++- .../common/component/KeyBindingEditor.java | 238 +++++++++++++++++- .../component/ModelComponentEditor.java | 18 +- .../component/ModelComponentsEditor.java | 10 +- .../component/PartDescriptorEditor.java | 4 +- .../internal/common/component/PartEditor.java | 31 +-- .../component/PartSashContainerEditor.java | 60 ++++- .../common/component/PartStackEditor.java | 13 +- .../common/component/ToolBarEditor.java | 13 +- .../common/component/ToolItemEditor.java | 129 +--------- .../common/component/WindowEditor.java | 85 ++++++- .../common/component/WindowTrimEditor.java | 13 +- 19 files changed, 791 insertions(+), 250 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index d96d4bff5e..532731877c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -17,6 +17,7 @@ import java.util.Map; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.runtime.FileLocator; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.graphics.Image; @@ -35,11 +36,13 @@ public abstract class AbstractComponentEditor { "/icons/full/obj16/arrow_down.png", }; - protected static final int SEARCH_IMAGE = 0; - protected static final int TABLE_ADD_IMAGE = 1; - protected static final int TABLE_DELETE_IMAGE = 2; - protected static final int ARROW_UP = 3; - protected static final int ARROW_DOWN = 4; + private WritableValue master = new WritableValue(); + + public static final int SEARCH_IMAGE = 0; + public static final int TABLE_ADD_IMAGE = 1; + public static final int TABLE_DELETE_IMAGE = 2; + public static final int ARROW_UP = 3; + public static final int ARROW_DOWN = 4; public AbstractComponentEditor(EditingDomain editingDomain) { this.editingDomain = editingDomain; @@ -49,7 +52,11 @@ public EditingDomain getEditingDomain() { return editingDomain; } - protected Image getImage( Display d, int id) { + public WritableValue getMaster() { + return master; + } + + public Image getImage( Display d, int id) { Image img = IMAGE_MAP.get(id); if( img == null ) { try { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 011f7c0a4e..50a8dc1286 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -144,7 +144,7 @@ private TreeViewer createTreeViewerArea(Composite parent) { parent.setLayout(l); ShadowComposite editingArea = new ShadowComposite(parent,SWT.NONE); editingArea.setLayout(new FillLayout()); - TreeViewer viewer = new TreeViewer(editingArea); + TreeViewer viewer = new TreeViewer(editingArea,SWT.FULL_SELECTION|SWT.H_SCROLL|SWT.V_SCROLL); viewer.setLabelProvider(new ComponentLabelProvider(this)); ObservableListTreeContentProvider contentProvider = new ObservableListTreeContentProvider( new ObservableFactoryImpl(), new TreeStructureAdvisorImpl()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index a3d9c923c5..e39b37fb57 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -13,16 +13,14 @@ import java.net.MalformedURLException; import java.net.URL; -import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.SWT; @@ -33,9 +31,8 @@ public class ApplicationEditor extends AbstractComponentEditor { private Composite composite; - private WritableValue master = new WritableValue(); private Image image; - private DataBindingContext context; + private EMFDataBindingContext context; private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); @@ -74,14 +71,14 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { if( composite == null ) { - context = new DataBindingContext(); - composite = createForm(parent,context, master); + context = new EMFDataBindingContext(); + composite = createForm(parent,context); } - master.setValue(object); + getMaster().setValue(object); return composite; } - protected Composite createForm(Composite parent, DataBindingContext context, IObservableValue master) { + protected Composite createForm(Composite parent, EMFDataBindingContext context) { parent = new Composite(parent,SWT.NONE); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 0d4413e6f9..6ec4b7c24c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -13,31 +13,42 @@ import java.net.MalformedURLException; import java.net.URL; -import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MCommand; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class CommandEditor extends AbstractComponentEditor { private Composite composite; - private WritableValue master = new WritableValue(); private Image image; - private DataBindingContext context; + private EMFDataBindingContext context; public CommandEditor(EditingDomain editingDomain) { super(editingDomain); - // TODO Auto-generated constructor stub } @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Command.gif")); } catch (MalformedURLException e) { @@ -61,17 +72,149 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { - context = new DataBindingContext(); - composite = createForm(parent,context, master); + if (composite == null) { + context = new EMFDataBindingContext(); + composite = createForm(parent, context); } - master.setValue(object); + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, DataBindingContext context2, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); + private Composite createForm(Composite parent, EMFDataBindingContext context) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IValueProperty textProp = WidgetProperties.text(); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Name"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND__COMMAND_NAME).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Description"); + l.setLayoutData(new GridData(GridData.BEGINNING,GridData.BEGINNING,false,false)); + + Text t = new Text(parent, SWT.BORDER|SWT.H_SCROLL|SWT.V_SCROLL); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + gd.heightHint=100; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND__DESCRIPTION).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Parameters"); + l.setLayoutData(new GridData(GridData.BEGINNING,GridData.BEGINNING,false,false)); + + TableViewer viewer = new TableViewer(parent,SWT.FULL_SELECTION|SWT.MULTI|SWT.BORDER); + viewer.getTable().setHeaderVisible(true); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 120; + viewer.getControl().setLayoutData(gd); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Name"); + column.getColumn().setWidth(200); + + column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Type-Id"); + column.getColumn().setWidth(200); + + column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Optional"); + column.getColumn().setWidth(200); + + IEMFEditListProperty mProp = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.COMMAND__PARAMETERS); + IValueProperty[] props = { + EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND_PARAMETER__NAME), + EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND_PARAMETER__TYPE_ID), + EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND_PARAMETER__OPTIONAL) + }; + + ViewerSupport.bind(viewer, mProp.observeDetail(getMaster()), props); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); +// b.addSelectionListener(new SelectionAdapter() { +// @Override +// public void widgetSelected(SelectionEvent e) { +// MHandledItem item = (MHandledItem) master.getValue(); +// MParameter param = MApplicationFactory.eINSTANCE.createParameter(); +// Command cmd = AddCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS, param); +// if( cmd.canExecute() ) { +// getEditingDomain().getCommandStack().execute(cmd); +// } +// tableviewer.editElement(param, 0); +// } +// }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); +// b.addSelectionListener(new SelectionAdapter() { +// +// public void widgetSelected(SelectionEvent e) { +// IStructuredSelection s = (IStructuredSelection) tableviewer.getSelection(); +// if( !s.isEmpty() ) { +// MHandledItem item = (MHandledItem) master.getValue(); +// Command cmd = RemoveCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS, s.toList()); +// if( cmd.canExecute() ) { +// getEditingDomain().getCommandStack().execute(cmd); +// } +// } +// } +// +// }); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + } + + ControlFactory.createTagsWidget(parent, this); + return parent; } @@ -83,7 +226,11 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { - // TODO Auto-generated method stub + MCommand cmd = (MCommand) element; + if (cmd.getCommandName() != null && cmd.getCommandName().trim().length() > 0) { + return cmd.getCommandName(); + } + return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java new file mode 100644 index 0000000000..3c42321410 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -0,0 +1,126 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import java.util.Arrays; + +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.MApplicationElement; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class ControlFactory { + public static void createTagsWidget( Composite parent, final AbstractComponentEditor editor ) { + Label l = new Label(parent, SWT.NONE); + l.setText("Tags"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + + final Text tagText = new Text(parent, SWT.BORDER); + tagText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + tagText.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { + handleAddText(editor, tagText); + } + } + }); + + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText("Add"); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + handleAddText(editor, tagText); + } + }); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + + l = new Label(parent, SWT.NONE); + final TableViewer viewer = new TableViewer(parent); + viewer.setContentProvider(new ObservableListContentProvider()); + viewer.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + return element.toString(); + } + }); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 120; + viewer.getControl().setLayoutData(gd); + + IEMFEditListProperty prop = EMFEditProperties.list(editor.getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__TAGS); + viewer.setInput(prop.observeDetail(editor.getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if( ! s.isEmpty() ) { + MApplicationElement appEl = (MApplicationElement) editor.getMaster().getValue(); + Command cmd = RemoveCommand.create(editor.getEditingDomain(), appEl, MApplicationPackage.Literals.APPLICATION_ELEMENT__TAGS, s.toList()); + if( cmd.canExecute() ) { + editor.getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + private static void handleAddText( AbstractComponentEditor editor, Text tagText) { + if (tagText.getText().trim().length() > 0) { + String[] tags = tagText.getText().split(";"); + for( int i = 0; i < tags.length;i++ ) { + tags[i] = tags[i].trim(); + } + + MApplicationElement appEl = (MApplicationElement) editor.getMaster().getValue(); + Command cmd = AddCommand.create(editor.getEditingDomain(), appEl, MApplicationPackage.Literals.APPLICATION_ELEMENT__TAGS, Arrays.asList(tags)); + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + } + tagText.setText(""); + } + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index 0851af1f53..89765f6ddd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -13,10 +13,10 @@ import java.net.MalformedURLException; import java.net.URL; -import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -52,7 +52,7 @@ public Image getImage(Object element, Display display) { @Override - protected void createSubTypeFormElements(Composite parent, DataBindingContext context, WritableValue master) { + protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, WritableValue master) { IValueProperty textProp = WidgetProperties.text(); Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index 535e52bca9..5b4ed386d4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -13,7 +13,6 @@ import java.net.MalformedURLException; import java.net.URL; -import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.ui.model.application.MApplicationFactory; @@ -21,6 +20,7 @@ import org.eclipse.e4.ui.model.application.MHandledItem; import org.eclipse.e4.ui.model.application.MParameter; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; @@ -74,7 +74,7 @@ public Image getImage(Object element, Display display) { } @Override - protected void createSubTypeFormElements(Composite parent, DataBindingContext context, final WritableValue master) { + protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, final WritableValue master) { IValueProperty textProp = WidgetProperties.text(); Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 77a46f65b9..7208902935 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -13,25 +13,33 @@ import java.net.MalformedURLException; import java.net.URL; -import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MHandler; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class HandlerEditor extends AbstractComponentEditor { private Composite composite; - private WritableValue master = new WritableValue(); private Image image; - private DataBindingContext context; + private EMFDataBindingContext context; public HandlerEditor(EditingDomain editingDomain) { super(editingDomain); - // TODO Auto-generated constructor stub } @@ -61,16 +69,64 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { if( composite == null ) { - context = new DataBindingContext(); - composite = createForm(parent,context, master); + context = new EMFDataBindingContext(); + composite = createForm(parent,context); } - master.setValue(object); + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, DataBindingContext context2, - WritableValue master) { + private Composite createForm(Composite parent, EMFDataBindingContext context) { parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IValueProperty textProp = WidgetProperties.text(); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Command"); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + t.setEnabled(false); + context.bindValue(textProp.observe(t), EMFEditProperties.value( getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLER__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(getMaster())); + + Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setText("Find ..."); + b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Class URI"); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(getMaster())); + + Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setText("Find ..."); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + } + + ControlFactory.createTagsWidget(parent, this); + return parent; } @@ -82,7 +138,11 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { - // TODO Auto-generated method stub + MHandler handler = (MHandler) element; + if( handler.getCommand() != null && handler.getCommand().getCommandName() != null && handler.getCommand().getCommandName().trim().length() > 0 ) { + return handler.getCommand().getCommandName(); + } + return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 2b64686b18..cbc94d2e08 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -13,22 +13,52 @@ import java.net.MalformedURLException; import java.net.URL; -import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MKeyBinding; +import org.eclipse.e4.ui.model.application.MKeySequence; +import org.eclipse.e4.ui.model.application.MParameter; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.ColumnViewerEditor; +import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; +import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.viewers.TableViewerEditor; +import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class KeyBindingEditor extends AbstractComponentEditor { private Composite composite; - private WritableValue master = new WritableValue(); private Image image; - private DataBindingContext context; + private EMFDataBindingContext context; public KeyBindingEditor(EditingDomain editingDomain) { super(editingDomain); @@ -62,16 +92,201 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { if( composite == null ) { - context = new DataBindingContext(); - composite = createForm(parent,context, master); + context = new EMFDataBindingContext(); + composite = createForm(parent,context); } - master.setValue(object); + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, DataBindingContext context2, - WritableValue master) { + private Composite createForm(Composite parent, EMFDataBindingContext context) { parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IValueProperty textProp = WidgetProperties.text(); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Sequence"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.KEY_SEQUENCE__KEY_SEQUENCE).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Command"); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + t.setEnabled(false); + context.bindValue(textProp.observe(t), EMFEditProperties.value( getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.KEY_BINDING__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(getMaster())); + + Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setText("Find ..."); + b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + } + + Label l = new Label(parent, SWT.NONE); + l.setText("Parameters"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + + final TableViewer tableviewer = new TableViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 120; + tableviewer.getTable().setHeaderVisible(true); + tableviewer.getControl().setLayoutData(gd); + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.KEY_BINDING__PARAMETERS); + + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Tag"); + column.getColumn().setWidth(200); + column.setEditingSupport(new EditingSupport(tableviewer) { + private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); + + @Override + protected void setValue(Object element, Object value) { + ((MParameter)element).setTag((String) value); + } + + @Override + protected Object getValue(Object element) { + String val = ((MParameter)element).getTag(); + return val == null ? "" : val; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return cellEditor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + + column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Value"); + column.getColumn().setWidth(200); + column.setEditingSupport(new EditingSupport(tableviewer) { + private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); + + @Override + protected void setValue(Object element, Object value) { + ((MParameter)element).setValue((String) value); + } + + @Override + protected Object getValue(Object element) { + String val = ((MParameter)element).getValue(); + return val == null ? "" : val; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return cellEditor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + + ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(tableviewer) { + @Override + protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { + boolean singleSelect = ((IStructuredSelection)tableviewer.getSelection()).size() == 1; + boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent)event.sourceEvent).button == 1; + + return singleSelect && (isLeftDoubleMouseSelect + || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC + || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); + } + }; + TableViewerEditor.create(tableviewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); + + ViewerSupport.bind(tableviewer, prop.observeDetail(getMaster()), new IValueProperty[] { + EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__TAG), + EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__VALUE) + }); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MKeyBinding item = (MKeyBinding) getMaster().getValue(); + MParameter param = MApplicationFactory.eINSTANCE.createParameter(); + Command cmd = AddCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.KEY_BINDING__PARAMETERS, param); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + tableviewer.editElement(param, 0); + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent e) { + IStructuredSelection s = (IStructuredSelection) tableviewer.getSelection(); + if( !s.isEmpty() ) { + MKeyBinding item = (MKeyBinding) getMaster().getValue(); + Command cmd = RemoveCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.KEY_BINDING__PARAMETERS, s.toList()); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + + }); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + ControlFactory.createTagsWidget(parent, this); + return parent; } @@ -83,7 +298,10 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { - // TODO Auto-generated method stub + MKeySequence seq = (MKeySequence) element; + if( seq.getKeySequence() != null && seq.getKeySequence().trim().length() > 0 ) { + return seq.getKeySequence(); + } return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index 4953469824..7e0465fbd0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -10,10 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -23,6 +21,7 @@ import org.eclipse.e4.ui.model.application.MMenu; import org.eclipse.e4.ui.model.application.MModelComponent; import org.eclipse.e4.ui.model.application.MPart; +import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; @@ -41,9 +40,8 @@ public class ModelComponentEditor extends AbstractComponentEditor { private Composite composite; - private WritableValue master = new WritableValue(); private Image image; - private DataBindingContext context; + private EMFDataBindingContext context; private IListProperty MODEL_COMPONENT__CHILDREN = EMFProperties.list( MApplicationPackage.Literals.MODEL_COMPONENT__CHILDREN); @@ -55,10 +53,10 @@ public ModelComponentEditor(EditingDomain editingDomain) { @Override public Composite getEditor(Composite parent, Object object) { if( composite == null ) { - context = new DataBindingContext(); + context = new EMFDataBindingContext(); composite = createForm(parent); } - master.setValue(object); + getMaster().setValue(object); return composite; } @@ -92,7 +90,7 @@ private Composite createForm(Composite parent) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); // ------------------------------------------------------------ @@ -119,7 +117,7 @@ private Composite createForm(Composite parent) { t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__PARENT_ID).observeDetail(master)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__PARENT_ID).observeDetail(getMaster())); Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setText("Find ..."); @@ -133,7 +131,7 @@ private Composite createForm(Composite parent) { gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__POSITION_IN_PARENT).observeDetail(master)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__POSITION_IN_PARENT).observeDetail(getMaster())); // ------------------------------------------------------------ @@ -144,7 +142,7 @@ private Composite createForm(Composite parent) { gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__PROCESSOR).observeDetail(master)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__PROCESSOR).observeDetail(getMaster())); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java index a8292c952f..9bd3ca841f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java @@ -10,12 +10,11 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.SWT; @@ -28,9 +27,8 @@ public class ModelComponentsEditor extends AbstractComponentEditor { private IListProperty MODEL_COMPONENTS__COMPONENTS = EMFProperties.list(MApplicationPackage.Literals.MODEL_COMPONENTS__COMPONENTS); private Composite composite; - private WritableValue master = new WritableValue(); private Image image; - private DataBindingContext context; + private EMFDataBindingContext context; public ModelComponentsEditor(EditingDomain editingDomain) { super(editingDomain); @@ -58,10 +56,10 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { if( composite == null ) { - context = new DataBindingContext(); + context = new EMFDataBindingContext(); composite = createForm(parent); } - master.setValue(object); + getMaster().setValue(object); return composite; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 00c1fd8213..16f14ce95b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -10,10 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -30,7 +30,7 @@ public PartDescriptorEditor(EditingDomain editingDomain) { } @Override - protected Composite createForm(Composite parent, DataBindingContext context, IObservableValue master) { + protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master) { Composite comp = super.createForm(parent,context,master); IValueProperty textProp = WidgetProperties.text(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 48a7d5c836..8b3af6a580 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -13,11 +13,9 @@ import java.net.MalformedURLException; import java.net.URL; -import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -25,6 +23,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MPart; +import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; @@ -45,9 +44,8 @@ public class PartEditor extends AbstractComponentEditor { private Composite composite; - private WritableValue master = new WritableValue(); private Image image; - private DataBindingContext context; + private EMFDataBindingContext context; private IListProperty PART__MENUS = EMFProperties.list(MApplicationPackage.Literals.PART__MENUS); private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); @@ -55,7 +53,6 @@ public class PartEditor extends AbstractComponentEditor { public PartEditor(EditingDomain editingDomain) { super(editingDomain); - // TODO Auto-generated constructor stub } @Override @@ -85,14 +82,14 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { if( composite == null ) { - context = new DataBindingContext(); - composite = createForm(parent,context, master); + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); } - master.setValue(object); + getMaster().setValue(object); return composite; } - protected Composite createForm(Composite parent, DataBindingContext context, IObservableValue master) { + protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master) { parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); @@ -155,23 +152,11 @@ protected Composite createForm(Composite parent, DataBindingContext context, IOb // ------------------------------------------------------------ - l = new Label(parent, SWT.NONE); - l.setText("Tags"); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); - - ListViewer viewer = new ListViewer(parent); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - gd.heightHint = 80; - viewer.getList().setLayoutData(gd); - - // ------------------------------------------------------------ - l = new Label(parent, SWT.NONE); l.setText("Variables"); l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); - viewer = new ListViewer(parent); + ListViewer viewer = new ListViewer(parent); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; gd.heightHint = 80; @@ -198,6 +183,8 @@ protected Composite createForm(Composite parent, DataBindingContext context, IOb column.getColumn().setText("Value"); column.getColumn().setWidth(200); + ControlFactory.createTagsWidget(parent, this); + // // ------------------------------------------------------------ // // l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index be11560eae..3a2f63df7c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -13,27 +13,38 @@ import java.net.MalformedURLException; import java.net.URL; -import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MPartSashContainer; +import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.IViewerValueProperty; +import org.eclipse.jface.databinding.viewers.ViewerProperties; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class PartSashContainerEditor extends AbstractComponentEditor { private Composite composite; - private WritableValue master = new WritableValue(); private Image vImage; private Image hImage; - private DataBindingContext context; + private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); @@ -84,16 +95,51 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { if( composite == null ) { - context = new DataBindingContext(); - composite = createForm(parent,context, master); + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); } - master.setValue(object); + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, DataBindingContext context2, + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IValueProperty textProp = WidgetProperties.text(); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Orientation"); + + ComboViewer viewer = new ComboViewer(parent); + viewer.setContentProvider(new ArrayContentProvider()); + viewer.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + return ((Boolean)element).booleanValue() ? "Horizontal" : "Vertical"; + } + }); + viewer.setInput(new Boolean[] { Boolean.TRUE, Boolean.FALSE }); + IViewerValueProperty vProp = ViewerProperties.singleSelection(); + context.bindValue(vProp.observe(viewer), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.GENERIC_TILE__HORIZONTAL).observeDetail(getMaster())); + } + + return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index f350b0c743..23493d0533 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -13,12 +13,12 @@ import java.net.MalformedURLException; import java.net.URL; -import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.SWT; @@ -29,9 +29,8 @@ public class PartStackEditor extends AbstractComponentEditor { private Composite composite; - private WritableValue master = new WritableValue(); private Image image; - private DataBindingContext context; + private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); @@ -67,14 +66,14 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { if( composite == null ) { - context = new DataBindingContext(); - composite = createForm(parent,context, master); + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); } - master.setValue(object); + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, DataBindingContext context2, + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { parent = new Composite(parent,SWT.NONE); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index e13175ed2f..bdddc0c9f2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -13,12 +13,12 @@ import java.net.MalformedURLException; import java.net.URL; -import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.SWT; @@ -29,9 +29,8 @@ public class ToolBarEditor extends AbstractComponentEditor { private Composite composite; - private WritableValue master = new WritableValue(); private Image image; - private DataBindingContext context; + private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); @@ -66,14 +65,14 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { if( composite == null ) { - context = new DataBindingContext(); - composite = createForm(parent,context, master); + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); } - master.setValue(object); + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, DataBindingContext context2, + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { parent = new Composite(parent,SWT.NONE); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index f7e4a38479..d2995869ff 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -12,37 +12,23 @@ import java.net.MalformedURLException; import java.net.URL; -import java.util.Arrays; -import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.ItemType; -import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MToolItem; -import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.databinding.viewers.ViewerProperties; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -54,9 +40,8 @@ public class ToolItemEditor extends AbstractComponentEditor { private Composite composite; - private WritableValue master = new WritableValue(); private Image image; - private DataBindingContext context; + private EMFDataBindingContext context; public ToolItemEditor(EditingDomain editingDomain) { super(editingDomain); @@ -89,14 +74,14 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { if (composite == null) { - context = new DataBindingContext(); - composite = createForm(parent, context, master); + context = new EMFDataBindingContext(); + composite = createForm(parent, context, getMaster()); } - master.setValue(object); + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, DataBindingContext context, WritableValue master) { + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); @@ -118,7 +103,7 @@ private Composite createForm(Composite parent, DataBindingContext context, Writa return parent; } - private void createFormSubTypeForm(Composite parent, DataBindingContext context, final WritableValue master) { + private void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, final WritableValue master) { IValueProperty textProp = WidgetProperties.text(); // ------------------------------------------------------------ @@ -179,106 +164,10 @@ private void createFormSubTypeForm(Composite parent, DataBindingContext context, createSubTypeFormElements(parent, context, master); - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Tags"); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); - - final Text tagText = new Text(parent, SWT.BORDER); - tagText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - tagText.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { - handleAddText(tagText); - } - } - }); - - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText("Add"); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleAddText(tagText); - } - }); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - - l = new Label(parent, SWT.NONE); - final TableViewer viewer = new TableViewer(parent); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - return element.toString(); - } - }); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 120; - viewer.getControl().setLayoutData(gd); - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__TAGS); - viewer.setInput(prop.observeDetail(master)); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if( ! s.isEmpty() ) { - MApplicationElement appEl = (MApplicationElement) master.getValue(); - Command cmd = RemoveCommand.create(getEditingDomain(), appEl, MApplicationPackage.Literals.APPLICATION_ELEMENT__TAGS, s.toList()); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - } - - private void handleAddText(Text tagText) { - if (tagText.getText().trim().length() > 0) { - String[] tags = tagText.getText().split(";"); - for( int i = 0; i < tags.length;i++ ) { - tags[i] = tags[i].trim(); - } - - MApplicationElement appEl = (MApplicationElement) master.getValue(); - Command cmd = AddCommand.create(getEditingDomain(), appEl, MApplicationPackage.Literals.APPLICATION_ELEMENT__TAGS, Arrays.asList(tags)); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - tagText.setText(""); - } + ControlFactory.createTagsWidget(parent, this); } - protected void createSubTypeFormElements(Composite parent, DataBindingContext context, WritableValue master) { + protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, WritableValue master) { } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 35b5690f5c..148070e7c6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -13,29 +13,35 @@ import java.net.MalformedURLException; import java.net.URL; -import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MWindow; +import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class WindowEditor extends AbstractComponentEditor { private Composite composite; - private WritableValue master = new WritableValue(); private Image image; - private DataBindingContext context; + private EMFDataBindingContext context; private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); @@ -73,16 +79,81 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { if( composite == null ) { - context = new DataBindingContext(); - composite = createForm(parent,context, master); + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); } - master.setValue(object); + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, DataBindingContext context2, + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IValueProperty textProp = WidgetProperties.text(); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("X"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__X).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Y"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__Y).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Width"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__WIDTH).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Height"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__HEIGHT).observeDetail(getMaster())); + } + + return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java index cc08c9d605..6325f8ee8e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java @@ -13,12 +13,12 @@ import java.net.MalformedURLException; import java.net.URL; -import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.SWT; @@ -29,9 +29,8 @@ public class WindowTrimEditor extends AbstractComponentEditor { private Composite composite; - private WritableValue master = new WritableValue(); private Image image; - private DataBindingContext context; + private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); @@ -67,14 +66,14 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { if( composite == null ) { - context = new DataBindingContext(); - composite = createForm(parent,context, master); + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); } - master.setValue(object); + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, DataBindingContext context2, + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { parent = new Composite(parent,SWT.NONE); return parent; From dc69b99aa839f98921316352ffb8c41673fef364 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 9 Mar 2010 00:19:01 +0000 Subject: [PATCH 0011/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixed container element editing --- .../component/PartSashContainerEditor.java | 49 ++++++++++++- .../common/component/PartStackEditor.java | 73 ++++++++++++++++++- .../common/component/WindowEditor.java | 1 + 3 files changed, 121 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 3a2f63df7c..95c1e23bf7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -13,7 +13,11 @@ import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.databinding.property.value.IValueProperty; @@ -23,10 +27,13 @@ import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; import org.eclipse.jface.databinding.viewers.ViewerProperties; +import org.eclipse.jface.databinding.viewers.ViewerSupport; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.LabelProvider; @@ -102,7 +109,7 @@ public Composite getEditor(Composite parent, Object object) { return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, + private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master) { parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); @@ -127,6 +134,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, l.setText("Orientation"); ComboViewer viewer = new ComboViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + viewer.getControl().setLayoutData(gd); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(new LabelProvider() { @Override @@ -139,6 +149,43 @@ public String getText(Object element) { context.bindValue(vProp.observe(viewer), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.GENERIC_TILE__HORIZONTAL).observeDetail(getMaster())); } + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Selected Element"); + + ComboViewer viewer = new ComboViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + viewer.getControl().setLayoutData(gd); + IEMFEditListProperty listProp = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); + IViewerValueProperty vProp = ViewerProperties.singleSelection(); + + final Binding[] binding = new Binding[1]; + final IObservableValue uiObs = vProp.observe(viewer); + final IObservableValue mObs = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(getMaster()); + getMaster().addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + if( binding[0] != null ) { + binding[0].dispose(); + } + + } + }); + + ViewerSupport.bind(viewer, listProp.observeDetail(getMaster()), valProp); + + getMaster().addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + binding[0] = context.bindValue(uiObs, mObs); + } + }); + } + + ControlFactory.createTagsWidget(parent, this); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 23493d0533..d6f387ea34 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -13,18 +13,35 @@ import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.IViewerValueProperty; +import org.eclipse.jface.databinding.viewers.ViewerProperties; +import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class PartStackEditor extends AbstractComponentEditor { @@ -73,9 +90,63 @@ public Composite getEditor(Composite parent, Object object) { return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, + private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master) { parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IValueProperty textProp = WidgetProperties.text(); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Selected Element"); + + ComboViewer viewer = new ComboViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + viewer.getControl().setLayoutData(gd); + IEMFEditListProperty listProp = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL); + IViewerValueProperty vProp = ViewerProperties.singleSelection(); + + final Binding[] binding = new Binding[1]; + final IObservableValue uiObs = vProp.observe(viewer); + final IObservableValue mObs = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(getMaster()); + getMaster().addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + if( binding[0] != null ) { + binding[0].dispose(); + } + + } + }); + + ViewerSupport.bind(viewer, listProp.observeDetail(getMaster()), valProp); + + getMaster().addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + binding[0] = context.bindValue(uiObs, mObs); + } + }); + } + + ControlFactory.createTagsWidget(parent, this); + return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 148070e7c6..dc67162560 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -153,6 +153,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__HEIGHT).observeDetail(getMaster())); } + ControlFactory.createTagsWidget(parent, this); return parent; } From 94257a4f71e8dc55d6c07e0bbb31efe6aa8743ce Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 9 Mar 2010 00:52:45 +0000 Subject: [PATCH 0012/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * some more editors --- .../emf/ui/internal/common/ModelEditor.java | 6 + .../common/component/PartStackEditor.java | 3 +- .../common/component/PerspectiveEditor.java | 194 ++++++++++++++++++ .../component/PerspectiveStackEditor.java | 161 +++++++++++++++ .../common/component/PlaceholderEditor.java | 108 ++++++++++ 5 files changed, 470 insertions(+), 2 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 50a8dc1286..10c188e9a8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -33,6 +33,9 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.PartEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PartSashContainerEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PartStackEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.PerspectiveEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.PerspectiveStackEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.PlaceholderEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolItemEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowEditor; @@ -172,6 +175,9 @@ private void registerDefaultEditors() { registerEditor( MApplicationPackage.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain())); registerEditor( MApplicationPackage.Literals.HANDLED_TOOL_ITEM, new HandledToolItemEditor(modelProvider.getEditingDomain())); registerEditor( MApplicationPackage.Literals.TOOL_ITEM, new ToolItemEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.PERSPECTIVE_STACK, new PerspectiveStackEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.PERSPECTIVE, new PerspectiveEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.PLACEHOLDER, new PlaceholderEditor(modelProvider.getEditingDomain())); } public void registerEditor(EClass eClass, AbstractComponentEditor editor) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index d6f387ea34..2b871867c7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -53,7 +53,6 @@ public class PartStackEditor extends AbstractComponentEditor { public PartStackEditor(EditingDomain editingDomain) { super(editingDomain); - // TODO Auto-generated constructor stub } @Override @@ -72,7 +71,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Stack"; + return "Part Stack"; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java new file mode 100644 index 0000000000..ed74687e2e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -0,0 +1,194 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.core.databinding.Binding; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MPerspective; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.IViewerValueProperty; +import org.eclipse.jface.databinding.viewers.ViewerProperties; +import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class PerspectiveEditor extends AbstractComponentEditor { + private Composite composite; + private Image image; + private EMFDataBindingContext context; + + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + + public PerspectiveEditor(EditingDomain editingDomain) { + super(editingDomain); + } + + @Override + public Image getImage(Object element, Display display) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Perspective.gif")); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "Perspective"; + } + + @Override + public String getDetailLabel(Object element) { + MPerspective perspective = (MPerspective) element; + if (perspective.getLabel() != null && perspective.getLabel().trim().length() > 0) { + return perspective.getLabel(); + } + + return null; + } + + @Override + public String getDescription(Object element) { + return "Perspective Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + composite = createForm(parent, context, getMaster()); + } + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IValueProperty textProp = WidgetProperties.text(); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Selected Element"); + + ComboViewer viewer = new ComboViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + viewer.getControl().setLayoutData(gd); + IEMFEditListProperty listProp = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); + IViewerValueProperty vProp = ViewerProperties.singleSelection(); + + final Binding[] binding = new Binding[1]; + final IObservableValue uiObs = vProp.observe(viewer); + final IObservableValue mObs = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(getMaster()); + getMaster().addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + if (binding[0] != null) { + binding[0].dispose(); + } + + } + }); + + ViewerSupport.bind(viewer, listProp.observeDetail(getMaster()), valProp); + + getMaster().addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + binding[0] = context.bindValue(uiObs, mObs); + } + }); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Label"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Tooltip"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Icon URI"); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText("Find ..."); + } + + ControlFactory.createTagsWidget(parent, this); + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return ELEMENT_CONTAINER__CHILDREN.observe(element); + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java new file mode 100644 index 0000000000..a8b4f8e68d --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -0,0 +1,161 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.core.databinding.Binding; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.IViewerValueProperty; +import org.eclipse.jface.databinding.viewers.ViewerProperties; +import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class PerspectiveStackEditor extends AbstractComponentEditor { + private Composite composite; + private Image image; + private EMFDataBindingContext context; + + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + + public PerspectiveStackEditor(EditingDomain editingDomain) { + super(editingDomain); + } + + @Override + public Image getImage(Object element, Display display) { + if( image == null ) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/PerspectiveStack.gif")); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "Perspective Stack"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Perspective Stack Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, final EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IValueProperty textProp = WidgetProperties.text(); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Selected Element"); + + ComboViewer viewer = new ComboViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + viewer.getControl().setLayoutData(gd); + IEMFEditListProperty listProp = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL); + IViewerValueProperty vProp = ViewerProperties.singleSelection(); + + final Binding[] binding = new Binding[1]; + final IObservableValue uiObs = vProp.observe(viewer); + final IObservableValue mObs = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(getMaster()); + getMaster().addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + if( binding[0] != null ) { + binding[0].dispose(); + } + + } + }); + + ViewerSupport.bind(viewer, listProp.observeDetail(getMaster()), valProp); + + getMaster().addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + binding[0] = context.bindValue(uiObs, mObs); + } + }); + } + + ControlFactory.createTagsWidget(parent, this); + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return ELEMENT_CONTAINER__CHILDREN.observe(element); + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java new file mode 100644 index 0000000000..fb95fa6d44 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -0,0 +1,108 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class PlaceholderEditor extends AbstractComponentEditor { + private Composite composite; + private Image image; + private EMFDataBindingContext context; + + public PlaceholderEditor(EditingDomain editingDomain) { + super(editingDomain); + } + + @Override + public Image getImage(Object element, Display display) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Placeholder.gif")); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "Placeholder"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Placeholder Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + composite = createForm(parent, context, getMaster()); + } + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IValueProperty textProp = WidgetProperties.text(); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + } + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return null; + } + +} From 33887567669014d838a5a8aa0ae7c66fc6d8fa01 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 9 Mar 2010 16:44:30 +0000 Subject: [PATCH 0013/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixing editor ids --- .../common/ComponentLabelProvider.java | 6 - .../emf/ui/internal/common/ModelEditor.java | 39 +++++- .../common/component/CommandEditor.java | 26 ---- .../common/component/PlaceholderEditor.java | 28 ++++ .../common/component/WindowEditor.java | 48 ++++++- .../component/virtual/VHandlerEditor.java | 129 ++++++++++++++++++ 6 files changed, 234 insertions(+), 42 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java index 5d898c46c7..b5633d98f2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java @@ -66,12 +66,6 @@ public void applyStyles(TextStyle textStyle) { } else if( cell.getElement() instanceof VirtualEntry ) { String s = cell.getElement().toString(); cell.setText(s); - if( "Parts".equals(s) ) { - if( partsImage == null ) { - partsImage = new Image(cell.getControl().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/application_double.png")); - } - cell.setImage(partsImage); - } } else { cell.setText(cell.getElement()+""); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 10c188e9a8..2321f95a7e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -40,6 +40,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolItemEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowTrimEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; @@ -59,14 +60,16 @@ import org.eclipse.swt.widgets.Label; public class ModelEditor { - public static final int VIRTUAL_MENU = 1; - public static final int VIRTUAL_PART = 2; - public static final int VIRTUAL_HANDLER = 3; - public static final int VIRTUAL_BINDING = 4; - public static final int VIRTUAL_COMMAND = 5; - public static final int VIRTUAL_WINDOWS = 6; + public static final int VIRTUAL_MENU = 0; + public static final int VIRTUAL_PART = 1; + public static final int VIRTUAL_HANDLER = 2; + public static final int VIRTUAL_BINDING = 3; + public static final int VIRTUAL_COMMAND = 4; + public static final int VIRTUAL_WINDOWS = 5; private Map editorMap = new HashMap(); + private AbstractComponentEditor[] virtualEditors; + // private List editors = new ArrayList(); private TreeViewer viewer; @@ -76,6 +79,7 @@ public class ModelEditor { public ModelEditor(Composite composite, IModelResource modelProvider) { this.modelProvider = modelProvider; registerDefaultEditors(); + registerVirtualEditors(); SashForm form = new SashForm(composite, SWT.HORIZONTAL); form.setBackground(form.getDisplay().getSystemColor(SWT.COLOR_WHITE)); @@ -131,6 +135,17 @@ public void selectionChanged(SelectionChangedEvent event) { layout.topControl = comp; contentContainer.layout(true); } + } else { + VirtualEntry entry = (VirtualEntry) s.getFirstElement(); + AbstractComponentEditor editor = virtualEditors[entry.getId()]; + if( editor != null ) { + textLabel.setText(editor.getLabel(entry)); + iconLabel.setImage(editor.getImage(entry, iconLabel.getDisplay())); + Composite comp = editor.getEditor(contentContainer, s.getFirstElement()); + comp.setBackgroundMode(SWT.INHERIT_DEFAULT); + layout.topControl = comp; + contentContainer.layout(true); + } } } } @@ -158,6 +173,18 @@ private TreeViewer createTreeViewerArea(Composite parent) { return viewer; } + private void registerVirtualEditors() { + virtualEditors = new AbstractComponentEditor[] { + null, // V-Menu + null, // V-Part + new VHandlerEditor(modelProvider.getEditingDomain()), + null, // V-Binding + null, // V-Command + null // Windows + }; + + } + private void registerDefaultEditors() { registerEditor( MApplicationPackage.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain())); registerEditor( MApplicationPackage.Literals.MODEL_COMPONENTS, new ModelComponentsEditor(modelProvider.getEditingDomain())); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 6ec4b7c24c..9f448b0f2b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -180,35 +180,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { b.setText("Add ..."); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); -// b.addSelectionListener(new SelectionAdapter() { -// @Override -// public void widgetSelected(SelectionEvent e) { -// MHandledItem item = (MHandledItem) master.getValue(); -// MParameter param = MApplicationFactory.eINSTANCE.createParameter(); -// Command cmd = AddCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS, param); -// if( cmd.canExecute() ) { -// getEditingDomain().getCommandStack().execute(cmd); -// } -// tableviewer.editElement(param, 0); -// } -// }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Remove"); -// b.addSelectionListener(new SelectionAdapter() { -// -// public void widgetSelected(SelectionEvent e) { -// IStructuredSelection s = (IStructuredSelection) tableviewer.getSelection(); -// if( !s.isEmpty() ) { -// MHandledItem item = (MHandledItem) master.getValue(); -// Command cmd = RemoveCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS, s.toList()); -// if( cmd.canExecute() ) { -// getEditingDomain().getCommandStack().execute(cmd); -// } -// } -// } -// -// }); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index fb95fa6d44..d140a66f4e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -18,8 +18,11 @@ import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MPlaceholder; +import org.eclipse.e4.ui.model.application.MUILabel; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -61,6 +64,31 @@ public String getLabel(Object element) { @Override public String getDetailLabel(Object element) { + MPlaceholder pl = (MPlaceholder) element; + if( pl.getRef() != null ) { + StringBuilder b = new StringBuilder(); + + b.append(((EObject)pl.getRef()).eClass().getName()); + if( pl.getRef() instanceof MUILabel ) { + MUILabel label = (MUILabel) pl.getRef(); + if( label.getLabel() != null && label.getLabel().trim().length() > 0 ) { + b.append(" (" + label.getLabel() + ")"); + } else if( label.getTooltip() != null && label.getTooltip().trim().length() > 0 ) { + b.append(" (" + label.getTooltip() + ")"); + } else { + if( pl.getRef().getId() != null && pl.getRef().getId().trim().length() > 0 ) { + b.append(pl.getRef().getId()); + } + } + } else { + if( pl.getRef().getId() != null && pl.getRef().getId().trim().length() > 0 ) { + b.append(" (" + pl.getRef().getId() + ")"); + } + } + + return b.toString(); + } + return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index dc67162560..ab0da3f34b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -32,6 +32,7 @@ import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; @@ -153,6 +154,43 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__HEIGHT).observeDetail(getMaster())); } + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Label"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Tooltip"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Icon URI"); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText("Find ..."); + } + ControlFactory.createTagsWidget(parent, this); return parent; @@ -193,8 +231,10 @@ protected boolean accepted(Object o) { @Override public String getDetailLabel(Object element) { - return ((MWindow)element).getLabel(); + MWindow window = (MWindow)element; + if( window.getLabel() != null && window.getLabel().trim().length() > 0 ) { + return window.getLabel(); + } + return null; } - - -} +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java new file mode 100644 index 0000000000..0f9c1d6e62 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -0,0 +1,129 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VHandlerEditor extends AbstractComponentEditor { + private Composite composite; + private Image image; + private EMFDataBindingContext context; + + public VHandlerEditor(EditingDomain editingDomain) { + super(editingDomain); + } + + @Override + public Image getImage(Object element, Display display) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getLabel(Object element) { + return "Handlers"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Handlers Bla Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Handlers"); + + TableViewer viewer = new TableViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Id"); + column.getColumn().setWidth(150); + + column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Command"); + column.getColumn().setWidth(200); + + column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Class"); + column.getColumn().setWidth(300); + + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + } + + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + +} From 532a9678d48b90185dc4de23413c130eeabcda0a Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 9 Mar 2010 16:58:00 +0000 Subject: [PATCH 0014/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * added editor component for virtual component --- .../component/virtual/VHandlerEditor.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index 0f9c1d6e62..f393451b31 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -4,9 +4,15 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ViewerSupport; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; @@ -54,7 +60,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); composite = createForm(parent,context, getMaster()); } - getMaster().setValue(object); + getMaster().setValue(((VirtualEntry)object).getOriginalParent()); return composite; } @@ -66,6 +72,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); l.setText("Handlers"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); TableViewer viewer = new TableViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -85,6 +92,14 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, column.getColumn().setText("Class"); column.getColumn().setWidth(300); + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); + IValueProperty[] props = { + EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID), + EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLER__COMMAND, MApplicationPackage.Literals.COMMAND__COMMAND_NAME)), + EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI) + }; + + ViewerSupport.bind(viewer, prop.observeDetail(getMaster()), props); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); From f3932a744a1c7dd6a554b0431df519f4ad25b20d Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 9 Mar 2010 19:47:17 +0000 Subject: [PATCH 0015/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * adding save --- .../tools/emf/ui/common/IModelResource.java | 8 +++++ .../tools/emf/ui/common/XMIModelResource.java | 35 +++++++++++++++++++ .../emf/ui/internal/common/ModelEditor.java | 17 ++++++++- .../common/component/CommandEditor.java | 9 ++--- .../component/DirectToolItemEditor.java | 6 ++-- .../component/HandledToolItemEditor.java | 5 +-- .../common/component/HandlerEditor.java | 10 +++--- .../common/component/KeyBindingEditor.java | 9 ++--- .../component/ModelComponentEditor.java | 12 +++---- .../component/PartDescriptorEditor.java | 6 ++-- .../internal/common/component/PartEditor.java | 14 ++++---- .../component/PartSashContainerEditor.java | 6 ++-- .../common/component/PartStackEditor.java | 6 ++-- .../common/component/PerspectiveEditor.java | 12 +++---- .../component/PerspectiveStackEditor.java | 6 ++-- .../common/component/PlaceholderEditor.java | 6 ++-- .../common/component/ToolItemEditor.java | 5 +-- .../common/component/WindowEditor.java | 20 +++++------ .../component/virtual/VHandlerEditor.java | 24 +++++++++++-- 19 files changed, 149 insertions(+), 67 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java index e47b866b8c..c2ee571e31 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java @@ -19,4 +19,12 @@ public interface IModelResource { public boolean isSaveable(); public IStatus save(); public EditingDomain getEditingDomain(); + public boolean isDirty(); + + public void addModelListener(ModelListener listener); + public void removeModelListener(ModelListener listener); + + public interface ModelListener { + public void dirtyChanged(); + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java index 7d7510a6d9..1f3b4cee63 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java @@ -10,7 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.common; +import java.util.ArrayList; +import java.util.EventObject; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -18,6 +21,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.emf.common.command.BasicCommandStack; +import org.eclipse.emf.common.command.CommandStackListener; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; @@ -30,12 +34,22 @@ public class XMIModelResource implements IModelResource { private EditingDomain editingDomain; private Resource resource; + private List listeners = new ArrayList(); + private boolean dirty; public XMIModelResource(String uri) { ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( ComposedAdapterFactory.Descriptor.Registry.INSTANCE); ResourceSet resourceSet = new ResourceSetImpl(); BasicCommandStack commandStack = new BasicCommandStack(); + commandStack.addCommandStackListener(new CommandStackListener() { + + public void commandStackChanged(EventObject event) { + dirty = true; + System.err.println("Exec"); + fireDirtyChanged(); + } + }); editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, resourceSet); resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap() @@ -58,10 +72,31 @@ public boolean isSaveable() { return true; } + public void addModelListener(ModelListener listener) { + listeners.add(listener); + } + + public void removeModelListener(ModelListener listener) { + listeners.remove(listener); + } + + public boolean isDirty() { + return dirty; + } + + private void fireDirtyChanged() { + for( ModelListener listener : listeners ) { + listener.dirtyChanged(); + } + } + public IStatus save() { Map map = new HashMap(); try { resource.save(map); + editingDomain.getCommandStack().flush(); + dirty = false; + fireDirtyChanged(); } catch (Exception e) { // TODO: handle exception } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 2321f95a7e..bb6a0be9f8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -18,6 +18,8 @@ import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ShadowComposite; @@ -49,6 +51,7 @@ import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.SashForm; @@ -177,13 +180,17 @@ private void registerVirtualEditors() { virtualEditors = new AbstractComponentEditor[] { null, // V-Menu null, // V-Part - new VHandlerEditor(modelProvider.getEditingDomain()), + new VHandlerEditor(modelProvider.getEditingDomain(),this), null, // V-Binding null, // V-Command null // Windows }; } + + public void setSelection(Object element) { + viewer.setSelection(new StructuredSelection(element)); + } private void registerDefaultEditors() { registerEditor( MApplicationPackage.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain())); @@ -214,6 +221,14 @@ public void registerEditor(EClass eClass, AbstractComponentEditor editor) { public AbstractComponentEditor getEditor(EClass eClass) { return editorMap.get(eClass); } + + public IStatus save() { + if( modelProvider.isSaveable() ) { + return modelProvider.save(); + } + + return Status.CANCEL_STATUS; + } private static class TreeStructureAdvisorImpl extends TreeStructureAdvisor { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 9f448b0f2b..c3c309c89e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -22,6 +22,7 @@ import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerSupport; import org.eclipse.jface.viewers.TableViewer; @@ -84,7 +85,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); { Label l = new Label(parent, SWT.NONE); @@ -94,7 +95,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -106,7 +107,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND__COMMAND_NAME).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND__COMMAND_NAME).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -120,7 +121,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { gd.horizontalSpan = 2; gd.heightHint=100; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND__DESCRIPTION).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND__DESCRIPTION).observeDetail(getMaster())); } // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index 89765f6ddd..1a01b4edf7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -14,11 +14,11 @@ import java.net.URL; import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; @@ -53,14 +53,14 @@ public Image getImage(Object element, Display display) { @Override protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, WritableValue master) { - IValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(); Label l = new Label(parent, SWT.NONE); l.setText("Class URI"); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observe(t), EMFEditProperties.value( getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value( getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setText("Find ..."); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index 5b4ed386d4..424d304177 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -27,6 +27,7 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerSupport; import org.eclipse.jface.viewers.CellEditor; @@ -75,7 +76,7 @@ public Image getImage(Object element, Display display) { @Override protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, final WritableValue master) { - IValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(); Label l = new Label(parent, SWT.NONE); l.setText("Command"); @@ -83,7 +84,7 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEnabled(false); - context.bindValue(textProp.observe(t), EMFEditProperties.value( getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLED_ITEM__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value( getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLED_ITEM__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(master)); Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setText("Find ..."); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 7208902935..6ae1c6e946 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -14,7 +14,6 @@ import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MHandler; @@ -22,6 +21,7 @@ import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; @@ -80,7 +80,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(); // ------------------------------------------------------------ { @@ -91,7 +91,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -102,7 +102,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEnabled(false); - context.bindValue(textProp.observe(t), EMFEditProperties.value( getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLER__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value( getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLER__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(getMaster())); Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setText("Find ..."); @@ -117,7 +117,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(getMaster())); Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index cbc94d2e08..fde361baa3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -29,6 +29,7 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerSupport; import org.eclipse.jface.viewers.CellEditor; @@ -103,7 +104,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(); // ------------------------------------------------------------ { @@ -114,7 +115,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -126,7 +127,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.KEY_SEQUENCE__KEY_SEQUENCE).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.KEY_SEQUENCE__KEY_SEQUENCE).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -137,7 +138,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEnabled(false); - context.bindValue(textProp.observe(t), EMFEditProperties.value( getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.KEY_BINDING__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value( getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.KEY_BINDING__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(getMaster())); Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setText("Find ..."); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index 7e0465fbd0..f6e85eb945 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -13,7 +13,6 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; @@ -25,6 +24,7 @@ import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.viewers.ListViewer; import org.eclipse.swt.SWT; @@ -81,7 +81,7 @@ private Composite createForm(Composite parent) { parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(); Label l = new Label(parent, SWT.NONE); l.setText("Id"); @@ -90,7 +90,7 @@ private Composite createForm(Composite parent) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); // ------------------------------------------------------------ @@ -117,7 +117,7 @@ private Composite createForm(Composite parent) { t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__PARENT_ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__PARENT_ID).observeDetail(getMaster())); Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setText("Find ..."); @@ -131,7 +131,7 @@ private Composite createForm(Composite parent) { gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__POSITION_IN_PARENT).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__POSITION_IN_PARENT).observeDetail(getMaster())); // ------------------------------------------------------------ @@ -142,7 +142,7 @@ private Composite createForm(Composite parent) { gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__PROCESSOR).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__PROCESSOR).observeDetail(getMaster())); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 16f14ce95b..d3ffc0a451 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -11,11 +11,11 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component; import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; @@ -33,7 +33,7 @@ public PartDescriptorEditor(EditingDomain editingDomain) { protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master) { Composite comp = super.createForm(parent,context,master); - IValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(); Label l = new Label(parent, SWT.NONE); l.setText("Label"); @@ -42,7 +42,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 8b3af6a580..2eaf36585f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -17,7 +17,6 @@ import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; @@ -27,6 +26,7 @@ import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.viewers.ListViewer; import org.eclipse.jface.viewers.TableViewer; @@ -93,7 +93,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(); Label l = new Label(parent, SWT.NONE); l.setText("Id"); @@ -102,7 +102,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); // ------------------------------------------------------------ @@ -113,7 +113,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); // ------------------------------------------------------------ @@ -124,7 +124,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); // ------------------------------------------------------------ @@ -133,7 +133,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setText("Find ..."); @@ -145,7 +145,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setText("Find ..."); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 95c1e23bf7..c50b4b6aa5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -20,7 +20,6 @@ import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MPartSashContainer; @@ -30,6 +29,7 @@ import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; import org.eclipse.jface.databinding.viewers.ViewerProperties; @@ -114,7 +114,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(); // ------------------------------------------------------------ { @@ -125,7 +125,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); } // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 2b871867c7..21cf744f12 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -20,7 +20,6 @@ import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.databinding.EMFDataBindingContext; @@ -29,6 +28,7 @@ import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; import org.eclipse.jface.databinding.viewers.ViewerProperties; @@ -94,7 +94,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(); // ------------------------------------------------------------ { @@ -105,7 +105,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); } // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index ed74687e2e..36c0385f75 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -10,7 +10,6 @@ import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MPerspective; @@ -20,6 +19,7 @@ import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; import org.eclipse.jface.databinding.viewers.ViewerProperties; @@ -94,7 +94,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(); // ------------------------------------------------------------ { @@ -105,7 +105,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -153,7 +153,7 @@ public void handleValueChange(ValueChangeEvent event) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); } // ------------------------------------------------------------ @@ -165,7 +165,7 @@ public void handleValueChange(ValueChangeEvent event) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); } // ------------------------------------------------------------ @@ -175,7 +175,7 @@ public void handleValueChange(ValueChangeEvent event) { Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText("Find ..."); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index a8b4f8e68d..49a20efc2b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -20,7 +20,6 @@ import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.databinding.EMFDataBindingContext; @@ -29,6 +28,7 @@ import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; import org.eclipse.jface.databinding.viewers.ViewerProperties; @@ -98,7 +98,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(); // ------------------------------------------------------------ { @@ -109,7 +109,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); } // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index d140a66f4e..cc472b7109 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -15,7 +15,6 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MPlaceholder; @@ -24,6 +23,7 @@ import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; @@ -111,7 +111,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(); // ------------------------------------------------------------ { @@ -122,7 +122,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); } return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index d2995869ff..fe64c49a84 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -24,6 +24,7 @@ import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerProperties; import org.eclipse.jface.viewers.ArrayContentProvider; @@ -85,7 +86,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(); Label l = new Label(parent, SWT.NONE); l.setText("Id"); @@ -94,7 +95,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); if (this.getClass() != ToolItemEditor.class) { createFormSubTypeForm(parent, context, master); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index ab0da3f34b..c38eeea2ae 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -17,7 +17,6 @@ import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; @@ -27,6 +26,7 @@ import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; @@ -92,7 +92,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(); // ------------------------------------------------------------ { @@ -103,7 +103,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -115,7 +115,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__X).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__X).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -127,7 +127,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__Y).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__Y).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -139,7 +139,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__WIDTH).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__WIDTH).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -151,7 +151,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__HEIGHT).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__HEIGHT).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -163,7 +163,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); } // ------------------------------------------------------------ @@ -175,7 +175,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); } // ------------------------------------------------------------ @@ -185,7 +185,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText("Find ..."); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index f393451b31..61d410c1c7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -4,18 +4,24 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MHandler; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerSupport; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -28,9 +34,11 @@ public class VHandlerEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; + private ModelEditor editor; - public VHandlerEditor(EditingDomain editingDomain) { + public VHandlerEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); + this.editor = editor; } @Override @@ -124,6 +132,18 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, b.setText("Add ..."); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MHandler handler = MApplicationFactory.eINSTANCE.createHandler(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS, handler); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Remove"); From 278831d429281642f9780b89bc719658f0adacef Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 9 Mar 2010 19:52:18 +0000 Subject: [PATCH 0016/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixed to receive events from the UI-side --- .../ui/internal/common/component/DirectToolItemEditor.java | 2 +- .../ui/internal/common/component/HandledToolItemEditor.java | 2 +- .../tools/emf/ui/internal/common/component/HandlerEditor.java | 2 +- .../emf/ui/internal/common/component/KeyBindingEditor.java | 2 +- .../ui/internal/common/component/ModelComponentEditor.java | 2 +- .../ui/internal/common/component/PartDescriptorEditor.java | 2 +- .../e4/tools/emf/ui/internal/common/component/PartEditor.java | 2 +- .../ui/internal/common/component/PartSashContainerEditor.java | 2 +- .../emf/ui/internal/common/component/PartStackEditor.java | 2 +- .../emf/ui/internal/common/component/PerspectiveEditor.java | 2 +- .../ui/internal/common/component/PerspectiveStackEditor.java | 2 +- .../emf/ui/internal/common/component/PlaceholderEditor.java | 2 +- .../emf/ui/internal/common/component/ToolItemEditor.java | 4 ++-- .../tools/emf/ui/internal/common/component/WindowEditor.java | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index 1a01b4edf7..183cbf2cab 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -53,7 +53,7 @@ public Image getImage(Object element, Display display) { @Override protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, WritableValue master) { - IWidgetValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); Label l = new Label(parent, SWT.NONE); l.setText("Class URI"); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index 424d304177..241e757d66 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -76,7 +76,7 @@ public Image getImage(Object element, Display display) { @Override protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, final WritableValue master) { - IWidgetValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); Label l = new Label(parent, SWT.NONE); l.setText("Command"); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 6ae1c6e946..11a4177e55 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -80,7 +80,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IWidgetValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); // ------------------------------------------------------------ { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index fde361baa3..9dc8a2d8f3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -104,7 +104,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IWidgetValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); // ------------------------------------------------------------ { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index f6e85eb945..402fc5734e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -81,7 +81,7 @@ private Composite createForm(Composite parent) { parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IWidgetValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); Label l = new Label(parent, SWT.NONE); l.setText("Id"); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index d3ffc0a451..f5b9e4e50b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -33,7 +33,7 @@ public PartDescriptorEditor(EditingDomain editingDomain) { protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master) { Composite comp = super.createForm(parent,context,master); - IWidgetValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); Label l = new Label(parent, SWT.NONE); l.setText("Label"); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 2eaf36585f..48e9558388 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -93,7 +93,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IWidgetValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); Label l = new Label(parent, SWT.NONE); l.setText("Id"); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index c50b4b6aa5..7c353761b3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -114,7 +114,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IWidgetValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); // ------------------------------------------------------------ { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 21cf744f12..6e701c5ef9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -94,7 +94,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IWidgetValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); // ------------------------------------------------------------ { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 36c0385f75..1ca98ba0ea 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -94,7 +94,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IWidgetValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); // ------------------------------------------------------------ { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 49a20efc2b..31624f5fc1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -98,7 +98,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IWidgetValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); // ------------------------------------------------------------ { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index cc472b7109..90b8d08cc0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -111,7 +111,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IWidgetValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); // ------------------------------------------------------------ { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index fe64c49a84..f9e819342e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -86,7 +86,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IWidgetValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); Label l = new Label(parent, SWT.NONE); l.setText("Id"); @@ -105,7 +105,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } private void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, final WritableValue master) { - IValueProperty textProp = WidgetProperties.text(); + IValueProperty textProp = WidgetProperties.text(SWT.Modify); // ------------------------------------------------------------ { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index c38eeea2ae..311dbd0890 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -92,7 +92,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); - IWidgetValueProperty textProp = WidgetProperties.text(); + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); // ------------------------------------------------------------ { From a6e33c11c00f963ead2fec188bfd5b013be98b2d Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 9 Mar 2010 20:18:18 +0000 Subject: [PATCH 0017/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * using e4-resource factory --- .../META-INF/MANIFEST.MF | 2 +- .../tools/emf/ui/common/XMIModelResource.java | 107 ------------------ 2 files changed, 1 insertion(+), 108 deletions(-) delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 91f26e4d5e..8fc35da937 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -25,4 +25,4 @@ Export-Package: org.eclipse.e4.tools.emf.ui.common, org.eclipse.e4.tools.emf.ui.internal.common;x-internal:=true, org.eclipse.e4.tools.emf.ui.internal.common.component;x-internal:=true, org.eclipse.e4.tools.emf.ui.internal.wbe;x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.wbm;x-internal:=true + org.eclipse.e4.tools.emf.ui.internal.wbm;x-friends:="org.eclipse.e4.tools.emf.editor" diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java deleted file mode 100644 index 1f3b4cee63..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import java.util.ArrayList; -import java.util.EventObject; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.common.command.CommandStackListener; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; - -public class XMIModelResource implements IModelResource { - private EditingDomain editingDomain; - private Resource resource; - private List listeners = new ArrayList(); - private boolean dirty; - - public XMIModelResource(String uri) { - ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - ResourceSet resourceSet = new ResourceSetImpl(); - BasicCommandStack commandStack = new BasicCommandStack(); - commandStack.addCommandStackListener(new CommandStackListener() { - - public void commandStackChanged(EventObject event) { - dirty = true; - System.err.println("Exec"); - fireDirtyChanged(); - } - }); - editingDomain = new AdapterFactoryEditingDomain(adapterFactory, - commandStack, resourceSet); - resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap() - .put(Resource.Factory.Registry.DEFAULT_EXTENSION, - new XMIResourceFactoryImpl()); - resource = resourceSet.getResource(URI.createURI(uri), true); - } - - public IObservableList getRoot() { - WritableList list = new WritableList(); - list.add(resource.getContents().get(0)); - return list; - } - - public EditingDomain getEditingDomain() { - return editingDomain; - } - - public boolean isSaveable() { - return true; - } - - public void addModelListener(ModelListener listener) { - listeners.add(listener); - } - - public void removeModelListener(ModelListener listener) { - listeners.remove(listener); - } - - public boolean isDirty() { - return dirty; - } - - private void fireDirtyChanged() { - for( ModelListener listener : listeners ) { - listener.dirtyChanged(); - } - } - - public IStatus save() { - Map map = new HashMap(); - try { - resource.save(map); - editingDomain.getCommandStack().flush(); - dirty = false; - fireDirtyChanged(); - } catch (Exception e) { - // TODO: handle exception - } - - return Status.OK_STATUS; - } - -} From ae793a7e96cd0917494c70109b1f63c660649630 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 9 Mar 2010 20:38:18 +0000 Subject: [PATCH 0018/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * editor for the virtual command, handler and binding section --- .../emf/ui/internal/common/ModelEditor.java | 6 +- .../component/virtual/VCommandEditor.java | 167 +++++++++++++++++ .../component/virtual/VHandlerEditor.java | 27 ++- .../component/virtual/VKeyBindingEditor.java | 173 ++++++++++++++++++ 4 files changed, 361 insertions(+), 12 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index bb6a0be9f8..bd4f365154 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -42,7 +42,9 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolItemEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowTrimEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VCommandEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VKeyBindingEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; @@ -181,8 +183,8 @@ private void registerVirtualEditors() { null, // V-Menu null, // V-Part new VHandlerEditor(modelProvider.getEditingDomain(),this), - null, // V-Binding - null, // V-Command + new VKeyBindingEditor(modelProvider.getEditingDomain(), this), + new VCommandEditor(modelProvider.getEditingDomain(), this), null // Windows }; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java new file mode 100644 index 0000000000..eddf3aa6ff --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -0,0 +1,167 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MCommand; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VCommandEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private ModelEditor editor; + + public VCommandEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "Commands"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Commands Bla Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + getMaster().setValue(((VirtualEntry)object).getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Commands"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + TableViewer viewer = new TableViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Name"); + column.getColumn().setWidth(200); + + column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Id"); + column.getColumn().setWidth(200); + + + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.APPLICATION__COMMANDS); + IValueProperty[] props = { + EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID), + EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND__COMMAND_NAME) + }; + + ViewerSupport.bind(viewer, prop.observeDetail(getMaster()), props); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MCommand command = MApplicationFactory.eINSTANCE.createCommand(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.APPLICATION__COMMANDS, command); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(command); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + } + + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index 61d410c1c7..708d8a28f8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -32,7 +42,6 @@ public class VHandlerEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private ModelEditor editor; @@ -43,7 +52,6 @@ public VHandlerEditor(EditingDomain editingDomain, ModelEditor editor) { @Override public Image getImage(Object element, Display display) { - // TODO Auto-generated method stub return null; } @@ -89,10 +97,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, viewer.getTable().setHeaderVisible(true); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Id"); - column.getColumn().setWidth(150); - - column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Command"); column.getColumn().setWidth(200); @@ -100,11 +104,15 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, column.getColumn().setText("Class"); column.getColumn().setWidth(300); + column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Id"); + column.getColumn().setWidth(150); + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); IValueProperty[] props = { - EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLER__COMMAND, MApplicationPackage.Literals.COMMAND__COMMAND_NAME)), - EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI) + EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI), + EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID) }; ViewerSupport.bind(viewer, prop.observeDetail(getMaster()), props); @@ -160,5 +168,4 @@ public IObservableList getChildList(Object element) { // TODO Auto-generated method stub return null; } - -} +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java new file mode 100644 index 0000000000..b086f10eaa --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java @@ -0,0 +1,173 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MKeyBinding; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VKeyBindingEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private ModelEditor editor; + + public VKeyBindingEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "KeyBindings"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "KeyBindings Bla Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + getMaster().setValue(((VirtualEntry)object).getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Keybindings"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + TableViewer viewer = new TableViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("KeySequence"); + column.getColumn().setWidth(100); + + column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Command"); + column.getColumn().setWidth(200); + + column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Id"); + column.getColumn().setWidth(170); + + + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); + IValueProperty[] props = { + EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.KEY_SEQUENCE__KEY_SEQUENCE), + EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.KEY_BINDING__COMMAND, MApplicationPackage.Literals.COMMAND__COMMAND_NAME)), + EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID) + }; + + ViewerSupport.bind(viewer, prop.observeDetail(getMaster()), props); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MKeyBinding handler = MApplicationFactory.eINSTANCE.createKeyBinding(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS, handler); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + } + + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + +} From de7003c4088b00aa5c47790b6908f4a2eb00cc19 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 9 Mar 2010 23:59:09 +0000 Subject: [PATCH 0019/1286] [Bug 304741 ] - Optimize the workbench model Java-Classes * added persisted map changes --- .../internal/common/component/PartEditor.java | 214 ++++++++++++------ 1 file changed, 145 insertions(+), 69 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 48e9558388..340fa11e9c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -12,6 +12,7 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.Map.Entry; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; @@ -25,9 +26,12 @@ import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ColumnLabelProvider; import org.eclipse.jface.viewers.ListViewer; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; @@ -95,93 +99,165 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - Label l = new Label(parent, SWT.NONE); - l.setText("Id"); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); - // ------------------------------------------------------------ - - l = new Label(parent, SWT.NONE); - l.setText("Label"); - - t = new Text(parent, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); + } // ------------------------------------------------------------ - - l = new Label(parent, SWT.NONE); - l.setText("Tooltip"); - - t = new Text(parent, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + { + Label l = new Label(parent, SWT.NONE); + l.setText("Label"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + } // ------------------------------------------------------------ - - l = new Label(parent, SWT.NONE); - l.setText("Icon URI"); - - t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - - Button b = new Button(parent, SWT.PUSH|SWT.FLAT); - b.setText("Find ..."); + { + Label l = new Label(parent, SWT.NONE); + l.setText("Tooltip"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + } // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Icon URI"); - l = new Label(parent, SWT.NONE); - l.setText("Class URI"); - - t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - b = new Button(parent, SWT.PUSH|SWT.FLAT); - b.setText("Find ..."); + Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setText("Find ..."); + } // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Class URI"); - l = new Label(parent, SWT.NONE); - l.setText("Variables"); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); - - ListViewer viewer = new ListViewer(parent); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - gd.heightHint = 80; - viewer.getList().setLayoutData(gd); + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); + Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setText("Find ..."); + } + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Persited State"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + + TableViewer tableviewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + tableviewer.setContentProvider(cp); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 80; + tableviewer.getControl().setLayoutData(gd); + + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Key"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ColumnLabelProvider() { + @SuppressWarnings("unchecked") + @Override + public String getText(Object element) { + Entry entry = (Entry) element; + return entry.getKey(); + } + }); + + //FIXME How can we react upon changes in the Map-Value? + column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Value"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ColumnLabelProvider() { + @SuppressWarnings("unchecked") + @Override + public String getText(Object element) { + Entry entry = (Entry) element; + return entry.getValue(); + } + }); + + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__PERSISTED_STATE); + tableviewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + } - l = new Label(parent, SWT.NONE); - l.setText("Properties"); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); - TableViewer tableviewer = new TableViewer(parent); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - gd.heightHint = 80; - tableviewer.getTable().setHeaderVisible(true); - tableviewer.getControl().setLayoutData(gd); + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Variables"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + + ListViewer viewer = new ListViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + gd.heightHint = 80; + viewer.getList().setLayoutData(gd); + } - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Key"); - column.getColumn().setWidth(200); + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Properties"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + + TableViewer tableviewer = new TableViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + gd.heightHint = 80; + tableviewer.getTable().setHeaderVisible(true); + tableviewer.getControl().setLayoutData(gd); + + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Key"); + column.getColumn().setWidth(200); + + column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Value"); + column.getColumn().setWidth(200); + } - column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Value"); - column.getColumn().setWidth(200); ControlFactory.createTagsWidget(parent, this); From 079dc4fc54a509df4fe4f292c2eb587a37b36a15 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 10 Mar 2010 00:22:28 +0000 Subject: [PATCH 0020/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling --- .../e4/tools/emf/ui/internal/common/component/PartEditor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 340fa11e9c..929f17a9a9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -184,7 +184,7 @@ public String getText(Object element) { Entry entry = (Entry) element; return entry.getKey(); } - }); + }); //FIXME How can we react upon changes in the Map-Value? column = new TableViewerColumn(tableviewer, SWT.NONE); From 99a244d15504762380892ee21f404b7acdae91b2 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 10 Mar 2010 23:11:05 +0000 Subject: [PATCH 0021/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * model virtual editors and some trim-editor and window-editor improvements --- .../ObservableColumnLabelProvider.java | 94 ++++++++ .../emf/ui/internal/common/ModelEditor.java | 7 +- .../common/component/WindowEditor.java | 2 +- .../common/component/WindowTrimEditor.java | 53 ++++- .../component/virtual/VControlEditor.java | 211 ++++++++++++++++++ .../component/virtual/VWindowEditor.java | 202 +++++++++++++++++ 6 files changed, 566 insertions(+), 3 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java new file mode 100644 index 0000000000..0647a798cd --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java @@ -0,0 +1,94 @@ +package org.eclipse.e4.tools.emf.ui.internal; + +import java.util.Set; + +import org.eclipse.core.databinding.observable.map.IMapChangeListener; +import org.eclipse.core.databinding.observable.map.IObservableMap; +import org.eclipse.core.databinding.observable.map.MapChangeEvent; +import org.eclipse.jface.viewers.CellLabelProvider; +import org.eclipse.jface.viewers.LabelProviderChangedEvent; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; + +public class ObservableColumnLabelProvider extends CellLabelProvider { + private IObservableMap[] attributeMaps; + + private IMapChangeListener mapChangeListener = new IMapChangeListener() { + public void handleMapChange(MapChangeEvent event) { + Set affectedElements = event.diff.getChangedKeys(); + LabelProviderChangedEvent newEvent = new LabelProviderChangedEvent( + ObservableColumnLabelProvider.this, affectedElements + .toArray()); + fireLabelProviderChanged(newEvent); + } + }; + + /** + * Creates a new label provider that tracks changes to one attribute. + * + * @param attributeMap + */ + public ObservableColumnLabelProvider(IObservableMap attributeMap) { + this(new IObservableMap[] { attributeMap }); + } + + /** + * Creates a new label provider that tracks changes to more than one + * attribute. This constructor should be used by subclasses that override + * {@link #update(ViewerCell)} and make use of more than one attribute. + * + * @param attributeMaps + */ + protected ObservableColumnLabelProvider(IObservableMap[] attributeMaps) { + System.arraycopy(attributeMaps, 0, + this.attributeMaps = new IObservableMap[attributeMaps.length], + 0, attributeMaps.length); + for (int i = 0; i < attributeMaps.length; i++) { + attributeMaps[i].addMapChangeListener(mapChangeListener); + } + } + + public void dispose() { + for (int i = 0; i < attributeMaps.length; i++) { + attributeMaps[i].removeMapChangeListener(mapChangeListener); + } + super.dispose(); + this.attributeMaps = null; + this.mapChangeListener = null; + } + + @SuppressWarnings("unchecked") + public void update(ViewerCell cell) { + M element = (M) cell.getElement(); + cell.setText(getText(element)); + cell.setImage(getImage(element)); + cell.setBackground(getBackground(element)); + cell.setForeground(getForeground(element)); + cell.setFont(getFont(element)); + } + + public String getText(M element) { + Object value = attributeMaps[0].get(element); + return value == null ? "" : value.toString(); + } + + public Font getFont(M element) { + return null; + } + + public Color getBackground(M element) { + return null; + } + + public Color getForeground(M element) { + return null; + } + + + public Image getImage(M element) { + return null; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index bd4f365154..4b588c6d4a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -43,8 +43,10 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowTrimEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VCommandEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VControlEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VKeyBindingEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; @@ -71,6 +73,7 @@ public class ModelEditor { public static final int VIRTUAL_BINDING = 3; public static final int VIRTUAL_COMMAND = 4; public static final int VIRTUAL_WINDOWS = 5; + public static final int VIRTUAL_WINDOW_CONTROLS = 6; private Map editorMap = new HashMap(); private AbstractComponentEditor[] virtualEditors; @@ -157,6 +160,7 @@ public void selectionChanged(SelectionChangedEvent event) { }); form.setWeights(new int[] { 1 , 2 }); + viewer.setSelection(new StructuredSelection(modelProvider.getRoot())); } private TreeViewer createTreeViewerArea(Composite parent) { @@ -185,7 +189,8 @@ private void registerVirtualEditors() { new VHandlerEditor(modelProvider.getEditingDomain(),this), new VKeyBindingEditor(modelProvider.getEditingDomain(), this), new VCommandEditor(modelProvider.getEditingDomain(), this), - null // Windows + new VWindowEditor(modelProvider.getEditingDomain(), this), + new VControlEditor(modelProvider.getEditingDomain(), this) }; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 311dbd0890..8f9e55849f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -217,7 +217,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOWS, ELEMENT_CONTAINER__CHILDREN, element, "Controls") { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOW_CONTROLS, ELEMENT_CONTAINER__CHILDREN, element, "Controls") { @Override protected boolean accepted(Object o) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java index 6325f8ee8e..31dd6d0540 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java @@ -14,17 +14,31 @@ import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.ItemType; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MTrimContainer; +import org.eclipse.e4.ui.model.application.SideValue; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ViewerProperties; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class WindowTrimEditor extends AbstractComponentEditor { @@ -76,6 +90,38 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Side"); + + ComboViewer viewer = new ComboViewer(parent); + viewer.setContentProvider(new ArrayContentProvider()); + viewer.setInput(SideValue.values()); + GridData gd = new GridData(); + gd.horizontalSpan = 2; + viewer.getControl().setLayoutData(gd); + IObservableValue sideValueObs = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.TRIM_CONTAINER__SIDE).observeDetail(master); + context.bindValue(ViewerProperties.singleSelection().observe(viewer), sideValueObs); + } + + return parent; } @@ -86,7 +132,12 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { - // TODO Auto-generated method stub + MTrimContainer trim = (MTrimContainer) element; + + if( trim.getSide() != null ) { + return trim.getSide().toString(); + } + return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java new file mode 100644 index 0000000000..a51d78954c --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java @@ -0,0 +1,211 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MPart; +import org.eclipse.e4.ui.model.application.MPartSashContainer; +import org.eclipse.e4.ui.model.application.MPartStack; +import org.eclipse.e4.ui.model.application.MPerspectiveStack; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VControlEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private ModelEditor editor; + + public VControlEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "Controls"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Controls Bla Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + getMaster().setValue(((VirtualEntry)object).getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Controls"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + TableViewer viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + viewer.setLabelProvider(new ComponentLabelProvider(editor)); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + + + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + viewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add Sash"); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MPartSashContainer handler = MApplicationFactory.eINSTANCE.createPartSashContainer(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add PartStack"); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MPartStack handler = MApplicationFactory.eINSTANCE.createPartStack(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add PerspectiveStack"); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MPerspectiveStack handler = MApplicationFactory.eINSTANCE.createPerspectiveStack(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add Part"); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MPart handler = MApplicationFactory.eINSTANCE.createPart(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + } + + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java new file mode 100644 index 0000000000..3b5bf2a6a5 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -0,0 +1,202 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MWindow; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VWindowEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private ModelEditor editor; + + public VWindowEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "Windows"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Windows Bla Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + getMaster().setValue(((VirtualEntry)object).getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Windows"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + TableViewer viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + + { + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Name"); + column.getColumn().setWidth(180); + column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__X); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("X"); + column.getColumn().setWidth(80); + column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__Y); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Y"); + column.getColumn().setWidth(80); + column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__WIDTH); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Width"); + column.getColumn().setWidth(100); + column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__HEIGHT); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Height"); + column.getColumn().setWidth(100); + column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); + } + + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + viewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MWindow handler = MApplicationFactory.eINSTANCE.createWindow(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + } + + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + +} \ No newline at end of file From 6d15c716857be02a7638a9c7dfc5fb615bcf4c38 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 10 Mar 2010 23:38:20 +0000 Subject: [PATCH 0022/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * moving trims to extra own virtual part --- .../emf/ui/internal/common/ModelEditor.java | 5 +- .../common/component/WindowEditor.java | 12 +- .../component/virtual/VControlEditor.java | 7 +- .../component/virtual/VWindowTrimEditor.java | 208 ++++++++++++++++++ 4 files changed, 228 insertions(+), 4 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 4b588c6d4a..79ae2c45c9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -47,6 +47,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VKeyBindingEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; @@ -74,6 +75,7 @@ public class ModelEditor { public static final int VIRTUAL_COMMAND = 4; public static final int VIRTUAL_WINDOWS = 5; public static final int VIRTUAL_WINDOW_CONTROLS = 6; + public static final int VIRTUAL_WINDOW_TRIMS = 7; private Map editorMap = new HashMap(); private AbstractComponentEditor[] virtualEditors; @@ -190,7 +192,8 @@ private void registerVirtualEditors() { new VKeyBindingEditor(modelProvider.getEditingDomain(), this), new VCommandEditor(modelProvider.getEditingDomain(), this), new VWindowEditor(modelProvider.getEditingDomain(), this), - new VControlEditor(modelProvider.getEditingDomain(), this) + new VControlEditor(modelProvider.getEditingDomain(), this), + new VWindowTrimEditor(modelProvider.getEditingDomain(), this) }; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 8f9e55849f..2b5718f546 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -22,6 +22,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MWindow; +import org.eclipse.e4.ui.model.application.MWindowTrim; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.edit.EMFEditProperties; @@ -216,12 +217,21 @@ protected boolean accepted(Object o) { } }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOW_TRIMS, ELEMENT_CONTAINER__CHILDREN, element, "Trims") { + + @Override + protected boolean accepted(Object o) { + return o instanceof MWindowTrim; + } + + }); list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOW_CONTROLS, ELEMENT_CONTAINER__CHILDREN, element, "Controls") { @Override protected boolean accepted(Object o) { - return true; + return !(o instanceof MWindowTrim); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java index a51d78954c..4df23d77de 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java @@ -45,6 +45,7 @@ public class VControlEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private ModelEditor editor; + private TableViewer viewer; public VControlEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); @@ -77,7 +78,9 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); composite = createForm(parent,context, getMaster()); } - getMaster().setValue(((VirtualEntry)object).getOriginalParent()); + VirtualEntry o = (VirtualEntry)object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); return composite; } @@ -91,7 +94,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, l.setText("Controls"); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - TableViewer viewer = new TableViewer(parent); + viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); viewer.setLabelProvider(new ComponentLabelProvider(editor)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java new file mode 100644 index 0000000000..7a8adfcbab --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -0,0 +1,208 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MPart; +import org.eclipse.e4.ui.model.application.MPartSashContainer; +import org.eclipse.e4.ui.model.application.MPartStack; +import org.eclipse.e4.ui.model.application.MPerspectiveStack; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VWindowTrimEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private ModelEditor editor; + private TableViewer viewer; + + public VWindowTrimEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "Window Trims"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Window Trims Bla Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + VirtualEntry o = (VirtualEntry)object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Controls"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + viewer.setLabelProvider(new ComponentLabelProvider(editor)); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add Sash"); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MPartSashContainer handler = MApplicationFactory.eINSTANCE.createPartSashContainer(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add PartStack"); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MPartStack handler = MApplicationFactory.eINSTANCE.createPartStack(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add PerspectiveStack"); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MPerspectiveStack handler = MApplicationFactory.eINSTANCE.createPerspectiveStack(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add Part"); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MPart handler = MApplicationFactory.eINSTANCE.createPart(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + } + + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + +} \ No newline at end of file From 8b03bef34875b9b5335e58dc594a633a28857364 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 10 Mar 2010 23:39:53 +0000 Subject: [PATCH 0023/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixing new window trim editor --- .../component/virtual/VWindowTrimEditor.java | 61 +------------------ 1 file changed, 3 insertions(+), 58 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java index 7a8adfcbab..f87f30b9ae 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -18,10 +18,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MPart; -import org.eclipse.e4.ui.model.application.MPartSashContainer; -import org.eclipse.e4.ui.model.application.MPartStack; -import org.eclipse.e4.ui.model.application.MPerspectiveStack; +import org.eclipse.e4.ui.model.application.MWindowTrim; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.edit.command.AddCommand; @@ -119,67 +116,15 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, b.setText("Down"); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add Sash"); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MPartSashContainer handler = MApplicationFactory.eINSTANCE.createPartSashContainer(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add PartStack"); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MPartStack handler = MApplicationFactory.eINSTANCE.createPartStack(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); - } - } - }); - - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add PerspectiveStack"); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MPerspectiveStack handler = MApplicationFactory.eINSTANCE.createPerspectiveStack(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); - } - } - }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add Part"); + b.setText("Add Trim"); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MPart handler = MApplicationFactory.eINSTANCE.createPart(); + MWindowTrim handler = MApplicationFactory.eINSTANCE.createWindowTrim(); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); if( cmd.canExecute() ) { From d9098aeef552a1293e6a2a228d273999cd7d6614 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 11 Mar 2010 21:53:21 +0000 Subject: [PATCH 0024/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * added new actions to create models --- .../e4/tools/emf/ui/internal/common/component/PartEditor.java | 1 + .../e4/tools/emf/ui/internal/common/component/WindowEditor.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 929f17a9a9..4b66c2ea3e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -168,6 +168,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); TableViewer tableviewer = new TableViewer(parent); + tableviewer.getTable().setHeaderVisible(true); ObservableListContentProvider cp = new ObservableListContentProvider(); tableviewer.setContentProvider(cp); GridData gd = new GridData(GridData.FILL_HORIZONTAL); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 2b5718f546..294fc7f4c7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -190,6 +190,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText("Find ..."); + b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); } ControlFactory.createTagsWidget(parent, this); From 7ae928b5a4cd375d2277803d8d9472385aba69d4 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 11 Mar 2010 22:19:42 +0000 Subject: [PATCH 0025/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * implemented remove actions --- .../component/virtual/VCommandEditor.java | 66 +++++++---- .../component/virtual/VControlEditor.java | 16 +++ .../component/virtual/VHandlerEditor.java | 75 +++++++++---- .../component/virtual/VKeyBindingEditor.java | 106 +++++++++++------- .../component/virtual/VWindowEditor.java | 27 ++++- .../component/virtual/VWindowTrimEditor.java | 16 +++ 6 files changed, 214 insertions(+), 92 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index eddf3aa6ff..3a7306a3c5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -10,22 +10,27 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.util.List; + import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MCommand; +import org.eclipse.e4.ui.model.application.MHandler; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; @@ -43,6 +48,7 @@ public class VCommandEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private ModelEditor editor; + private TableViewer viewer; public VCommandEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); @@ -75,7 +81,9 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); composite = createForm(parent,context, getMaster()); } - getMaster().setValue(((VirtualEntry)object).getOriginalParent()); + VirtualEntry o = (VirtualEntry)object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); return composite; } @@ -89,29 +97,32 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, l.setText("Commands"); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - TableViewer viewer = new TableViewer(parent); + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); viewer.getTable().setHeaderVisible(true); - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Name"); - column.getColumn().setWidth(200); - - column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Id"); - column.getColumn().setWidth(200); - - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.APPLICATION__COMMANDS); - IValueProperty[] props = { - EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID), - EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND__COMMAND_NAME) - }; - - ViewerSupport.bind(viewer, prop.observeDetail(getMaster()), props); + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Name"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND__COMMAND_NAME); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Id"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); GridLayout gl = new GridLayout(); @@ -152,9 +163,20 @@ public void widgetSelected(SelectionEvent e) { b.setText("Remove"); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List commands = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.APPLICATION__COMMANDS, commands); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); } - return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java index 4df23d77de..af30d970c2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.util.List; + import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -27,8 +29,10 @@ import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; @@ -199,6 +203,18 @@ public void widgetSelected(SelectionEvent e) { b.setText("Remove"); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List controls = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, controls); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index 708d8a28f8..f93b39920d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -10,10 +10,12 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.util.List; + import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationFactory; @@ -23,10 +25,12 @@ import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; @@ -44,6 +48,7 @@ public class VHandlerEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private ModelEditor editor; + private TableViewer viewer; public VHandlerEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); @@ -76,7 +81,9 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); composite = createForm(parent,context, getMaster()); } - getMaster().setValue(((VirtualEntry)object).getOriginalParent()); + VirtualEntry o = (VirtualEntry)object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); return composite; } @@ -90,33 +97,41 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, l.setText("Handlers"); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - TableViewer viewer = new TableViewer(parent); + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); viewer.getTable().setHeaderVisible(true); - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Command"); - column.getColumn().setWidth(200); - - column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Class"); - column.getColumn().setWidth(300); - - column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Id"); - column.getColumn().setWidth(150); - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); - IValueProperty[] props = { - EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLER__COMMAND, MApplicationPackage.Literals.COMMAND__COMMAND_NAME)), - EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI), - EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID) - }; + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLER__COMMAND, MApplicationPackage.Literals.COMMAND__COMMAND_NAME)); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Command"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } - ViewerSupport.bind(viewer, prop.observeDetail(getMaster()), props); + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Class"); + column.getColumn().setWidth(300); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Id"); + column.getColumn().setWidth(150); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); GridLayout gl = new GridLayout(); @@ -157,6 +172,18 @@ public void widgetSelected(SelectionEvent e) { b.setText("Remove"); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List handlers = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS, handlers); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java index b086f10eaa..df1e2d2bbf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java @@ -10,23 +10,28 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.util.List; + import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MHandler; import org.eclipse.e4.ui.model.application.MKeyBinding; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; @@ -44,6 +49,7 @@ public class VKeyBindingEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private ModelEditor editor; + private TableViewer viewer; public VKeyBindingEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); @@ -72,17 +78,18 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + composite = createForm(parent, context, getMaster()); } - getMaster().setValue(((VirtualEntry)object).getOriginalParent()); + VirtualEntry o = (VirtualEntry) object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); { @@ -90,41 +97,49 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, l.setText("Keybindings"); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - TableViewer viewer = new TableViewer(parent); + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); viewer.getTable().setHeaderVisible(true); - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("KeySequence"); - column.getColumn().setWidth(100); - - column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Command"); - column.getColumn().setWidth(200); - - column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Id"); - column.getColumn().setWidth(170); - - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); - IValueProperty[] props = { - EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.KEY_SEQUENCE__KEY_SEQUENCE), - EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.KEY_BINDING__COMMAND, MApplicationPackage.Literals.COMMAND__COMMAND_NAME)), - EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID) - }; - - ViewerSupport.bind(viewer, prop.observeDetail(getMaster()), props); - + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.KEY_SEQUENCE__KEY_SEQUENCE); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("KeySequence"); + column.getColumn().setWidth(100); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.KEY_BINDING__COMMAND, MApplicationPackage.Literals.COMMAND__COMMAND_NAME)); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Command"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Id"); + column.getColumn().setWidth(170); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); @@ -146,8 +161,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, public void widgetSelected(SelectionEvent e) { MKeyBinding handler = MApplicationFactory.eINSTANCE.createKeyBinding(); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS, handler); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); editor.setSelection(handler); } @@ -158,9 +173,20 @@ public void widgetSelected(SelectionEvent e) { b.setText("Remove"); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List keybinding = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS, keybinding); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); } - return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index 3b5bf2a6a5..aed6c06a28 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.util.List; + import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -22,11 +24,12 @@ import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; @@ -44,6 +47,7 @@ public class VWindowEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private ModelEditor editor; + private TableViewer viewer; public VWindowEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); @@ -76,7 +80,9 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); composite = createForm(parent,context, getMaster()); } - getMaster().setValue(((VirtualEntry)object).getOriginalParent()); + VirtualEntry o = (VirtualEntry) object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); return composite; } @@ -90,7 +96,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, l.setText("Windows"); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - TableViewer viewer = new TableViewer(parent); + viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); @@ -144,9 +150,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); } - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); GridLayout gl = new GridLayout(); @@ -187,6 +190,18 @@ public void widgetSelected(SelectionEvent e) { b.setText("Remove"); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List windows = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, windows); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java index f87f30b9ae..2e3e539efe 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.util.List; + import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -22,8 +24,10 @@ import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; @@ -138,6 +142,18 @@ public void widgetSelected(SelectionEvent e) { b.setText("Remove"); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List trimElements = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, trimElements); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); } From 641bf06e50acba9751d63fce894f15700bc02336 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 12 Mar 2010 00:14:38 +0000 Subject: [PATCH 0026/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * added menu implementation parts --- .../emf/ui/internal/common/ModelEditor.java | 11 +- .../component/DirectMenuItemEditor.java | 59 ++++ .../component/HandledMenuItemEditor.java | 59 ++++ .../internal/common/component/MenuEditor.java | 267 +++++++++++++++++ .../common/component/MenuItemEditor.java | 273 ++++++++++++++++++ .../common/component/WindowTrimEditor.java | 1 - .../common/component/virtual/VMenuEditor.java | 168 +++++++++++ .../component/virtual/VWindowEditor.java | 222 +++++++------- 8 files changed, 945 insertions(+), 115 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 79ae2c45c9..042e28c16b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -24,11 +24,15 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ShadowComposite; import org.eclipse.e4.tools.emf.ui.internal.common.component.ApplicationEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.DirectMenuItemEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.HandledMenuItemEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.KeyBindingEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.CommandEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.DirectToolItemEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.HandledToolItemEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.HandlerEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ModelComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ModelComponentsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PartDescriptorEditor; @@ -46,6 +50,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VControlEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VKeyBindingEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; @@ -186,7 +191,7 @@ private TreeViewer createTreeViewerArea(Composite parent) { private void registerVirtualEditors() { virtualEditors = new AbstractComponentEditor[] { - null, // V-Menu + new VMenuEditor(modelProvider.getEditingDomain(),this), // V-Menu null, // V-Part new VHandlerEditor(modelProvider.getEditingDomain(),this), new VKeyBindingEditor(modelProvider.getEditingDomain(), this), @@ -222,6 +227,10 @@ private void registerDefaultEditors() { registerEditor( MApplicationPackage.Literals.PERSPECTIVE_STACK, new PerspectiveStackEditor(modelProvider.getEditingDomain())); registerEditor( MApplicationPackage.Literals.PERSPECTIVE, new PerspectiveEditor(modelProvider.getEditingDomain())); registerEditor( MApplicationPackage.Literals.PLACEHOLDER, new PlaceholderEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.MENU, new MenuEditor(modelProvider.getEditingDomain(), this)); + registerEditor( MApplicationPackage.Literals.MENU_ITEM, new MenuItemEditor(modelProvider.getEditingDomain(), this)); + registerEditor( MApplicationPackage.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), this)); + registerEditor( MApplicationPackage.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this)); } public void registerEditor(EClass eClass, AbstractComponentEditor editor) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java new file mode 100644 index 0000000000..59a9e66ff7 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class DirectMenuItemEditor extends MenuItemEditor { + private Image image; + + public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain, editor); + } + + @Override + public Image getImage(Object element, Display display) { + if( image == null ) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/DirectMenuItem.gif")); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "DirectMenuItem"; + } + + @Override + public String getDescription(Object element) { + return "DirectMenuItem bla bla bla"; + } + + @Override + protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java new file mode 100644 index 0000000000..a3d534cfde --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class HandledMenuItemEditor extends MenuItemEditor { + private Image image; + + public HandledMenuItemEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain, editor); + } + + @Override + public Image getImage(Object element, Display display) { + if( image == null ) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/HandledMenuItem.gif")); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "HandledMenuItem"; + } + + @Override + public String getDescription(Object element) { + return "HandledMenuItem bla bla bla"; + } + + @Override + protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java new file mode 100644 index 0000000000..cfa7ca9cc2 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -0,0 +1,267 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MDirectMenuItem; +import org.eclipse.e4.ui.model.application.MHandledMenuItem; +import org.eclipse.e4.ui.model.application.MHandler; +import org.eclipse.e4.ui.model.application.MMenuItem; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class MenuEditor extends AbstractComponentEditor { + + private Composite composite; + private Image image; + private EMFDataBindingContext context; + private ModelEditor editor; + + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + + public MenuEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + if( image == null ) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Menu.gif")); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "Menu"; + } + + @Override + public String getDescription(Object element) { + return "Menu bla bla bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("MenuItems"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final TableViewer viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + + { + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Type"); + column.getColumn().setWidth(100); + column.setLabelProvider(new ComponentLabelProvider(editor)); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ITEM__TYPE); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("ItemType"); + column.getColumn().setWidth(100); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Label"); + column.getColumn().setWidth(100); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + viewer.setInput(prop.observeDetail(master)); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add MenuItem ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MMenuItem handler = MApplicationFactory.eINSTANCE.createMenuItem(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add Handled-MenuItem ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MHandledMenuItem handler = MApplicationFactory.eINSTANCE.createHandledMenuItem(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add Direct-MenuItem ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MDirectMenuItem handler = MApplicationFactory.eINSTANCE.createDirectMenuItem(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List keybinding = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return ELEMENT_CONTAINER__CHILDREN.observe(element); + } + + @Override + public String getDetailLabel(Object element) { + return null; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java new file mode 100644 index 0000000000..287a145bea --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -0,0 +1,273 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MDirectMenuItem; +import org.eclipse.e4.ui.model.application.MHandledMenuItem; +import org.eclipse.e4.ui.model.application.MHandler; +import org.eclipse.e4.ui.model.application.MMenuItem; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class MenuItemEditor extends AbstractComponentEditor { + + private Composite composite; + private Image image; + private EMFDataBindingContext context; + private ModelEditor editor; + + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + + public MenuItemEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + if( image == null ) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/MenuItem.gif")); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "MenuItem"; + } + + @Override + public String getDescription(Object element) { + return "MenuItem bla bla bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + } + + createFormSubTypeForm(parent, context, master); + + return parent; + } + + protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("MenuItems"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final TableViewer viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + + { + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Type"); + column.getColumn().setWidth(100); + column.setLabelProvider(new ComponentLabelProvider(editor)); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ITEM__TYPE); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("ItemType"); + column.getColumn().setWidth(100); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Label"); + column.getColumn().setWidth(100); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + viewer.setInput(prop.observeDetail(master)); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add MenuItem ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MMenuItem handler = MApplicationFactory.eINSTANCE.createMenuItem(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add Handled-MenuItem ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MHandledMenuItem handler = MApplicationFactory.eINSTANCE.createHandledMenuItem(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add Direct-MenuItem ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MDirectMenuItem handler = MApplicationFactory.eINSTANCE.createDirectMenuItem(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List keybinding = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + } + + @Override + public IObservableList getChildList(Object element) { + return ELEMENT_CONTAINER__CHILDREN.observe(element); + } + + @Override + public String getDetailLabel(Object element) { + return null; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java index 31dd6d0540..33ae1f5b15 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java @@ -18,7 +18,6 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.ui.model.application.ItemType; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MTrimContainer; import org.eclipse.e4.ui.model.application.SideValue; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java new file mode 100644 index 0000000000..965dc168a0 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -0,0 +1,168 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import java.util.List; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MMenu; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VMenuEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private ModelEditor editor; + private TableViewer viewer; + + public VMenuEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "Menus"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Menus Bla Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + composite = createForm(parent, context, getMaster()); + } + VirtualEntry o = (VirtualEntry) object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + Label l = new Label(parent, SWT.NONE); + l.setText("Menus"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); + viewer.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MMenu handler = MApplicationFactory.eINSTANCE.createMenu(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.PART__MENUS, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List windows = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.PART__MENUS, windows); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index aed6c06a28..f065d0d409 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -76,9 +76,9 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + composite = createForm(parent, context, getMaster()); } VirtualEntry o = (VirtualEntry) object; viewer.setInput(o.getList()); @@ -86,124 +86,120 @@ public Composite getEditor(Composite parent, Object object) { return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); + Label l = new Label(parent, SWT.NONE); + l.setText("Windows"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + { - Label l = new Label(parent, SWT.NONE); - l.setText("Windows"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Name"); - column.getColumn().setWidth(180); - column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__X); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("X"); - column.getColumn().setWidth(80); - column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__Y); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Y"); - column.getColumn().setWidth(80); - column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__WIDTH); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Width"); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__HEIGHT); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Height"); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Name"); + column.getColumn().setWidth(180); + column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__X); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("X"); + column.getColumn().setWidth(80); + column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__Y); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Y"); + column.getColumn().setWidth(80); + column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__WIDTH); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Width"); + column.getColumn().setWidth(100); + column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__HEIGHT); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Height"); + column.getColumn().setWidth(100); + column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); + } + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MWindow handler = MApplicationFactory.eINSTANCE.createWindow(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } } - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MWindow handler = MApplicationFactory.eINSTANCE.createWindow(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); - - if( cmd.canExecute() ) { + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List windows = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, windows); + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List windows = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, windows); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } } } - }); - } - + } + }); return parent; } From b705e2748d674eb7a8f797994c50082e12a50686 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 13 Mar 2010 10:39:02 +0000 Subject: [PATCH 0027/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * implemented some menu details --- .../component/DirectMenuItemEditor.java | 23 ++++++++ .../internal/common/component/MenuEditor.java | 11 +--- .../common/component/MenuItemEditor.java | 54 +++++++++++++++---- .../internal/common/component/PartEditor.java | 2 + 4 files changed, 71 insertions(+), 19 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index 59a9e66ff7..408a5ae179 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -15,11 +15,20 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class DirectMenuItemEditor extends MenuItemEditor { private Image image; @@ -54,6 +63,20 @@ public String getDescription(Object element) { @Override protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Class URI"); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); + + Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setText("Find ..."); + } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index cfa7ca9cc2..aeb7bd659f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -139,7 +139,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Type"); - column.getColumn().setWidth(100); + column.getColumn().setWidth(300); column.setLabelProvider(new ComponentLabelProvider(editor)); } @@ -152,15 +152,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Label"); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } - IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(master)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 287a145bea..d9b85af5c8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -27,6 +27,7 @@ import org.eclipse.e4.ui.model.application.MHandledMenuItem; import org.eclipse.e4.ui.model.application.MHandler; import org.eclipse.e4.ui.model.application.MMenuItem; +import org.eclipse.e4.ui.model.application.MUILabel; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; @@ -121,6 +122,45 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); } + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Label"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Tooltip"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Icon URI"); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + + Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setText("Find ..."); + } + + createFormSubTypeForm(parent, context, master); return parent; @@ -147,7 +187,7 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con { TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Type"); - column.getColumn().setWidth(100); + column.getColumn().setWidth(300); column.setLabelProvider(new ComponentLabelProvider(editor)); } @@ -160,14 +200,6 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Label"); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(master)); @@ -268,6 +300,10 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { + MUILabel label = (MUILabel) element; + if( label.getLabel() != null && label.getLabel().trim().length() > 0 ) { + return label.getLabel(); + } return null; } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 4b66c2ea3e..6c535e8a44 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -145,6 +145,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText("Find ..."); } @@ -158,6 +159,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText("Find ..."); } From eccd80cafc5bce2ce81ced3cb6412643d254d7eb Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 13 Mar 2010 14:45:59 +0000 Subject: [PATCH 0028/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * added support for viewer updates --- .../component/AbstractComponentEditor.java | 7 ++ .../emf/ui/internal/common/ModelEditor.java | 72 ++++++++++- .../common/component/CommandEditor.java | 8 ++ .../common/component/HandlerEditor.java | 27 ++-- .../common/component/KeyBindingEditor.java | 63 +++++----- .../internal/common/component/MenuEditor.java | 19 +++ .../common/component/MenuItemEditor.java | 119 ++++++++++++++++-- 7 files changed, 260 insertions(+), 55 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index 532731877c..8a376fe144 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -18,7 +18,10 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.core.runtime.FileLocator; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; @@ -96,4 +99,8 @@ protected Image loadSharedImage(Display d, URL path) { } return null; } + + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] {}; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 042e28c16b..f3a20636de 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -10,14 +10,23 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.Set; import javax.inject.Inject; import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.map.IMapChangeListener; +import org.eclipse.core.databinding.observable.map.IObservableMap; +import org.eclipse.core.databinding.observable.map.MapChangeEvent; import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory; +import org.eclipse.core.databinding.observable.set.ISetChangeListener; +import org.eclipse.core.databinding.observable.set.SetChangeEvent; +import org.eclipse.core.databinding.observable.set.WritableSet; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.e4.tools.emf.ui.common.IModelResource; @@ -54,6 +63,8 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider; @@ -84,6 +95,7 @@ public class ModelEditor { private Map editorMap = new HashMap(); private AbstractComponentEditor[] virtualEditors; + private List labelFeaturePaths = new ArrayList(); // private List editors = new ArrayList(); @@ -178,11 +190,41 @@ private TreeViewer createTreeViewerArea(Composite parent) { parent.setLayout(l); ShadowComposite editingArea = new ShadowComposite(parent,SWT.NONE); editingArea.setLayout(new FillLayout()); - TreeViewer viewer = new TreeViewer(editingArea,SWT.FULL_SELECTION|SWT.H_SCROLL|SWT.V_SCROLL); + final TreeViewer viewer = new TreeViewer(editingArea,SWT.FULL_SELECTION|SWT.H_SCROLL|SWT.V_SCROLL); viewer.setLabelProvider(new ComponentLabelProvider(this)); ObservableListTreeContentProvider contentProvider = new ObservableListTreeContentProvider( new ObservableFactoryImpl(), new TreeStructureAdvisorImpl()); viewer.setContentProvider(contentProvider); + + final WritableSet clearedSet = new WritableSet(); + + contentProvider.getKnownElements().addSetChangeListener(new ISetChangeListener() { + + public void handleSetChange(SetChangeEvent event) { + for( Object o : event.diff.getAdditions() ) { + if( o instanceof EObject ) { + clearedSet.add(o); + } + } + + for( Object o : event.diff.getRemovals() ) { + if( o instanceof EObject ) { + clearedSet.remove(o); + } + } + } + }); + + for( FeaturePath p : labelFeaturePaths ) { + IObservableMap map = EMFProperties.value(p).observeDetail(clearedSet); + map.addMapChangeListener(new IMapChangeListener() { + + public void handleMapChange(MapChangeEvent event) { + viewer.update(event.diff.getChangedKeys().toArray(), null); + } + }); + } + viewer.setInput(modelProvider.getRoot()); viewer.expandAll(); @@ -235,6 +277,34 @@ private void registerDefaultEditors() { public void registerEditor(EClass eClass, AbstractComponentEditor editor) { editorMap.put(eClass, editor); + + for( FeaturePath p : editor.getLabelProperties() ) { + boolean found = false; + for( FeaturePath tmp : labelFeaturePaths ) { + if( equalsPaths(p, tmp) ) { + found = true; + break; + } + } + + if( ! found ) { + labelFeaturePaths.add(p); + } + } + } + + private boolean equalsPaths(FeaturePath p1, FeaturePath p2) { + if( p1.getFeaturePath().length == p2.getFeaturePath().length ) { + for( int i = 0; i < p1.getFeaturePath().length; i++ ) { + if( ! p1.getFeaturePath()[i].equals(p2.getFeaturePath()[i]) ) { + return false; + } + } + + return true; + } + + return false; } public AbstractComponentEditor getEditor(EClass eClass) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index c3c309c89e..f1ee59f784 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -19,6 +19,7 @@ import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MCommand; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.edit.domain.EditingDomain; @@ -208,5 +209,12 @@ public String getDetailLabel(Object element) { return null; } + + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { + FeaturePath.fromList(MApplicationPackage.Literals.COMMAND__COMMAND_NAME) + }; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 11a4177e55..7b7ac5d7e6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -42,10 +42,9 @@ public HandlerEditor(EditingDomain editingDomain) { super(editingDomain); } - @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Handler.gif")); } catch (MalformedURLException e) { @@ -68,16 +67,16 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context); + composite = createForm(parent, context); } getMaster().setValue(object); return composite; } private Composite createForm(Composite parent, EMFDataBindingContext context) { - parent = new Composite(parent,SWT.NONE); + parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -89,9 +88,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -102,9 +101,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEnabled(false); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value( getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLER__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLER__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(getMaster())); - Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText("Find ..."); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); @@ -117,9 +116,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(getMaster())); - Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setText("Find ..."); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); @@ -139,11 +138,15 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { MHandler handler = (MHandler) element; - if( handler.getCommand() != null && handler.getCommand().getCommandName() != null && handler.getCommand().getCommandName().trim().length() > 0 ) { + if (handler.getCommand() != null && handler.getCommand().getCommandName() != null && handler.getCommand().getCommandName().trim().length() > 0) { return handler.getCommand().getCommandName(); } return null; } + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { FeaturePath.fromList(MApplicationPackage.Literals.HANDLER__COMMAND, MApplicationPackage.Literals.COMMAND__COMMAND_NAME) }; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 9dc8a2d8f3..195137df1c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -68,7 +68,7 @@ public KeyBindingEditor(EditingDomain editingDomain) { @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/KeyBinding.gif")); } catch (MalformedURLException e) { @@ -92,16 +92,16 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context); + composite = createForm(parent, context); } getMaster().setValue(object); return composite; } private Composite createForm(Composite parent, EMFDataBindingContext context) { - parent = new Composite(parent,SWT.NONE); + parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -113,9 +113,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -125,9 +125,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.KEY_SEQUENCE__KEY_SEQUENCE).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.KEY_SEQUENCE__KEY_SEQUENCE).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -138,9 +138,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEnabled(false); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value( getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.KEY_BINDING__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.KEY_BINDING__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(getMaster())); - Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText("Find ..."); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); @@ -165,12 +165,12 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { @Override protected void setValue(Object element, Object value) { - ((MParameter)element).setTag((String) value); + ((MParameter) element).setTag((String) value); } @Override protected Object getValue(Object element) { - String val = ((MParameter)element).getTag(); + String val = ((MParameter) element).getTag(); return val == null ? "" : val; } @@ -193,12 +193,12 @@ protected boolean canEdit(Object element) { @Override protected void setValue(Object element, Object value) { - ((MParameter)element).setValue((String) value); + ((MParameter) element).setValue((String) value); } @Override protected Object getValue(Object element) { - String val = ((MParameter)element).getValue(); + String val = ((MParameter) element).getValue(); return val == null ? "" : val; } @@ -216,28 +216,23 @@ protected boolean canEdit(Object element) { ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(tableviewer) { @Override protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { - boolean singleSelect = ((IStructuredSelection)tableviewer.getSelection()).size() == 1; - boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent)event.sourceEvent).button == 1; + boolean singleSelect = ((IStructuredSelection) tableviewer.getSelection()).size() == 1; + boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent) event.sourceEvent).button == 1; - return singleSelect && (isLeftDoubleMouseSelect - || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC - || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); + return singleSelect && (isLeftDoubleMouseSelect || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); } }; TableViewerEditor.create(tableviewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); - ViewerSupport.bind(tableviewer, prop.observeDetail(getMaster()), new IValueProperty[] { - EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__TAG), - EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__VALUE) - }); + ViewerSupport.bind(tableviewer, prop.observeDetail(getMaster()), new IValueProperty[] { EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__TAG), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__VALUE) }); Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); @@ -260,7 +255,7 @@ public void widgetSelected(SelectionEvent e) { MKeyBinding item = (MKeyBinding) getMaster().getValue(); MParameter param = MApplicationFactory.eINSTANCE.createParameter(); Command cmd = AddCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.KEY_BINDING__PARAMETERS, param); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } tableviewer.editElement(param, 0); @@ -273,10 +268,10 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection) tableviewer.getSelection(); - if( !s.isEmpty() ) { + if (!s.isEmpty()) { MKeyBinding item = (MKeyBinding) getMaster().getValue(); Command cmd = RemoveCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.KEY_BINDING__PARAMETERS, s.toList()); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } @@ -300,10 +295,14 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { MKeySequence seq = (MKeySequence) element; - if( seq.getKeySequence() != null && seq.getKeySequence().trim().length() > 0 ) { + if (seq.getKeySequence() != null && seq.getKeySequence().trim().length() > 0) { return seq.getKeySequence(); } return null; } + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { FeaturePath.fromList(MApplicationPackage.Literals.KEY_SEQUENCE__KEY_SEQUENCE) }; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index aeb7bd659f..a62493c72d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -21,6 +21,7 @@ import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.ItemType; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MDirectMenuItem; @@ -174,6 +175,24 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add Separator ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MMenuItem handler = MApplicationFactory.eINSTANCE.createMenuItem(); + handler.setType(ItemType.SEPARATOR); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Add MenuItem ..."); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index d9b85af5c8..1035aaed48 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -12,15 +12,19 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.ItemType; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MDirectMenuItem; @@ -31,6 +35,7 @@ import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; @@ -44,6 +49,7 @@ import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StackLayout; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -58,7 +64,8 @@ public class MenuItemEditor extends AbstractComponentEditor { private Composite composite; - private Image image; + private Image menuImage; + private Image separatorImage; private EMFDataBindingContext context; private ModelEditor editor; @@ -71,21 +78,41 @@ public MenuItemEditor(EditingDomain editingDomain, ModelEditor editor) { @Override public Image getImage(Object element, Display display) { - if( image == null ) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/MenuItem.gif")); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + MMenuItem item = (MMenuItem) element; + if( item.getType() == ItemType.SEPARATOR ) { + if( separatorImage == null ) { + try { + separatorImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/MenuItem_separator.gif")); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return separatorImage; + } else { + if( menuImage == null ) { + try { + menuImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/MenuItem.gif")); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } - } - return image; + return menuImage; + } } @Override public String getLabel(Object element) { - return "MenuItem"; + MMenuItem item = (MMenuItem) element; + if( item.getType() == ItemType.SEPARATOR ) { + return "Separator"; + } else { + return "MenuItem"; + } + } @Override @@ -105,6 +132,53 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + final Composite container = new Composite(parent, SWT.NONE); + final StackLayout layout = new StackLayout(); + container.setLayout(layout); + + final Composite menuFormComposite = createMenuItemForm(container, context, master); + final Composite separatorComposite = createSeparatorForm(container, context, master); + + getMaster().addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + MMenuItem item = (MMenuItem) event.diff.getNewValue(); + if( item.getType() == ItemType.SEPARATOR ) { + layout.topControl = separatorComposite; + } else { + layout.topControl = menuFormComposite; + } + container.layout(true, true); + } + }); + + return container; + } + + private Composite createSeparatorForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + } + + return parent; + } + + private Composite createMenuItemForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); @@ -223,6 +297,24 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add Separator ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MMenuItem handler = MApplicationFactory.eINSTANCE.createMenuItem(); + handler.setType(ItemType.SEPARATOR); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Add MenuItem ..."); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); @@ -306,4 +398,11 @@ public String getDetailLabel(Object element) { } return null; } + + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { + FeaturePath.fromList(MApplicationPackage.Literals.UI_LABEL__LABEL) + }; + } } \ No newline at end of file From 3653dd91f70f275cccfe026fb92de1fece3520f3 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 13 Mar 2010 15:42:14 +0000 Subject: [PATCH 0029/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * implemented property editors for commands and handleditems --- .../emf/ui/internal/common/ModelEditor.java | 1 - .../common/component/CommandEditor.java | 179 +++++++++++++-- .../component/HandledMenuItemEditor.java | 210 +++++++++++++++++- .../component/HandledToolItemEditor.java | 129 ++++++----- .../common/component/MenuItemEditor.java | 1 - .../internal/common/component/PartEditor.java | 7 + .../component/PartSashContainerEditor.java | 7 + .../common/component/PartStackEditor.java | 1 - .../common/component/PerspectiveEditor.java | 8 + .../common/component/ToolBarEditor.java | 1 - .../common/component/ToolItemEditor.java | 8 + .../common/component/WindowEditor.java | 9 +- .../common/component/WindowTrimEditor.java | 8 + .../component/virtual/VCommandEditor.java | 4 +- 14 files changed, 492 insertions(+), 81 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index f3a20636de..5503557b46 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -14,7 +14,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; import javax.inject.Inject; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index f1ee59f784..e418a4cf1b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -14,21 +14,40 @@ import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MCommand; +import org.eclipse.e4.ui.model.application.MCommandParameter; +import org.eclipse.e4.ui.model.application.MParameter; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.ColumnViewerEditor; +import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; +import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; +import org.eclipse.jface.viewers.ComboBoxCellEditor; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.viewers.TableViewerEditor; +import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -131,33 +150,145 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { l.setText("Parameters"); l.setLayoutData(new GridData(GridData.BEGINNING,GridData.BEGINNING,false,false)); - TableViewer viewer = new TableViewer(parent,SWT.FULL_SELECTION|SWT.MULTI|SWT.BORDER); + final TableViewer viewer = new TableViewer(parent,SWT.FULL_SELECTION|SWT.MULTI|SWT.BORDER); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); viewer.getTable().setHeaderVisible(true); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 120; viewer.getControl().setLayoutData(gd); - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Name"); - column.getColumn().setWidth(200); + { + IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND_PARAMETER__NAME); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Name"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + column.setEditingSupport(new EditingSupport(viewer) { + private TextCellEditor editor = new TextCellEditor(viewer.getTable()); + + @Override + protected void setValue(Object element, Object value) { + Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.COMMAND_PARAMETER__NAME, value); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + @Override + protected Object getValue(Object element) { + MCommandParameter obj = (MCommandParameter) element; + return obj.getName() != null ? obj.getName() : ""; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return editor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + } + + { + IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND_PARAMETER__TYPE_ID); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Type-Id"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + column.setEditingSupport(new EditingSupport(viewer) { + private TextCellEditor editor = new TextCellEditor(viewer.getTable()); + + @Override + protected void setValue(Object element, Object value) { + Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.COMMAND_PARAMETER__TYPE_ID, value); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + @Override + protected Object getValue(Object element) { + MCommandParameter obj = (MCommandParameter) element; + return obj.getTypeId() != null ? obj.getTypeId() : ""; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return editor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + } - column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Type-Id"); - column.getColumn().setWidth(200); + { + IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND_PARAMETER__OPTIONAL); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Optional"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements())) { + @Override + public String getText(MCommandParameter element) { + return element.isOptional() ? "yes" : "no"; + } + }); + column.setEditingSupport(new EditingSupport(viewer) { + private ComboBoxCellEditor editor = new ComboBoxCellEditor(viewer.getTable(), new String[] { "yes", "no" }); + + @Override + protected void setValue(Object element, Object value) { + int idx = ((Number)value).intValue(); + Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.COMMAND_PARAMETER__OPTIONAL, idx == 0); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + @Override + protected Object getValue(Object element) { + MCommandParameter obj = (MCommandParameter) element; + return obj.isOptional() ? 0 : 1; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return editor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + } - column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Optional"); - column.getColumn().setWidth(200); + ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(viewer) { + @Override + protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { + boolean singleSelect = ((IStructuredSelection)viewer.getSelection()).size() == 1; + boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent)event.sourceEvent).button == 1; - IEMFEditListProperty mProp = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.COMMAND__PARAMETERS); - IValueProperty[] props = { - EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND_PARAMETER__NAME), - EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND_PARAMETER__TYPE_ID), - EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND_PARAMETER__OPTIONAL) + return singleSelect && (isLeftDoubleMouseSelect + || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC + || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); + } }; + TableViewerEditor.create(viewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); - ViewerSupport.bind(viewer, mProp.observeDetail(getMaster()), props); + + IEMFEditListProperty mProp = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.COMMAND__PARAMETERS); + viewer.setInput(mProp.observeDetail(getMaster())); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); @@ -182,6 +313,18 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { b.setText("Add ..."); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MCommandParameter param = MApplicationFactory.eINSTANCE.createCommandParameter(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.COMMAND__PARAMETERS, param); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.editElement(param, 0); + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Remove"); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index a3d534cfde..e796142c1f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -14,12 +14,47 @@ import java.net.URL; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MHandledItem; +import org.eclipse.e4.ui.model.application.MParameter; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFValueProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.ColumnViewerEditor; +import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; +import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.viewers.TableViewerEditor; +import org.eclipse.jface.viewers.TextCellEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class HandledMenuItemEditor extends MenuItemEditor { private Image image; @@ -53,7 +88,180 @@ public String getDescription(Object element) { } @Override - protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, final WritableValue master) { + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + Label l = new Label(parent, SWT.NONE); + l.setText("Command"); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + t.setEnabled(false); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value( getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLED_ITEM__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(master)); + + Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setText("Find ..."); + b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Parameters"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + + final TableViewer tableviewer = new TableViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 120; + tableviewer.getTable().setHeaderVisible(true); + tableviewer.getControl().setLayoutData(gd); + + ObservableListContentProvider cp = new ObservableListContentProvider(); + tableviewer.setContentProvider(cp); + + { + IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__TAG); + + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Tag"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + column.setEditingSupport(new EditingSupport(tableviewer) { + private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); + + @Override + protected void setValue(Object element, Object value) { + Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.PARAMETER__TAG, value); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + @Override + protected Object getValue(Object element) { + String val = ((MParameter)element).getTag(); + return val == null ? "" : val; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return cellEditor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + } + + { + IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__VALUE); + + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Value"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + column.setEditingSupport(new EditingSupport(tableviewer) { + private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); + + @Override + protected void setValue(Object element, Object value) { + Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.PARAMETER__VALUE, value); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + @Override + protected Object getValue(Object element) { + String val = ((MParameter)element).getValue(); + return val == null ? "" : val; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return cellEditor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + } + + + ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(tableviewer) { + @Override + protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { + boolean singleSelect = ((IStructuredSelection)tableviewer.getSelection()).size() == 1; + boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent)event.sourceEvent).button == 1; + + return singleSelect && (isLeftDoubleMouseSelect + || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC + || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); + } + }; + TableViewerEditor.create(tableviewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); + + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS); + tableviewer.setInput(prop.observeDetail(master)); + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MHandledItem item = (MHandledItem) master.getValue(); + MParameter param = MApplicationFactory.eINSTANCE.createParameter(); + Command cmd = AddCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS, param); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + tableviewer.editElement(param, 0); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent e) { + IStructuredSelection s = (IStructuredSelection) tableviewer.getSelection(); + if( !s.isEmpty() ) { + MHandledItem item = (MHandledItem) master.getValue(); + Command cmd = RemoveCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS, s.toList()); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + + }); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index 241e757d66..be54826183 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -14,7 +14,7 @@ import java.net.URL; import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MHandledItem; @@ -22,14 +22,16 @@ import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.ColumnViewerEditor; import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; @@ -102,63 +104,82 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext gd.heightHint = 120; tableviewer.getTable().setHeaderVisible(true); tableviewer.getControl().setLayoutData(gd); - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Tag"); - column.getColumn().setWidth(200); - column.setEditingSupport(new EditingSupport(tableviewer) { - private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); - @Override - protected void setValue(Object element, Object value) { - ((MParameter)element).setTag((String) value); - } + ObservableListContentProvider cp = new ObservableListContentProvider(); + tableviewer.setContentProvider(cp); + + { + IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__TAG); + + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Tag"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + column.setEditingSupport(new EditingSupport(tableviewer) { + private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); + + @Override + protected void setValue(Object element, Object value) { + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.PARAMETER__TAG, value); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } - @Override - protected Object getValue(Object element) { - String val = ((MParameter)element).getTag(); - return val == null ? "" : val; - } + @Override + protected Object getValue(Object element) { + String val = ((MParameter)element).getTag(); + return val == null ? "" : val; + } - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; - } + @Override + protected CellEditor getCellEditor(Object element) { + return cellEditor; + } - @Override - protected boolean canEdit(Object element) { - return true; - } - }); + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + } - column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Value"); - column.getColumn().setWidth(200); - column.setEditingSupport(new EditingSupport(tableviewer) { - private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); + { + IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__VALUE); + + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Value"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + column.setEditingSupport(new EditingSupport(tableviewer) { + private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); + + @Override + protected void setValue(Object element, Object value) { + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.PARAMETER__VALUE, value); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } - @Override - protected void setValue(Object element, Object value) { - ((MParameter)element).setValue((String) value); - } + @Override + protected Object getValue(Object element) { + String val = ((MParameter)element).getValue(); + return val == null ? "" : val; + } - @Override - protected Object getValue(Object element) { - String val = ((MParameter)element).getValue(); - return val == null ? "" : val; - } + @Override + protected CellEditor getCellEditor(Object element) { + return cellEditor; + } - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; - } + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + } - @Override - protected boolean canEdit(Object element) { - return true; - } - }); ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(tableviewer) { @Override @@ -173,11 +194,9 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even }; TableViewerEditor.create(tableviewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); - ViewerSupport.bind(tableviewer, prop.observeDetail(master), new IValueProperty[] { - EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__TAG), - EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__VALUE) - }); - + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS); + tableviewer.setInput(prop.observeDetail(getMaster())); + Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); GridLayout gl = new GridLayout(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 1035aaed48..1164cd85e1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; -import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 6c535e8a44..9e47b65682 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -25,6 +25,7 @@ import org.eclipse.e4.ui.model.application.MPart; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.edit.domain.EditingDomain; @@ -330,4 +331,10 @@ public String getDetailLabel(Object element) { return o.getLabel(); } + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { + FeaturePath.fromList(MApplicationPackage.Literals.UI_LABEL__LABEL) + }; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 7c353761b3..7336c2be68 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -25,6 +25,7 @@ import org.eclipse.e4.ui.model.application.MPartSashContainer; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; @@ -201,4 +202,10 @@ public String getDetailLabel(Object element) { return null; } + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { + FeaturePath.fromList(MApplicationPackage.Literals.GENERIC_TILE__HORIZONTAL) + }; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 6e701c5ef9..31ab7ea114 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -156,7 +156,6 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { - // TODO Auto-generated method stub return null; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 1ca98ba0ea..70730a4568 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -15,6 +15,7 @@ import org.eclipse.e4.ui.model.application.MPerspective; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; @@ -75,6 +76,13 @@ public String getDetailLabel(Object element) { return null; } + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { + FeaturePath.fromList(MApplicationPackage.Literals.UI_LABEL__LABEL) + }; + } + @Override public String getDescription(Object element) { return "Perspective Bla Bla Bla"; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index bdddc0c9f2..f04d8365d7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -85,7 +85,6 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { - // TODO Auto-generated method stub return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index f9e819342e..345d3b77ae 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -22,6 +22,7 @@ import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MToolItem; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -193,4 +194,11 @@ public String getDetailLabel(Object element) { return null; } + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { + FeaturePath.fromList(MApplicationPackage.Literals.UI_LABEL__LABEL), + FeaturePath.fromList(MApplicationPackage.Literals.UI_LABEL__TOOLTIP) + }; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 294fc7f4c7..8176e8d2ac 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -25,6 +25,7 @@ import org.eclipse.e4.ui.model.application.MWindowTrim; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -51,7 +52,6 @@ public class WindowEditor extends AbstractComponentEditor { public WindowEditor(EditingDomain editingDomain) { super(editingDomain); - // TODO Auto-generated constructor stub } @Override @@ -249,4 +249,11 @@ public String getDetailLabel(Object element) { } return null; } + + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { + FeaturePath.fromList(MApplicationPackage.Literals.UI_LABEL__LABEL) + }; + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java index 33ae1f5b15..bead362981 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java @@ -23,6 +23,7 @@ import org.eclipse.e4.ui.model.application.SideValue; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -139,5 +140,12 @@ public String getDetailLabel(Object element) { return null; } + + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { + FeaturePath.fromList(MApplicationPackage.Literals.TRIM_CONTAINER__SIDE) + }; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index 3a7306a3c5..467d12b48c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -106,7 +106,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, viewer.getTable().setHeaderVisible(true); { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND__COMMAND_NAME); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Name"); @@ -115,7 +115,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, } { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND__COMMAND_NAME); + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Id"); From 89ee9d45d8c7ebdbfba2aa25dd02c8dcb9184774 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 14 Mar 2010 10:53:16 +0000 Subject: [PATCH 0030/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * doing adds with a dropdown --- .../emf/ui/internal/common/ModelEditor.java | 2 +- .../common/component/CommandEditor.java | 1 - .../component/PartSashContainerEditor.java | 113 +++++++++++++++++- .../component/virtual/VControlEditor.java | 104 ++++++---------- 4 files changed, 150 insertions(+), 70 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 5503557b46..a2f28595b7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -258,7 +258,7 @@ private void registerDefaultEditors() { registerEditor( MApplicationPackage.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain())); registerEditor( MApplicationPackage.Literals.COMMAND,new CommandEditor(modelProvider.getEditingDomain())); registerEditor( MApplicationPackage.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor(modelProvider.getEditingDomain())); + registerEditor( MApplicationPackage.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor(modelProvider.getEditingDomain(), this)); registerEditor( MApplicationPackage.Literals.PART_STACK, new PartStackEditor(modelProvider.getEditingDomain())); registerEditor( MApplicationPackage.Literals.WINDOW_TRIM, new WindowTrimEditor(modelProvider.getEditingDomain())); registerEditor( MApplicationPackage.Literals.TOOL_BAR, new ToolBarEditor(modelProvider.getEditingDomain())); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index e418a4cf1b..85b70bb6bd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -20,7 +20,6 @@ import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MCommand; import org.eclipse.e4.ui.model.application.MCommandParameter; -import org.eclipse.e4.ui.model.application.MParameter; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 7336c2be68..349e9f5864 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -12,6 +12,7 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.List; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -21,27 +22,43 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MPartSashContainer; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.databinding.viewers.ViewerProperties; import org.eclipse.jface.databinding.viewers.ViewerSupport; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; @@ -53,12 +70,13 @@ public class PartSashContainerEditor extends AbstractComponentEditor { private Image vImage; private Image hImage; private EMFDataBindingContext context; + private ModelEditor editor; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); - public PartSashContainerEditor(EditingDomain editingDomain) { + public PartSashContainerEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); - // TODO Auto-generated constructor stub + this.editor = editor; } @Override @@ -188,6 +206,97 @@ public void handleValueChange(ValueChangeEvent event) { ControlFactory.createTagsWidget(parent, this); + { + Label l = new Label(parent, SWT.NONE); + l.setText("Controls"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final TableViewer viewer = new TableViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 200; + viewer.getControl().setLayoutData(gd); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + viewer.setLabelProvider(new ComponentLabelProvider(editor)); + + IEMFListProperty prop = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + viewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(2,false); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + EClass eclass = (EClass) element; + return eclass.getName(); + } + }); + childrenDropDown.setInput(new EClass[] { + MApplicationPackage.Literals.PART_SASH_CONTAINER, + MApplicationPackage.Literals.PART_STACK, + MApplicationPackage.Literals.PART + }); + childrenDropDown.setSelection(new StructuredSelection(MApplicationPackage.Literals.PART_SASH_CONTAINER)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! childrenDropDown.getSelection().isEmpty() ) { + EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); + EObject eObject = MApplicationFactory.eINSTANCE.create(eClass); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(eObject); + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List elements = ((IStructuredSelection)viewer.getSelection()).toList(); + + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, elements); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java index af30d970c2..5cd4a5a93f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java @@ -20,19 +20,21 @@ import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MPart; -import org.eclipse.e4.ui.model.application.MPartSashContainer; -import org.eclipse.e4.ui.model.application.MPartStack; -import org.eclipse.e4.ui.model.application.MPerspectiveStack; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; @@ -113,7 +115,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); + GridLayout gl = new GridLayout(2,false); gl.marginLeft=0; gl.marginRight=0; gl.marginWidth=0; @@ -123,92 +125,62 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Down"); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add Sash"); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MPartSashContainer handler = MApplicationFactory.eINSTANCE.createPartSashContainer(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); - } - } - }); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add PartStack"); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { @Override - public void widgetSelected(SelectionEvent e) { - MPartStack handler = MApplicationFactory.eINSTANCE.createPartStack(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); - } + public String getText(Object element) { + EClass eclass = (EClass) element; + return eclass.getName(); } }); - - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add PerspectiveStack"); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MPerspectiveStack handler = MApplicationFactory.eINSTANCE.createPerspectiveStack(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); - } - } + childrenDropDown.setInput(new EClass[] { + MApplicationPackage.Literals.PERSPECTIVE_STACK, + MApplicationPackage.Literals.PART_SASH_CONTAINER, + MApplicationPackage.Literals.PART_STACK, + MApplicationPackage.Literals.PART }); + childrenDropDown.setSelection(new StructuredSelection(MApplicationPackage.Literals.PERSPECTIVE_STACK)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add Part"); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MPart handler = MApplicationFactory.eINSTANCE.createPart(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); + if( ! childrenDropDown.getSelection().isEmpty() ) { + EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); + EObject eObject = MApplicationFactory.eINSTANCE.create(eClass); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(eObject); + } } } }); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Remove"); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if( ! viewer.getSelection().isEmpty() ) { - List controls = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, controls); + List elements = ((IStructuredSelection)viewer.getSelection()).toList(); + + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, elements); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } From 9c45b089711042ef6eb73d0e2fb51a56c480cdfe Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 14 Mar 2010 11:15:01 +0000 Subject: [PATCH 0031/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * small fix to keep the selection --- .../component/PartSashContainerEditor.java | 46 +++++++++++++++++++ .../component/virtual/VControlEditor.java | 46 +++++++++++++++++++ 2 files changed, 92 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 349e9f5864..b815c75844 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -26,6 +26,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MElementContainer; import org.eclipse.e4.ui.model.application.MPartSashContainer; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; @@ -38,6 +39,7 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -235,11 +237,55 @@ public void handleValueChange(ValueChangeEvent event) { b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Down"); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if( idx < container.getChildren().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); final ComboViewer childrenDropDown = new ComboViewer(buttonComp); childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java index 5cd4a5a93f..e7840fbdbc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java @@ -20,6 +20,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MElementContainer; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; @@ -27,6 +28,7 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -126,11 +128,55 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Down"); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if( idx < container.getChildren().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); final ComboViewer childrenDropDown = new ComboViewer(buttonComp); childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); From 4da73d0035a58f3460ef6a0eefce88ca5afbbe61 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 14 Mar 2010 11:32:03 +0000 Subject: [PATCH 0032/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * implemented menu-item move support * implemented menu-item adds using a dropdown --- .../internal/common/component/MenuEditor.java | 173 +++++++----- .../common/component/MenuItemEditor.java | 246 ++++++++++-------- 2 files changed, 239 insertions(+), 180 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index a62493c72d..0ff1793cb9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -24,8 +24,7 @@ import org.eclipse.e4.ui.model.application.ItemType; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MDirectMenuItem; -import org.eclipse.e4.ui.model.application.MHandledMenuItem; +import org.eclipse.e4.ui.model.application.MElementContainer; import org.eclipse.e4.ui.model.application.MHandler; import org.eclipse.e4.ui.model.application.MMenuItem; import org.eclipse.emf.common.command.Command; @@ -34,13 +33,19 @@ import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; @@ -64,6 +69,18 @@ public class MenuEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + private class Struct { + private final String label; + private final EClass eClass; + private final boolean separator; + + public Struct(String label, EClass eClass, boolean separator) { + this.label = label; + this.eClass = eClass; + this.separator = separator; + } + } + public MenuEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); this.editor = editor; @@ -71,7 +88,7 @@ public MenuEditor(EditingDomain editingDomain, ModelEditor editor) { @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Menu.gif")); } catch (MalformedURLException e) { @@ -95,17 +112,16 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + composite = createForm(parent, context, getMaster()); } getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -117,17 +133,17 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText("MenuItems"); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - + final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); @@ -136,14 +152,14 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, gd.heightHint = 300; viewer.getControl().setLayoutData(gd); viewer.getTable().setHeaderVisible(true); - + { TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Type"); column.getColumn().setWidth(300); column.setLabelProvider(new ComponentLabelProvider(editor)); } - + { IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ITEM__TYPE); @@ -152,13 +168,13 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, column.getColumn().setWidth(100); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - + IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(master)); - + Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -168,78 +184,95 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add Separator ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MMenuItem handler = MApplicationFactory.eINSTANCE.createMenuItem(); - handler.setType(ItemType.SEPARATOR); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); + } } } }); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add MenuItem ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MMenuItem handler = MApplicationFactory.eINSTANCE.createMenuItem(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if (idx < container.getChildren().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } } } }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add Handled-MenuItem ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MHandledMenuItem handler = MApplicationFactory.eINSTANCE.createHandledMenuItem(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); - } + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + Struct struct = (Struct) element; + return struct.label; } }); - + + Struct defaultStruct = new Struct("MenuItem", MApplicationPackage.Literals.MENU_ITEM, false); + childrenDropDown.setInput(new Struct[] { new Struct("Separator", MApplicationPackage.Literals.MENU_ITEM, true), defaultStruct, new Struct("Handled MenuItem", MApplicationPackage.Literals.HANDLED_MENU_ITEM, false), new Struct("Direct MenuItem", MApplicationPackage.Literals.DIRECT_MENU_ITEM, false) }); + childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add Direct-MenuItem ..."); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MDirectMenuItem handler = MApplicationFactory.eINSTANCE.createDirectMenuItem(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + if (!childrenDropDown.getSelection().isEmpty()) { + Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); + EClass eClass = struct.eClass; + MMenuItem eObject = (MMenuItem) MApplicationFactory.eINSTANCE.create(eClass); + + if (struct.separator) { + eObject.setType(ItemType.SEPARATOR); + } + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + if (!struct.separator) { + editor.setSelection(eObject); + } + } } } }); @@ -247,21 +280,21 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Remove"); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List keybinding = ((IStructuredSelection)viewer.getSelection()).toList(); + if (!viewer.getSelection().isEmpty()) { + List keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } } }); } - + return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 1164cd85e1..cec1707f45 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -26,8 +26,7 @@ import org.eclipse.e4.ui.model.application.ItemType; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MDirectMenuItem; -import org.eclipse.e4.ui.model.application.MHandledMenuItem; +import org.eclipse.e4.ui.model.application.MElementContainer; import org.eclipse.e4.ui.model.application.MHandler; import org.eclipse.e4.ui.model.application.MMenuItem; import org.eclipse.e4.ui.model.application.MUILabel; @@ -38,13 +37,19 @@ import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; @@ -60,7 +65,7 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; -public class MenuItemEditor extends AbstractComponentEditor { +public class MenuItemEditor extends AbstractComponentEditor { private Composite composite; private Image menuImage; @@ -70,6 +75,18 @@ public class MenuItemEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + private class Struct { + private final String label; + private final EClass eClass; + private final boolean separator; + + public Struct(String label, EClass eClass, boolean separator) { + this.label = label; + this.eClass = eClass; + this.separator = separator; + } + } + public MenuItemEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); this.editor = editor; @@ -78,8 +95,8 @@ public MenuItemEditor(EditingDomain editingDomain, ModelEditor editor) { @Override public Image getImage(Object element, Display display) { MMenuItem item = (MMenuItem) element; - if( item.getType() == ItemType.SEPARATOR ) { - if( separatorImage == null ) { + if (item.getType() == ItemType.SEPARATOR) { + if (separatorImage == null) { try { separatorImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/MenuItem_separator.gif")); } catch (MalformedURLException e) { @@ -87,10 +104,10 @@ public Image getImage(Object element, Display display) { e.printStackTrace(); } } - + return separatorImage; } else { - if( menuImage == null ) { + if (menuImage == null) { try { menuImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/MenuItem.gif")); } catch (MalformedURLException e) { @@ -106,12 +123,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { MMenuItem item = (MMenuItem) element; - if( item.getType() == ItemType.SEPARATOR ) { + if (item.getType() == ItemType.SEPARATOR) { return "Separator"; } else { - return "MenuItem"; + return "MenuItem"; } - + } @Override @@ -121,28 +138,27 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + composite = createForm(parent, context, getMaster()); } getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { final Composite container = new Composite(parent, SWT.NONE); final StackLayout layout = new StackLayout(); container.setLayout(layout); - + final Composite menuFormComposite = createMenuItemForm(container, context, master); final Composite separatorComposite = createSeparatorForm(container, context, master); - + getMaster().addValueChangeListener(new IValueChangeListener() { - + public void handleValueChange(ValueChangeEvent event) { MMenuItem item = (MMenuItem) event.diff.getNewValue(); - if( item.getType() == ItemType.SEPARATOR ) { + if (item.getType() == ItemType.SEPARATOR) { layout.topControl = separatorComposite; } else { layout.topControl = menuFormComposite; @@ -150,13 +166,12 @@ public void handleValueChange(ValueChangeEvent event) { container.layout(true, true); } }); - + return container; } - - private Composite createSeparatorForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); + + private Composite createSeparatorForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -168,17 +183,16 @@ private Composite createSeparatorForm(Composite parent, EMFDataBindingContext co Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); } - + return parent; } - - private Composite createMenuItemForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); + + private Composite createMenuItemForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -190,11 +204,11 @@ private Composite createMenuItemForm(Composite parent, EMFDataBindingContext con Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -202,9 +216,9 @@ private Composite createMenuItemForm(Composite parent, EMFDataBindingContext con Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); } // ------------------------------------------------------------ @@ -214,9 +228,9 @@ private Composite createMenuItemForm(Composite parent, EMFDataBindingContext con Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); } // ------------------------------------------------------------ @@ -226,28 +240,26 @@ private Composite createMenuItemForm(Composite parent, EMFDataBindingContext con Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText("Find ..."); + b.setText("Find ..."); } - createFormSubTypeForm(parent, context, master); - + return parent; } - - protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - + + protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText("MenuItems"); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - + final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); @@ -256,14 +268,14 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con gd.heightHint = 300; viewer.getControl().setLayoutData(gd); viewer.getTable().setHeaderVisible(true); - + { TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Type"); column.getColumn().setWidth(300); column.setLabelProvider(new ComponentLabelProvider(editor)); } - + { IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ITEM__TYPE); @@ -272,14 +284,13 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con column.getColumn().setWidth(100); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - - + IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(master)); - + Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -289,78 +300,95 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add Separator ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MMenuItem handler = MApplicationFactory.eINSTANCE.createMenuItem(); - handler.setType(ItemType.SEPARATOR); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); + } } } }); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add MenuItem ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MMenuItem handler = MApplicationFactory.eINSTANCE.createMenuItem(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if (idx < container.getChildren().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); + } } } }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add Handled-MenuItem ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MHandledMenuItem handler = MApplicationFactory.eINSTANCE.createHandledMenuItem(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); - } + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + Struct struct = (Struct) element; + return struct.label; } }); - + + Struct defaultStruct = new Struct("MenuItem", MApplicationPackage.Literals.MENU_ITEM, false); + childrenDropDown.setInput(new Struct[] { new Struct("Separator", MApplicationPackage.Literals.MENU_ITEM, true), defaultStruct, new Struct("Handled MenuItem", MApplicationPackage.Literals.HANDLED_MENU_ITEM, false), new Struct("Direct MenuItem", MApplicationPackage.Literals.DIRECT_MENU_ITEM, false) }); + childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add Direct-MenuItem ..."); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MDirectMenuItem handler = MApplicationFactory.eINSTANCE.createDirectMenuItem(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + if (!childrenDropDown.getSelection().isEmpty()) { + Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); + EClass eClass = struct.eClass; + MMenuItem eObject = (MMenuItem) MApplicationFactory.eINSTANCE.create(eClass); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); + if (struct.separator) { + eObject.setType(ItemType.SEPARATOR); + } + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + if (!struct.separator) { + editor.setSelection(eObject); + } + } } } }); @@ -368,14 +396,14 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Remove"); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List keybinding = ((IStructuredSelection)viewer.getSelection()).toList(); + if (!viewer.getSelection().isEmpty()) { + List keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } @@ -392,16 +420,14 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { MUILabel label = (MUILabel) element; - if( label.getLabel() != null && label.getLabel().trim().length() > 0 ) { + if (label.getLabel() != null && label.getLabel().trim().length() > 0) { return label.getLabel(); } return null; } - + @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { - FeaturePath.fromList(MApplicationPackage.Literals.UI_LABEL__LABEL) - }; + return new FeaturePath[] { FeaturePath.fromList(MApplicationPackage.Literals.UI_LABEL__LABEL) }; } } \ No newline at end of file From 46de1e5dc76f511e514fa37f8be05518e708a168 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 14 Mar 2010 11:39:27 +0000 Subject: [PATCH 0033/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * implemented window moving * reseting selection when removing --- .../component/virtual/VWindowEditor.java | 53 ++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index f065d0d409..8dec90f559 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -20,16 +20,19 @@ import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MElementContainer; import org.eclipse.e4.ui.model.application.MWindow; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; @@ -161,11 +164,55 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Down"); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if( idx < container.getChildren().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Add ..."); @@ -193,9 +240,13 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { List windows = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, windows); + MElementContainer container = (MElementContainer) getMaster().getValue(); + Command cmd = RemoveCommand.create(getEditingDomain(), container, MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, windows); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); + if( container.getChildren().size() > 0 ) { + viewer.setSelection(new StructuredSelection(container.getChildren().get(0))); + } } } } From db8a52ecc2014fbcd009350b392ba7b2493e19f8 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 14 Mar 2010 11:48:58 +0000 Subject: [PATCH 0034/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * implemented move for commands, handlers and keybindings --- .../component/virtual/VCommandEditor.java | 47 +++++++++++++++++++ .../component/virtual/VHandlerEditor.java | 47 +++++++++++++++++++ .../component/virtual/VKeyBindingEditor.java | 47 +++++++++++++++++++ 3 files changed, 141 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index 467d12b48c..6dffa85080 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -18,6 +18,7 @@ import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MCommand; @@ -27,10 +28,12 @@ import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; @@ -136,11 +139,55 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MApplication container = (MApplication) getMaster().getValue(); + int idx = container.getCommands().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.APPLICATION__COMMANDS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Down"); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MApplication container = (MApplication) getMaster().getValue(); + int idx = container.getCommands().indexOf(obj) + 1; + if( idx < container.getCommands().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.APPLICATION__COMMANDS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Add ..."); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index f93b39920d..28b4d8a892 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -21,16 +21,19 @@ import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MHandler; +import org.eclipse.e4.ui.model.application.MHandlerContainer; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; @@ -145,11 +148,55 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MHandlerContainer container = (MHandlerContainer) getMaster().getValue(); + int idx = container.getHandlers().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Down"); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MHandlerContainer container = (MHandlerContainer) getMaster().getValue(); + int idx = container.getHandlers().indexOf(obj) + 1; + if( idx < container.getHandlers().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Add ..."); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java index df1e2d2bbf..3c3f036555 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java @@ -20,6 +20,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MBindingContainer; import org.eclipse.e4.ui.model.application.MHandler; import org.eclipse.e4.ui.model.application.MKeyBinding; import org.eclipse.emf.common.command.Command; @@ -28,10 +29,12 @@ import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; @@ -146,11 +149,55 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MBindingContainer container = (MBindingContainer) getMaster().getValue(); + int idx = container.getBindings().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Down"); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MBindingContainer container = (MBindingContainer) getMaster().getValue(); + int idx = container.getBindings().indexOf(obj) + 1; + if( idx < container.getBindings().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Add ..."); From d3baff9a94b5b8e8266f8585a61a5ebf31c19f5e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 14 Mar 2010 12:20:27 +0000 Subject: [PATCH 0035/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * implemented toolbar items --- .../emf/ui/internal/common/ModelEditor.java | 177 +++++++------- .../common/component/ToolBarEditor.java | 231 +++++++++++++++++- .../common/component/WindowTrimEditor.java | 138 ++++++++++- .../component/virtual/VWindowTrimEditor.java | 13 +- 4 files changed, 448 insertions(+), 111 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index a2f28595b7..87602e0a28 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -83,8 +83,8 @@ import org.eclipse.swt.widgets.Label; public class ModelEditor { - public static final int VIRTUAL_MENU = 0; - public static final int VIRTUAL_PART = 1; + public static final int VIRTUAL_MENU = 0; + public static final int VIRTUAL_PART = 1; public static final int VIRTUAL_HANDLER = 2; public static final int VIRTUAL_BINDING = 3; public static final int VIRTUAL_COMMAND = 4; @@ -96,7 +96,8 @@ public class ModelEditor { private AbstractComponentEditor[] virtualEditors; private List labelFeaturePaths = new ArrayList(); -// private List editors = new ArrayList(); + // private List editors = new + // ArrayList(); private TreeViewer viewer; private IModelResource modelProvider; @@ -111,36 +112,36 @@ public ModelEditor(Composite composite, IModelResource modelProvider) { viewer = createTreeViewerArea(form); - Composite parent = new Composite(form,SWT.NONE); + Composite parent = new Composite(form, SWT.NONE); parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); parent.setBackgroundMode(SWT.INHERIT_DEFAULT); -// parent.setData("org.eclipse.e4.ui.css.CssClassName","contentContainer"); + // parent.setData("org.eclipse.e4.ui.css.CssClassName","contentContainer"); FillLayout l = new FillLayout(); - l.marginWidth=5; + l.marginWidth = 5; parent.setLayout(l); - ShadowComposite editingArea = new ShadowComposite(parent,SWT.NONE); + ShadowComposite editingArea = new ShadowComposite(parent, SWT.NONE); GridLayout gl = new GridLayout(); - gl.marginTop=0; - gl.marginHeight=0; + gl.marginTop = 0; + gl.marginHeight = 0; editingArea.setLayout(gl); editingArea.setBackgroundMode(SWT.INHERIT_DEFAULT); -// editingArea.setData("org.eclipse.e4.ui.css.CssClassName","contentContainer"); + // editingArea.setData("org.eclipse.e4.ui.css.CssClassName","contentContainer"); - Composite headerContainer = new Composite(editingArea,SWT.NONE); + Composite headerContainer = new Composite(editingArea, SWT.NONE); headerContainer.setBackgroundMode(SWT.INHERIT_DEFAULT); headerContainer.setData("org.eclipse.e4.ui.css.CssClassName", "headerSectionContainer"); headerContainer.setLayout(new GridLayout(2, false)); headerContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - final Label iconLabel = new Label(headerContainer,SWT.NONE); + final Label iconLabel = new Label(headerContainer, SWT.NONE); iconLabel.setLayoutData(new GridData(20, 20)); final Label textLabel = new Label(headerContainer, SWT.NONE); textLabel.setData("org.eclipse.e4.ui.css.CssClassName", "sectionHeader"); textLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - final Composite contentContainer = new Composite(editingArea,SWT.NONE); + final Composite contentContainer = new Composite(editingArea, SWT.NONE); contentContainer.setLayoutData(new GridData(GridData.FILL_BOTH)); final StackLayout layout = new StackLayout(); contentContainer.setLayout(layout); @@ -148,12 +149,12 @@ public ModelEditor(Composite composite, IModelResource modelProvider) { viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { - if( ! event.getSelection().isEmpty() ) { + if (!event.getSelection().isEmpty()) { IStructuredSelection s = (IStructuredSelection) event.getSelection(); - if( s.getFirstElement() instanceof EObject ) { + if (s.getFirstElement() instanceof EObject) { EObject obj = (EObject) s.getFirstElement(); AbstractComponentEditor editor = editorMap.get(obj.eClass()); - if( editor != null ) { + if (editor != null) { textLabel.setText(editor.getLabel(obj)); iconLabel.setImage(editor.getImage(obj, iconLabel.getDisplay())); Composite comp = editor.getEditor(contentContainer, s.getFirstElement()); @@ -164,7 +165,7 @@ public void selectionChanged(SelectionChangedEvent event) { } else { VirtualEntry entry = (VirtualEntry) s.getFirstElement(); AbstractComponentEditor editor = virtualEditors[entry.getId()]; - if( editor != null ) { + if (editor != null) { textLabel.setText(editor.getLabel(entry)); iconLabel.setImage(editor.getImage(entry, iconLabel.getDisplay())); Composite comp = editor.getEditor(contentContainer, s.getFirstElement()); @@ -177,53 +178,52 @@ public void selectionChanged(SelectionChangedEvent event) { } }); - form.setWeights(new int[] { 1 , 2 }); + form.setWeights(new int[] { 1, 2 }); viewer.setSelection(new StructuredSelection(modelProvider.getRoot())); } private TreeViewer createTreeViewerArea(Composite parent) { - parent = new Composite(parent,SWT.NONE); + parent = new Composite(parent, SWT.NONE); parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); FillLayout l = new FillLayout(); - l.marginWidth=5; + l.marginWidth = 5; parent.setLayout(l); - ShadowComposite editingArea = new ShadowComposite(parent,SWT.NONE); + ShadowComposite editingArea = new ShadowComposite(parent, SWT.NONE); editingArea.setLayout(new FillLayout()); - final TreeViewer viewer = new TreeViewer(editingArea,SWT.FULL_SELECTION|SWT.H_SCROLL|SWT.V_SCROLL); + final TreeViewer viewer = new TreeViewer(editingArea, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); viewer.setLabelProvider(new ComponentLabelProvider(this)); - ObservableListTreeContentProvider contentProvider = new ObservableListTreeContentProvider( - new ObservableFactoryImpl(), new TreeStructureAdvisorImpl()); + ObservableListTreeContentProvider contentProvider = new ObservableListTreeContentProvider(new ObservableFactoryImpl(), new TreeStructureAdvisorImpl()); viewer.setContentProvider(contentProvider); - + final WritableSet clearedSet = new WritableSet(); - + contentProvider.getKnownElements().addSetChangeListener(new ISetChangeListener() { - + public void handleSetChange(SetChangeEvent event) { - for( Object o : event.diff.getAdditions() ) { - if( o instanceof EObject ) { - clearedSet.add(o); + for (Object o : event.diff.getAdditions()) { + if (o instanceof EObject) { + clearedSet.add(o); } } - - for( Object o : event.diff.getRemovals() ) { - if( o instanceof EObject ) { - clearedSet.remove(o); + + for (Object o : event.diff.getRemovals()) { + if (o instanceof EObject) { + clearedSet.remove(o); } } } }); - - for( FeaturePath p : labelFeaturePaths ) { + + for (FeaturePath p : labelFeaturePaths) { IObservableMap map = EMFProperties.value(p).observeDetail(clearedSet); map.addMapChangeListener(new IMapChangeListener() { - + public void handleMapChange(MapChangeEvent event) { viewer.update(event.diff.getChangedKeys().toArray(), null); } }); } - + viewer.setInput(modelProvider.getRoot()); viewer.expandAll(); @@ -231,90 +231,83 @@ public void handleMapChange(MapChangeEvent event) { } private void registerVirtualEditors() { - virtualEditors = new AbstractComponentEditor[] { - new VMenuEditor(modelProvider.getEditingDomain(),this), // V-Menu - null, // V-Part - new VHandlerEditor(modelProvider.getEditingDomain(),this), - new VKeyBindingEditor(modelProvider.getEditingDomain(), this), - new VCommandEditor(modelProvider.getEditingDomain(), this), - new VWindowEditor(modelProvider.getEditingDomain(), this), - new VControlEditor(modelProvider.getEditingDomain(), this), - new VWindowTrimEditor(modelProvider.getEditingDomain(), this) - }; + virtualEditors = new AbstractComponentEditor[] { new VMenuEditor(modelProvider.getEditingDomain(), this), // V-Menu + null, // V-Part + new VHandlerEditor(modelProvider.getEditingDomain(), this), new VKeyBindingEditor(modelProvider.getEditingDomain(), this), new VCommandEditor(modelProvider.getEditingDomain(), this), new VWindowEditor(modelProvider.getEditingDomain(), this), new VControlEditor(modelProvider.getEditingDomain(), this), new VWindowTrimEditor(modelProvider.getEditingDomain(), this) }; } - + public void setSelection(Object element) { viewer.setSelection(new StructuredSelection(element)); } private void registerDefaultEditors() { - registerEditor( MApplicationPackage.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.MODEL_COMPONENTS, new ModelComponentsEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.MODEL_COMPONENT, new ModelComponentEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.PART, new PartEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.COMMAND,new CommandEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor(modelProvider.getEditingDomain(), this)); - registerEditor( MApplicationPackage.Literals.PART_STACK, new PartStackEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.WINDOW_TRIM, new WindowTrimEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.TOOL_BAR, new ToolBarEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.HANDLED_TOOL_ITEM, new HandledToolItemEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.TOOL_ITEM, new ToolItemEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.PERSPECTIVE_STACK, new PerspectiveStackEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.PERSPECTIVE, new PerspectiveEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.PLACEHOLDER, new PlaceholderEditor(modelProvider.getEditingDomain())); - registerEditor( MApplicationPackage.Literals.MENU, new MenuEditor(modelProvider.getEditingDomain(), this)); - registerEditor( MApplicationPackage.Literals.MENU_ITEM, new MenuItemEditor(modelProvider.getEditingDomain(), this)); - registerEditor( MApplicationPackage.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), this)); - registerEditor( MApplicationPackage.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this)); + registerEditor(MApplicationPackage.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.MODEL_COMPONENTS, new ModelComponentsEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.MODEL_COMPONENT, new ModelComponentEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.PART, new PartEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.COMMAND, new CommandEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor(modelProvider.getEditingDomain(), this)); + registerEditor(MApplicationPackage.Literals.PART_STACK, new PartStackEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.WINDOW_TRIM, new WindowTrimEditor(modelProvider.getEditingDomain(), this)); + registerEditor(MApplicationPackage.Literals.TOOL_BAR, new ToolBarEditor(modelProvider.getEditingDomain(), this)); + registerEditor(MApplicationPackage.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.HANDLED_TOOL_ITEM, new HandledToolItemEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.TOOL_ITEM, new ToolItemEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.PERSPECTIVE_STACK, new PerspectiveStackEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.PERSPECTIVE, new PerspectiveEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.PLACEHOLDER, new PlaceholderEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.MENU, new MenuEditor(modelProvider.getEditingDomain(), this)); + registerEditor(MApplicationPackage.Literals.MENU_ITEM, new MenuItemEditor(modelProvider.getEditingDomain(), this)); + registerEditor(MApplicationPackage.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), this)); + registerEditor(MApplicationPackage.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this)); } public void registerEditor(EClass eClass, AbstractComponentEditor editor) { editorMap.put(eClass, editor); - - for( FeaturePath p : editor.getLabelProperties() ) { + + for (FeaturePath p : editor.getLabelProperties()) { boolean found = false; - for( FeaturePath tmp : labelFeaturePaths ) { - if( equalsPaths(p, tmp) ) { + for (FeaturePath tmp : labelFeaturePaths) { + if (equalsPaths(p, tmp)) { found = true; break; } } - - if( ! found ) { + + if (!found) { labelFeaturePaths.add(p); } } } - + private boolean equalsPaths(FeaturePath p1, FeaturePath p2) { - if( p1.getFeaturePath().length == p2.getFeaturePath().length ) { - for( int i = 0; i < p1.getFeaturePath().length; i++ ) { - if( ! p1.getFeaturePath()[i].equals(p2.getFeaturePath()[i]) ) { + if (p1.getFeaturePath().length == p2.getFeaturePath().length) { + for (int i = 0; i < p1.getFeaturePath().length; i++) { + if (!p1.getFeaturePath()[i].equals(p2.getFeaturePath()[i])) { return false; } } - + return true; } - + return false; } public AbstractComponentEditor getEditor(EClass eClass) { return editorMap.get(eClass); } - + public IStatus save() { - if( modelProvider.isSaveable() ) { + if (modelProvider.isSaveable()) { return modelProvider.save(); } - + return Status.CANCEL_STATUS; } @@ -325,13 +318,13 @@ private static class TreeStructureAdvisorImpl extends TreeStructureAdvisor { private class ObservableFactoryImpl implements IObservableFactory { public IObservable createObservable(Object target) { - if( target instanceof IObservableList ) { + if (target instanceof IObservableList) { return (IObservable) target; - } else if( target instanceof VirtualEntry ) { - return ((VirtualEntry)target).getList(); + } else if (target instanceof VirtualEntry) { + return ((VirtualEntry) target).getList(); } else { - AbstractComponentEditor editor = editorMap.get(((EObject)target).eClass()); - if( editor != null ) { + AbstractComponentEditor editor = editorMap.get(((EObject) target).eClass()); + if (editor != null) { return editor.getChildList(target); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index f04d8365d7..0a9eaebd12 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -12,31 +12,80 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.ItemType; +import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MElementContainer; +import org.eclipse.e4.ui.model.application.MHandler; +import org.eclipse.e4.ui.model.application.MMenuItem; +import org.eclipse.e4.ui.model.application.MToolItem; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class ToolBarEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; + private ModelEditor editor; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); - public ToolBarEditor(EditingDomain editingDomain) { + private class Struct { + private final String label; + private final EClass eClass; + private final boolean separator; + + public Struct(String label, EClass eClass, boolean separator) { + this.label = label; + this.eClass = eClass; + this.separator = separator; + } + } + + + public ToolBarEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); - // TODO Auto-generated constructor stub + this.editor = editor; } @Override @@ -72,9 +121,181 @@ public Composite getEditor(Composite parent, Object object) { return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("ToolbarItems"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final TableViewer viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + + { + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Type"); + column.getColumn().setWidth(300); + column.setLabelProvider(new ComponentLabelProvider(editor)); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ITEM__TYPE); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("ItemType"); + column.getColumn().setWidth(100); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + viewer.setInput(prop.observeDetail(master)); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if (idx < container.getChildren().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + Struct struct = (Struct) element; + return struct.label; + } + }); + + Struct defaultStruct = new Struct("Handled ToolItem", MApplicationPackage.Literals.HANDLED_TOOL_ITEM, false); + childrenDropDown.setInput(new Struct[] { defaultStruct, new Struct("Direct ToolItem", MApplicationPackage.Literals.DIRECT_TOOL_ITEM, false), new Struct("Separator", MApplicationPackage.Literals.TOOL_ITEM, true) }); + childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!childrenDropDown.getSelection().isEmpty()) { + Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); + EClass eClass = struct.eClass; + MToolItem eObject = (MToolItem) MApplicationFactory.eINSTANCE.create(eClass); + + if (struct.separator) { + eObject.setType(ItemType.SEPARATOR); + } + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + if (!struct.separator) { + editor.setSelection(eObject); + } + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java index bead362981..b95636fe5c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java @@ -12,29 +12,47 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MElementContainer; +import org.eclipse.e4.ui.model.application.MToolBar; import org.eclipse.e4.ui.model.application.MTrimContainer; import org.eclipse.e4.ui.model.application.SideValue; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.databinding.viewers.ViewerProperties; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; @@ -45,12 +63,13 @@ public class WindowTrimEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; + private ModelEditor editor; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); - public WindowTrimEditor(EditingDomain editingDomain) { + public WindowTrimEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); - // TODO Auto-generated constructor stub + this.editor = editor; } @Override @@ -121,6 +140,121 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, context.bindValue(ViewerProperties.singleSelection().observe(viewer), sideValueObs); } + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Controls"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final TableViewer viewer = new TableViewer(parent); + viewer.setLabelProvider(new ComponentLabelProvider(editor)); + viewer.setContentProvider(new ObservableListContentProvider()); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + + IEMFListProperty prop = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + viewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if( idx < container.getChildren().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add Toolbar"); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MToolBar toolbar = MApplicationFactory.eINSTANCE.createToolBar(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(toolbar); + } + } + }); + + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List elements = ((IStructuredSelection)viewer.getSelection()).toList(); + + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, elements); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java index 2e3e539efe..edb5656cd7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -110,18 +110,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, gl.marginWidth=0; gl.marginHeight=0; buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Add Trim"); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); @@ -156,7 +146,6 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; } From bbf2bd8ebc86572db6a4ff6a23510fd2dc6e26e3 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 14 Mar 2010 12:32:17 +0000 Subject: [PATCH 0036/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * added itemtype editing --- .../component/HandledMenuItemEditor.java | 304 +++++++++--------- .../internal/common/component/MenuEditor.java | 2 + .../common/component/MenuItemEditor.java | 21 ++ 3 files changed, 175 insertions(+), 152 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index e796142c1f..adf83a1fe3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -58,14 +58,14 @@ public class HandledMenuItemEditor extends MenuItemEditor { private Image image; - + public HandledMenuItemEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); } @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/HandledMenuItem.gif")); } catch (MalformedURLException e) { @@ -86,182 +86,182 @@ public String getLabel(Object element) { public String getDescription(Object element) { return "HandledMenuItem bla bla bla"; } - + @Override protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, final WritableValue master) { IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - Label l = new Label(parent, SWT.NONE); - l.setText("Command"); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setEnabled(false); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value( getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLED_ITEM__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(master)); - - Button b = new Button(parent, SWT.PUSH|SWT.FLAT); - b.setText("Find ..."); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Command"); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + t.setEnabled(false); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLED_ITEM__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(master)); + + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText("Find ..."); + b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + } - l = new Label(parent, SWT.NONE); - l.setText("Parameters"); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); - - final TableViewer tableviewer = new TableViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 120; - tableviewer.getTable().setHeaderVisible(true); - tableviewer.getControl().setLayoutData(gd); - - ObservableListContentProvider cp = new ObservableListContentProvider(); - tableviewer.setContentProvider(cp); - + // ------------------------------------------------------------ { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__TAG); + Label l = new Label(parent, SWT.NONE); + l.setText("Parameters"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + + final TableViewer tableviewer = new TableViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 120; + tableviewer.getTable().setHeaderVisible(true); + tableviewer.getControl().setLayoutData(gd); + + ObservableListContentProvider cp = new ObservableListContentProvider(); + tableviewer.setContentProvider(cp); + + { + IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__TAG); + + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Tag"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + column.setEditingSupport(new EditingSupport(tableviewer) { + private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); + + @Override + protected void setValue(Object element, Object value) { + Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.PARAMETER__TAG, value); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Tag"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - column.setEditingSupport(new EditingSupport(tableviewer) { - private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); + @Override + protected Object getValue(Object element) { + String val = ((MParameter) element).getTag(); + return val == null ? "" : val; + } - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.PARAMETER__TAG, value); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); + @Override + protected CellEditor getCellEditor(Object element) { + return cellEditor; } - } - @Override - protected Object getValue(Object element) { - String val = ((MParameter)element).getTag(); - return val == null ? "" : val; - } + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + } - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; - } + { + IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__VALUE); + + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Value"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + column.setEditingSupport(new EditingSupport(tableviewer) { + private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); + + @Override + protected void setValue(Object element, Object value) { + Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.PARAMETER__VALUE, value); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } + @Override + protected Object getValue(Object element) { + String val = ((MParameter) element).getValue(); + return val == null ? "" : val; + } - { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__VALUE); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Value"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - column.setEditingSupport(new EditingSupport(tableviewer) { - private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); + @Override + protected CellEditor getCellEditor(Object element) { + return cellEditor; + } - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.PARAMETER__VALUE, value); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); + @Override + protected boolean canEdit(Object element) { + return true; } - } + }); + } + ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(tableviewer) { @Override - protected Object getValue(Object element) { - String val = ((MParameter)element).getValue(); - return val == null ? "" : val; - } + protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { + boolean singleSelect = ((IStructuredSelection) tableviewer.getSelection()).size() == 1; + boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent) event.sourceEvent).button == 1; - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; + return singleSelect && (isLeftDoubleMouseSelect || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); } - + }; + TableViewerEditor.create(tableviewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); + + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS); + tableviewer.setInput(prop.observeDetail(master)); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - - ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(tableviewer) { - @Override - protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { - boolean singleSelect = ((IStructuredSelection)tableviewer.getSelection()).size() == 1; - boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent)event.sourceEvent).button == 1; - - return singleSelect && (isLeftDoubleMouseSelect - || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC - || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); - } - }; - TableViewerEditor.create(tableviewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS); - tableviewer.setInput(prop.observeDetail(master)); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; - buttonComp.setLayout(gl); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MHandledItem item = (MHandledItem) master.getValue(); - MParameter param = MApplicationFactory.eINSTANCE.createParameter(); - Command cmd = AddCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS, param); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - tableviewer.editElement(param, 0); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.addSelectionListener(new SelectionAdapter() { - - public void widgetSelected(SelectionEvent e) { - IStructuredSelection s = (IStructuredSelection) tableviewer.getSelection(); - if( !s.isEmpty() ) { + public void widgetSelected(SelectionEvent e) { MHandledItem item = (MHandledItem) master.getValue(); - Command cmd = RemoveCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS, s.toList()); - if( cmd.canExecute() ) { + MParameter param = MApplicationFactory.eINSTANCE.createParameter(); + Command cmd = AddCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS, param); + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); + tableviewer.editElement(param, 0); } } - } + }); - }); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent e) { + IStructuredSelection s = (IStructuredSelection) tableviewer.getSelection(); + if (!s.isEmpty()) { + MHandledItem item = (MHandledItem) master.getValue(); + Command cmd = RemoveCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS, s.toList()); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 0ff1793cb9..9cd961c986 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -294,6 +294,8 @@ public void widgetSelected(SelectionEvent e) { } }); } + + ControlFactory.createTagsWidget(parent, this); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index cec1707f45..b6d099e637 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -15,6 +15,7 @@ import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -45,6 +46,7 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.databinding.viewers.ViewerProperties; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IStructuredSelection; @@ -209,6 +211,23 @@ private Composite createMenuItemForm(Composite parent, EMFDataBindingContext con context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); } + if (this.getClass() != MenuItemEditor.class) { + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Type"); + + ComboViewer viewer = new ComboViewer(parent); + viewer.setContentProvider(new ArrayContentProvider()); + viewer.setInput(new ItemType[] { ItemType.CHECK, ItemType.PUSH, ItemType.RADIO }); + GridData gd = new GridData(); + gd.horizontalSpan = 2; + viewer.getControl().setLayoutData(gd); + IObservableValue itemTypeObs = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ITEM__TYPE).observeDetail(master); + context.bindValue(ViewerProperties.singleSelection().observe(viewer), itemTypeObs); + } + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -249,6 +268,8 @@ private Composite createMenuItemForm(Composite parent, EMFDataBindingContext con createFormSubTypeForm(parent, context, master); + ControlFactory.createTagsWidget(parent, this); + return parent; } From 3af890476070304ee6da4f688446c5d01a47b51c Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 14 Mar 2010 13:42:47 +0000 Subject: [PATCH 0037/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * adding 3.x Editor bundle --- .../.classpath | 7 + .../.project | 28 ++++ .../.settings/org.eclipse.jdt.core.prefs | 8 + .../META-INF/MANIFEST.MF | 16 ++ .../build.properties | 5 + .../css/default.css | 18 +++ .../icons/full/obj16/Application.gif | Bin 0 -> 1048 bytes .../plugin.xml | 16 ++ .../emf/editor3x/E4WorkbenchModelEditor.java | 137 ++++++++++++++++++ .../tools/emf/editor3x/XMIModelResource.java | 107 ++++++++++++++ 10 files changed, 342 insertions(+) create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/.classpath create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/.project create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.jdt.core.prefs create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/build.properties create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/css/default.css create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/Application.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/.classpath b/bundles/org.eclipse.e4.tools.emf.editor3x/.classpath new file mode 100644 index 0000000000..64c5e31b7a --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/.project b/bundles/org.eclipse.e4.tools.emf.editor3x/.project new file mode 100644 index 0000000000..281687d11a --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/.project @@ -0,0 +1,28 @@ + + + org.eclipse.e4.tools.emf.editor3x + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..df1b497b8a --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Sun Mar 14 13:37:58 CET 2010 +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/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..c361c5cbf1 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Editor3x +Bundle-SymbolicName: org.eclipse.e4.tools.emf.editor3x;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", + org.eclipse.core.runtime;bundle-version="3.6.0", + org.eclipse.emf.common;bundle-version="2.6.0", + org.eclipse.emf.edit.ui;bundle-version="2.6.0", + org.eclipse.core.databinding.observable;bundle-version="1.3.0", + org.eclipse.e4.tools.emf.ui;bundle-version="1.0.0", + org.eclipse.e4.ui.workbench;bundle-version="0.9.1", + org.eclipse.e4.ui.css.core;bundle-version="0.9.0", + org.eclipse.e4.ui.css.swt;bundle-version="0.9.1", + org.w3c.css.sac;bundle-version="1.3.0" diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties new file mode 100644 index 0000000000..e9863e281e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/css/default.css b/bundles/org.eclipse.e4.tools.emf.editor3x/css/default.css new file mode 100644 index 0000000000..fea596f24b --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/css/default.css @@ -0,0 +1,18 @@ +.headerSectionContainer { + background-color: gradient #575757 #101010 100%; +} + +.sectionHeader { + font-weight: bold; + font-size: 15pt; + color: white; +} + +.subSectionHeader { + background-color: gradient #575757 #101010 100%; +} + + +.contentContainer { + background-color: #fff #fff #cccccc 20% 80%; +} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/Application.gif b/bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/Application.gif new file mode 100644 index 0000000000000000000000000000000000000000..9246dfa126e2e4b11aba2f7b341be8187aad4ce4 GIT binary patch literal 1048 zcmeH`Yfn-E0EQ3d2er-7#dWWFscGwGeMn=iY-w8RR7A~7A+{7$Gz23F$IYozlY=)7 zqItm!W{s#hSv9q_w(=4OY{R)Ww5-4=EIfx>=am1TAJDt!9rNPk6p9=5dQjZ$#9b)nM1H@YH{0!Q6vYw5Q_ccy z-@T|4E3Rm>|MZlwWh+)Uv$FB6!3wsk)*N03;-zz1i`Xp;j*M};gt=GB zEI&LetEg#tJzZiTa~|aIG&y%QdHlz(4J)6&A*2H3nSAI%QBML>b-7HH#2QLvkEC)& zD7Qzmsvc!kJroWs+8mfbRCAgtkETJS8_IJxyDrf0$CmWRmh>gD2C4UE$UM!s0m+r> zuQyM>SzOBo^?BgzwbE)%^N7`f*%9xA$^O-Wb2R3bsn1Ugwv3*IJk?^+$Op0RWB>Fj zZ2hgbc=Z-HZ1or|u2lrHAzs+xe6e78x9a)&%QbDo=d4b>)%gX%mQZZX?decJLa_)^ zG)pA>ni@evJ+GmjKhQ}ZRF)`PS?yAetciP`}X^9)>zj6m;M5eY^ri zFs#IoPqoPhV#Jtz!Kj9z6Dfghu9Jg_9Ve*c>}UVacSl=i^3y81ma<=jy`zWA-QdcFXnTom)cU zS + + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java new file mode 100644 index 0000000000..3963f4578e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java @@ -0,0 +1,137 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.editor3x; + +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.e4.tools.emf.ui.common.IModelResource.ModelListener; +import org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor; +import org.eclipse.e4.ui.css.core.engine.CSSEngine; +import org.eclipse.e4.ui.css.core.engine.CSSErrorHandler; +import org.eclipse.e4.ui.css.core.util.impl.resources.OSGiResourceLocator; +import org.eclipse.e4.ui.css.swt.engine.CSSSWTEngineImpl; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.edit.ui.util.EditUIUtil; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.part.EditorPart; + +public class E4WorkbenchModelEditor extends EditorPart { + private XMIModelResource resource; + private ApplicationModelEditor editor; + + private static final String CSS_URI = "platform:/plugin/org.eclipse.e4.tools.emf.editor3x/css/default.css"; + + @Override + public void doSave(IProgressMonitor monitor) { + editor.save(); + } + + @Override + public void doSaveAs() { + + } + + private void setupCss(Display display) { + CSSEngine engine = (CSSEngine) display + .getData("org.eclipse.e4.ui.css.core.engine"); + + if( engine == null ) { + engine = new CSSSWTEngineImpl(display, true); + engine.setErrorHandler(new CSSErrorHandler() { + public void error(Exception e) { + e.printStackTrace(); + } + }); + display.setData("org.eclipse.e4.ui.css.core.engine", engine); + + try { + URL url = FileLocator.resolve(new URL(CSS_URI.toString())); + display.setData("org.eclipse.e4.ui.css.core.cssURL", url); //$NON-NLS-1$ + + InputStream stream = url.openStream(); + engine.parseStyleSheet(stream); + stream.close(); + } catch (MalformedURLException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + } + + @Override + public void init(IEditorSite site, IEditorInput input) + throws PartInitException { + setSite(site); + setInput(input); + + URI resourceURI = EditUIUtil.getURI(input); + if( resourceURI != null ) { + resource = new XMIModelResource(resourceURI); + resource.addModelListener(new ModelListener() { + + public void dirtyChanged() { + firePropertyChange(PROP_DIRTY); + } + }); + } + } + + @Override + public boolean isDirty() { + return resource.isDirty(); + } + + @Override + public boolean isSaveAsAllowed() { + return false; + } + + @Override + public void createPartControl(Composite parent) { + setupCss(parent.getDisplay()); + Composite comp = new Composite(parent, SWT.NONE); + comp.setBackground(comp.getDisplay().getSystemColor(SWT.COLOR_WHITE)); + + FillLayout layout = new FillLayout(); + layout.marginWidth=10; + layout.marginHeight=10; + comp.setLayout(layout); + + editor = new ApplicationModelEditor(comp, resource); + + try { + parent.setRedraw(false); + parent.reskin(SWT.ALL); + } finally { + parent.setRedraw(true); + } + } + + @Override + public void setFocus() { + editor.setFocus(); + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java new file mode 100644 index 0000000000..2f717517f2 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java @@ -0,0 +1,107 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.editor3x; + +import java.util.ArrayList; +import java.util.EventObject; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.workbench.ui.internal.E4XMIResourceFactory; +import org.eclipse.emf.common.command.BasicCommandStack; +import org.eclipse.emf.common.command.CommandStackListener; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; + +public class XMIModelResource implements IModelResource { + private EditingDomain editingDomain; + private Resource resource; + private List listeners = new ArrayList(); + private boolean dirty; + + public XMIModelResource(URI uri) { + ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( + ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + ResourceSet resourceSet = new ResourceSetImpl(); + BasicCommandStack commandStack = new BasicCommandStack(); + commandStack.addCommandStackListener(new CommandStackListener() { + + public void commandStackChanged(EventObject event) { + dirty = true; + fireDirtyChanged(); + } + }); + editingDomain = new AdapterFactoryEditingDomain(adapterFactory, + commandStack, resourceSet); + resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap() + .put(Resource.Factory.Registry.DEFAULT_EXTENSION, + new E4XMIResourceFactory()); + resource = resourceSet.getResource(uri, true); + } + + public IObservableList getRoot() { + WritableList list = new WritableList(); + list.add(resource.getContents().get(0)); + return list; + } + + public EditingDomain getEditingDomain() { + return editingDomain; + } + + public boolean isSaveable() { + return true; + } + + public void addModelListener(ModelListener listener) { + listeners.add(listener); + } + + public void removeModelListener(ModelListener listener) { + listeners.remove(listener); + } + + public boolean isDirty() { + return dirty; + } + + private void fireDirtyChanged() { + for( ModelListener listener : listeners ) { + listener.dirtyChanged(); + } + } + + public IStatus save() { + Map map = new HashMap(); + try { + resource.save(map); + editingDomain.getCommandStack().flush(); + dirty = false; + fireDirtyChanged(); + } catch (Exception e) { + // TODO: handle exception + } + + return Status.OK_STATUS; + } + +} From 528dea283683a002f200431e092020ec5d693b99 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 14 Mar 2010 14:17:13 +0000 Subject: [PATCH 0038/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * adding undo/redo support --- .../emf/editor3x/E4WorkbenchModelEditor.java | 78 ++++++++++++++----- .../e4/tools/emf/editor3x/RedoAction.java | 72 +++++++++++++++++ .../e4/tools/emf/editor3x/UndoAction.java | 69 ++++++++++++++++ .../tools/emf/editor3x/XMIModelResource.java | 12 ++- .../tools/emf/ui/common/IModelResource.java | 1 + .../emf/ui/internal/common/ModelEditor.java | 5 ++ 6 files changed, 215 insertions(+), 22 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java index 3963f4578e..b3d2f279f0 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java @@ -21,7 +21,6 @@ import org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor; import org.eclipse.e4.ui.css.core.engine.CSSEngine; import org.eclipse.e4.ui.css.core.engine.CSSErrorHandler; -import org.eclipse.e4.ui.css.core.util.impl.resources.OSGiResourceLocator; import org.eclipse.e4.ui.css.swt.engine.CSSSWTEngineImpl; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.edit.ui.util.EditUIUtil; @@ -32,14 +31,30 @@ import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorSite; import org.eclipse.ui.PartInitException; +import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.part.EditorPart; +@SuppressWarnings("restriction") public class E4WorkbenchModelEditor extends EditorPart { private XMIModelResource resource; private ApplicationModelEditor editor; - + private UndoAction undoAction; + private RedoAction redoAction; + private static final String CSS_URI = "platform:/plugin/org.eclipse.e4.tools.emf.editor3x/css/default.css"; - + + private ModelListener listener = new ModelListener() { + + public void dirtyChanged() { + firePropertyChange(PROP_DIRTY); + } + + public void commandStackChanged() { + // TODO Auto-generated method stub + + } + }; + @Override public void doSave(IProgressMonitor monitor) { editor.save(); @@ -47,14 +62,14 @@ public void doSave(IProgressMonitor monitor) { @Override public void doSaveAs() { - + } - + private void setupCss(Display display) { CSSEngine engine = (CSSEngine) display .getData("org.eclipse.e4.ui.css.core.engine"); - - if( engine == null ) { + + if (engine == null) { engine = new CSSSWTEngineImpl(display, true); engine.setErrorHandler(new CSSErrorHandler() { public void error(Exception e) { @@ -62,7 +77,7 @@ public void error(Exception e) { } }); display.setData("org.eclipse.e4.ui.css.core.engine", engine); - + try { URL url = FileLocator.resolve(new URL(CSS_URI.toString())); display.setData("org.eclipse.e4.ui.css.core.cssURL", url); //$NON-NLS-1$ @@ -85,16 +100,11 @@ public void init(IEditorSite site, IEditorInput input) throws PartInitException { setSite(site); setInput(input); - + URI resourceURI = EditUIUtil.getURI(input); - if( resourceURI != null ) { + if (resourceURI != null) { resource = new XMIModelResource(resourceURI); - resource.addModelListener(new ModelListener() { - - public void dirtyChanged() { - firePropertyChange(PROP_DIRTY); - } - }); + resource.addModelListener(listener); } } @@ -113,20 +123,46 @@ public void createPartControl(Composite parent) { setupCss(parent.getDisplay()); Composite comp = new Composite(parent, SWT.NONE); comp.setBackground(comp.getDisplay().getSystemColor(SWT.COLOR_WHITE)); - + FillLayout layout = new FillLayout(); - layout.marginWidth=10; - layout.marginHeight=10; + layout.marginWidth = 10; + layout.marginHeight = 10; comp.setLayout(layout); - + editor = new ApplicationModelEditor(comp, resource); - + try { parent.setRedraw(false); parent.reskin(SWT.ALL); } finally { parent.setRedraw(true); } + + makeActions(); + } + + private void makeActions() { + undoAction = new UndoAction(resource); + redoAction = new RedoAction(resource); + + getEditorSite().getActionBars().setGlobalActionHandler( + ActionFactory.UNDO.getId(), undoAction); + getEditorSite().getActionBars().setGlobalActionHandler( + ActionFactory.REDO.getId(), redoAction); + } + + @Override + public void dispose() { + if (undoAction != null) + undoAction.dispose(); + + if (redoAction != null) + redoAction.dispose(); + + if (listener != null && resource != null) + resource.removeModelListener(listener); + + super.dispose(); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java new file mode 100644 index 0000000000..a67480d322 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.editor3x; + +import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.jface.action.Action; + + +public class RedoAction extends Action +{ + private final IModelResource resource; + private final IModelResource.ModelListener listener; + + public RedoAction(IModelResource resource) + { + this.resource = resource; + this.listener = new IModelResource.ModelListener() + { + + public void commandStackChanged() + { + update(); + } + + public void dirtyChanged() { + + } + + }; + resource.addModelListener(listener); + update(); + } + + @Override + public void run() + { + if (resource.getEditingDomain().getCommandStack().canRedo()) + { + resource.getEditingDomain().getCommandStack().redo(); + } + } + + private void update() + { + if (resource.getEditingDomain().getCommandStack().canRedo()) + { + setText("Redo " + resource.getEditingDomain().getCommandStack().getRedoCommand().getLabel()); + setEnabled(true); + } + else + { + setText("Redo"); + setEnabled(false); + } + } + + /** + * Clean up + */ + public void dispose() + { + resource.removeModelListener(listener); + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java new file mode 100644 index 0000000000..0d44bff024 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.editor3x; + +import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.jface.action.Action; + +public class UndoAction extends Action +{ + private final IModelResource resource; + private final IModelResource.ModelListener listener; + + public UndoAction(IModelResource resource) + { + this.resource = resource; + this.listener = new IModelResource.ModelListener() + { + + public void commandStackChanged() + { + update(); + } + + public void dirtyChanged() { + } + }; + resource.addModelListener(listener); + update(); + } + + @Override + public void run() + { + if (resource.getEditingDomain().getCommandStack().canUndo()) + { + resource.getEditingDomain().getCommandStack().undo(); + } + } + + private void update() + { + if (resource.getEditingDomain().getCommandStack().canUndo()) + { + setText("Undo " + resource.getEditingDomain().getCommandStack().getUndoCommand().getLabel()); + setEnabled(true); + } + else + { + setText("Undo"); + setEnabled(false); + } + } + + /** + * Clean up + */ + public void dispose() + { + resource.removeModelListener(listener); + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java index 2f717517f2..59b63ecf7c 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java @@ -32,12 +32,14 @@ import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +@SuppressWarnings("restriction") public class XMIModelResource implements IModelResource { private EditingDomain editingDomain; private Resource resource; private List listeners = new ArrayList(); private boolean dirty; + public XMIModelResource(URI uri) { ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( ComposedAdapterFactory.Descriptor.Registry.INSTANCE); @@ -48,6 +50,7 @@ public XMIModelResource(URI uri) { public void commandStackChanged(EventObject event) { dirty = true; fireDirtyChanged(); + fireCommandStackChanged(); } }); editingDomain = new AdapterFactoryEditingDomain(adapterFactory, @@ -81,7 +84,7 @@ public void removeModelListener(ModelListener listener) { } public boolean isDirty() { - return dirty; + return dirty && getEditingDomain().getCommandStack().canUndo(); } private void fireDirtyChanged() { @@ -90,6 +93,12 @@ private void fireDirtyChanged() { } } + private void fireCommandStackChanged() { + for( ModelListener listener : listeners ) { + listener.commandStackChanged(); + } + } + public IStatus save() { Map map = new HashMap(); try { @@ -97,6 +106,7 @@ public IStatus save() { editingDomain.getCommandStack().flush(); dirty = false; fireDirtyChanged(); + fireCommandStackChanged(); } catch (Exception e) { // TODO: handle exception } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java index c2ee571e31..4c5d0acaa3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java @@ -26,5 +26,6 @@ public interface IModelResource { public interface ModelListener { public void dirtyChanged(); + public void commandStackChanged(); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 87602e0a28..21a3f0c529 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -310,6 +310,11 @@ public IStatus save() { return Status.CANCEL_STATUS; } + + public void setFocus() { + viewer.getControl().setFocus(); + } + private static class TreeStructureAdvisorImpl extends TreeStructureAdvisor { From 9719130af2c72205658bc336a1af3a3d9a37b28e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 14 Mar 2010 16:44:05 +0000 Subject: [PATCH 0039/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixed build properties * using famfam icon for editor * fixed problems with model and modelcomponent editor --- .../about.html | 45 +++ .../build.properties | 4 +- .../icons/full/obj16/Application.gif | Bin 1048 -> 0 bytes .../full/obj16/application_view_tile.png | Bin 0 -> 465 bytes .../plugin.xml | 2 +- .../emf/ui/internal/common/ModelEditor.java | 14 +- .../component/ModelComponentEditor.java | 23 +- .../component/ModelComponentsEditor.java | 11 +- .../component/PartDescriptorEditor.java | 310 +++++++++++++++++- .../component/virtual/VPartDescriptor.java | 237 +++++++++++++ 10 files changed, 625 insertions(+), 21 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/about.html delete mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/Application.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/application_view_tile.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/about.html b/bundles/org.eclipse.e4.tools.emf.editor3x/about.html new file mode 100644 index 0000000000..c1343aa318 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/about.html @@ -0,0 +1,45 @@ + + + + +About + + +

    About This Content

    + +

    December 3, 2009

    +

    License

    + +

    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 http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    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 http://www.eclipse.org.

    + +

    Third Party Content

    + +

    The Content includes items from third parties as set out below. If you did not +receive this Content directly from the Eclipse Foundation, the following is provided for informational +purposes only, and you should look to the Redistributor’s license for terms and conditions of use.

    + +

    Silk icon set Version 1.3

    +

    +This plugin contains icons from the Silk icon set created by Mark James. The original files can +be found at: +

    +

    The license can be found at:

    + + + + \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties index e9863e281e..5e4181d7c1 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties @@ -2,4 +2,6 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - plugin.xml + plugin.xml,\ + icons/,\ + css/ diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/Application.gif b/bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/Application.gif deleted file mode 100644 index 9246dfa126e2e4b11aba2f7b341be8187aad4ce4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1048 zcmeH`Yfn-E0EQ3d2er-7#dWWFscGwGeMn=iY-w8RR7A~7A+{7$Gz23F$IYozlY=)7 zqItm!W{s#hSv9q_w(=4OY{R)Ww5-4=EIfx>=am1TAJDt!9rNPk6p9=5dQjZ$#9b)nM1H@YH{0!Q6vYw5Q_ccy z-@T|4E3Rm>|MZlwWh+)Uv$FB6!3wsk)*N03;-zz1i`Xp;j*M};gt=GB zEI&LetEg#tJzZiTa~|aIG&y%QdHlz(4J)6&A*2H3nSAI%QBML>b-7HH#2QLvkEC)& zD7Qzmsvc!kJroWs+8mfbRCAgtkETJS8_IJxyDrf0$CmWRmh>gD2C4UE$UM!s0m+r> zuQyM>SzOBo^?BgzwbE)%^N7`f*%9xA$^O-Wb2R3bsn1Ugwv3*IJk?^+$Op0RWB>Fj zZ2hgbc=Z-HZ1or|u2lrHAzs+xe6e78x9a)&%QbDo=d4b>)%gX%mQZZX?decJLa_)^ zG)pA>ni@evJ+GmjKhQ}ZRF)`PS?yAetciP`}X^9)>zj6m;M5eY^ri zFs#IoPqoPhV#Jtz!Kj9z6Dfghu9Jg_9Ve*c>}UVacSl=i^3y81ma<=jy`zWA-QdcFXnTom)cU zSzJNu3H-P zO&@UpeyZQXi7jKe-Hk?r-sue;aDce_XqkvXP+W#F_*ot`jB?BS93Uw71|U^ZjLH`yP%FO7U<6!nLCG} z$SDlW diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 21a3f0c529..c597867342 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -59,6 +59,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VKeyBindingEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor; import org.eclipse.e4.ui.model.application.MApplicationPackage; @@ -91,6 +92,7 @@ public class ModelEditor { public static final int VIRTUAL_WINDOWS = 5; public static final int VIRTUAL_WINDOW_CONTROLS = 6; public static final int VIRTUAL_WINDOW_TRIMS = 7; + public static final int VIRTUAL_PART_DESCRIPTORS = 8; private Map editorMap = new HashMap(); private AbstractComponentEditor[] virtualEditors; @@ -232,9 +234,15 @@ public void handleMapChange(MapChangeEvent event) { private void registerVirtualEditors() { virtualEditors = new AbstractComponentEditor[] { new VMenuEditor(modelProvider.getEditingDomain(), this), // V-Menu - null, // V-Part - new VHandlerEditor(modelProvider.getEditingDomain(), this), new VKeyBindingEditor(modelProvider.getEditingDomain(), this), new VCommandEditor(modelProvider.getEditingDomain(), this), new VWindowEditor(modelProvider.getEditingDomain(), this), new VControlEditor(modelProvider.getEditingDomain(), this), new VWindowTrimEditor(modelProvider.getEditingDomain(), this) }; - + null, // V-Part + new VHandlerEditor(modelProvider.getEditingDomain(), this), + new VKeyBindingEditor(modelProvider.getEditingDomain(), this), + new VCommandEditor(modelProvider.getEditingDomain(), this), + new VWindowEditor(modelProvider.getEditingDomain(), this), + new VControlEditor(modelProvider.getEditingDomain(), this), + new VWindowTrimEditor(modelProvider.getEditingDomain(), this), + new VPartDescriptor(modelProvider.getEditingDomain(), this) + }; } public void setSelection(Object element) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index 402fc5734e..01129c8d53 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import java.net.MalformedURLException; +import java.net.URL; + import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.property.list.IListProperty; @@ -20,6 +23,7 @@ import org.eclipse.e4.ui.model.application.MMenu; import org.eclipse.e4.ui.model.application.MModelComponent; import org.eclipse.e4.ui.model.application.MPart; +import org.eclipse.e4.ui.model.application.MPartDescriptor; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.edit.EMFEditProperties; @@ -44,10 +48,10 @@ public class ModelComponentEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IListProperty MODEL_COMPONENT__CHILDREN = EMFProperties.list( MApplicationPackage.Literals.MODEL_COMPONENT__CHILDREN); - + private IListProperty PART_DESCRIPTOR_CONTAINER__DESCRIPTORS = EMFProperties.list( MApplicationPackage.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS); + public ModelComponentEditor(EditingDomain editingDomain) { super(editingDomain); - // TODO Auto-generated constructor stub } @Override @@ -150,7 +154,12 @@ private Composite createForm(Composite parent) { @Override public Image getImage(Object element, Display display) { if( image == null ) { - image = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/package_go.png")); + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ModelComponent.gif")); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } return image; } @@ -183,6 +192,14 @@ protected boolean accepted(Object o) { return o instanceof MPart; } + }); + list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART_DESCRIPTORS, PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, element, "PartDescriptors") { + + @Override + protected boolean accepted(Object o) { + return o instanceof MPartDescriptor; + } + }); return list; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java index 9bd3ca841f..7f72155f91 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import java.net.MalformedURLException; +import java.net.URL; + import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -32,13 +35,17 @@ public class ModelComponentsEditor extends AbstractComponentEditor { public ModelComponentsEditor(EditingDomain editingDomain) { super(editingDomain); - // TODO Auto-generated constructor stub } @Override public Image getImage(Object element, Display display) { if( image == null ) { - image = new Image(display, getClass().getClassLoader().getResourceAsStream("/icons/application_view_icons.png")); + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ModelComponents.gif")); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } return image; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index f5b9e4e50b..60ed9f92fb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -10,43 +10,331 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Map.Entry; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MPart; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; -public class PartDescriptorEditor extends PartEditor { +public class PartDescriptorEditor extends AbstractComponentEditor { + + private Composite composite; + private Image image; + private EMFDataBindingContext context; + + private IListProperty PART__MENUS = EMFProperties.list(MApplicationPackage.Literals.PART__MENUS); + private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); + private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); public PartDescriptorEditor(EditingDomain editingDomain) { super(editingDomain); } @Override + public Image getImage(Object element, Display display) { + if( image == null ) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Part.gif")); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "PartDescriptor"; + } + + @Override + public String getDescription(Object element) { + return "PartDescriptor Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + getMaster().setValue(object); + return composite; + } + protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master) { - Composite comp = super.createForm(parent,context,master); + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - Label l = new Label(parent, SWT.NONE); - l.setText("Label"); + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Label"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Tooltip"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Icon URI"); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + + Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setText("Find ..."); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Class URI"); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); + + Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setText("Find ..."); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Persited State"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + + TableViewer tableviewer = new TableViewer(parent); + tableviewer.getTable().setHeaderVisible(true); + ObservableListContentProvider cp = new ObservableListContentProvider(); + tableviewer.setContentProvider(cp); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 80; + tableviewer.getControl().setLayoutData(gd); + + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Key"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ColumnLabelProvider() { + @SuppressWarnings("unchecked") + @Override + public String getText(Object element) { + Entry entry = (Entry) element; + return entry.getKey(); + } + }); + + //FIXME How can we react upon changes in the Map-Value? + column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Value"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ColumnLabelProvider() { + @SuppressWarnings("unchecked") + @Override + public String getText(Object element) { + Entry entry = (Entry) element; + return entry.getValue(); + } + }); + + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__PERSISTED_STATE); + tableviewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + } + + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Variables"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + ListViewer viewer = new ListViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + gd.heightHint = 80; + viewer.getList().setLayoutData(gd); + } // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Properties"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + TableViewer tableviewer = new TableViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + gd.heightHint = 80; + tableviewer.getTable().setHeaderVisible(true); + tableviewer.getControl().setLayoutData(gd); - return comp; + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Key"); + column.getColumn().setWidth(200); + + column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Value"); + column.getColumn().setWidth(200); + } + + + ControlFactory.createTagsWidget(parent, this); + +// // ------------------------------------------------------------ +// +// l = new Label(parent, SWT.NONE); +// l.setText(""); +// +// Composite booleanContainer = new Composite(parent,SWT.NONE); +// gd = new GridData(GridData.FILL_HORIZONTAL); +// gd.horizontalSpan=2; +// booleanContainer.setBackgroundMode(SWT.INHERIT_DEFAULT); +// booleanContainer.setLayoutData(gd); +// booleanContainer.setLayout(new GridLayout(4,false)); +// +// Button checkbox = new Button(booleanContainer, SWT.CHECK); +// checkbox.setText("to render"); +// +// checkbox = new Button(booleanContainer, SWT.CHECK); +// checkbox.setText("on Top"); +// +// checkbox = new Button(booleanContainer, SWT.CHECK); +// checkbox.setText("visible"); +// +// checkbox = new Button(booleanContainer, SWT.CHECK); +// checkbox.setText("closeable"); + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + WritableList list = new WritableList(); + list.add(new VirtualEntry( ModelEditor.VIRTUAL_MENU, PART__MENUS, element, "Menus") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING, BINDING_CONTAINER__BINDINGS, element, "Bindings") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + return list; + } + + @Override + public String getDetailLabel(Object element) { + MPart o = (MPart) element; + return o.getLabel(); + } + + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { + FeaturePath.fromList(MApplicationPackage.Literals.UI_LABEL__LABEL) + }; } -} +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java new file mode 100644 index 0000000000..db6d274a81 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java @@ -0,0 +1,237 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import java.util.List; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MApplication; +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MCommand; +import org.eclipse.e4.ui.model.application.MHandler; +import org.eclipse.e4.ui.model.application.MPartDescriptor; +import org.eclipse.e4.ui.model.application.MPartDescriptorContainer; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VPartDescriptor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private ModelEditor editor; + private TableViewer viewer; + + public VPartDescriptor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "Part Descriptors"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Part Descriptors Bla Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + VirtualEntry o = (VirtualEntry)object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Commands"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Name"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PART_DESCRIPTOR__CATEGORY); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Category"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MPartDescriptorContainer container = (MPartDescriptorContainer) getMaster().getValue(); + int idx = container.getDescriptors().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MPartDescriptorContainer container = (MPartDescriptorContainer) getMaster().getValue(); + int idx = container.getDescriptors().indexOf(obj) + 1; + if( idx < container.getDescriptors().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MPartDescriptor command = MApplicationFactory.eINSTANCE.createPartDescriptor(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, command); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(command); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List commands = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, commands); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } +} From 1ac6252bf94f861ec912e5aec3457806dee29925 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 14 Mar 2010 17:12:04 +0000 Subject: [PATCH 0040/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * improved PartEditor descriptors --- .../component/PartDescriptorEditor.java | 42 ++++++++++++++++++- .../internal/common/component/PartEditor.java | 16 +++++++ 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 60ed9f92fb..d681017442 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -28,6 +28,7 @@ import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -164,6 +165,44 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, b.setText("Find ..."); } + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Closeable"); + + Button checkbox = new Button(parent, SWT.CHECK); + checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); + + IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PART__CLOSEABLE); + IWidgetValueProperty uiProp = WidgetProperties.selection(); + + context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Multiple"); + + Button checkbox = new Button(parent, SWT.CHECK); + checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); + + IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PART_DESCRIPTOR__ALLOW_MULTIPLE); + IWidgetValueProperty uiProp = WidgetProperties.selection(); + + context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Category"); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL,GridData.BEGINNING, true, false, 2, 1)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PART_DESCRIPTOR__CATEGORY).observeDetail(master)); + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -225,8 +264,7 @@ public String getText(Object element) { b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); } - - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 9e47b65682..10c344d0c1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -28,6 +28,7 @@ import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -164,6 +165,21 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, b.setText("Find ..."); } + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Closeable"); + + Button checkbox = new Button(parent, SWT.CHECK); + checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); + + IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PART__CLOSEABLE); + IWidgetValueProperty uiProp = WidgetProperties.selection(); + + context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); + } + + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); From 9097a2c507a2c818c60d76683a6cc1004014c605 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 14 Mar 2010 17:16:23 +0000 Subject: [PATCH 0041/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixed compiler warnings * removed editor for model extensions --- .../META-INF/MANIFEST.MF | 1 - .../common/component/AbstractComponentEditor.java | 2 -- .../common/component/virtual/VPartDescriptor.java | 2 -- .../emf/ui/internal/wbe/ExtensionModelEditor.java | 15 --------------- 4 files changed, 20 deletions(-) delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbe/ExtensionModelEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 8fc35da937..885f1af4ab 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -24,5 +24,4 @@ Export-Package: org.eclipse.e4.tools.emf.ui.common, org.eclipse.e4.tools.emf.ui.common.component, org.eclipse.e4.tools.emf.ui.internal.common;x-internal:=true, org.eclipse.e4.tools.emf.ui.internal.common.component;x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.wbe;x-internal:=true, org.eclipse.e4.tools.emf.ui.internal.wbm;x-friends:="org.eclipse.e4.tools.emf.editor" diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index 8a376fe144..662d39cecf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -18,10 +18,8 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.core.runtime.FileLocator; import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java index db6d274a81..47fcb534a5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java @@ -18,10 +18,8 @@ import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MCommand; import org.eclipse.e4.ui.model.application.MHandler; import org.eclipse.e4.ui.model.application.MPartDescriptor; import org.eclipse.e4.ui.model.application.MPartDescriptorContainer; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbe/ExtensionModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbe/ExtensionModelEditor.java deleted file mode 100644 index 6ddbfedab2..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbe/ExtensionModelEditor.java +++ /dev/null @@ -1,15 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.wbe; - -public class ExtensionModelEditor { - -} From fb346b8b43b08f710c4e44ed0852ad3c105760c0 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 14 Mar 2010 17:57:33 +0000 Subject: [PATCH 0042/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * model components editors improved --- .../emf/ui/internal/common/ModelEditor.java | 2 +- .../component/ModelComponentEditor.java | 47 +++--- .../component/ModelComponentsEditor.java | 148 +++++++++++++++++- 3 files changed, 171 insertions(+), 26 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index c597867342..160c2eb515 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -251,7 +251,7 @@ public void setSelection(Object element) { private void registerDefaultEditors() { registerEditor(MApplicationPackage.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain())); - registerEditor(MApplicationPackage.Literals.MODEL_COMPONENTS, new ModelComponentsEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.MODEL_COMPONENTS, new ModelComponentsEditor(modelProvider.getEditingDomain(),this)); registerEditor(MApplicationPackage.Literals.MODEL_COMPONENT, new ModelComponentEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.PART, new PartEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain())); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index 01129c8d53..9fcef0a2f4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -26,6 +26,7 @@ import org.eclipse.e4.ui.model.application.MPartDescriptor; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -96,24 +97,6 @@ private Composite createForm(Composite parent) { t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); - // ------------------------------------------------------------ - - l = new Label(parent, SWT.NONE); - l.setText("Tags"); - - t = new Text(parent, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - t.setLayoutData(gd); - - l = new Label(parent, SWT.NONE); - ListViewer viewer = new ListViewer(parent); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - gd.heightHint = 130; - viewer.getList().setLayoutData(gd); - - // ------------------------------------------------------------ l = new Label(parent, SWT.NONE); @@ -147,6 +130,23 @@ private Composite createForm(Composite parent) { gd.horizontalSpan=2; t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__PROCESSOR).observeDetail(getMaster())); + + // ------------------------------------------------------------ + + l = new Label(parent, SWT.NONE); + l.setText("Tags"); + + t = new Text(parent, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + + l = new Label(parent, SWT.NONE); + ListViewer viewer = new ListViewer(parent); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + gd.heightHint = 130; + viewer.getList().setLayoutData(gd); return parent; } @@ -207,7 +207,16 @@ protected boolean accepted(Object o) { @Override public String getDetailLabel(Object element) { MModelComponent o = (MModelComponent) element; - return "parentId: " + o.getParentID(); + if( o.getParentID() != null ) { + return "parentId: " + o.getParentID(); + } + return null; } + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { + FeaturePath.fromList(MApplicationPackage.Literals.MODEL_COMPONENT__PARENT_ID) + }; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java index 7f72155f91..4e6c714512 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java @@ -12,18 +12,38 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.e4.ui.model.application.MModelComponent; +import org.eclipse.e4.ui.model.application.MModelComponents; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; public class ModelComponentsEditor extends AbstractComponentEditor { @@ -31,15 +51,16 @@ public class ModelComponentsEditor extends AbstractComponentEditor { private Composite composite; private Image image; - private EMFDataBindingContext context; + private ModelEditor editor; - public ModelComponentsEditor(EditingDomain editingDomain) { + public ModelComponentsEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); + this.editor = editor; } @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ModelComponents.gif")); } catch (MalformedURLException e) { @@ -62,8 +83,7 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { - context = new EMFDataBindingContext(); + if (composite == null) { composite = createForm(parent); } getMaster().setValue(object); @@ -72,6 +92,122 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent) { parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Model Contributions"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final TableViewer viewer = new TableViewer(parent); + viewer.setContentProvider(new ObservableListContentProvider()); + viewer.setLabelProvider(new ComponentLabelProvider(editor)); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + + IEMFListProperty prop = EMFProperties.list(MApplicationPackage.Literals.MODEL_COMPONENTS__COMPONENTS); + viewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MModelComponents container = (MModelComponents) getMaster().getValue(); + int idx = container.getComponents().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.MODEL_COMPONENTS__COMPONENTS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MModelComponents container = (MModelComponents) getMaster().getValue(); + int idx = container.getComponents().indexOf(obj) + 1; + if (idx < container.getComponents().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.MODEL_COMPONENTS__COMPONENTS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add"); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MModelComponent component = MApplicationFactory.eINSTANCE.createModelComponent(); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.MODEL_COMPONENTS__COMPONENTS, component); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(component); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List elements = ((IStructuredSelection) viewer.getSelection()).toList(); + + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.MODEL_COMPONENTS__COMPONENTS, elements); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } return parent; } From 337e157445899710194f8f5ecf3eb549c894e1b9 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 14 Mar 2010 21:38:56 +0000 Subject: [PATCH 0043/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * added handlers and binding changes --- .../emf/ui/internal/common/ModelEditor.java | 3 ++- .../component/ModelComponentEditor.java | 20 +++++++++++++++++++ .../component/virtual/VCommandEditor.java | 14 ++++++++----- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 160c2eb515..7b26f60bf0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -93,6 +93,7 @@ public class ModelEditor { public static final int VIRTUAL_WINDOW_CONTROLS = 6; public static final int VIRTUAL_WINDOW_TRIMS = 7; public static final int VIRTUAL_PART_DESCRIPTORS = 8; + public static final int VIRTUAL_MODEL_COMP_COMMANDS = 9; private Map editorMap = new HashMap(); private AbstractComponentEditor[] virtualEditors; @@ -237,7 +238,7 @@ private void registerVirtualEditors() { null, // V-Part new VHandlerEditor(modelProvider.getEditingDomain(), this), new VKeyBindingEditor(modelProvider.getEditingDomain(), this), - new VCommandEditor(modelProvider.getEditingDomain(), this), + new VCommandEditor(modelProvider.getEditingDomain(), this, MApplicationPackage.Literals.APPLICATION__COMMANDS), new VWindowEditor(modelProvider.getEditingDomain(), this), new VControlEditor(modelProvider.getEditingDomain(), this), new VWindowTrimEditor(modelProvider.getEditingDomain(), this), diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index 9fcef0a2f4..3cb5393087 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -50,6 +50,8 @@ public class ModelComponentEditor extends AbstractComponentEditor { private IListProperty MODEL_COMPONENT__CHILDREN = EMFProperties.list( MApplicationPackage.Literals.MODEL_COMPONENT__CHILDREN); private IListProperty PART_DESCRIPTOR_CONTAINER__DESCRIPTORS = EMFProperties.list( MApplicationPackage.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS); + private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); + private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); public ModelComponentEditor(EditingDomain editingDomain) { super(editingDomain); @@ -201,6 +203,24 @@ protected boolean accepted(Object o) { } }); + list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING, BINDING_CONTAINER__BINDINGS, element, "Bindings") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + return list; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index 6dffa85080..26be242d71 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -27,6 +27,7 @@ import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; @@ -52,10 +53,13 @@ public class VCommandEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private ModelEditor editor; private TableViewer viewer; + + private EStructuralFeature commandsFeature; - public VCommandEditor(EditingDomain editingDomain, ModelEditor editor) { + public VCommandEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature commandsFeature) { super(editingDomain); this.editor = editor; + this.commandsFeature = commandsFeature; } @Override @@ -149,7 +153,7 @@ public void widgetSelected(SelectionEvent e) { MApplication container = (MApplication) getMaster().getValue(); int idx = container.getCommands().indexOf(obj) - 1; if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.APPLICATION__COMMANDS, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -176,7 +180,7 @@ public void widgetSelected(SelectionEvent e) { MApplication container = (MApplication) getMaster().getValue(); int idx = container.getCommands().indexOf(obj) + 1; if( idx < container.getCommands().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.APPLICATION__COMMANDS, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -197,7 +201,7 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { MCommand command = MApplicationFactory.eINSTANCE.createCommand(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.APPLICATION__COMMANDS, command); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, command); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -215,7 +219,7 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { if( ! viewer.getSelection().isEmpty() ) { List commands = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.APPLICATION__COMMANDS, commands); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, commands); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } From f46209b8513bde30515f2c4c4caa647ed7d47453 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 15 Mar 2010 16:48:31 +0000 Subject: [PATCH 0044/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * align with keybinding changes --- .../emf/ui/internal/common/ModelEditor.java | 6 +- .../common/component/ApplicationEditor.java | 4 +- .../component/ModelComponentEditor.java | 2 +- .../component/PartDescriptorEditor.java | 10 --- .../internal/common/component/PartEditor.java | 10 --- .../common/component/WindowEditor.java | 18 ++--- .../virtual/VBindingTableEditor.java | 75 +++++++++++++++++++ .../component/virtual/VKeyBindingEditor.java | 14 ++-- 8 files changed, 99 insertions(+), 40 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 7b26f60bf0..f32e1c9ad5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -54,6 +54,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolItemEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowTrimEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VBindingTableEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VCommandEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VControlEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; @@ -94,6 +95,7 @@ public class ModelEditor { public static final int VIRTUAL_WINDOW_TRIMS = 7; public static final int VIRTUAL_PART_DESCRIPTORS = 8; public static final int VIRTUAL_MODEL_COMP_COMMANDS = 9; + public static final int VIRTUAL_BINDING_TABLE = 10; private Map editorMap = new HashMap(); private AbstractComponentEditor[] virtualEditors; @@ -242,7 +244,9 @@ private void registerVirtualEditors() { new VWindowEditor(modelProvider.getEditingDomain(), this), new VControlEditor(modelProvider.getEditingDomain(), this), new VWindowTrimEditor(modelProvider.getEditingDomain(), this), - new VPartDescriptor(modelProvider.getEditingDomain(), this) + new VPartDescriptor(modelProvider.getEditingDomain(), this), + null, + new VBindingTableEditor(modelProvider.getEditingDomain(), this) }; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index e39b37fb57..190f096ac1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -35,7 +35,7 @@ public class ApplicationEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); - private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); + private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES); private IListProperty APPLICATION__COMMANDS = EMFProperties.list(MApplicationPackage.Literals.APPLICATION__COMMANDS); private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); @@ -96,7 +96,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING, BINDING_CONTAINER__BINDINGS, element, "Bindings") { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING_TABLE, BINDING_CONTAINER__BINDINGS, element, "BindingTables") { @Override protected boolean accepted(Object o) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index 3cb5393087..2490d727cc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -51,7 +51,7 @@ public class ModelComponentEditor extends AbstractComponentEditor { private IListProperty MODEL_COMPONENT__CHILDREN = EMFProperties.list( MApplicationPackage.Literals.MODEL_COMPONENT__CHILDREN); private IListProperty PART_DESCRIPTOR_CONTAINER__DESCRIPTORS = EMFProperties.list( MApplicationPackage.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS); private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); - private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); + private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES); public ModelComponentEditor(EditingDomain editingDomain) { super(editingDomain); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index d681017442..e65cd34744 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -55,7 +55,6 @@ public class PartDescriptorEditor extends AbstractComponentEditor { private IListProperty PART__MENUS = EMFProperties.list(MApplicationPackage.Literals.PART__MENUS); private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); - private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); public PartDescriptorEditor(EditingDomain editingDomain) { super(editingDomain); @@ -351,15 +350,6 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING, BINDING_CONTAINER__BINDINGS, element, "Bindings") { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - return list; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 10c344d0c1..eb28d707bd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -55,7 +55,6 @@ public class PartEditor extends AbstractComponentEditor { private IListProperty PART__MENUS = EMFProperties.list(MApplicationPackage.Literals.PART__MENUS); private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); - private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); public PartEditor(EditingDomain editingDomain) { super(editingDomain); @@ -329,15 +328,6 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING, BINDING_CONTAINER__BINDINGS, element, "Bindings") { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - return list; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 8176e8d2ac..7db1cba282 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -47,7 +47,7 @@ public class WindowEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); - private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS); + private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES); private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); public WindowEditor(EditingDomain editingDomain) { @@ -211,14 +211,14 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING, BINDING_CONTAINER__BINDINGS, element, "Bindings") { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); +// list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING, BINDING_CONTAINER__BINDINGS, element, "Bindings") { +// +// @Override +// protected boolean accepted(Object o) { +// return true; +// } +// +// }); list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOW_TRIMS, ELEMENT_CONTAINER__CHILDREN, element, "Trims") { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java new file mode 100644 index 0000000000..93a3627ae4 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class VBindingTableEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private ModelEditor editor; + + public VBindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + @Override + public String getLabel(Object element) { + return "BindingTables"; + } + @Override + public String getDetailLabel(Object element) { + return null; + } + @Override + public String getDescription(Object element) { + return "BindingTables Bla Bla Bla Bla"; + } + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + return parent; + } + + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java index 3c3f036555..4d8c82e7d6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java @@ -20,7 +20,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MBindingContainer; +import org.eclipse.e4.ui.model.application.MBindingTable; import org.eclipse.e4.ui.model.application.MHandler; import org.eclipse.e4.ui.model.application.MKeyBinding; import org.eclipse.emf.common.command.Command; @@ -156,10 +156,10 @@ public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); if( s.size() == 1 ) { Object obj = s.getFirstElement(); - MBindingContainer container = (MBindingContainer) getMaster().getValue(); + MBindingTable container = (MBindingTable) getMaster().getValue(); int idx = container.getBindings().indexOf(obj) - 1; if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_TABLE__BINDINGS, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -183,10 +183,10 @@ public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); if( s.size() == 1 ) { Object obj = s.getFirstElement(); - MBindingContainer container = (MBindingContainer) getMaster().getValue(); + MBindingTable container = (MBindingTable) getMaster().getValue(); int idx = container.getBindings().indexOf(obj) + 1; if( idx < container.getBindings().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_TABLE__BINDINGS, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -207,7 +207,7 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { MKeyBinding handler = MApplicationFactory.eINSTANCE.createKeyBinding(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS, handler); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_TABLE__BINDINGS, handler); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); @@ -225,7 +225,7 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { if( ! viewer.getSelection().isEmpty() ) { List keybinding = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDINGS, keybinding); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_TABLE__BINDINGS, keybinding); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } From 5486775355d443466c00cfd403c9b366a1f65434 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 15 Mar 2010 17:58:58 +0000 Subject: [PATCH 0045/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * prelimenary support for new binding model objects --- .../emf/ui/internal/common/ModelEditor.java | 11 +- ...ingEditor.java => BindingTableEditor.java} | 77 ++++++---- .../component/ModelComponentEditor.java | 2 +- .../virtual/VBindingTableEditor.java | 134 ++++++++++++++++++ 4 files changed, 193 insertions(+), 31 deletions(-) rename bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/{virtual/VKeyBindingEditor.java => BindingTableEditor.java} (83%) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index f32e1c9ad5..ac399615fc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -32,6 +32,7 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ShadowComposite; import org.eclipse.e4.tools.emf.ui.internal.common.component.ApplicationEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.BindingTableEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.DirectMenuItemEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.HandledMenuItemEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.KeyBindingEditor; @@ -58,7 +59,6 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VCommandEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VControlEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VKeyBindingEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor; @@ -88,14 +88,13 @@ public class ModelEditor { public static final int VIRTUAL_MENU = 0; public static final int VIRTUAL_PART = 1; public static final int VIRTUAL_HANDLER = 2; - public static final int VIRTUAL_BINDING = 3; + public static final int VIRTUAL_BINDING_TABLE = 3; public static final int VIRTUAL_COMMAND = 4; public static final int VIRTUAL_WINDOWS = 5; public static final int VIRTUAL_WINDOW_CONTROLS = 6; public static final int VIRTUAL_WINDOW_TRIMS = 7; public static final int VIRTUAL_PART_DESCRIPTORS = 8; public static final int VIRTUAL_MODEL_COMP_COMMANDS = 9; - public static final int VIRTUAL_BINDING_TABLE = 10; private Map editorMap = new HashMap(); private AbstractComponentEditor[] virtualEditors; @@ -239,14 +238,13 @@ private void registerVirtualEditors() { virtualEditors = new AbstractComponentEditor[] { new VMenuEditor(modelProvider.getEditingDomain(), this), // V-Menu null, // V-Part new VHandlerEditor(modelProvider.getEditingDomain(), this), - new VKeyBindingEditor(modelProvider.getEditingDomain(), this), + new VBindingTableEditor(modelProvider.getEditingDomain(), this), new VCommandEditor(modelProvider.getEditingDomain(), this, MApplicationPackage.Literals.APPLICATION__COMMANDS), new VWindowEditor(modelProvider.getEditingDomain(), this), new VControlEditor(modelProvider.getEditingDomain(), this), new VWindowTrimEditor(modelProvider.getEditingDomain(), this), new VPartDescriptor(modelProvider.getEditingDomain(), this), - null, - new VBindingTableEditor(modelProvider.getEditingDomain(), this) + null }; } @@ -278,6 +276,7 @@ private void registerDefaultEditors() { registerEditor(MApplicationPackage.Literals.MENU_ITEM, new MenuItemEditor(modelProvider.getEditingDomain(), this)); registerEditor(MApplicationPackage.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), this)); registerEditor(MApplicationPackage.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this)); + registerEditor(MApplicationPackage.Literals.BINDING_TABLE, new BindingTableEditor(modelProvider.getEditingDomain(), this)); } public void registerEditor(EClass eClass, AbstractComponentEditor editor) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java similarity index 83% rename from bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java rename to bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index 4d8c82e7d6..31de9ed2f0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VKeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -8,16 +8,17 @@ * Contributors: * Tom Schindl - initial API and implementation ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +package org.eclipse.e4.tools.emf.ui.internal.common.component; +import java.net.MalformedURLException; +import java.net.URL; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MBindingTable; @@ -25,7 +26,9 @@ import org.eclipse.e4.ui.model.application.MKeyBinding; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.command.AddCommand; @@ -48,59 +51,65 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; -public class VKeyBindingEditor extends AbstractComponentEditor { +public class BindingTableEditor extends AbstractComponentEditor { + private Composite composite; + private Image image; private EMFDataBindingContext context; private ModelEditor editor; - private TableViewer viewer; + + private IListProperty BINDING_TABLE__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_TABLE__BINDINGS); + - public VKeyBindingEditor(EditingDomain editingDomain, ModelEditor editor) { + public BindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); this.editor = editor; } @Override public Image getImage(Object element, Display display) { - return null; - } + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/BindingTable.gif")); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } - @Override - public String getLabel(Object element) { - return "KeyBindings"; + return image; } @Override - public String getDetailLabel(Object element) { - return null; + public String getLabel(Object element) { + return "BindingTable"; } @Override public String getDescription(Object element) { - return "KeyBindings Bla Bla Bla Bla Bla"; + return "BindingTable bla bla bla"; } @Override public Composite getEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); + composite = createForm(parent, context); } - VirtualEntry o = (VirtualEntry) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + private Composite createForm(Composite parent, EMFDataBindingContext context) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); - + { Label l = new Label(parent, SWT.NONE); l.setText("Keybindings"); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); + final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); @@ -135,6 +144,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr column.getColumn().setWidth(170); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } + + IEMFListProperty prop = EMFProperties.list(MApplicationPackage.Literals.BINDING_TABLE__BINDINGS); + viewer.setInput(prop.observeDetail(getMaster())); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); @@ -207,6 +219,7 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { MKeyBinding handler = MApplicationFactory.eINSTANCE.createKeyBinding(); + System.err.println(getMaster().getValue()); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_TABLE__BINDINGS, handler); if (cmd.canExecute()) { @@ -233,14 +246,30 @@ public void widgetSelected(SelectionEvent e) { } }); } - + + return parent; } @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; + return BINDING_TABLE__BINDINGS.observe(element); } + @Override + public String getDetailLabel(Object element) { + MBindingTable cmd = (MBindingTable) element; + if (cmd.getBindingContextId() != null && cmd.getBindingContextId().trim().length() > 0) { + return cmd.getBindingContextId(); + } + + return null; + } + + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { + FeaturePath.fromList(MApplicationPackage.Literals.BINDING_TABLE__BINDING_CONTEXT_ID) + }; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index 2490d727cc..a7eb29f9a3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -212,7 +212,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING, BINDING_CONTAINER__BINDINGS, element, "Bindings") { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING_TABLE, BINDING_CONTAINER__BINDINGS, element, "BindingTables") { @Override protected boolean accepted(Object o) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index 93a3627ae4..0ae7599a7c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -10,26 +10,48 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.util.List; + import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MBindingContainer; +import org.eclipse.e4.ui.model.application.MBindingTable; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; public class VBindingTableEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private ModelEditor editor; + private TableViewer viewer; public VBindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); + this.editor = editor; } @Override @@ -54,6 +76,9 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); composite = createForm(parent,context, getMaster()); } + VirtualEntry o = (VirtualEntry)object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); return composite; } @@ -62,6 +87,115 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); + Label l = new Label(parent, SWT.NONE); + l.setText("Binding Tables"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 180; + viewer.getControl().setLayoutData(gd); + viewer.setLabelProvider(new ComponentLabelProvider(editor)); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MBindingContainer container = (MBindingContainer) getMaster().getValue(); + int idx = container.getBindingTables().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MBindingContainer container = (MBindingContainer) getMaster().getValue(); + int idx = container.getBindingTables().indexOf(obj) + 1; + if( idx < container.getBindingTables().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MBindingTable command = MApplicationFactory.eINSTANCE.createBindingTable(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES, command); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(command); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List commands = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES, commands); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + return parent; } From d71b5c29d315d6690e7614467d4dbc9673b3bbb6 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 16 Mar 2010 21:55:42 +0000 Subject: [PATCH 0046/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * more bindings support --- .../common/component/ApplicationEditor.java | 105 +++++++++++++++++- .../common/component/ToolBarEditor.java | 1 - .../common/component/WindowEditor.java | 1 - 3 files changed, 104 insertions(+), 3 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 190f096ac1..93605892cc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -19,14 +19,30 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class ApplicationEditor extends AbstractComponentEditor { @@ -79,7 +95,94 @@ public Composite getEditor(Composite parent, Object object) { } protected Composite createForm(Composite parent, EMFDataBindingContext context) { - parent = new Composite(parent,SWT.NONE); + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + } + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Bindings"); + + final ListViewer viewer = new ListViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 200; + viewer.getControl().setLayoutData(gd); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MApplication container = (MApplication) getMaster().getValue(); + int idx = container.getCommands().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MApplication container = (MApplication) getMaster().getValue(); + int idx = container.getCommands().indexOf(obj) + 1; + if( idx < container.getCommands().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + } return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 0a9eaebd12..552d287987 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -26,7 +26,6 @@ import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MElementContainer; import org.eclipse.e4.ui.model.application.MHandler; -import org.eclipse.e4.ui.model.application.MMenuItem; import org.eclipse.e4.ui.model.application.MToolItem; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 7db1cba282..a6ccf1913f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -47,7 +47,6 @@ public class WindowEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); - private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES); private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); public WindowEditor(EditingDomain editingDomain) { From eeb6d3cbfb581bc2b0e88edfb435cd586b663df5 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 16 Mar 2010 22:02:46 +0000 Subject: [PATCH 0047/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixed classpath --- bundles/org.eclipse.e4.tools.emf.ui/.classpath | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.classpath b/bundles/org.eclipse.e4.tools.emf.ui/.classpath index 304e86186a..64c5e31b7a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/.classpath +++ b/bundles/org.eclipse.e4.tools.emf.ui/.classpath @@ -1,7 +1,7 @@ - + From 96ea52058c1a8bb320cf09c704599e5ba2e61a87 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 16 Mar 2010 22:03:26 +0000 Subject: [PATCH 0048/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixed build.properties --- bundles/org.eclipse.e4.tools.emf.ui/build.properties | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/build.properties b/bundles/org.eclipse.e4.tools.emf.ui/build.properties index 6cf6ee0dc7..4ce589ce29 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/build.properties @@ -2,11 +2,13 @@ # # # -# $Id$ +# $Id: build.properties,v 1.1 2010/03/03 21:12:20 tschindl Exp $ bin.includes = .,\ META-INF/,\ - plugin.properties + plugin.properties,\ + icons/,\ + about.html jars.compile.order = . source.. = src/ output.. = bin/ From aef9b90706345c2e6c6ea654799f74925ef7ca50 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 16 Mar 2010 22:07:55 +0000 Subject: [PATCH 0049/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * new feature with correct name --- .../.project | 17 ++++++++++ .../build.properties | 1 + .../feature.xml | 33 +++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 features/org.eclipse.e4.core.tools.feature/.project create mode 100644 features/org.eclipse.e4.core.tools.feature/build.properties create mode 100644 features/org.eclipse.e4.core.tools.feature/feature.xml diff --git a/features/org.eclipse.e4.core.tools.feature/.project b/features/org.eclipse.e4.core.tools.feature/.project new file mode 100644 index 0000000000..d0fa7e4498 --- /dev/null +++ b/features/org.eclipse.e4.core.tools.feature/.project @@ -0,0 +1,17 @@ + + + org.eclipse.e4.core.tools.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/features/org.eclipse.e4.core.tools.feature/build.properties b/features/org.eclipse.e4.core.tools.feature/build.properties new file mode 100644 index 0000000000..64f93a9f0b --- /dev/null +++ b/features/org.eclipse.e4.core.tools.feature/build.properties @@ -0,0 +1 @@ +bin.includes = feature.xml diff --git a/features/org.eclipse.e4.core.tools.feature/feature.xml b/features/org.eclipse.e4.core.tools.feature/feature.xml new file mode 100644 index 0000000000..3518aafe7b --- /dev/null +++ b/features/org.eclipse.e4.core.tools.feature/feature.xml @@ -0,0 +1,33 @@ + + + + + [Enter Feature Description here.] + + + + [Enter Copyright Description here.] + + + + [Enter License Description here.] + + + + + + + From b20d6a1ac638060b9484219bb748dc5a94dfa25b Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 16 Mar 2010 22:33:46 +0000 Subject: [PATCH 0050/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * some more binding support --- .../common/component/ApplicationEditor.java | 84 ++++++++++++++++++- 1 file changed, 80 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 93605892cc..58dfde8fba 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -12,6 +12,8 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.Arrays; +import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; @@ -20,19 +22,27 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplication; +import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -57,7 +67,6 @@ public class ApplicationEditor extends AbstractComponentEditor { public ApplicationEditor(EditingDomain editingDomain) { super(editingDomain); - // TODO Auto-generated constructor stub } @Override @@ -114,12 +123,42 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) { Label l = new Label(parent, SWT.NONE); l.setText("Bindings"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - final ListViewer viewer = new ListViewer(parent); + final Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + t.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { + handleAddText(t); + } + } + }); + + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText("Add"); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + handleAddText(t); + } + }); + + new Label(parent, SWT.NONE); + + final TableViewer viewer = new TableViewer(parent); + viewer.setLabelProvider(new LabelProvider()); + viewer.setContentProvider(new ObservableListContentProvider()); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 200; viewer.getControl().setLayoutData(gd); + IEMFListProperty prop = EMFProperties.list(MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS); + viewer.setInput(prop.observeDetail(getMaster())); + Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); GridLayout gl = new GridLayout(); @@ -129,7 +168,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) gl.marginHeight=0; buttonComp.setLayout(gl); - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); @@ -182,10 +221,47 @@ public void widgetSelected(SelectionEvent e) { } } }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + MApplication el = (MApplication) getMaster().getValue(); + List ids = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), el, MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, ids); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + if( el.getBindingContexts().size() > 0 ) { + viewer.setSelection(new StructuredSelection(el.getBindingContexts().get(0))); + } + } + } + } + }); } return parent; } + + private void handleAddText( Text tagText) { + if (tagText.getText().trim().length() > 0) { + String[] tags = tagText.getText().split(";"); + for( int i = 0; i < tags.length;i++ ) { + tags[i] = tags[i].trim(); + } + + MApplicationElement appEl = (MApplicationElement) getMaster().getValue(); + Command cmd = AddCommand.create(getEditingDomain(), appEl, MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, Arrays.asList(tags)); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + tagText.setText(""); + } + } @Override public IObservableList getChildList(Object element) { From 1ac9acb7a7ffaa3d52d5798e18288928a53ee964 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 16 Mar 2010 23:42:29 +0000 Subject: [PATCH 0051/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * further improvements to the binding stuff --- .../common/component/BindingTableEditor.java | 29 ++ .../virtual/VBindingTableEditor.java | 403 +++++++++++++----- 2 files changed, 321 insertions(+), 111 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index 31de9ed2f0..382baea5f1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -35,6 +35,8 @@ import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; @@ -50,6 +52,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class BindingTableEditor extends AbstractComponentEditor { @@ -104,6 +107,32 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + } + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Context Id"); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.BINDING_TABLE__BINDING_CONTEXT_ID).observeDetail(getMaster())); + + Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setText("Find ..."); + } + { Label l = new Label(parent, SWT.NONE); l.setText("Keybindings"); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index 0ae7599a7c..46e18f6b13 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -10,28 +10,47 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.util.ArrayList; import java.util.List; +import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MBindingContainer; +import org.eclipse.e4.ui.model.application.MBindingContext; import org.eclipse.e4.ui.model.application.MBindingTable; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CompoundCommand; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.IEMFValueProperty; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider; +import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.TreeViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -47,163 +66,325 @@ public class VBindingTableEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private ModelEditor editor; - private TableViewer viewer; - + private TableViewer bindingViewer; + private TreeViewer contextsViewer; + public VBindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); this.editor = editor; } - + @Override public Image getImage(Object element, Display display) { return null; } + @Override public String getLabel(Object element) { - return "BindingTables"; + return "Binding Configuration"; } + @Override public String getDetailLabel(Object element) { return null; } + @Override public String getDescription(Object element) { - return "BindingTables Bla Bla Bla Bla"; + return "Binding Configuration Bla Bla Bla Bla"; } + @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + composite = createForm(parent, context, getMaster()); } - VirtualEntry o = (VirtualEntry)object; - viewer.setInput(o.getList()); + VirtualEntry o = (VirtualEntry) object; + bindingViewer.setInput(o.getList()); getMaster().setValue(o.getOriginalParent()); return composite; } - - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); + + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); - - Label l = new Label(parent, SWT.NONE); - l.setText("Binding Tables"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 180; - viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(editor)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Contexts"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + contextsViewer = new TreeViewer(parent); + ObservableListTreeContentProvider pv = new ObservableListTreeContentProvider(new ObservableFactoryImpl(), new TreeStructureAdvisorImpl()); + contextsViewer.setContentProvider(pv); + contextsViewer.getTree().setHeaderVisible(true); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 200; + contextsViewer.getControl().setLayoutData(gd); + + final WritableList list = new WritableList(); + + IEMFValueProperty listProp = EMFProperties.value(MApplicationPackage.Literals.BINDING_CONTAINER__ROOT_CONTEXT); + IObservableValue val = listProp.observeDetail(getMaster()); + val.addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + list.clear(); + MBindingContext ctx = (MBindingContext) event.getObservableValue().getValue(); + if( ctx != null ) { + list.add(ctx); + } + } + }); + + + contextsViewer.setInput(list); + + + { + IEMFValueProperty prop = EMFProperties.value(MApplicationPackage.Literals.BINDING_CONTEXT__NAME); - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MBindingContainer container = (MBindingContainer) getMaster().getValue(); - int idx = container.getBindingTables().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); + TreeViewerColumn column = new TreeViewerColumn(contextsViewer, SWT.NONE); + column.getColumn().setText("Name"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(pv.getKnownElements()))); + } + + { + IEMFValueProperty prop = EMFProperties.value(MApplicationPackage.Literals.BINDING_CONTEXT__DESCRIPTION); + + TreeViewerColumn column = new TreeViewerColumn(contextsViewer, SWT.NONE); + column.getColumn().setText("Description"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(pv.getKnownElements()))); + } + + { + IEMFValueProperty prop = EMFProperties.value(MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); + + TreeViewerColumn column = new TreeViewerColumn(contextsViewer, SWT.NONE); + column.getColumn().setText("Id"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(pv.getKnownElements()))); + } + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IStructuredSelection s = (IStructuredSelection) contextsViewer.getSelection(); + MBindingContext context = MApplicationFactory.eINSTANCE.createBindingContext(); + MBindingContext parentContext = null; + + if( ! s.isEmpty() ) { + parentContext = (MBindingContext) s.getFirstElement(); + Command cmd = AddCommand.create(getEditingDomain(), parentContext, MApplicationPackage.Literals.BINDING_CONTEXT__CHILDREN, context); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + contextsViewer.setSelection(new StructuredSelection(context)); + } + } else if( s.isEmpty() && ((MBindingContainer)getMaster().getValue()).getRootContext() == null ) { + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__ROOT_CONTEXT, context); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + contextsViewer.setSelection(new StructuredSelection(context)); + } + } + + + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IStructuredSelection s = (IStructuredSelection) contextsViewer.getSelection(); + if( ! s.isEmpty() ) { + List commands = new ArrayList(); + + for( Object o : s.toArray() ) { + MBindingContext ctx = (MBindingContext) o; + EObject owner = ((EObject)ctx).eContainer(); + if( owner instanceof MBindingContainer ) { + Command cmd = SetCommand.create(getEditingDomain(), owner, MApplicationPackage.Literals.BINDING_CONTAINER__ROOT_CONTEXT, null); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + return; + } + } else { + commands.add(RemoveCommand.create(getEditingDomain(), owner, MApplicationPackage.Literals.BINDING_CONTEXT__CHILDREN, ctx)); } } + CompoundCommand cmd = new CompoundCommand(commands); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } } } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MBindingContainer container = (MBindingContainer) getMaster().getValue(); - int idx = container.getBindingTables().indexOf(obj) + 1; - if( idx < container.getBindingTables().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); + }); + } + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Binding Tables"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + bindingViewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + bindingViewer.setContentProvider(cp); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 180; + bindingViewer.getControl().setLayoutData(gd); + bindingViewer.setLabelProvider(new ComponentLabelProvider(editor)); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!bindingViewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) bindingViewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MBindingContainer container = (MBindingContainer) getMaster().getValue(); + int idx = container.getBindingTables().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + bindingViewer.setSelection(new StructuredSelection(obj)); + } } + } - } } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MBindingTable command = MApplicationFactory.eINSTANCE.createBindingTable(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES, command); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(command); + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!bindingViewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) bindingViewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MBindingContainer container = (MBindingContainer) getMaster().getValue(); + int idx = container.getBindingTables().indexOf(obj) + 1; + if (idx < container.getBindingTables().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + bindingViewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List commands = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES, commands); - if( cmd.canExecute() ) { + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MBindingTable command = MApplicationFactory.eINSTANCE.createBindingTable(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES, command); + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(command); } } - } - }); - + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!bindingViewer.getSelection().isEmpty()) { + List commands = ((IStructuredSelection) bindingViewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES, commands); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + return parent; } - - + @Override public IObservableList getChildList(Object element) { // TODO Auto-generated method stub return null; } + private class ObservableFactoryImpl implements IObservableFactory { + private IEMFListProperty prop = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTEXT__CHILDREN); + + public IObservable createObservable(Object target) { + if( target instanceof IObservableList ) { + return (IObservable) target; + } + return prop.observe(target); + } + } + + private class TreeStructureAdvisorImpl extends TreeStructureAdvisor { + + } } From f52f55738e0888df0166b136b2d3f5588f26ca57 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 16 Mar 2010 23:50:50 +0000 Subject: [PATCH 0052/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * added editing for new binding contexts --- .../virtual/VBindingTableEditor.java | 105 +++++++++++++++++- 1 file changed, 104 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index 46e18f6b13..2f9cd418dd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -46,12 +46,20 @@ import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider; import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.ColumnViewerEditor; +import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; +import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; +import org.eclipse.jface.viewers.EditingSupport; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.TreeViewerColumn; +import org.eclipse.jface.viewers.TreeViewerEditor; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -148,7 +156,34 @@ public void handleValueChange(ValueChangeEvent event) { TreeViewerColumn column = new TreeViewerColumn(contextsViewer, SWT.NONE); column.getColumn().setText("Name"); column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(pv.getKnownElements()))); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(pv.getKnownElements()))); + column.setEditingSupport(new EditingSupport(contextsViewer) { + private TextCellEditor editor = new TextCellEditor(contextsViewer.getTree()); + + @Override + protected void setValue(Object element, Object value) { + Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.BINDING_CONTEXT__NAME, value); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + @Override + protected Object getValue(Object element) { + MBindingContext ctx = (MBindingContext) element; + return ctx.getName() != null ? ctx.getName() : ""; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return editor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); } { @@ -158,6 +193,33 @@ public void handleValueChange(ValueChangeEvent event) { column.getColumn().setText("Description"); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(pv.getKnownElements()))); + column.setEditingSupport(new EditingSupport(contextsViewer) { + private TextCellEditor editor = new TextCellEditor(contextsViewer.getTree()); + + @Override + protected void setValue(Object element, Object value) { + Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.BINDING_CONTEXT__DESCRIPTION, value); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + @Override + protected Object getValue(Object element) { + MBindingContext ctx = (MBindingContext) element; + return ctx.getName() != null ? ctx.getDescription() : ""; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return editor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); } { @@ -167,8 +229,49 @@ public void handleValueChange(ValueChangeEvent event) { column.getColumn().setText("Id"); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(pv.getKnownElements()))); + column.setEditingSupport(new EditingSupport(contextsViewer) { + private TextCellEditor editor = new TextCellEditor(contextsViewer.getTree()); + + @Override + protected void setValue(Object element, Object value) { + Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID, value); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + @Override + protected Object getValue(Object element) { + MBindingContext ctx = (MBindingContext) element; + return ctx.getName() != null ? ctx.getId() : ""; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return editor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); } + ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(contextsViewer) { + @Override + protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { + boolean singleSelect = ((IStructuredSelection)contextsViewer.getSelection()).size() == 1; + boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent)event.sourceEvent).button == 1; + + return singleSelect && (isLeftDoubleMouseSelect + || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC + || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); + } + }; + TreeViewerEditor.create(contextsViewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); + + Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); GridLayout gl = new GridLayout(); From 3c6f96c5cc5b7bc10250d21b217096747c1220d7 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 16 Mar 2010 23:56:18 +0000 Subject: [PATCH 0053/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * small editing fix --- .../common/component/virtual/VBindingTableEditor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index 2f9cd418dd..9c3df275a6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -207,7 +207,7 @@ protected void setValue(Object element, Object value) { @Override protected Object getValue(Object element) { MBindingContext ctx = (MBindingContext) element; - return ctx.getName() != null ? ctx.getDescription() : ""; + return ctx.getDescription() != null ? ctx.getDescription() : ""; } @Override @@ -243,7 +243,7 @@ protected void setValue(Object element, Object value) { @Override protected Object getValue(Object element) { MBindingContext ctx = (MBindingContext) element; - return ctx.getName() != null ? ctx.getId() : ""; + return ctx.getId() != null ? ctx.getId() : ""; } @Override From 2ecbd68c02bf42904c77cef7e56bbd7251863288 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 17 Mar 2010 01:08:01 +0000 Subject: [PATCH 0054/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * add support for command definition on keybinding --- .../META-INF/MANIFEST.MF | 3 +- .../tools/emf/ui/internal/PatternFilter.java | 356 ++++++++++++++ .../tools/emf/ui/internal/StringMatcher.java | 451 ++++++++++++++++++ .../emf/ui/internal/common/ModelEditor.java | 2 +- .../common/component/KeyBindingEditor.java | 16 +- .../KeyBindingCommandSelectionDialog.java | 167 +++++++ 6 files changed, 990 insertions(+), 5 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 885f1af4ab..5ff5f9cccd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -16,7 +16,8 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.emf.edit;bundle-version="2.6.0", org.eclipse.equinox.common;bundle-version="3.6.0", org.eclipse.e4.ui.model.workbench.edit;bundle-version="0.9.1", - org.eclipse.emf.databinding.edit;bundle-version="1.2.0" + org.eclipse.emf.databinding.edit;bundle-version="1.2.0", + com.ibm.icu;bundle-version="4.2.1" Bundle-ActivationPolicy: lazy Import-Package: javax.inject;version="1.0.0", org.osgi.framework;version="1.5.0" diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java new file mode 100644 index 0000000000..23ff9a5051 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java @@ -0,0 +1,356 @@ +/******************************************************************************* + * Copyright (c) 2004, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.jface.viewers.AbstractTreeViewer; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerFilter; + +import com.ibm.icu.text.BreakIterator; + +/** + * A filter used in conjunction with FilteredTree. In order to + * determine if a node should be filtered it uses the content and label provider + * of the tree to do pattern matching on its children. This causes the entire + * tree structure to be realized. Note that the label provider must implement + * ILabelProvider. + * + * @see org.eclipse.ui.dialogs.FilteredTree + * @since 3.2 + */ +public class PatternFilter extends ViewerFilter { + /* + * Cache of filtered elements in the tree + */ + private Map cache = new HashMap(); + + /* + * Maps parent elements to TRUE or FALSE + */ + private Map foundAnyCache = new HashMap(); + + private boolean useCache = false; + + /** + * Whether to include a leading wildcard for all provided patterns. A + * trailing wildcard is always included. + */ + private boolean includeLeadingWildcard = false; + + /** + * The string pattern matcher used for this pattern filter. + */ + private StringMatcher matcher; + + private boolean useEarlyReturnIfMatcherIsNull = true; + + private static Object[] EMPTY = new Object[0]; + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.ViewerFilter#filter(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object[]) + */ + public final Object[] filter(Viewer viewer, Object parent, Object[] elements) { + // we don't want to optimize if we've extended the filter ... this + // needs to be addressed in 3.4 + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=186404 + if (matcher == null && useEarlyReturnIfMatcherIsNull) { + return elements; + } + + if (!useCache) { + return super.filter(viewer, parent, elements); + } + + Object[] filtered = (Object[]) cache.get(parent); + if (filtered == null) { + Boolean foundAny = (Boolean) foundAnyCache.get(parent); + if (foundAny != null && !foundAny.booleanValue()) { + filtered = EMPTY; + } else { + filtered = super.filter(viewer, parent, elements); + } + cache.put(parent, filtered); + } + return filtered; + } + + /** + * Returns true if any of the elements makes it through the filter. + * This method uses caching if enabled; the computation is done in + * computeAnyVisible. + * + * @param viewer + * @param parent + * @param elements the elements (must not be an empty array) + * @return true if any of the elements makes it through the filter. + */ + private boolean isAnyVisible(Viewer viewer, Object parent, Object[] elements) { + if (matcher == null) { + return true; + } + + if (!useCache) { + return computeAnyVisible(viewer, elements); + } + + Object[] filtered = (Object[]) cache.get(parent); + if (filtered != null) { + return filtered.length > 0; + } + Boolean foundAny = (Boolean) foundAnyCache.get(parent); + if (foundAny == null) { + foundAny = computeAnyVisible(viewer, elements) ? Boolean.TRUE : Boolean.FALSE; + foundAnyCache.put(parent, foundAny); + } + return foundAny.booleanValue(); + } + + /** + * Returns true if any of the elements makes it through the filter. + * + * @param viewer the viewer + * @param elements the elements to test + * @return true if any of the elements makes it through the filter + */ + private boolean computeAnyVisible(Viewer viewer, Object[] elements) { + boolean elementFound = false; + for (int i = 0; i < elements.length && !elementFound; i++) { + Object element = elements[i]; + elementFound = isElementVisible(viewer, element); + } + return elementFound; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) + */ + public final boolean select(Viewer viewer, Object parentElement, + Object element) { + return isElementVisible(viewer, element); + } + + /** + * Sets whether a leading wildcard should be attached to each pattern + * string. + * + * @param includeLeadingWildcard + * Whether a leading wildcard should be added. + */ + public final void setIncludeLeadingWildcard( + final boolean includeLeadingWildcard) { + this.includeLeadingWildcard = includeLeadingWildcard; + } + + /** + * The pattern string for which this filter should select + * elements in the viewer. + * + * @param patternString + */ + public void setPattern(String patternString) { + // these 2 strings allow the PatternFilter to be extended in + // 3.3 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=186404 + if ("org.eclipse.ui.keys.optimization.true".equals(patternString)) { //$NON-NLS-1$ + useEarlyReturnIfMatcherIsNull = true; + return; + } else if ("org.eclipse.ui.keys.optimization.false".equals(patternString)) { //$NON-NLS-1$ + useEarlyReturnIfMatcherIsNull = false; + return; + } + clearCaches(); + if (patternString == null || patternString.equals("")) { //$NON-NLS-1$ + matcher = null; + } else { + String pattern = patternString + "*"; //$NON-NLS-1$ + if (includeLeadingWildcard) { + pattern = "*" + pattern; //$NON-NLS-1$ + } + matcher = new StringMatcher(pattern, true, false); + } + } + + /** + * Clears the caches used for optimizing this filter. Needs to be called whenever + * the tree content changes. + */ + /* package */ void clearCaches() { + cache.clear(); + foundAnyCache.clear(); + } + + /** + * Answers whether the given String matches the pattern. + * + * @param string the String to test + * + * @return whether the string matches the pattern + */ + private boolean match(String string) { + if (matcher == null) { + return true; + } + return matcher.match(string); + } + + /** + * Answers whether the given element is a valid selection in + * the filtered tree. For example, if a tree has items that + * are categorized, the category itself may not be a valid + * selection since it is used merely to organize the elements. + * + * @param element + * @return true if this element is eligible for automatic selection + */ + public boolean isElementSelectable(Object element){ + return element != null; + } + + /** + * Answers whether the given element in the given viewer matches + * the filter pattern. This is a default implementation that will + * show a leaf element in the tree based on whether the provided + * filter text matches the text of the given element's text, or that + * of it's children (if the element has any). + * + * Subclasses may override this method. + * + * @param viewer the tree viewer in which the element resides + * @param element the element in the tree to check for a match + * + * @return true if the element matches the filter pattern + */ + public boolean isElementVisible(Viewer viewer, Object element){ + return isParentMatch(viewer, element) || isLeafMatch(viewer, element); + } + + /** + * Check if the parent (category) is a match to the filter text. The default + * behavior returns true if the element has at least one child element that is + * a match with the filter text. + * + * Subclasses may override this method. + * + * @param viewer the viewer that contains the element + * @param element the tree element to check + * @return true if the given element has children that matches the filter text + */ + protected boolean isParentMatch(Viewer viewer, Object element){ + Object[] children = ((ITreeContentProvider) ((AbstractTreeViewer) viewer) + .getContentProvider()).getChildren(element); + + if ((children != null) && (children.length > 0)) { + return isAnyVisible(viewer, element, children); + } + return false; + } + + /** + * Check if the current (leaf) element is a match with the filter text. + * The default behavior checks that the label of the element is a match. + * + * Subclasses should override this method. + * + * @param viewer the viewer that contains the element + * @param element the tree element to check + * @return true if the given element's label matches the filter text + */ + protected boolean isLeafMatch(Viewer viewer, Object element){ + String labelText = ((ILabelProvider) ((StructuredViewer) viewer) + .getLabelProvider()).getText(element); + + if(labelText == null) { + return false; + } + return wordMatches(labelText); + } + + /** + * Take the given filter text and break it down into words using a + * BreakIterator. + * + * @param text + * @return an array of words + */ + private String[] getWords(String text){ + List words = new ArrayList(); + // Break the text up into words, separating based on whitespace and + // common punctuation. + // Previously used String.split(..., "\\W"), where "\W" is a regular + // expression (see the Javadoc for class Pattern). + // Need to avoid both String.split and regular expressions, in order to + // compile against JCL Foundation (bug 80053). + // Also need to do this in an NL-sensitive way. The use of BreakIterator + // was suggested in bug 90579. + BreakIterator iter = BreakIterator.getWordInstance(); + iter.setText(text); + int i = iter.first(); + while (i != java.text.BreakIterator.DONE && i < text.length()) { + int j = iter.following(i); + if (j == java.text.BreakIterator.DONE) { + j = text.length(); + } + // match the word + if (Character.isLetterOrDigit(text.charAt(i))) { + String word = text.substring(i, j); + words.add(word); + } + i = j; + } + return (String[]) words.toArray(new String[words.size()]); + } + + /** + * Return whether or not if any of the words in text satisfy the + * match critera. + * + * @param text the text to match + * @return boolean true if one of the words in text + * satisifes the match criteria. + */ + protected boolean wordMatches(String text) { + if (text == null) { + return false; + } + + //If the whole text matches we are all set + if(match(text)) { + return true; + } + + // Otherwise check if any of the words of the text matches + String[] words = getWords(text); + for (int i = 0; i < words.length; i++) { + String word = words[i]; + if (match(word)) { + return true; + } + } + + return false; + } + + /** + * Can be called by the filtered tree to turn on caching. + * + * @param useCache The useCache to set. + */ + void setUseCache(boolean useCache) { + this.useCache = useCache; + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java new file mode 100644 index 0000000000..ddde765f1c --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java @@ -0,0 +1,451 @@ +/******************************************************************************* + * Copyright (c) 2000, 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal; + +import java.util.Vector; + +/** + * A string pattern matcher, suppporting "*" and "?" wildcards. + */ +public class StringMatcher { + protected String fPattern; + + protected int fLength; // pattern length + + protected boolean fIgnoreWildCards; + + protected boolean fIgnoreCase; + + protected boolean fHasLeadingStar; + + protected boolean fHasTrailingStar; + + protected String fSegments[]; //the given pattern is split into * separated segments + + /* boundary value beyond which we don't need to search in the text */ + protected int fBound = 0; + + protected static final char fSingleWildCard = '\u0000'; + + public static class Position { + int start; //inclusive + + int end; //exclusive + + public Position(int start, int end) { + this.start = start; + this.end = end; + } + + public int getStart() { + return start; + } + + public int getEnd() { + return end; + } + } + + /** + * StringMatcher constructor takes in a String object that is a simple + * pattern which may contain '*' for 0 and many characters and + * '?' for exactly one character. + * + * Literal '*' and '?' characters must be escaped in the pattern + * e.g., "\*" means literal "*", etc. + * + * Escaping any other character (including the escape character itself), + * just results in that character in the pattern. + * e.g., "\a" means "a" and "\\" means "\" + * + * If invoking the StringMatcher with string literals in Java, don't forget + * escape characters are represented by "\\". + * + * @param pattern the pattern to match text against + * @param ignoreCase if true, case is ignored + * @param ignoreWildCards if true, wild cards and their escape sequences are ignored + * (everything is taken literally). + */ + public StringMatcher(String pattern, boolean ignoreCase, + boolean ignoreWildCards) { + if (pattern == null) { + throw new IllegalArgumentException(); + } + fIgnoreCase = ignoreCase; + fIgnoreWildCards = ignoreWildCards; + fPattern = pattern; + fLength = pattern.length(); + + if (fIgnoreWildCards) { + parseNoWildCards(); + } else { + parseWildCards(); + } + } + + /** + * Find the first occurrence of the pattern between startend(exclusive). + * @param text the String object to search in + * @param start the starting index of the search range, inclusive + * @param end the ending index of the search range, exclusive + * @return an StringMatcher.Position object that keeps the starting + * (inclusive) and ending positions (exclusive) of the first occurrence of the + * pattern in the specified range of the text; return null if not found or subtext + * is empty (start==end). A pair of zeros is returned if pattern is empty string + * Note that for pattern like "*abc*" with leading and trailing stars, position of "abc" + * is returned. For a pattern like"*??*" in text "abcdf", (1,3) is returned + */ + public StringMatcher.Position find(String text, int start, int end) { + if (text == null) { + throw new IllegalArgumentException(); + } + + int tlen = text.length(); + if (start < 0) { + start = 0; + } + if (end > tlen) { + end = tlen; + } + if (end < 0 || start >= end) { + return null; + } + if (fLength == 0) { + return new Position(start, start); + } + if (fIgnoreWildCards) { + int x = posIn(text, start, end); + if (x < 0) { + return null; + } + return new Position(x, x + fLength); + } + + int segCount = fSegments.length; + if (segCount == 0) { + return new Position(start, end); + } + + int curPos = start; + int matchStart = -1; + int i; + for (i = 0; i < segCount && curPos < end; ++i) { + String current = fSegments[i]; + int nextMatch = regExpPosIn(text, curPos, end, current); + if (nextMatch < 0) { + return null; + } + if (i == 0) { + matchStart = nextMatch; + } + curPos = nextMatch + current.length(); + } + if (i < segCount) { + return null; + } + return new Position(matchStart, curPos); + } + + /** + * match the given text with the pattern + * @return true if matched otherwise false + * @param text a String object + */ + public boolean match(String text) { + if(text == null) { + return false; + } + return match(text, 0, text.length()); + } + + /** + * Given the starting (inclusive) and the ending (exclusive) positions in the + * text, determine if the given substring matches with aPattern + * @return true if the specified portion of the text matches the pattern + * @param text a String object that contains the substring to match + * @param start marks the starting position (inclusive) of the substring + * @param end marks the ending index (exclusive) of the substring + */ + public boolean match(String text, int start, int end) { + if (null == text) { + throw new IllegalArgumentException(); + } + + if (start > end) { + return false; + } + + if (fIgnoreWildCards) { + return (end - start == fLength) + && fPattern.regionMatches(fIgnoreCase, 0, text, start, + fLength); + } + int segCount = fSegments.length; + if (segCount == 0 && (fHasLeadingStar || fHasTrailingStar)) { + return true; + } + if (start == end) { + return fLength == 0; + } + if (fLength == 0) { + return start == end; + } + + int tlen = text.length(); + if (start < 0) { + start = 0; + } + if (end > tlen) { + end = tlen; + } + + int tCurPos = start; + int bound = end - fBound; + if (bound < 0) { + return false; + } + int i = 0; + String current = fSegments[i]; + int segLength = current.length(); + + /* process first segment */ + if (!fHasLeadingStar) { + if (!regExpRegionMatches(text, start, current, 0, segLength)) { + return false; + } else { + ++i; + tCurPos = tCurPos + segLength; + } + } + if ((fSegments.length == 1) && (!fHasLeadingStar) + && (!fHasTrailingStar)) { + // only one segment to match, no wildcards specified + return tCurPos == end; + } + /* process middle segments */ + while (i < segCount) { + current = fSegments[i]; + int currentMatch; + int k = current.indexOf(fSingleWildCard); + if (k < 0) { + currentMatch = textPosIn(text, tCurPos, end, current); + if (currentMatch < 0) { + return false; + } + } else { + currentMatch = regExpPosIn(text, tCurPos, end, current); + if (currentMatch < 0) { + return false; + } + } + tCurPos = currentMatch + current.length(); + i++; + } + + /* process final segment */ + if (!fHasTrailingStar && tCurPos != end) { + int clen = current.length(); + return regExpRegionMatches(text, end - clen, current, 0, clen); + } + return i == segCount; + } + + /** + * This method parses the given pattern into segments seperated by wildcard '*' characters. + * Since wildcards are not being used in this case, the pattern consists of a single segment. + */ + private void parseNoWildCards() { + fSegments = new String[1]; + fSegments[0] = fPattern; + fBound = fLength; + } + + /** + * Parses the given pattern into segments seperated by wildcard '*' characters. + * @param p, a String object that is a simple regular expression with '*' and/or '?' + */ + private void parseWildCards() { + if (fPattern.startsWith("*")) { //$NON-NLS-1$ + fHasLeadingStar = true; + } + if (fPattern.endsWith("*")) {//$NON-NLS-1$ + /* make sure it's not an escaped wildcard */ + if (fLength > 1 && fPattern.charAt(fLength - 2) != '\\') { + fHasTrailingStar = true; + } + } + + Vector temp = new Vector(); + + int pos = 0; + StringBuffer buf = new StringBuffer(); + while (pos < fLength) { + char c = fPattern.charAt(pos++); + switch (c) { + case '\\': + if (pos >= fLength) { + buf.append(c); + } else { + char next = fPattern.charAt(pos++); + /* if it's an escape sequence */ + if (next == '*' || next == '?' || next == '\\') { + buf.append(next); + } else { + /* not an escape sequence, just insert literally */ + buf.append(c); + buf.append(next); + } + } + break; + case '*': + if (buf.length() > 0) { + /* new segment */ + temp.addElement(buf.toString()); + fBound += buf.length(); + buf.setLength(0); + } + break; + case '?': + /* append special character representing single match wildcard */ + buf.append(fSingleWildCard); + break; + default: + buf.append(c); + } + } + + /* add last buffer to segment list */ + if (buf.length() > 0) { + temp.addElement(buf.toString()); + fBound += buf.length(); + } + + fSegments = new String[temp.size()]; + temp.copyInto(fSegments); + } + + /** + * @param text a string which contains no wildcard + * @param start the starting index in the text for search, inclusive + * @param end the stopping point of search, exclusive + * @return the starting index in the text of the pattern , or -1 if not found + */ + protected int posIn(String text, int start, int end) {//no wild card in pattern + int max = end - fLength; + + if (!fIgnoreCase) { + int i = text.indexOf(fPattern, start); + if (i == -1 || i > max) { + return -1; + } + return i; + } + + for (int i = start; i <= max; ++i) { + if (text.regionMatches(true, i, fPattern, 0, fLength)) { + return i; + } + } + + return -1; + } + + /** + * @param text a simple regular expression that may only contain '?'(s) + * @param start the starting index in the text for search, inclusive + * @param end the stopping point of search, exclusive + * @param p a simple regular expression that may contains '?' + * @return the starting index in the text of the pattern , or -1 if not found + */ + protected int regExpPosIn(String text, int start, int end, String p) { + int plen = p.length(); + + int max = end - plen; + for (int i = start; i <= max; ++i) { + if (regExpRegionMatches(text, i, p, 0, plen)) { + return i; + } + } + return -1; + } + + /** + * + * @return boolean + * @param text a String to match + * @param start int that indicates the starting index of match, inclusive + * @param end int that indicates the ending index of match, exclusive + * @param p String, String, a simple regular expression that may contain '?' + * @param ignoreCase boolean indicating wether code>p is case sensitive + */ + protected boolean regExpRegionMatches(String text, int tStart, String p, + int pStart, int plen) { + while (plen-- > 0) { + char tchar = text.charAt(tStart++); + char pchar = p.charAt(pStart++); + + /* process wild cards */ + if (!fIgnoreWildCards) { + /* skip single wild cards */ + if (pchar == fSingleWildCard) { + continue; + } + } + if (pchar == tchar) { + continue; + } + if (fIgnoreCase) { + if (Character.toUpperCase(tchar) == Character + .toUpperCase(pchar)) { + continue; + } + // comparing after converting to upper case doesn't handle all cases; + // also compare after converting to lower case + if (Character.toLowerCase(tchar) == Character + .toLowerCase(pchar)) { + continue; + } + } + return false; + } + return true; + } + + /** + * @param text the string to match + * @param start the starting index in the text for search, inclusive + * @param end the stopping point of search, exclusive + * @param p a pattern string that has no wildcard + * @return the starting index in the text of the pattern , or -1 if not found + */ + protected int textPosIn(String text, int start, int end, String p) { + + int plen = p.length(); + int max = end - plen; + + if (!fIgnoreCase) { + int i = text.indexOf(p, start); + if (i == -1 || i > max) { + return -1; + } + return i; + } + + for (int i = start; i <= max; ++i) { + if (text.regionMatches(true, i, p, 0, plen)) { + return i; + } + } + + return -1; + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index ac399615fc..6c05ff251b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -258,7 +258,7 @@ private void registerDefaultEditors() { registerEditor(MApplicationPackage.Literals.MODEL_COMPONENT, new ModelComponentEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.PART, new PartEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain())); - registerEditor(MApplicationPackage.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(),modelProvider)); registerEditor(MApplicationPackage.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.COMMAND, new CommandEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain())); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 195137df1c..baf05e7824 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -15,7 +15,9 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.KeyBindingCommandSelectionDialog; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MKeyBinding; @@ -60,10 +62,11 @@ public class KeyBindingEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; + private IModelResource resource; - public KeyBindingEditor(EditingDomain editingDomain) { + public KeyBindingEditor(EditingDomain editingDomain, IModelResource resource) { super(editingDomain); - // TODO Auto-generated constructor stub + this.resource = resource; } @Override @@ -140,10 +143,17 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { t.setEnabled(false); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.KEY_BINDING__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(getMaster())); - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText("Find ..."); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + KeyBindingCommandSelectionDialog dialog = new KeyBindingCommandSelectionDialog(b.getShell(), (MKeyBinding) getMaster().getValue(), resource); + dialog.open(); + } + }); } Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java new file mode 100644 index 0000000000..a6642e7467 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java @@ -0,0 +1,167 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; +import org.eclipse.e4.ui.model.application.MApplication; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MCommand; +import org.eclipse.e4.ui.model.application.MKeyBinding; +import org.eclipse.e4.ui.model.application.MModelComponent; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.viewers.AbstractTreeViewer; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.jface.viewers.StyledString.Styler; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.TextStyle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public class KeyBindingCommandSelectionDialog extends TitleAreaDialog { + private MKeyBinding binding; + private IModelResource resource; + private TableViewer viewer; + + public KeyBindingCommandSelectionDialog(Shell parentShell, MKeyBinding binding, IModelResource resource) { + super(parentShell); + this.binding = binding; + this.resource = resource; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + getShell().setText("Keybinding Command"); + setTitle("Keybinding-Command"); + setMessage("Select the keybinding"); + + Composite container = new Composite(composite, SWT.NONE); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + container.setLayout(new GridLayout(2, false)); + + Label l = new Label(container, SWT.NONE); + l.setText("Command-Id"); + + Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); + searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + l = new Label(container, SWT.NONE); + viewer = new TableViewer(container); + viewer.setContentProvider(new ArrayContentProvider()); + viewer.setLabelProvider(new LabelProviderImpl()); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + if( resource.getRoot().get(0) instanceof MApplication ) { + MApplication app = (MApplication) resource.getRoot().get(0); + viewer.setInput(app.getCommands()); + } else { + MModelComponent comp = (MModelComponent)resource.getRoot().get(0); + viewer.setInput(comp.getCommands()); + } + + + final PatternFilter filter = new PatternFilter() { + @Override + protected boolean isParentMatch(Viewer viewer, Object element) { + return viewer instanceof AbstractTreeViewer && super.isParentMatch(viewer, element); + } + }; + viewer.addFilter(filter); + + searchText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + filter.setPattern(((Text) e.widget).getText()); + viewer.refresh(); + } + }); + + return composite; + } + + @Override + protected void okPressed() { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if( ! s.isEmpty() ) { + Command cmd = SetCommand.create(resource.getEditingDomain(), binding, MApplicationPackage.Literals.KEY_BINDING__COMMAND, s.getFirstElement()); + if( cmd.canExecute() ) { + resource.getEditingDomain().getCommandStack().execute(cmd); + super.okPressed(); + } + } + } + + private class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { + private Styler styler = new Styler() { + + @Override + public void applyStyles(TextStyle textStyle) { + textStyle.foreground = getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY); + } + }; + + public void update(final ViewerCell cell) { + MCommand cmd = (MCommand) cell.getElement(); + + StyledString styledString = new StyledString(); + if( cmd.getCommandName() != null ) { + styledString.append(cmd.getCommandName()); + } + if( cmd.getDescription() != null ) { + styledString.append(" - " + cmd.getDescription(),styler); + } + if( cmd.getId() != null ) { + styledString.append(" - " + cmd.getId(),styler); + } + cell.setText(styledString.getString()); + cell.setStyleRanges(styledString.getStyleRanges()); + } + + public Image getImage(Object element) { + return null; + } + + public String getText(Object element) { + MCommand command = (MCommand) element; + String s = ""; + if( command.getCommandName() != null ) { + s += command.getCommandName(); + } + + if( command.getDescription() != null ) { + s += " " + command.getDescription(); + } + + if( command.getId() != null ) { + s += " " + command.getId(); + } + + return s; + } + } +} From 79553b8afe7a6bd1f71f0653d6e04b58314de079 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 17 Mar 2010 13:46:40 +0000 Subject: [PATCH 0055/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixed file suffix --- bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml index fec54cec4b..c1760d3644 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml @@ -6,7 +6,7 @@ From c596c2a64f4960b6eefb1fdf70abee55b3b3bf8f Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 17 Mar 2010 14:16:43 +0000 Subject: [PATCH 0056/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * adding support for command connecting in keybindings and handlers --- .../emf/ui/internal/common/ModelEditor.java | 2 +- .../common/component/HandlerEditor.java | 17 +- .../AbstractCommandSelectionDialog.java | 177 ++++++++++++++++++ .../HandlerCommandSelectionDialog.java | 49 +++++ .../KeyBindingCommandSelectionDialog.java | 152 ++------------- 5 files changed, 259 insertions(+), 138 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 6c05ff251b..03f1e020e1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -259,7 +259,7 @@ private void registerDefaultEditors() { registerEditor(MApplicationPackage.Literals.PART, new PartEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(),modelProvider)); - registerEditor(MApplicationPackage.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain(),modelProvider)); registerEditor(MApplicationPackage.Literals.COMMAND, new CommandEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor(modelProvider.getEditingDomain(), this)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 7b7ac5d7e6..a52beeb095 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -14,7 +14,9 @@ import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandlerCommandSelectionDialog; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MHandler; import org.eclipse.emf.databinding.EMFDataBindingContext; @@ -24,6 +26,8 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -37,9 +41,11 @@ public class HandlerEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; + private IModelResource resource; - public HandlerEditor(EditingDomain editingDomain) { + public HandlerEditor(EditingDomain editingDomain, IModelResource resource) { super(editingDomain); + this.resource = resource; } @Override @@ -103,10 +109,17 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { t.setEnabled(false); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLER__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(getMaster())); - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText("Find ..."); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + HandlerCommandSelectionDialog dialog = new HandlerCommandSelectionDialog(b.getShell(), (MHandler) getMaster().getValue(), resource); + dialog.open(); + } + }); } // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java new file mode 100644 index 0000000000..0e59caf02f --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java @@ -0,0 +1,177 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; +import org.eclipse.e4.ui.model.application.MApplication; +import org.eclipse.e4.ui.model.application.MCommand; +import org.eclipse.e4.ui.model.application.MModelComponent; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.viewers.AbstractTreeViewer; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.jface.viewers.StyledString.Styler; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.TextStyle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public abstract class AbstractCommandSelectionDialog extends TitleAreaDialog { + private IModelResource resource; + private TableViewer viewer; + + public AbstractCommandSelectionDialog(Shell parentShell, IModelResource resource) { + super(parentShell); + this.resource = resource; + } + + protected abstract String getShellTitle(); + protected abstract String getDialogTitle(); + protected abstract String getDialogMessage(); + + @Override + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + getShell().setText( getShellTitle()); + setTitle( getDialogTitle() ); + setMessage( getDialogMessage() ); + + Composite container = new Composite(composite, SWT.NONE); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + container.setLayout(new GridLayout(2, false)); + + Label l = new Label(container, SWT.NONE); + l.setText("Command-Id"); + + Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); + searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + l = new Label(container, SWT.NONE); + viewer = new TableViewer(container); + viewer.setContentProvider(new ArrayContentProvider()); + viewer.setLabelProvider(new LabelProviderImpl()); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + viewer.addDoubleClickListener(new IDoubleClickListener() { + + public void doubleClick(DoubleClickEvent event) { + okPressed(); + } + }); + + if( resource.getRoot().get(0) instanceof MApplication ) { + MApplication app = (MApplication) resource.getRoot().get(0); + viewer.setInput(app.getCommands()); + } else { + MModelComponent comp = (MModelComponent)resource.getRoot().get(0); + viewer.setInput(comp.getCommands()); + } + + + final PatternFilter filter = new PatternFilter() { + @Override + protected boolean isParentMatch(Viewer viewer, Object element) { + return viewer instanceof AbstractTreeViewer && super.isParentMatch(viewer, element); + } + }; + viewer.addFilter(filter); + + searchText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + filter.setPattern(((Text) e.widget).getText()); + viewer.refresh(); + } + }); + + return composite; + } + + @Override + protected void okPressed() { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if( ! s.isEmpty() ) { + Command cmd = createStoreCommand( resource.getEditingDomain(), (MCommand) s.getFirstElement() ); + if( cmd.canExecute() ) { + resource.getEditingDomain().getCommandStack().execute(cmd); + super.okPressed(); + } + } + } + + protected abstract Command createStoreCommand( EditingDomain editingDomain, MCommand command); + + private class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { + private Styler styler = new Styler() { + + @Override + public void applyStyles(TextStyle textStyle) { + textStyle.foreground = getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY); + } + }; + + public void update(final ViewerCell cell) { + MCommand cmd = (MCommand) cell.getElement(); + + StyledString styledString = new StyledString(); + if( cmd.getCommandName() != null ) { + styledString.append(cmd.getCommandName()); + } + if( cmd.getDescription() != null ) { + styledString.append(" - " + cmd.getDescription(),styler); + } + if( cmd.getId() != null ) { + styledString.append(" - " + cmd.getId(),styler); + } + cell.setText(styledString.getString()); + cell.setStyleRanges(styledString.getStyleRanges()); + } + + public Image getImage(Object element) { + return null; + } + + public String getText(Object element) { + MCommand command = (MCommand) element; + String s = ""; + if( command.getCommandName() != null ) { + s += command.getCommandName(); + } + + if( command.getDescription() != null ) { + s += " " + command.getDescription(); + } + + if( command.getId() != null ) { + s += " " + command.getId(); + } + + return s; + } + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java new file mode 100644 index 0000000000..3532bf70d5 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MCommand; +import org.eclipse.e4.ui.model.application.MHandler; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.widgets.Shell; + +public class HandlerCommandSelectionDialog extends AbstractCommandSelectionDialog { + private MHandler handler; + + public HandlerCommandSelectionDialog(Shell parentShell, MHandler handler, IModelResource resource) { + super(parentShell, resource); + this.handler = handler; + } + + @Override + protected String getShellTitle() { + return "Handler Command"; + } + + @Override + protected String getDialogTitle() { + return "Handler-Command"; + } + + @Override + protected String getDialogMessage() { + return "Connect the handler to a command"; + } + + @Override + protected Command createStoreCommand( EditingDomain editingDomain, MCommand command) { + return SetCommand.create(editingDomain, handler, MApplicationPackage.Literals.HANDLER__COMMAND, command); + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java index a6642e7467..6b7ed917ce 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java @@ -11,157 +11,39 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; -import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MCommand; import org.eclipse.e4.ui.model.application.MKeyBinding; -import org.eclipse.e4.ui.model.application.MModelComponent; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.jface.viewers.StyledString.Styler; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.TextStyle; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -public class KeyBindingCommandSelectionDialog extends TitleAreaDialog { +public class KeyBindingCommandSelectionDialog extends AbstractCommandSelectionDialog { private MKeyBinding binding; - private IModelResource resource; - private TableViewer viewer; public KeyBindingCommandSelectionDialog(Shell parentShell, MKeyBinding binding, IModelResource resource) { - super(parentShell); + super(parentShell, resource); this.binding = binding; - this.resource = resource; } @Override - protected Control createDialogArea(Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); - getShell().setText("Keybinding Command"); - setTitle("Keybinding-Command"); - setMessage("Select the keybinding"); - - Composite container = new Composite(composite, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(2, false)); - - Label l = new Label(container, SWT.NONE); - l.setText("Command-Id"); - - Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - l = new Label(container, SWT.NONE); - viewer = new TableViewer(container); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setLabelProvider(new LabelProviderImpl()); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - if( resource.getRoot().get(0) instanceof MApplication ) { - MApplication app = (MApplication) resource.getRoot().get(0); - viewer.setInput(app.getCommands()); - } else { - MModelComponent comp = (MModelComponent)resource.getRoot().get(0); - viewer.setInput(comp.getCommands()); - } - - - final PatternFilter filter = new PatternFilter() { - @Override - protected boolean isParentMatch(Viewer viewer, Object element) { - return viewer instanceof AbstractTreeViewer && super.isParentMatch(viewer, element); - } - }; - viewer.addFilter(filter); - - searchText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - filter.setPattern(((Text) e.widget).getText()); - viewer.refresh(); - } - }); - - return composite; + protected String getShellTitle() { + return "Keybinding Command"; } - + @Override - protected void okPressed() { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if( ! s.isEmpty() ) { - Command cmd = SetCommand.create(resource.getEditingDomain(), binding, MApplicationPackage.Literals.KEY_BINDING__COMMAND, s.getFirstElement()); - if( cmd.canExecute() ) { - resource.getEditingDomain().getCommandStack().execute(cmd); - super.okPressed(); - } - } + protected String getDialogTitle() { + return "Keybinding-Command"; } - private class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { - private Styler styler = new Styler() { - - @Override - public void applyStyles(TextStyle textStyle) { - textStyle.foreground = getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY); - } - }; - - public void update(final ViewerCell cell) { - MCommand cmd = (MCommand) cell.getElement(); - - StyledString styledString = new StyledString(); - if( cmd.getCommandName() != null ) { - styledString.append(cmd.getCommandName()); - } - if( cmd.getDescription() != null ) { - styledString.append(" - " + cmd.getDescription(),styler); - } - if( cmd.getId() != null ) { - styledString.append(" - " + cmd.getId(),styler); - } - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - } - - public Image getImage(Object element) { - return null; - } - - public String getText(Object element) { - MCommand command = (MCommand) element; - String s = ""; - if( command.getCommandName() != null ) { - s += command.getCommandName(); - } - - if( command.getDescription() != null ) { - s += " " + command.getDescription(); - } - - if( command.getId() != null ) { - s += " " + command.getId(); - } - - return s; - } + @Override + protected String getDialogMessage() { + return "Connect the keybinding to a command"; + } + + @Override + protected Command createStoreCommand( EditingDomain editingDomain, MCommand command) { + return SetCommand.create(editingDomain, binding, MApplicationPackage.Literals.KEY_BINDING__COMMAND, command); } -} +} \ No newline at end of file From 961ad486ee258803390862437f58227590f3c6ef Mon Sep 17 00:00:00 2001 From: Paul Webster Date: Wed, 17 Mar 2010 14:30:24 +0000 Subject: [PATCH 0057/1286] Bug 306200 - [releng] add the model editor tools to the build --- .../META-INF/MANIFEST.MF | 4 +- .../META-INF/MANIFEST.MF | 2 +- .../build.properties | 3 +- .../feature.properties | 148 ++++++++ .../feature.xml | 17 +- .../eclipse_update_120.jpg | Bin 0 -> 21695 bytes .../sourceTemplateFeature/epl-v10.html | 328 ++++++++++++++++++ .../sourceTemplateFeature/feature.properties | 144 ++++++++ .../sourceTemplateFeature/license.html | 79 +++++ .../sourceTemplatePlugin/build.properties | 12 + 10 files changed, 725 insertions(+), 12 deletions(-) create mode 100755 features/org.eclipse.e4.core.tools.feature/feature.properties create mode 100755 features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/eclipse_update_120.jpg create mode 100755 features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/epl-v10.html create mode 100755 features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/feature.properties create mode 100755 features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/license.html create mode 100755 features/org.eclipse.e4.core.tools.feature/sourceTemplatePlugin/build.properties diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index c361c5cbf1..a8b23b3c18 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -2,14 +2,14 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Editor3x Bundle-SymbolicName: org.eclipse.e4.tools.emf.editor3x;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 0.9.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.core.runtime;bundle-version="3.6.0", org.eclipse.emf.common;bundle-version="2.6.0", org.eclipse.emf.edit.ui;bundle-version="2.6.0", org.eclipse.core.databinding.observable;bundle-version="1.3.0", - org.eclipse.e4.tools.emf.ui;bundle-version="1.0.0", + org.eclipse.e4.tools.emf.ui;bundle-version="0.9.0", org.eclipse.e4.ui.workbench;bundle-version="0.9.1", org.eclipse.e4.ui.css.core;bundle-version="0.9.0", org.eclipse.e4.ui.css.swt;bundle-version="0.9.1", diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 5ff5f9cccd..01777f6750 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.e4.tools.emf.ui;singleton:=true -Bundle-Version: 1.0.0 +Bundle-Version: 0.9.0.qualifier Bundle-ClassPath: . Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/features/org.eclipse.e4.core.tools.feature/build.properties b/features/org.eclipse.e4.core.tools.feature/build.properties index 64f93a9f0b..b3a611b5c9 100644 --- a/features/org.eclipse.e4.core.tools.feature/build.properties +++ b/features/org.eclipse.e4.core.tools.feature/build.properties @@ -1 +1,2 @@ -bin.includes = feature.xml +bin.includes = feature.xml,\ + feature.properties diff --git a/features/org.eclipse.e4.core.tools.feature/feature.properties b/features/org.eclipse.e4.core.tools.feature/feature.properties new file mode 100755 index 0000000000..b4f9dc8130 --- /dev/null +++ b/features/org.eclipse.e4.core.tools.feature/feature.properties @@ -0,0 +1,148 @@ +############################################################################### +# Copyright (c) 2000, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +# feature.properties +# contains externalized strings for feature.xml +# "%foo" in feature.xml corresponds to the key "foo" in this file +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file should be translated. + +# "featureName" property - name of the feature +featureName=Eclipse e4 Tools (Incubation) + +# "providerName" property - name of the company that provides the feature +providerName=Eclipse.org + +# "updateSiteName" property - label for the update site +updateSiteName=The Eclipse Project Updates + +# "secondarySiteName" property - label for the update site +secondaryUpdateSiteName=Ganymede Discovery Site + + +# "description" property - description of the feature +description=Eclipse e4 Multiple Programming Language + +# "copyright" property - text of the "Feature Update Copyright" +copyright=\ +Copyright (c) 2000, 2009 IBM Corporation and others.\n\ +All rights reserved. This program and the accompanying materials\n\ +are made available under the terms of the Eclipse Public License v1.0\n\ +which accompanies this distribution, and is available at\n\ +http://www.eclipse.org/legal/epl-v10.html\n\ +\n\ +Contributors:\n\ + IBM Corporation - initial API and implementation\n +################ end of copyright property #################################### + +# "licenseURL" property - URL of the "Feature License" +# do not translate value - just change to point to a locale-specific HTML page +licenseURL=license.html + +# "license" property - text of the "Feature Update License" +# should be plain text version of license agreement pointed to be "licenseURL" +license=\ +ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\ +March 17, 2005\n\ +\n\ +Usage Of Content\n\ +\n\ +THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ +OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ +USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ +AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ +NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ +AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ +AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ +OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ +TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ +OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ +BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ +\n\ +Applicable Licenses\n\ +\n\ +Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\ +is provided to you under the terms and conditions of the Eclipse Public\n\ +License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\ +Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ +For purposes of the EPL, "Program" will mean the Content.\n\ +\n\ +Content includes, but is not limited to, source code, object code,\n\ +documentation and other files maintained in the Eclipse.org CVS\n\ +repository ("Repository") in CVS modules ("Modules") and made available\n\ +as downloadable archives ("Downloads").\n\ +\n\ + - Content may be structured and packaged into modules to facilitate delivering,\n\ + extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ + plug-in fragments ("Fragments"), and features ("Features").\n\ + - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\ + in a directory named "plugins".\n\ + - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ + Each Feature may be packaged as a sub-directory in a directory named "features".\n\ + Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ + numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ + - Features may also include other Features ("Included Features"). Within a Feature, files\n\ + named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ +\n\ +Features may also include other Features ("Included Features"). Files named\n\ +"feature.xml" may contain a list of the names and version numbers of\n\ +Included Features.\n\ +\n\ +The terms and conditions governing Plug-ins and Fragments should be\n\ +contained in files named "about.html" ("Abouts"). The terms and\n\ +conditions governing Features and Included Features should be contained\n\ +in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ +Licenses may be located in any directory of a Download or Module\n\ +including, but not limited to the following locations:\n\ +\n\ + - The top-level (root) directory\n\ + - Plug-in and Fragment directories\n\ + - Inside Plug-ins and Fragments packaged as JARs\n\ + - Sub-directories of the directory named "src" of certain Plug-ins\n\ + - Feature directories\n\ +\n\ +Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ +Eclipse Update Manager, you must agree to a license ("Feature Update\n\ +License") during the installation process. If the Feature contains\n\ +Included Features, the Feature Update License should either provide you\n\ +with the terms and conditions governing the Included Features or inform\n\ +you where you can locate them. Feature Update Licenses may be found in\n\ +the "license" property of files named "feature.properties". Such Abouts,\n\ +Feature Licenses and Feature Update Licenses contain the terms and\n\ +conditions (or references to such terms and conditions) that govern your\n\ +use of the associated Content in that directory.\n\ +\n\ +THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\ +TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ +SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ +\n\ + - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ + - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ + - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ + - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\ + - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ + - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ +\n\ +IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ +TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\ +is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ +govern that particular Content.\n\ +\n\ +Cryptography\n\ +\n\ +Content may contain encryption software. The country in which you are\n\ +currently may have restrictions on the import, possession, and use,\n\ +and/or re-export to another country, of encryption software. BEFORE\n\ +using any encryption software, please check the country's laws,\n\ +regulations and policies concerning the import, possession, or use,\n\ +and re-export of encryption software, to see if this is permitted.\n\ +\n\ +Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n +########### end of license property ########################################## diff --git a/features/org.eclipse.e4.core.tools.feature/feature.xml b/features/org.eclipse.e4.core.tools.feature/feature.xml index 3518aafe7b..b542dc7298 100644 --- a/features/org.eclipse.e4.core.tools.feature/feature.xml +++ b/features/org.eclipse.e4.core.tools.feature/feature.xml @@ -1,19 +1,20 @@ + label="%featureName" + version="0.9.0.qualifier" + provider-name="%providerName"> - - [Enter Feature Description here.] + + %description - - [Enter Copyright Description here.] + + %copyright - - [Enter License Description here.] + + %license e6uPge`61wfz> zKnMH-2t(wlntoUZ0MOS5!~g)G0LUSX01Sj6;2!|t1W0#b0I-Mb{{cHgM85GrK^`dp zjDh{&;{}o4g_%M4W+)aQ`Ia{W{A~pvuts93d%tREoIM6^=!C=Lyq$0!aCH;71=byn z^YsR#4K)C?^2G&J-q>`Y87Oib(yG`r#3&tBpmV+buZH7y1PEApjKiowyHxkU(Hi5-2G-83ief<_Jh+fRXSrN|CA=*)j2XUX~_f zj!rE)&M&}XTx);is8?{CI=Nts$=uL9%3Fptt@w(NMyx4Xvo0Mk%hql-j9GXRQs3b- zvZy5-mvQxJd_(8wrOc8SU8Bq94(F~VWR|-ORQhr>Gf{$CgY0`@~*!7=J4EGX}z^MYhV0my}9>e@je z(%I0OX0mw9@DCCGwFJUHMIiJ7G_c(|82|)Oi{wp>=YxfmePK;|DXQxvrWTTxXk~1? z^ePNXDHa!l9_K|0#ONA>QCtjCAX6X)DN1OqMP^*#<-32yEbpl-hv8E_ysyVYi|YpH z_wmj9%H}+7W~e)u2#VPZAEUWkNBy|qTxz9XGMk&Drkm^Fyow%MPMK>-bpS&Xm4?>n zmzf6^OG&vOu(&oW4*kxUCj|$xJaBDvD){)Bu9LyY#4lB;Z>8x;6}^~2QL_ncF9u9Pl}h7jCzp`Rxd_to{*TD39d(hOkDJ*i zaQgS}TVz;u%v%>46=lT9E%Ob%N{x-L^f9VqzLsoqEnjvduO#q^So|Ync**pr8uF!X zxE_04j3~UKD9p2<&!ElsQ{ltX{I#zi4U@I5is;!e>-gw`3S_M&wAY@v-p5J8s(U-% zc2->TfnQmrUXa$N(#enI2HWcfxoFNQ7sm;X&FBD2mwBX9lz+!(7W#)Kwwa$W{7=x~ z4WTm*3df)DozLSgI^m{&_G$NNv1cDelNL-Vkt8`;qC%=UqVSk=A??N-R~=~w$K)Dx zAKttcbRsA(NW`dN=dpj*X*px0Am%2aqxK{dpLF&!%ge*&saCMuwq)gF2WKff)+Y!+ zpxQ<=@*=-0Y@8i|*czp$>zyxjiO33kG#6Y_oWsHXHD|}8b$vxI-I+gvBcfg)ELJb4 zqN`kul*&ZBKrag^ZJya75C@M3vY`6TJ_kO>Gv2%;_|^9k?5mmE1=7?|qr7WZmhR8` zHe?MQI3>AiBp#a)qubs{=xksuN$>sO8>UnBbwm5}gCz0emy8dS7IrMu_lo+j(x+X} z4sLRdg|PD&s4cYwk#KmviuD=1J@xdnsq)CgWddMY5en^LeRiA;6OlwgQ$Dpx0M-Rf za+eer)Shv|-aXSM-^gJIxVkPiACSJHRH@TrKcN0v9E;@^gXA3%v&#ZRuVsg1N}CwR z*~~#5-$Nx32BpJ1euoNI{X7XkQ%*_rgDiRZFPqAaQEi7Oz8vomt+#r4?WwxfC6ZTz z@)T5?=FQ*>6VOBGsy*3?ymX7?4n;<|2CYpHY0gv9&!%wa#Wf-9*8!>%&7(TZR6_zo zjhCCv4>lF2mqcDt;EK1pq1WQBB1-D4ExJX zZ`tM#xEoY>gb5VbOnKQ`(8TDBq~v>ARjGF!DWFV@!O}huW@xN`PLf9?4g>PX zk@_TpyJPgeZzJ`OA0iDl^NqGQWf7-(;qVogn zx(<69q1a6mH34b?s=D`l(=j)Q{gs!Kn1mt0Xs@-zB&h#y4;5erxC3|q3qGy@20#Pi zfD}mku3aMU_wXz3d;agV-QQmsz7xI)Nld!?xVnNr#Kw@><9yuF-Ujy0C@}RcpD_wg zta`WYrl7axigR}a)4SmW#sU9p`Zylv_AN~m1u%AW`c5aN$-G^$D2%tc>j`f#1^H7w zq`Nc_%?Li^y9uPmFJ+TEdf|LL{)8gKd0`!~?ihC;H!u&4rU|ihgIye$rnU3ITh%_o!(2)KKOJk42g9i0acxteVo&J%1_x%(h76#CO4+Jr{3-7&|#LtpF z6W$${NQfK&StuA0)%NYJfj9v`P7R260oXye{kNn4+tL5B^4rn>?dbn@^nW}0|Cf&b z-Wfo>lTum{~gIA91kfiNC?ymukc{RJJRf6oC2)c1SRbUkTqM5;!kMNht*d16X=#k{#<}|JGRjFye&_ua{e$<^ zU-SNo{=xf`)yy4>SCRfE!#|+^JE{W*xxeo7@1q~l1mQ|xN>SYl1AaehfR74sb3**E zthkh%>G#bEapHCb_y+z1=l9I|I5gJ5|3At63+Io_;An}q!`uBw*?;BzUcj#C;FlRV z!m8}<@5(E;b> zW`|e7y4g8mB%M7lj!Ke0v41V^-p~!sl;E5x`C}F)+VTH=_+820((!L~{Z`lC(!k$h z{%u{q)%CYD@VA(MTi0)O{VfgrE#}|W^;=zkO9Ow4`L}ibR@dLsz~5s2ZC$_B^|v(e zx0wI8)u=Aa*Ek4}B9Y;^_qdsi_Y42APQP&#=qX1phV%| zE`>Z?2jlCC!Q;gZ!OayrFEm^o=jLJO?hgQaZ6@Xd7>T-tgG!c_QjnDumzE%&!1*5j zE%7_k|L{xf+dY;=quoA(u)g_;`c5Sd2lmtKx6_n2dgp%tqkk#2zIwS8oRr@gmwQ{J^a7S_KOTe zaL=wmfGJ}KV78S2_O&nru$eai2@^E{vrYynkRSbag3=t^WCQ>Up0Pc<2Vs!D8~-VS zMuADFH+J{H6rgTw3P<^Po!es}A^wm8RN&?%Gr$3G1N?vpcydh|kOPhZs(>b-3m5>V zz$w56K!MwsZh#ly3tRv$1J{5E;1&=MBmyZw29OIp0*Zk$;18e{cnQ1)FA#JAeZVJR z6qo|$fE8d9JgQC(p@lF(I3PR_LC8UfG(;Yv0?~w=fEYtgLC!)PA?^?#$OXt1NCYGX zk_btKwtZNO~ckn$Viw-;3VQC$4GQY%t%lqo+KAZZjdCB~+V43W%{?2yuu z9w0qPsz{0?wIp>U^(DPVnn0RGT0;7Qw2O3=ckm)k>4eMNM23ePCiP$MnO%%Lm^F}MPWtZP7zFz zK#@oBoT8m#jAD~=AEh9rBBcQ(n$n*#iZX+;lCp(zlyZ}bfl8Q4naY&Pnd&mt9jZrE zFR1#d7OAPJ`KT4Bji|BIm#FVhKc;S?9->~SVWbhGQKzw{@u7*N$)>5H`9QNsOG_(6 zt4eD{i>HmG&84lU9i&~OW1^FwL(-w?g6QtimD07-&C*lS3(~96+t3HlC(u8kZ=s*w zN4ZaEpZY$#eHZuL+gGu#XWudd6N40k0fQUE4Te01W`=P_az-IWO-3|h2xB^9J>v)y zjESE~oe9Nsg(-vS1=A=q8M81mlG&L#g1LbC9rGLuBg;`1a~40Adn{EfpIBk6Laazu zSJo)jV%Bcf4K^+|H8u=e7~3PZcD7aa{p_mj81``XLiR594GuVmCWi}0G)Ec704E8j z7^e}ZFK0663(o2N%=?e+N9_;aU%bEf0Q7*^0pkPb52PP>b6}Z^n@gL^gX=C=J=Zih zE4M1QGj|;KbM6TqCLR?YEKeLyHP0lR1+E5nh2McUz~^`m@apjT@TT&<39 z<}2hI;HTo3=Xcw6_XKj61ykXau9k@_8|7){ex|XNDnC- zazB)Is7IVeTuuC(c)s|M1gpdeiC~E`iCIYjNh`@{$wtYY!!n0m4`&?ilVX(8l?s-s zlvZ^G6RJ#T-pO`d)@fMqegWrcP#CR!-JS_L1y_oPgX} zxg@zBd1iS-`5W?03Zx3h6@nE0P*_)#Rm3Y6D}FsDe$3@q-m!5dVI_=GhSG>KpR%2D zs`4ilxXM|T2P&Tsya+o)8e&+LUlpyIr8=f2s^+ZrP;K`3;p1M%OOCIqE2;;o*J!{r zv^Byt-f1#wnrS9#4r=jfIcnu=&1uVMpVzL@A=S~-iPq^sav@R3T;!atoNl0QgC32Z ziC&`K@CmUKUMDK`q58V|vHJZd1y8!4EHeNMkOr{^1BSweo`%ni$czk)?iqbCmNLFz z+-SmNVr!CTvSNDNG|IHkOvKE`tj?U?+}b?XeAPn3BF5sArKDw`lAg6Vn|F50&cH6sZrL7b zpJYFWQb*lJO`%oMap(z*GA0Hy=Ai5l<1p^1>=^4f;e>EXaGJ)dV-vCS&N|L1&Z{m4 zF4-;wR}0rdHww42ZWZo~?k?^PIBuLDuFd11$2E^no{FCFo^xJ$URmA{?=#-zcxKR< zdgCMFbJb_)oXWX-=hl49eV_O-___PN@fY(C^B)V)3dlT9avpWQ?gHnQf^b-_PPD(&WStacLna=y1SL=l-PCe_`SlU z14&^?tM}3O+mlt3AEj`mM5Jsyz&?1Ns-0SzCX|+tPL_Ty{Y!>#mbsZQW+w?|ZC! zKD|f3AOGO`VZQfV?`Gene$xK%fqerBg9irFK8k)U{3QFSYDi<~&9KRE-w0}C>a+Lf ztaLCZjo=@*%sZd+|k?VC%A#9?tfl> zQw4p2y~}TVSIhpR82U57euQ6g60dqee-QptfbjG38+cpn=jAtg@bVkz)&gWu@B-J5 zKu$qMN|=DIk;p74<#<3W0&w-(W^>`PT&ZevFBxW`)EP+)S@||qh3@TwQVxOLngAp^D$`}rrw%b za@r^nGjj{h;=1976sy*uw$|8Z< zXj?eQ|G2yN^WvV4rIX+FJ2~Y|@5k2^kf*TzVRv&YnmUIo-BY<*?K4ZvTX=re=ARLS*4!L{xi_(-G=`DvXHEr))i2O*Ha@?y zZa6nCdxQD2SwKKyB+U)UQ<1FEq+=N)Rzc=!+nEI5`l=NRoXJcjP}If#^{{sQggjrO zmYCUPvIYhhZ+GnyUe#*xAg<{xRKh9iVok8WZ zd)8-F-nj6%e}aEIwCdARhi0dYSGL~ybm0`FKxC5Q+vSy>6FwjReG}SpZL?K2=vz?_ z<5*;lE=PBoC|Ia3?Yxdyh(x5WY+Pav7NgfPcW-_C!gQXCcI`}|_A@@KSL_W6Bt>}{ zk4X!b@jUT}p_!wRXGh`|#>aaFUI~V-;1A6V=H=y?*_OD>(Y6wR7xYgV2lI9$?zElY zRu)^}I%Yva`j($wfBi;O;nJt`c5{%cxe(d<6ztScpQe0$(t&VwrZ-_1l?*zJW2O{WzL#A?0zpf$wQTVx&XO#J8h&w z?u;1_?deuGSB!){F5gKz&e?DgzloHXC~DAcbUa$Hc=pnElED@lujh+(bnry7} zdV+l2V&_Qf8HDp}uOprScoqkQnFumjQ_~yFwCvjo3LE=ix|!r4e`tqXs?GD{_ zAw6y3+Aj18sH+Asm=JdfObrNM8l z8Wpd-zG1NRs%8S!8h>eqEB8J=+qtZvyMpTJ2i04LZf^7CTLhR_Z1dhfQ&_ioie>qa z42c5q@t~IatmHvcmQ0J$)`;bmCs~SL!B@a$b+)RfYO~OX(4MOxk>|(1?fEs8I<^%{ z?lI9w55!=|`lDw?>eEGThiZ-G9TpeI9J&<~LuO#Sqs?Zla*Y6tOy?~Giq*`GcT;lm zQOHmBZ)j&`449xA%NzV{oKk#OE~L%O(liK4v)vsmZv{ zWBs-6m3YO~6E9IbET+M{V(rrTCaUFFIQX)Q6ELN&(Z!d>Q^}J=1gXtx7YzuYxj9-2 zwJlC}h^@)S0aVTeKyKstyWGtuo;Mux5*+-|_Pxnk5@Yuk-oCB6Gv!a0ZEuh}E_Y1n zMhibHsv#*kEMY3s6x+BltqFSL>Li;5J*Y z%$(fOZnDjboR|kpWavOt8T-Mng&H*Q_Lt0JDg{) zd+}r0*7p7j?z*9p>iRK_rh;ZH*7iEWQHFG7Vru48VlJe#kWNb0@Z8z)>W&f+ZZVjUu{<2nHs&I*VP)VuVkaC z;&ji<*`(_A$-Oy*##c5~8ju9pE?33OQs^cg@EO_Pc+Gmb=wsd1AP=@3weTS%Vm2Rs zGaU(?%*?`bUaZdYHw-rD($2n;b3SxE-92%LUC^a9p~D$p%A}M1($f$T;(yU`-8{MK zz{Tm=ft+)1&BcQA6wuL>cM?=hufjD-1$O+wzL;hynX%A2m)Utq5h;cDW-OySN&v`B zsTcNpwwarn|KT3OB)So)fS5XeXC>!@k+WjXreZGlyMmjabKp_=J3$9h=2irZ!hMhw z55{BNn=P7;*j~;FijqUjT&-HasmjG_Z4x&Ahhq{4{aS?WmH}d(ds==;XDk$nOGOL? ztzMp~c+Svq>(eroK`H^T45}gkFSoOVl||LUm&q5Z=Ztoik~>a#T>QAWl*X$|e_P$a zbavw0wmoV}2vJ)sef8F{0Fg<{@yH@~*X#NTwwc{;f^?p-?r)skY@>O*BgzZ(%q2sf zw+yd4zAm&mwKjK``C{>n3ypU`6WLVW&*Md|_I!7`B6Q|z8NO0uBLJ|ksX*%zhskmJ zQ}bpe^1W9RV$!Uz%n|GZar^f#KvuGCGSkuE#VOxI8vEXlPb|>|@m8*i3(1Mnu*CVT zofbZ0JTW!baTLoeSS2UJBApg}KCaWhXyw}QplrUN_UqJa$rqc0^Y-XGc=!7S64asq zeQ}jlJiV7}YrW}bn{1uT>lBZ=|Cl{~{E$w0w;KPpj!ONpYyDTbJ_PKam5OljcW3tx zIuf;fp_1}QkbraX(S^GQ2NKU{3>y2p^xrGmxH7H4`aXQ)=`vT$sR*XnHr45itqMHl z;wCwzX@Nmsd1k8a_ti0IlAm7lThj6!9A|nu)}&B978|r$=n_YNGFEp@IIXC{%Wf;< zv0#Lk!pH<_n-bItZnkh9kf#fOBv6|>&eYs8dbgsSgaDNCe3e`IRG<>bQhGWos-9_` z=c{n9f21mx$aV9QNs@wko)uQaP;=QPZZ!oP#ht<(sIl|m%O`63>}5p97O;|N(pQg| zBmf9qK8}(0bk0iq(*!`10Qf&+2s%6S;f3wu_&Yc@`Q}I4FZX0hCpaB@%v4XRWQILc zxNKO0RQToot%Grmf71`z?+kOY*=nT?O_y{Yrk$&H!o!pSjLkoz=HLi2S(l ze5r0_R%(^i$wc{~FtyJfFP}zl>k@#_;;J@P4P8&fCjt;LUVk6G@AT<d- zyJ-JB5PIy2cVh78=GuyldzMVivIKzse9cf}hVk2m*jBl_ub)oWT8%`5gRb3L`D4(L z;+`bG%Q2pZq)y@vk4IkhdmQ*&P9Wkzy* zPW#h|=ju(Td;8}!zt(OM0Ijl3)J%+vNyjA*F8eT_;;3b}^_|dd+)DHeOZ@~*Ah{kN z*CDKlE@TOukQXd~s1@#-dr4hgZ820Lx3h#cpsD2BW*BS+GE}Q_w=Dj*IB7Su=XnEZwsK~akcrl|puF%M!vt!Ljaj0C z5*IU4mcQ=w?*y(TdQLtqGzxr%KI;fRYAN*_}umWBIVJ4x2@3ldt2-i@^d%PHBdJmch( z;LzRV%TdQ`=-n2gXRK%{7` zP!bSod)Q^C@I&X=%>AYf@s~}>qqlTa0m3lcIn}$F z$M|;hXyFXkKKH^t#`PG3>7gB_w!5o}c)cF*+b+c10iq@_cZiYz1gy524@F*y&OZXA zWoIS}yEq)Idj)5XBLKZQ5Bb<@cJkPR{Wi{@c!glP_%4L?9OGe{;VY?Q*>Wd8PHumV zXzFt0OqFJ9=3}(Ak6dadJI+{Q*&FPya`a)COz(^I zLy|3Jv%GAw3&;JUx3((ptR7^h<>>UDwbF(&Ni6`|=jZqu0pov}vd zo%O@_54AltQSz$$IOCz4Y0xt<4fhchsf(ngm}1Ax2ozT)4x)MEueZE@ogtUF3bWV* z$Tz#9s##wkC)n5NitegZYwncExnE4WSO~h7lC~+QQ#Tds+HF1sT;E98fZ}#){dw*M z70hN<`32=~+m24wy3|K)RCn#1eEejwF}HA;87Jd&sHZ75TD5<4)31@16;6 z-O1X|kQq0fn{`ov)PA=ttnWX+l9gWZw8SvyL3N?gC#Us9PMUJcgP>6!@upbYFy)q1BZ;U9&k`zzWb1J$pqWzLt!S|#BN zP}D0+BX#tvAHRmJFjhTZdsbPYsNIq=ixOuMIC-k>{r-EAq*1V~z^jrHQ`SrO@5DAL zBk(CUX6IOk^hXo3?Vgk_+f<5-7M<8}kFVFH5|xYPxtY*@vawAd)qa^?L=9J#lq*|f{GH5cK#F8%J)3B3+I}87wt1mNbL4YNZB_M$In%E;kDRFv zyqSM(y_VceQtN$$9zF6pn_1q07u;zrj8ECZ%7`bsx$t{z>exrsWfRbni2I%<-( z@v-vEn-%xA76xtZ^sQ}8-_vKh;%>4u2wDa#-3#U6400d_9`JAguuNu-L z13Yxh$Xn^>2tfFbepR&fto6x9NzfGD9^q(yp3{KBXAi_+!SpeoawaP|Ge^KEKo7H6 zWSkD{q))Jp-i>M%+eXSgE_*!scGM-YCyScN@JMUeV-vnx7>V2 zf)c)pm-;p4xtNB=1rPx(1{d&m4q_+qR$=` zLUoN*%*f~P_@tUzRDG+leUT}CZOe^>p}oz>_+^nvM@L;MDqN%!$V=Z2Q%Vl}%ys`E z>$$n!-nyc`mk-2p9sp+nMWKp-7?(~Y?R)SOX9dgNsIkCZwCS5wN$A-7a_H=3cgVdD zzsji{9h{dVkRVh8APP$bY){6Yp7b?UGgqe6%Dd-eQlKO#CdYE(oOivDqAX9(Jv~%Q zX%}!te=aCA)m5D92FmDR%4DPd+D6)=_GW%PrGiJNtOxFgRezp?tOTFK()sz*CG^=O zoNZVt&1iZpma#8(^nMI8EY??6DJb}3ujOzToII2}Waah}Oqse|oB$;E$`qmI6tKBY zIjIa?#sk9Xc{#UuL<6whIzHQ4nUKa$QO-iimLjbs+|QHMQ^`8Yl}MACoCa-dpX8n{ zQ@A?KDVs51>56fR=Fmgxv7AtS%;xkdw|o8>Lou5U+W=#4*8Zc)BV2r+pg#@G3o9GtQ<)R3{U%Jr_Z@{j+lB9~7H`SkRg=B9{60v#>;?glDd#CO7;O{iFHOs^4G+pJ zT-UbAUduPgJ&kzoEEv)8IkVp0KJ&aK8$*wUS+{tzEJ?>jNnDMbF9tVwN3l3d-J+T_9FPnbtRR@ZCUON_|I?h>(8dut>jUA{Gg7>-y(G zt_5qsQc5HD`H#eUK5BV&jQibd@q$|}(L2|-XI0K7i4p)^wv2Xa7Y_}+6qDGU!s7cP zQ)0M_ff3P){FTWiEy#(_;F8Cna=zwxI95z&60-7`itd(F?$qFFcO|$eF==%w?~4vx zD@GemYUJIrF}OjaPZ~hWcjU1di*V-WC&tsS447>cZ@w_$S(6@V3!TK}FfJ}_LvOAMccEFAf!fyaR8z(FV5*Y^^V2VY)+zcU;x7@>vJ6JE0N`D zckJKtR}ETVxe7P#Hp?NpdmgXEXmmHMz7L*`m5x6A{M;$O8FXX{jA^eSRhB<@UlVG6+&g20xt z1eI{dYN3h=gvqJ%i!;ZwHJ%J~S4>3uzqXET9O;cWI2kUK_&iYV7^_MbUq{+%z{n$& z{)unPJ6#3xQ=Xf)+)-Nd-40XsG*R_}%6UWw{Cu`SBX15YO0R#^ctom`-RX`$G(7J$w-uJO&FZ5O=jrXJQmRC} zzf4Uq`va2!-Q-xK9)@+5Ua6(tGtpz6nN1Aah2ZQ;KA + + + + + + + +Eclipse Public License - Version 1.0 + + + + + + +
    + +

    Eclipse Public License - v 1.0 +

    + +

    THE ACCOMPANYING PROGRAM IS PROVIDED UNDER +THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, +REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE +OF THIS AGREEMENT.

    + +

    1. DEFINITIONS

    + +

    "Contribution" means:

    + +

    a) +in the case of the initial Contributor, the initial code and documentation +distributed under this Agreement, and
    +b) in the case of each subsequent Contributor:

    + +

    i) +changes to the Program, and

    + +

    ii) +additions to the Program;

    + +

    where +such changes and/or additions to the Program originate from and are distributed +by that particular Contributor. A Contribution 'originates' from a Contributor +if it was added to the Program by such Contributor itself or anyone acting on +such Contributor's behalf. Contributions do not include additions to the +Program which: (i) are separate modules of software distributed in conjunction +with the Program under their own license agreement, and (ii) are not derivative +works of the Program.

    + +

    "Contributor" means any person or +entity that distributes the Program.

    + +

    "Licensed Patents " mean patent +claims licensable by a Contributor which are necessarily infringed by the use +or sale of its Contribution alone or when combined with the Program.

    + +

    "Program" means the Contributions +distributed in accordance with this Agreement.

    + +

    "Recipient" means anyone who +receives the Program under this Agreement, including all Contributors.

    + +

    2. GRANT OF RIGHTS

    + +

    a) +Subject to the terms of this Agreement, each Contributor hereby grants Recipient +a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly +display, publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and object code +form.

    + +

    b) +Subject to the terms of this Agreement, each Contributor hereby grants +Recipient a non-exclusive, worldwide, royalty-free +patent license under Licensed Patents to make, use, sell, offer to sell, import +and otherwise transfer the Contribution of such Contributor, if any, in source +code and object code form. This patent license shall apply to the combination +of the Contribution and the Program if, at the time the Contribution is added +by the Contributor, such addition of the Contribution causes such combination +to be covered by the Licensed Patents. The patent license shall not apply to +any other combinations which include the Contribution. No hardware per se is +licensed hereunder.

    + +

    c) +Recipient understands that although each Contributor grants the licenses to its +Contributions set forth herein, no assurances are provided by any Contributor +that the Program does not infringe the patent or other intellectual property +rights of any other entity. Each Contributor disclaims any liability to Recipient +for claims brought by any other entity based on infringement of intellectual +property rights or otherwise. As a condition to exercising the rights and +licenses granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For example, +if a third party patent license is required to allow Recipient to distribute +the Program, it is Recipient's responsibility to acquire that license before +distributing the Program.

    + +

    d) +Each Contributor represents that to its knowledge it has sufficient copyright +rights in its Contribution, if any, to grant the copyright license set forth in +this Agreement.

    + +

    3. REQUIREMENTS

    + +

    A Contributor may choose to distribute the +Program in object code form under its own license agreement, provided that: +

    + +

    a) +it complies with the terms and conditions of this Agreement; and

    + +

    b) +its license agreement:

    + +

    i) +effectively disclaims on behalf of all Contributors all warranties and +conditions, express and implied, including warranties or conditions of title +and non-infringement, and implied warranties or conditions of merchantability +and fitness for a particular purpose;

    + +

    ii) +effectively excludes on behalf of all Contributors all liability for damages, +including direct, indirect, special, incidental and consequential damages, such +as lost profits;

    + +

    iii) +states that any provisions which differ from this Agreement are offered by that +Contributor alone and not by any other party; and

    + +

    iv) +states that source code for the Program is available from such Contributor, and +informs licensees how to obtain it in a reasonable manner on or through a +medium customarily used for software exchange.

    + +

    When the Program is made available in source +code form:

    + +

    a) +it must be made available under this Agreement; and

    + +

    b) a +copy of this Agreement must be included with each copy of the Program.

    + +

    Contributors may not remove or alter any +copyright notices contained within the Program.

    + +

    Each Contributor must identify itself as the +originator of its Contribution, if any, in a manner that reasonably allows +subsequent Recipients to identify the originator of the Contribution.

    + +

    4. COMMERCIAL DISTRIBUTION

    + +

    Commercial distributors of software may +accept certain responsibilities with respect to end users, business partners +and the like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a commercial +product offering should do so in a manner which does not create potential +liability for other Contributors. Therefore, if a Contributor includes the +Program in a commercial product offering, such Contributor ("Commercial +Contributor") hereby agrees to defend and indemnify every other +Contributor ("Indemnified Contributor") against any losses, damages and +costs (collectively "Losses") arising from claims, lawsuits and other +legal actions brought by a third party against the Indemnified Contributor to +the extent caused by the acts or omissions of such Commercial Contributor in +connection with its distribution of the Program in a commercial product +offering. The obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. In order +to qualify, an Indemnified Contributor must: a) promptly notify the Commercial +Contributor in writing of such claim, and b) allow the Commercial Contributor +to control, and cooperate with the Commercial Contributor in, the defense and +any related settlement negotiations. The Indemnified Contributor may participate +in any such claim at its own expense.

    + +

    For example, a Contributor might include the +Program in a commercial product offering, Product X. That Contributor is then a +Commercial Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance claims and +warranties are such Commercial Contributor's responsibility alone. Under this +section, the Commercial Contributor would have to defend claims against the +other Contributors related to those performance claims and warranties, and if a +court requires any other Contributor to pay any damages as a result, the +Commercial Contributor must pay those damages.

    + +

    5. NO WARRANTY

    + +

    EXCEPT AS EXPRESSLY SET FORTH IN THIS +AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, +WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, +MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and distributing the +Program and assumes all risks associated with its exercise of rights under this +Agreement , including but not limited to the risks and costs of program errors, +compliance with applicable laws, damage to or loss of data, programs or +equipment, and unavailability or interruption of operations.

    + +

    6. DISCLAIMER OF LIABILITY

    + +

    EXCEPT AS EXPRESSLY SET FORTH IN THIS +AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF +THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGES.

    + +

    7. GENERAL

    + +

    If any provision of this Agreement is invalid +or unenforceable under applicable law, it shall not affect the validity or +enforceability of the remainder of the terms of this Agreement, and without +further action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable.

    + +

    If Recipient institutes patent litigation +against any entity (including a cross-claim or counterclaim in a lawsuit) +alleging that the Program itself (excluding combinations of the Program with +other software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of the date +such litigation is filed.

    + +

    All Recipient's rights under this Agreement +shall terminate if it fails to comply with any of the material terms or +conditions of this Agreement and does not cure such failure in a reasonable +period of time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use and +distribution of the Program as soon as reasonably practicable. However, +Recipient's obligations under this Agreement and any licenses granted by +Recipient relating to the Program shall continue and survive.

    + +

    Everyone is permitted to copy and distribute +copies of this Agreement, but in order to avoid inconsistency the Agreement is +copyrighted and may only be modified in the following manner. The Agreement +Steward reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement Steward has +the right to modify this Agreement. The Eclipse Foundation is the initial +Agreement Steward. The Eclipse Foundation may assign the responsibility to +serve as the Agreement Steward to a suitable separate entity. Each new version +of the Agreement will be given a distinguishing version number. The Program +(including Contributions) may always be distributed subject to the version of +the Agreement under which it was received. In addition, after a new version of +the Agreement is published, Contributor may elect to distribute the Program +(including its Contributions) under the new version. Except as expressly stated +in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to +the intellectual property of any Contributor under this Agreement, whether +expressly, by implication, estoppel or otherwise. All rights in the Program not +expressly granted under this Agreement are reserved.

    + +

    This Agreement is governed by the laws of the +State of New York and the intellectual property laws of the United States of +America. No party to this Agreement will bring a legal action under this +Agreement more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation.

    + +

     

    + +
    + + + + \ No newline at end of file diff --git a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/feature.properties b/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/feature.properties new file mode 100755 index 0000000000..7b266ca81c --- /dev/null +++ b/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/feature.properties @@ -0,0 +1,144 @@ +############################################################################### +# Copyright (c) 2000, 2007 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +# feature.properties +# contains externalized strings for feature.xml +# "%foo" in feature.xml corresponds to the key "foo" in this file +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file should be translated. + +# "featureName" property - name of the feature +featureName=Eclipse e4 Tools Source (Incubation) + +# "providerName" property - name of the company that provides the feature +providerName=Eclipse.org + +# "updateSiteName" property - label for the update site +updateSiteName=The Eclipse Project Updates + +# "description" property - description of the feature +description=Source code zips for Eclipse E4 initiative. + +# "copyright" property - text of the "Feature Update Copyright" +copyright=\ +Copyright (c) 2000, 2007 IBM Corporation and others.\n\ +All rights reserved. This program and the accompanying materials\n\ +are made available under the terms of the Eclipse Public License v1.0\n\ +which accompanies this distribution, and is available at\n\ +http://www.eclipse.org/legal/epl-v10.html\n\ +\n\ +Contributors:\n\ + IBM Corporation - initial API and implementation\n +################ end of copyright property #################################### + +# "licenseURL" property - URL of the "Feature License" +# do not translate value - just change to point to a locale-specific HTML page +licenseURL=license.html + +# "license" property - text of the "Feature Update License" +# should be plain text version of license agreement pointed to be "licenseURL" +license=\ +ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\ +March 17, 2005\n\ +\n\ +Usage Of Content\n\ +\n\ +THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ +OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ +USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ +AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ +NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ +AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ +AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ +OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ +TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ +OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ +BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ +\n\ +Applicable Licenses\n\ +\n\ +Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\ +is provided to you under the terms and conditions of the Eclipse Public\n\ +License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\ +Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ +For purposes of the EPL, "Program" will mean the Content.\n\ +\n\ +Content includes, but is not limited to, source code, object code,\n\ +documentation and other files maintained in the Eclipse.org CVS\n\ +repository ("Repository") in CVS modules ("Modules") and made available\n\ +as downloadable archives ("Downloads").\n\ +\n\ + - Content may be structured and packaged into modules to facilitate delivering,\n\ + extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ + plug-in fragments ("Fragments"), and features ("Features").\n\ + - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\ + in a directory named "plugins".\n\ + - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ + Each Feature may be packaged as a sub-directory in a directory named "features".\n\ + Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ + numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ + - Features may also include other Features ("Included Features"). Within a Feature, files\n\ + named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ +\n\ +Features may also include other Features ("Included Features"). Files named\n\ +"feature.xml" may contain a list of the names and version numbers of\n\ +Included Features.\n\ +\n\ +The terms and conditions governing Plug-ins and Fragments should be\n\ +contained in files named "about.html" ("Abouts"). The terms and\n\ +conditions governing Features and Included Features should be contained\n\ +in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ +Licenses may be located in any directory of a Download or Module\n\ +including, but not limited to the following locations:\n\ +\n\ + - The top-level (root) directory\n\ + - Plug-in and Fragment directories\n\ + - Inside Plug-ins and Fragments packaged as JARs\n\ + - Sub-directories of the directory named "src" of certain Plug-ins\n\ + - Feature directories\n\ +\n\ +Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ +Eclipse Update Manager, you must agree to a license ("Feature Update\n\ +License") during the installation process. If the Feature contains\n\ +Included Features, the Feature Update License should either provide you\n\ +with the terms and conditions governing the Included Features or inform\n\ +you where you can locate them. Feature Update Licenses may be found in\n\ +the "license" property of files named "feature.properties". Such Abouts,\n\ +Feature Licenses and Feature Update Licenses contain the terms and\n\ +conditions (or references to such terms and conditions) that govern your\n\ +use of the associated Content in that directory.\n\ +\n\ +THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\ +TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ +SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ +\n\ + - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ + - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ + - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ + - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\ + - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ + - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ +\n\ +IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ +TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\ +is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ +govern that particular Content.\n\ +\n\ +Cryptography\n\ +\n\ +Content may contain encryption software. The country in which you are\n\ +currently may have restrictions on the import, possession, and use,\n\ +and/or re-export to another country, of encryption software. BEFORE\n\ +using any encryption software, please check the country's laws,\n\ +regulations and policies concerning the import, possession, or use,\n\ +and re-export of encryption software, to see if this is permitted.\n\ +\n\ +Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n +########### end of license property ########################################## diff --git a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/license.html b/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/license.html new file mode 100755 index 0000000000..c6af966b61 --- /dev/null +++ b/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/license.html @@ -0,0 +1,79 @@ + + + + +Eclipse.org Software User Agreement + + + +

    Eclipse Foundation Software User Agreement

    +

    March 17, 2005

    + +

    Usage Of Content

    + +

    THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS + (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND + CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE + OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR + NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND + CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

    + +

    Applicable Licenses

    + +

    Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 + ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. + For purposes of the EPL, "Program" will mean the Content.

    + +

    Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS + modules ("Modules") and made available as downloadable archives ("Downloads").

    + +
      +
    • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
    • +
    • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
    • +
    • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins + and/or Fragments associated with that Feature.
    • +
    • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
    • +
    + +

    The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and +Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module +including, but not limited to the following locations:

    + +
      +
    • The top-level (root) directory
    • +
    • Plug-in and Fragment directories
    • +
    • Inside Plug-ins and Fragments packaged as JARs
    • +
    • Sub-directories of the directory named "src" of certain Plug-ins
    • +
    • Feature directories
    • +
    + +

    Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the +installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or +inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. +Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in +that directory.

    + +

    THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE +OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

    + + + +

    IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please +contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

    + +

    Cryptography

    + +

    Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to + another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, + possession, or use, and re-export of encryption software, to see if this is permitted.

    + +Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. + + diff --git a/features/org.eclipse.e4.core.tools.feature/sourceTemplatePlugin/build.properties b/features/org.eclipse.e4.core.tools.feature/sourceTemplatePlugin/build.properties new file mode 100755 index 0000000000..cdb3ab38f3 --- /dev/null +++ b/features/org.eclipse.e4.core.tools.feature/sourceTemplatePlugin/build.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2000, 2006 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +bin.includes = plugin.xml, src/**, META-INF/ +sourcePlugin = true From 648ce470d427fc20b6ec9f98f2add627057622c9 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 17 Mar 2010 14:50:59 +0000 Subject: [PATCH 0058/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * starting to contribution class lookup --- bundles/org.eclipse.e4.tools.emf.ui/.project | 5 +++ .../META-INF/MANIFEST.MF | 1 + .../OSGI-INF/contributioncollector.xml | 5 +++ .../build.properties | 11 ++---- .../ui/common/IClassContributionProvider.java | 35 +++++++++++++++++++ .../common/ClassContributionCollector.java | 23 ++++++++++++ .../dialogs/ContributionClassDialog.java | 32 +++++++++++++++++ 7 files changed, 104 insertions(+), 8 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.project b/bundles/org.eclipse.e4.tools.emf.ui/.project index 3848d4ae08..b7697e08f4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/.project +++ b/bundles/org.eclipse.e4.tools.emf.ui/.project @@ -20,6 +20,11 @@ + + org.eclipse.pde.ds.core.builder + + + org.eclipse.pde.PluginNature diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 01777f6750..8dc53b285b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -26,3 +26,4 @@ Export-Package: org.eclipse.e4.tools.emf.ui.common, org.eclipse.e4.tools.emf.ui.internal.common;x-internal:=true, org.eclipse.e4.tools.emf.ui.internal.common.component;x-internal:=true, org.eclipse.e4.tools.emf.ui.internal.wbm;x-friends:="org.eclipse.e4.tools.emf.editor" +Service-Component: OSGI-INF/contributioncollector.xml diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml new file mode 100644 index 0000000000..aa06561e9f --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.ui/build.properties b/bundles/org.eclipse.e4.tools.emf.ui/build.properties index 4ce589ce29..d72a1c5dd5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/build.properties @@ -1,14 +1,9 @@ - -# -# -# -# $Id: build.properties,v 1.1 2010/03/03 21:12:20 tschindl Exp $ - bin.includes = .,\ META-INF/,\ plugin.properties,\ icons/,\ - about.html + about.html,\ + OSGI-INF/contributioncollector.xml +output.. = bin/ jars.compile.order = . source.. = src/ -output.. = bin/ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java new file mode 100644 index 0000000000..d3cf042ab2 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.common; + +import java.util.List; + +public interface IClassContributionProvider { + public class ContributionData { + public final String bundleName; + public final String className; + public final String sourceType; + public final String iconPath; + + public ContributionData(String bundleName, String className, String sourceType, String iconPath) { + this.bundleName = bundleName; + this.className = className; + this.sourceType = sourceType; + this.iconPath = iconPath; + } + } + + public class Filter { + private String namePattern; + } + + public List findContribution(Filter filter); +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java new file mode 100644 index 0000000000..7e35f60a41 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common; + +import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider; + +public class ClassContributionCollector { + public void addContributor(IClassContributionProvider contributor) { + + } + + public void removeContributor(IClassContributionProvider contributor) { + + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java new file mode 100644 index 0000000000..d00f77e78e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; + +public class ContributionClassDialog extends TitleAreaDialog { + + public ContributionClassDialog(Shell parentShell) { + super(parentShell); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite comp = (Composite) super.createDialogArea(parent); + + + + return comp; + } +} From 1d053e66161d3739ccaec7d29e15ce6184d3c366 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 17 Mar 2010 15:05:33 +0000 Subject: [PATCH 0059/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * adding resources-plugin to deal with project informations, ... --- .../.project | 5 ++ .../META-INF/MANIFEST.MF | 1 + .../OSGI-INF/pdecontributionprovider.xml | 4 + .../build.properties | 5 +- .../PDEClassContributionProvider.java | 24 +++++ .../e4/tools/emf/editor3x/RedoAction.java | 90 +++++++++---------- .../e4/tools/emf/editor3x/UndoAction.java | 87 ++++++++---------- .../META-INF/MANIFEST.MF | 3 +- .../ui/common/IClassContributionProvider.java | 9 +- 9 files changed, 126 insertions(+), 102 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/.project b/bundles/org.eclipse.e4.tools.emf.editor3x/.project index 281687d11a..6682b79ae1 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/.project +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/.project @@ -20,6 +20,11 @@ + + org.eclipse.pde.ds.core.builder + + + org.eclipse.pde.PluginNature diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index a8b23b3c18..baee77a2c8 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -14,3 +14,4 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.ui.css.core;bundle-version="0.9.0", org.eclipse.e4.ui.css.swt;bundle-version="0.9.1", org.w3c.css.sac;bundle-version="1.3.0" +Service-Component: OSGI-INF/pdecontributionprovider.xml diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml new file mode 100644 index 0000000000..283568552d --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties index 5e4181d7c1..b2760a07f1 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties @@ -1,7 +1,8 @@ -source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ plugin.xml,\ icons/,\ - css/ + css/,\ + OSGI-INF/pdecontributionprovider.xml +source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java new file mode 100644 index 0000000000..bf9c5d415e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.editor3x; + +import java.util.List; + +import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider; + +public class PDEClassContributionProvider implements IClassContributionProvider { + + public List findContribution(Filter filter) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java index a67480d322..36c0b85a8d 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java @@ -13,60 +13,50 @@ import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.jface.action.Action; +public class RedoAction extends Action { + private final IModelResource resource; + private final IModelResource.ModelListener listener; -public class RedoAction extends Action -{ - private final IModelResource resource; - private final IModelResource.ModelListener listener; + public RedoAction(IModelResource resource) { + this.resource = resource; + this.listener = new IModelResource.ModelListener() { - public RedoAction(IModelResource resource) - { - this.resource = resource; - this.listener = new IModelResource.ModelListener() - { + public void commandStackChanged() { + update(); + } - public void commandStackChanged() - { - update(); - } + public void dirtyChanged() { - public void dirtyChanged() { - - } - - }; - resource.addModelListener(listener); - update(); - } - - @Override - public void run() - { - if (resource.getEditingDomain().getCommandStack().canRedo()) - { - resource.getEditingDomain().getCommandStack().redo(); - } - } + } - private void update() - { - if (resource.getEditingDomain().getCommandStack().canRedo()) - { - setText("Redo " + resource.getEditingDomain().getCommandStack().getRedoCommand().getLabel()); - setEnabled(true); - } - else - { - setText("Redo"); - setEnabled(false); - } - } + }; + resource.addModelListener(listener); + update(); + } - /** - * Clean up - */ - public void dispose() - { - resource.removeModelListener(listener); - } + @Override + public void run() { + if (resource.getEditingDomain().getCommandStack().canRedo()) { + resource.getEditingDomain().getCommandStack().redo(); + } + } + + private void update() { + if (resource.getEditingDomain().getCommandStack().canRedo()) { + setText("Redo " + + resource.getEditingDomain().getCommandStack() + .getRedoCommand().getLabel()); + setEnabled(true); + } else { + setText("Redo"); + setEnabled(false); + } + } + + /** + * Clean up + */ + public void dispose() { + resource.removeModelListener(listener); + } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java index 0d44bff024..6988d3d117 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java @@ -13,57 +13,48 @@ import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.jface.action.Action; -public class UndoAction extends Action -{ - private final IModelResource resource; - private final IModelResource.ModelListener listener; +public class UndoAction extends Action { + private final IModelResource resource; + private final IModelResource.ModelListener listener; - public UndoAction(IModelResource resource) - { - this.resource = resource; - this.listener = new IModelResource.ModelListener() - { + public UndoAction(IModelResource resource) { + this.resource = resource; + this.listener = new IModelResource.ModelListener() { - public void commandStackChanged() - { - update(); - } - - public void dirtyChanged() { - } - }; - resource.addModelListener(listener); - update(); - } + public void commandStackChanged() { + update(); + } - @Override - public void run() - { - if (resource.getEditingDomain().getCommandStack().canUndo()) - { - resource.getEditingDomain().getCommandStack().undo(); - } - } + public void dirtyChanged() { + } + }; + resource.addModelListener(listener); + update(); + } - private void update() - { - if (resource.getEditingDomain().getCommandStack().canUndo()) - { - setText("Undo " + resource.getEditingDomain().getCommandStack().getUndoCommand().getLabel()); - setEnabled(true); - } - else - { - setText("Undo"); - setEnabled(false); - } - } + @Override + public void run() { + if (resource.getEditingDomain().getCommandStack().canUndo()) { + resource.getEditingDomain().getCommandStack().undo(); + } + } - /** - * Clean up - */ - public void dispose() - { - resource.removeModelListener(listener); - } + private void update() { + if (resource.getEditingDomain().getCommandStack().canUndo()) { + setText("Undo " + + resource.getEditingDomain().getCommandStack() + .getUndoCommand().getLabel()); + setEnabled(true); + } else { + setText("Undo"); + setEnabled(false); + } + } + + /** + * Clean up + */ + public void dispose() { + resource.removeModelListener(listener); + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 8dc53b285b..7982e38c20 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -17,7 +17,8 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.equinox.common;bundle-version="3.6.0", org.eclipse.e4.ui.model.workbench.edit;bundle-version="0.9.1", org.eclipse.emf.databinding.edit;bundle-version="1.2.0", - com.ibm.icu;bundle-version="4.2.1" + com.ibm.icu;bundle-version="4.2.1", + org.eclipse.core.resources;bundle-version="3.6.0" Bundle-ActivationPolicy: lazy Import-Package: javax.inject;version="1.0.0", org.osgi.framework;version="1.5.0" diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java index d3cf042ab2..37cb738a54 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java @@ -12,6 +12,8 @@ import java.util.List; +import org.eclipse.core.resources.IProject; + public interface IClassContributionProvider { public class ContributionData { public final String bundleName; @@ -28,7 +30,12 @@ public ContributionData(String bundleName, String className, String sourceType, } public class Filter { - private String namePattern; + public IProject project; + public final String namePattern; + + public Filter(String namePattern) { + this.namePattern = namePattern; + } } public List findContribution(Filter filter); From 255a7a285ab4e44dfcc198550065ce112e73cb82 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 17 Mar 2010 16:45:34 +0000 Subject: [PATCH 0060/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * using JDT to look up classes --- .../META-INF/MANIFEST.MF | 7 +- .../OSGI-INF/pdecontributionprovider.xml | 5 +- .../emf/editor3x/E4WorkbenchModelEditor.java | 6 +- .../PDEClassContributionProvider.java | 81 +++++++++++++- .../META-INF/MANIFEST.MF | 3 +- .../OSGI-INF/contributioncollector.xml | 3 + .../ui/common/IClassContributionProvider.java | 13 ++- .../common/ClassContributionCollector.java | 18 +++- .../emf/ui/internal/common/ModelEditor.java | 7 +- .../common/component/HandlerEditor.java | 15 ++- .../dialogs/ContributionClassDialog.java | 100 +++++++++++++++++- .../internal/wbm/ApplicationModelEditor.java | 9 +- 12 files changed, 242 insertions(+), 25 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index baee77a2c8..dd63143407 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -13,5 +13,10 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.ui.workbench;bundle-version="0.9.1", org.eclipse.e4.ui.css.core;bundle-version="0.9.0", org.eclipse.e4.ui.css.swt;bundle-version="0.9.1", - org.w3c.css.sac;bundle-version="1.3.0" + org.w3c.css.sac;bundle-version="1.3.0", + org.eclipse.pde.core;bundle-version="3.6.0", + org.eclipse.core.resources;bundle-version="3.6.0", + org.eclipse.jdt.core;bundle-version="3.6.0", + org.eclipse.ui.ide;bundle-version="3.6.0" Service-Component: OSGI-INF/pdecontributionprovider.xml +Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml index 283568552d..dbd21aa8b9 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml @@ -1,4 +1,7 @@ - \ No newline at end of file + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java index b3d2f279f0..e1452e8119 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java @@ -15,6 +15,7 @@ import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.e4.tools.emf.ui.common.IModelResource.ModelListener; @@ -30,6 +31,7 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.PartInitException; import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.part.EditorPart; @@ -128,8 +130,8 @@ public void createPartControl(Composite parent) { layout.marginWidth = 10; layout.marginHeight = 10; comp.setLayout(layout); - - editor = new ApplicationModelEditor(comp, resource); + IFileEditorInput input = (IFileEditorInput)getEditorInput(); + editor = new ApplicationModelEditor(comp, resource, input.getFile().getProject()); try { parent.setRedraw(false); diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java index bf9c5d415e..f3ab1ba881 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java @@ -13,12 +13,87 @@ import java.util.List; import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.search.IJavaSearchConstants; +import org.eclipse.jdt.core.search.IJavaSearchScope; +import org.eclipse.jdt.core.search.SearchEngine; +import org.eclipse.jdt.core.search.SearchPattern; +import org.eclipse.jdt.core.search.TypeNameRequestor; +import org.eclipse.pde.internal.core.util.PDEJavaHelper; public class PDEClassContributionProvider implements IClassContributionProvider { + private SearchEngine searchEngine; + public PDEClassContributionProvider() { + searchEngine = new SearchEngine(); + } + + @SuppressWarnings("restriction") + public void findContribution(Filter filter, final ContributionResultHandler handler) { + System.err.println("Searching for: " + filter.namePattern); + + IJavaSearchScope scope = PDEJavaHelper.getSearchScope(filter.project); + + char[] packageName = null; + char[] typeName = null; + String currentContent = filter.namePattern; + int index = currentContent.lastIndexOf('.'); - public List findContribution(Filter filter) { - // TODO Auto-generated method stub - return null; + if (index == -1) { + // There is no package qualification + // Perform the search only on the type name + typeName = currentContent.toCharArray(); + } else if ((index + 1) == currentContent.length()) { + // There is a package qualification and the last character is a + // dot + // Perform the search for all types under the given package + // Pattern for all types + typeName = "".toCharArray(); //$NON-NLS-1$ + // Package name without the trailing dot + packageName = currentContent.substring(0, index).toCharArray(); + } else { + // There is a package qualification, followed by a dot, and + // a type fragment + // Type name without the package qualification + typeName = currentContent.substring(index + 1).toCharArray(); + // Package name without the trailing dot + packageName = currentContent.substring(0, index).toCharArray(); + } + +// char[] packageName = "at.bestsolution.e4.handlers".toCharArray(); +// char[] typeName = "*".toCharArray(); + + TypeNameRequestor req = new TypeNameRequestor() { + public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path) { + // Accept search results from the JDT SearchEngine + String cName = new String(simpleTypeName); + String pName = new String(packageName); + String label = cName + " - " + pName; //$NON-NLS-1$ + String content = pName + "." + cName; //$NON-NLS-1$ + System.err.println("Found: " + label + " => " + pName); + + ContributionData data = new ContributionData(null, content, "Java", null); + handler.result(data); + + //Image image = (Flags.isInterface(modifiers)) ? PDEPluginImages.get(PDEPluginImages.OBJ_DESC_GENERATE_INTERFACE) : PDEPluginImages.get(PDEPluginImages.OBJ_DESC_GENERATE_CLASS); + //addProposalToCollection(c, startOffset, length, label, content, image); + } + }; + + try { + searchEngine.searchAllTypeNames( + packageName, + SearchPattern.R_EXACT_MATCH, + typeName, + SearchPattern.R_PREFIX_MATCH, + IJavaSearchConstants.CLASS, + scope, + req, + IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null); + } catch (JavaModelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 7982e38c20..d622a13711 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.e4.ui.model.workbench.edit;bundle-version="0.9.1", org.eclipse.emf.databinding.edit;bundle-version="1.2.0", com.ibm.icu;bundle-version="4.2.1", - org.eclipse.core.resources;bundle-version="3.6.0" + org.eclipse.core.resources;bundle-version="3.6.0", + org.eclipse.e4.core.services;bundle-version="0.9.1" Bundle-ActivationPolicy: lazy Import-Package: javax.inject;version="1.0.0", org.osgi.framework;version="1.5.0" diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml index aa06561e9f..42e124fe44 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml +++ b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml @@ -2,4 +2,7 @@ + + + diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java index 37cb738a54..53383e00f5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.common; -import java.util.List; - import org.eclipse.core.resources.IProject; public interface IClassContributionProvider { @@ -30,13 +28,18 @@ public ContributionData(String bundleName, String className, String sourceType, } public class Filter { - public IProject project; + public final IProject project; public final String namePattern; - public Filter(String namePattern) { + public Filter(IProject project, String namePattern) { + this.project = project; this.namePattern = namePattern; } } - public List findContribution(Filter filter); + public interface ContributionResultHandler { + public void result(ContributionData data); + } + + public void findContribution(Filter filter, ContributionResultHandler handler); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java index 7e35f60a41..a976bc2261 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java @@ -10,14 +10,30 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; + +import java.util.concurrent.CopyOnWriteArrayList; + import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider; +import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionResultHandler; +import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Filter; public class ClassContributionCollector { + private CopyOnWriteArrayList providers = new CopyOnWriteArrayList(); + public void addContributor(IClassContributionProvider contributor) { - + System.err.println("Add Contributor: " + contributor); + providers.add(contributor); } public void removeContributor(IClassContributionProvider contributor) { + System.err.println("Remove Contributor: " + contributor); + providers.remove(contributor); + } + + public void findContributions(Filter filter, ContributionResultHandler resultHandler) { + for( IClassContributionProvider contributor: providers ) { + contributor.findContribution(filter, resultHandler); + } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 03f1e020e1..d9a67c5b75 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -26,6 +26,7 @@ import org.eclipse.core.databinding.observable.set.ISetChangeListener; import org.eclipse.core.databinding.observable.set.SetChangeEvent; import org.eclipse.core.databinding.observable.set.WritableSet; +import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.e4.tools.emf.ui.common.IModelResource; @@ -105,10 +106,12 @@ public class ModelEditor { private TreeViewer viewer; private IModelResource modelProvider; + private IProject project; @Inject - public ModelEditor(Composite composite, IModelResource modelProvider) { + public ModelEditor(Composite composite, IModelResource modelProvider, IProject project) { this.modelProvider = modelProvider; + this.project = project; registerDefaultEditors(); registerVirtualEditors(); SashForm form = new SashForm(composite, SWT.HORIZONTAL); @@ -259,7 +262,7 @@ private void registerDefaultEditors() { registerEditor(MApplicationPackage.Literals.PART, new PartEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(),modelProvider)); - registerEditor(MApplicationPackage.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain(),modelProvider)); + registerEditor(MApplicationPackage.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain(),modelProvider,project)); registerEditor(MApplicationPackage.Literals.COMMAND, new CommandEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor(modelProvider.getEditingDomain(), this)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index a52beeb095..14896d3312 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -14,8 +14,10 @@ import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandlerCommandSelectionDialog; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MHandler; @@ -42,10 +44,12 @@ public class HandlerEditor extends AbstractComponentEditor { private Image image; private EMFDataBindingContext context; private IModelResource resource; + private IProject project; - public HandlerEditor(EditingDomain editingDomain, IModelResource resource) { + public HandlerEditor(EditingDomain editingDomain, IModelResource resource, IProject project) { super(editingDomain); this.resource = resource; + this.project = project; } @Override @@ -131,10 +135,17 @@ public void widgetSelected(SelectionEvent e) { t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(getMaster())); - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setText("Find ..."); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project); + dialog.open(); + } + }); } ControlFactory.createTagsWidget(parent, this); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java index d00f77e78e..67a11d670f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -10,23 +10,119 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionData; +import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionResultHandler; +import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Filter; +import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; public class ContributionClassDialog extends TitleAreaDialog { - - public ContributionClassDialog(Shell parentShell) { + private IProject project; + + public ContributionClassDialog(Shell parentShell, IProject project) { super(parentShell); + this.project = project; } @Override protected Control createDialogArea(Composite parent) { Composite comp = (Composite) super.createDialogArea(parent); + Composite container = new Composite(comp, SWT.NONE); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + container.setLayout(new GridLayout(2,false)); + + Label l = new Label(container, SWT.NONE); + l.setText("Classname"); + + final Text t = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + l = new Label(container,SWT.NONE); + + TableViewer viewer = new TableViewer(container); + GridData gd = new GridData(GridData.FILL_BOTH); + viewer.getControl().setLayoutData(gd); + viewer.setContentProvider(new ObservableListContentProvider()); + viewer.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + return ((ContributionData)element).className; + } + }); + + final WritableList list = new WritableList(); + viewer.setInput(list); + + final ClassContributionCollector collector = getCollector(); + t.addModifyListener(new ModifyListener() { + private ContributionResultHandlerImpl currentResultHandler; + + public void modifyText(ModifyEvent e) { + if( currentResultHandler != null ) { + currentResultHandler.cancled = true; + } + list.clear(); + currentResultHandler = new ContributionResultHandlerImpl(list); + Filter filter = new Filter(project, t.getText()); + collector.findContributions(filter, currentResultHandler); + } + }); + +// collector.findContributions(new Filter(project, "at.bestsolution.e4.handlers.*"), new ContributionResultHandler() { +// +// public void result(ContributionData data) { +// System.err.println(data.className); +// } +// }); return comp; } + + private ClassContributionCollector getCollector() { + Bundle bundle = FrameworkUtil.getBundle(ContributionClassDialog.class); + BundleContext context = bundle.getBundleContext(); + ServiceReference ref = context.getServiceReference(ClassContributionCollector.class.getName()); + if( ref != null ) { + return (ClassContributionCollector) context.getService(ref); + } + return null; + } + + private class ContributionResultHandlerImpl implements ContributionResultHandler { + private boolean cancled = false; + private IObservableList list; + + public ContributionResultHandlerImpl(IObservableList list) { + this.list = list; + } + + public void result(ContributionData data) { + if( ! cancled ) { + list.add(data); + } + } + + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java index ea7dfd9e39..51ddad58d1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java @@ -10,17 +10,16 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.wbm; -import javax.inject.Inject; - +import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.swt.widgets.Composite; public class ApplicationModelEditor extends ModelEditor { - @Inject public ApplicationModelEditor(Composite composite, - IModelResource modelProvider) { - super(composite, modelProvider); + IModelResource modelProvider, IProject project) { + super(composite, modelProvider, project); } + } From 92d4ada86634a3259a02fbc612f0069f2843cd28 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 17 Mar 2010 16:52:21 +0000 Subject: [PATCH 0061/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * removed unneeded code --- .../component/dialogs/ContributionClassDialog.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java index 67a11d670f..3743b139d2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -89,14 +89,7 @@ public void modifyText(ModifyEvent e) { collector.findContributions(filter, currentResultHandler); } }); - -// collector.findContributions(new Filter(project, "at.bestsolution.e4.handlers.*"), new ContributionResultHandler() { -// -// public void result(ContributionData data) { -// System.err.println(data.className); -// } -// }); - + return comp; } From 82d9f058af71a36d5e4f40845b55223cc45e48e4 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 17 Mar 2010 17:51:42 +0000 Subject: [PATCH 0062/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * a frist working implementation for class selection --- .../PDEClassContributionProvider.java | 47 ++++++++++++++++-- .../icons/full/obj16/class_obj.gif | Bin 0 -> 586 bytes .../common/ComponentLabelProvider.java | 10 +--- .../AbstractCommandSelectionDialog.java | 13 +---- .../dialogs/ContributionClassDialog.java | 45 +++++++++++++++-- 5 files changed, 86 insertions(+), 29 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/class_obj.gif diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java index f3ab1ba881..7b66d31cd3 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java @@ -10,8 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.util.List; +import java.util.StringTokenizer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.search.IJavaSearchConstants; @@ -28,7 +37,7 @@ public PDEClassContributionProvider() { } @SuppressWarnings("restriction") - public void findContribution(Filter filter, final ContributionResultHandler handler) { + public void findContribution(final Filter filter, final ContributionResultHandler handler) { System.err.println("Searching for: " + filter.namePattern); IJavaSearchScope scope = PDEJavaHelper.getSearchScope(filter.project); @@ -69,10 +78,40 @@ public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, String pName = new String(packageName); String label = cName + " - " + pName; //$NON-NLS-1$ String content = pName + "." + cName; //$NON-NLS-1$ - System.err.println("Found: " + label + " => " + pName); - ContributionData data = new ContributionData(null, content, "Java", null); - handler.result(data); +// System.err.println("Found: " + label + " => " + pName + " => " + path); + + IResource resource = filter.project.getWorkspace().getRoot().findMember(path); + + if( resource != null ) { + IProject project = resource.getProject(); + IFile f = project.getFile("/META-INF/MANIFEST.MF"); + + if( f != null && f.exists() ) { + try { + InputStream s = f.getContents(); + BufferedReader r = new BufferedReader(new InputStreamReader(s)); + String line; + while( (line = r.readLine()) != null ) { + if( line.startsWith("Bundle-SymbolicName:") ) { + int start = line.indexOf(':'); + int end = line.indexOf(';'); + ContributionData data = new ContributionData(line.substring(start+1,end), content, "Java", null); + handler.result(data); + break; + } + } + + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + //Image image = (Flags.isInterface(modifiers)) ? PDEPluginImages.get(PDEPluginImages.OBJ_DESC_GENERATE_INTERFACE) : PDEPluginImages.get(PDEPluginImages.OBJ_DESC_GENERATE_CLASS); //addProposalToCollection(c, startOffset, length, label, content, image); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/class_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/class_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..e4c2a836f83e7dc72d29873fded01e7206eba2f5 GIT binary patch literal 586 zcmZ?wbhEHb6krfwc*ekxv!cRsX(Ohwq+z^!{nkw1lu( zDPc2HV&`P7KEHX-jYA>R6T@ewM9fTyo0E0x)!k_2wz@P-Sk|APSoeSzXn7Dfh!ClGm2|QYKe-7h)T#Q@$He9j?`9AQ4ux} zP&?5iq-<&#X{ezXX|J!t&@97aWMj6{+|Gn&T@xp-YRQ`y8=a5yFmmdtZYWsP+AXH8 bqq4{4!~q5-W`Qq@Pi$O#yuX);k--`O+yTtY literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java index b5633d98f2..a06d3302e0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java @@ -47,15 +47,7 @@ public void update(final ViewerCell cell) { cell.setText(label); } else { StyledString styledString = new StyledString(label, null); - Styler styler = new Styler() { - - @Override - public void applyStyles(TextStyle textStyle) { - textStyle.foreground = cell.getControl().getDisplay().getSystemColor(SWT.COLOR_GRAY); - } - }; - - styledString.append(" - " + detailText, styler); + styledString.append(" - " + detailText, StyledString.DECORATIONS_STYLER); cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java index 0e59caf02f..9e8fb32435 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java @@ -29,12 +29,10 @@ import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.jface.viewers.StyledString.Styler; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.TextStyle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; @@ -127,13 +125,6 @@ protected void okPressed() { protected abstract Command createStoreCommand( EditingDomain editingDomain, MCommand command); private class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { - private Styler styler = new Styler() { - - @Override - public void applyStyles(TextStyle textStyle) { - textStyle.foreground = getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY); - } - }; public void update(final ViewerCell cell) { MCommand cmd = (MCommand) cell.getElement(); @@ -143,10 +134,10 @@ public void update(final ViewerCell cell) { styledString.append(cmd.getCommandName()); } if( cmd.getDescription() != null ) { - styledString.append(" - " + cmd.getDescription(),styler); + styledString.append(" - " + cmd.getDescription(),StyledString.DECORATIONS_STYLER); } if( cmd.getId() != null ) { - styledString.append(" - " + cmd.getId(),styler); + styledString.append(" - " + cmd.getId(),StyledString.DECORATIONS_STYLER); } cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java index 3743b139d2..d0593091da 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -19,11 +19,18 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.jface.viewers.StyledString.Styler; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.TextStyle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; @@ -38,16 +45,26 @@ public class ContributionClassDialog extends TitleAreaDialog { private IProject project; + private Image javaClassImage; public ContributionClassDialog(Shell parentShell, IProject project) { super(parentShell); - this.project = project; + this.project = project; } @Override protected Control createDialogArea(Composite parent) { Composite comp = (Composite) super.createDialogArea(parent); + getShell().addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + javaClassImage.dispose(); + } + }); + + javaClassImage = new Image(getShell().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/class_obj.gif")); + Composite container = new Composite(comp, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); container.setLayout(new GridLayout(2,false)); @@ -64,13 +81,31 @@ protected Control createDialogArea(Composite parent) { GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new LabelProvider() { + viewer.setLabelProvider(new StyledCellLabelProvider() { @Override - public String getText(Object element) { - return ((ContributionData)element).className; + public void update(ViewerCell cell) { + ContributionData data = (ContributionData) cell.getElement(); + StyledString styledString = new StyledString(data.className, null); + + if( data.bundleName != null ) { + styledString.append(" - " + data.bundleName, StyledString.DECORATIONS_STYLER); + } + + if( data.sourceType != null ) { + styledString.append(" - ", StyledString.DECORATIONS_STYLER); + styledString.append(data.sourceType + "", StyledString.COUNTER_STYLER); + } + + if( data.iconPath == null ) { + cell.setImage(javaClassImage); + } + + cell.setText(styledString.getString()); + cell.setStyleRanges(styledString.getStyleRanges()); } }); + final WritableList list = new WritableList(); viewer.setInput(list); From c34c3ed813ef8447a8bd8949a40a9ffbf087dac6 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 17 Mar 2010 18:07:19 +0000 Subject: [PATCH 0063/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * look and setting of command handler working --- .../PDEClassContributionProvider.java | 4 +- .../common/component/HandlerEditor.java | 3 +- .../dialogs/ContributionClassDialog.java | 43 ++++++++++++++++--- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java index 7b66d31cd3..7a205c2883 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java @@ -14,8 +14,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.util.List; -import java.util.StringTokenizer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; @@ -96,7 +94,7 @@ public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, if( line.startsWith("Bundle-SymbolicName:") ) { int start = line.indexOf(':'); int end = line.indexOf(';'); - ContributionData data = new ContributionData(line.substring(start+1,end), content, "Java", null); + ContributionData data = new ContributionData(line.substring(start+1,end).trim(), content, "Java", null); handler.result(data); break; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 14896d3312..714683ffd3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -20,6 +20,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandlerCommandSelectionDialog; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.MHandler; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; @@ -142,7 +143,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue()); dialog.open(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java index d0593091da..ab0d2fb693 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -17,20 +17,26 @@ import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionResultHandler; import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Filter; import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MContribution; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StyledCellLabelProvider; import org.eclipse.jface.viewers.StyledString; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.jface.viewers.StyledString.Styler; import org.eclipse.swt.SWT; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.TextStyle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; @@ -46,10 +52,15 @@ public class ContributionClassDialog extends TitleAreaDialog { private IProject project; private Image javaClassImage; + private MContribution contribution; + private EditingDomain editingDomain; + private TableViewer viewer; - public ContributionClassDialog(Shell parentShell, IProject project) { + public ContributionClassDialog(Shell parentShell, IProject project, EditingDomain editingDomain, MContribution contribution) { super(parentShell); - this.project = project; + this.project = project; + this.contribution = contribution; + this.editingDomain = editingDomain; } @Override @@ -77,7 +88,7 @@ public void widgetDisposed(DisposeEvent e) { l = new Label(container,SWT.NONE); - TableViewer viewer = new TableViewer(container); + viewer = new TableViewer(container); GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setContentProvider(new ObservableListContentProvider()); @@ -104,6 +115,12 @@ public void update(ViewerCell cell) { cell.setStyleRanges(styledString.getStyleRanges()); } }); + viewer.addDoubleClickListener(new IDoubleClickListener() { + + public void doubleClick(DoubleClickEvent event) { + okPressed(); + } + }); final WritableList list = new WritableList(); @@ -128,6 +145,20 @@ public void modifyText(ModifyEvent e) { return comp; } + @Override + protected void okPressed() { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if( ! s.isEmpty() ) { + ContributionData cd = (ContributionData) s.getFirstElement(); + String uri = "platform:/plugin/" + cd.bundleName + "/" + cd.className; + Command cmd = SetCommand.create(editingDomain, contribution, MApplicationPackage.Literals.CONTRIBUTION__URI, uri); + if( cmd.canExecute() ) { + editingDomain.getCommandStack().execute(cmd); + super.okPressed(); + } + } + } + private ClassContributionCollector getCollector() { Bundle bundle = FrameworkUtil.getBundle(ContributionClassDialog.class); BundleContext context = bundle.getBundleContext(); @@ -153,4 +184,4 @@ public void result(ContributionData data) { } } -} +} \ No newline at end of file From 2f4c4d7f45b15c7da6730060bfbecea78d3fc285 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 17 Mar 2010 18:15:21 +0000 Subject: [PATCH 0064/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * class look up for all MContribution-Types --- .../emf/ui/internal/common/ModelEditor.java | 8 +++---- .../component/DirectMenuItemEditor.java | 20 ++++++++++++++--- .../component/DirectToolItemEditor.java | 18 +++++++++++++-- .../component/PartDescriptorEditor.java | 22 +++++++++++++++---- .../internal/common/component/PartEditor.java | 20 ++++++++++++++--- 5 files changed, 72 insertions(+), 16 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index d9a67c5b75..ecdf445662 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -259,8 +259,8 @@ private void registerDefaultEditors() { registerEditor(MApplicationPackage.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.MODEL_COMPONENTS, new ModelComponentsEditor(modelProvider.getEditingDomain(),this)); registerEditor(MApplicationPackage.Literals.MODEL_COMPONENT, new ModelComponentEditor(modelProvider.getEditingDomain())); - registerEditor(MApplicationPackage.Literals.PART, new PartEditor(modelProvider.getEditingDomain())); - registerEditor(MApplicationPackage.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.PART, new PartEditor(modelProvider.getEditingDomain(),project)); + registerEditor(MApplicationPackage.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain(),project)); registerEditor(MApplicationPackage.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(),modelProvider)); registerEditor(MApplicationPackage.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain(),modelProvider,project)); registerEditor(MApplicationPackage.Literals.COMMAND, new CommandEditor(modelProvider.getEditingDomain())); @@ -269,7 +269,7 @@ private void registerDefaultEditors() { registerEditor(MApplicationPackage.Literals.PART_STACK, new PartStackEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.WINDOW_TRIM, new WindowTrimEditor(modelProvider.getEditingDomain(), this)); registerEditor(MApplicationPackage.Literals.TOOL_BAR, new ToolBarEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MApplicationPackage.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain(),project)); registerEditor(MApplicationPackage.Literals.HANDLED_TOOL_ITEM, new HandledToolItemEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.TOOL_ITEM, new ToolItemEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.PERSPECTIVE_STACK, new PerspectiveStackEditor(modelProvider.getEditingDomain())); @@ -278,7 +278,7 @@ private void registerDefaultEditors() { registerEditor(MApplicationPackage.Literals.MENU, new MenuEditor(modelProvider.getEditingDomain(), this)); registerEditor(MApplicationPackage.Literals.MENU_ITEM, new MenuItemEditor(modelProvider.getEditingDomain(), this)); registerEditor(MApplicationPackage.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MApplicationPackage.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this)); + registerEditor(MApplicationPackage.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(MApplicationPackage.Literals.BINDING_TABLE, new BindingTableEditor(modelProvider.getEditingDomain(), this)); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index 408a5ae179..b7065fd31f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -14,14 +14,19 @@ import java.net.URL; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Button; @@ -32,9 +37,11 @@ public class DirectMenuItemEditor extends MenuItemEditor { private Image image; + private IProject project; - public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor) { + public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain, editor); + this.project = project; } @Override @@ -74,9 +81,16 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); - Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText("Find ..."); + b.setText("Find ..."); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue()); + dialog.open(); + } + }); } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index 183cbf2cab..b076239a69 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -14,13 +14,18 @@ import java.net.URL; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Button; @@ -31,9 +36,11 @@ public class DirectToolItemEditor extends ToolItemEditor { private Image image; + private IProject project; - public DirectToolItemEditor(EditingDomain editingDomain) { + public DirectToolItemEditor(EditingDomain editingDomain, IProject project) { super(editingDomain); + this.project = project; } @Override @@ -62,10 +69,17 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value( getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); - Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setText("Find ..."); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue()); + dialog.open(); + } + }); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index e65cd34744..f012cd6830 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -18,10 +18,13 @@ import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.MPart; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; @@ -38,6 +41,8 @@ import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -52,12 +57,14 @@ public class PartDescriptorEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; - + private IProject project; + private IListProperty PART__MENUS = EMFProperties.list(MApplicationPackage.Literals.PART__MENUS); private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); - public PartDescriptorEditor(EditingDomain editingDomain) { + public PartDescriptorEditor(EditingDomain editingDomain, IProject project) { super(editingDomain); + this.project = project; } @Override @@ -159,9 +166,16 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); - Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText("Find ..."); + b.setText("Find ..."); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue()); + dialog.open(); + } + }); } // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index eb28d707bd..60d5e55052 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -18,10 +18,13 @@ import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.MPart; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; @@ -38,6 +41,8 @@ import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -52,12 +57,14 @@ public class PartEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; + private IProject project; private IListProperty PART__MENUS = EMFProperties.list(MApplicationPackage.Literals.PART__MENUS); private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); - public PartEditor(EditingDomain editingDomain) { + public PartEditor(EditingDomain editingDomain, IProject project) { super(editingDomain); + this.project = project; } @Override @@ -159,9 +166,16 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); - Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText("Find ..."); + b.setText("Find ..."); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue()); + dialog.open(); + } + }); } // ------------------------------------------------------------ From bad714d14082b5325201eccf105bdd1a7bb5ceab Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 18 Mar 2010 08:32:47 +0000 Subject: [PATCH 0065/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * ensure white background --- .../eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java | 1 + .../eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java index e1452e8119..f2ab75ca2e 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java @@ -125,6 +125,7 @@ public void createPartControl(Composite parent) { setupCss(parent.getDisplay()); Composite comp = new Composite(parent, SWT.NONE); comp.setBackground(comp.getDisplay().getSystemColor(SWT.COLOR_WHITE)); + comp.setBackgroundMode(SWT.INHERIT_DEFAULT); FillLayout layout = new FillLayout(); layout.marginWidth = 10; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index ecdf445662..46c6f0c99c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -192,6 +192,8 @@ public void selectionChanged(SelectionChangedEvent event) { private TreeViewer createTreeViewerArea(Composite parent) { parent = new Composite(parent, SWT.NONE); parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); + parent.setBackgroundMode(SWT.INHERIT_DEFAULT); + FillLayout l = new FillLayout(); l.marginWidth = 5; parent.setLayout(l); From 3ff9427ab2dad851c6e80f7b08044360b52d60fa Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 18 Mar 2010 09:04:10 +0000 Subject: [PATCH 0066/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * add possibility to add parts to a part stack --- .../emf/ui/internal/common/ModelEditor.java | 2 +- .../common/component/PartStackEditor.java | 139 +++++++++++++++++- 2 files changed, 139 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 46c6f0c99c..23bec3c6b4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -268,7 +268,7 @@ private void registerDefaultEditors() { registerEditor(MApplicationPackage.Literals.COMMAND, new CommandEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain())); registerEditor(MApplicationPackage.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MApplicationPackage.Literals.PART_STACK, new PartStackEditor(modelProvider.getEditingDomain())); + registerEditor(MApplicationPackage.Literals.PART_STACK, new PartStackEditor(modelProvider.getEditingDomain(),this)); registerEditor(MApplicationPackage.Literals.WINDOW_TRIM, new WindowTrimEditor(modelProvider.getEditingDomain(), this)); registerEditor(MApplicationPackage.Literals.TOOL_BAR, new ToolBarEditor(modelProvider.getEditingDomain(), this)); registerEditor(MApplicationPackage.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain(),project)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 31ab7ea114..3dc0d67998 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -12,6 +12,7 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.List; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -21,23 +22,41 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MElementContainer; +import org.eclipse.e4.ui.model.application.MPart; +import org.eclipse.e4.ui.model.application.MToolBar; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.databinding.viewers.ViewerProperties; import org.eclipse.jface.databinding.viewers.ViewerSupport; import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; @@ -48,11 +67,13 @@ public class PartStackEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; + private ModelEditor editor; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); - public PartStackEditor(EditingDomain editingDomain) { + public PartStackEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); + this.editor = editor; } @Override @@ -143,6 +164,122 @@ public void handleValueChange(ValueChangeEvent event) { } }); } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Parts"); + + final TableViewer viewer = new TableViewer(parent); + viewer.setContentProvider(new ObservableListContentProvider()); + viewer.setLabelProvider(new ComponentLabelProvider(editor)); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + + + IEMFListProperty prop = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + viewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if( idx < container.getChildren().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add Part"); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MPart part = MApplicationFactory.eINSTANCE.createPart(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, part); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(part); + } + } + }); + + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List elements = ((IStructuredSelection)viewer.getSelection()).toList(); + + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, elements); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } ControlFactory.createTagsWidget(parent, this); From a3f4ae38a14175dfa260d010d3accd570343fb90 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 18 Mar 2010 09:39:56 +0000 Subject: [PATCH 0067/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * add some description text --- .../common/component/dialogs/ContributionClassDialog.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java index ab0d2fb693..d12ccd5362 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -67,6 +67,10 @@ public ContributionClassDialog(Shell parentShell, IProject project, EditingDomai protected Control createDialogArea(Composite parent) { Composite comp = (Composite) super.createDialogArea(parent); + getShell().setText("Find Contribution Class"); + setTitle("Find Contribution Class"); + setMessage("Enter the name of the contributing class"); + getShell().addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { From 235daf223d41361505adfdc4c09a34f88f69ebd8 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 18 Mar 2010 11:06:32 +0000 Subject: [PATCH 0068/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * add support for the main menu --- .../common/component/WindowEditor.java | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index a6ccf1913f..4377478552 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -15,8 +15,11 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; @@ -48,6 +51,7 @@ public class WindowEditor extends AbstractComponentEditor { private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + private IValueProperty WINDOW__MAIN_MENU = EMFProperties.value(MApplicationPackage.Literals.WINDOW__MAIN_MENU); public WindowEditor(EditingDomain editingDomain) { super(editingDomain); @@ -200,7 +204,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, @Override public IObservableList getChildList(Object element) { - WritableList list = new WritableList(); + final WritableList list = new WritableList(); list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { @Override @@ -210,15 +214,6 @@ protected boolean accepted(Object o) { }); -// list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING, BINDING_CONTAINER__BINDINGS, element, "Bindings") { -// -// @Override -// protected boolean accepted(Object o) { -// return true; -// } -// -// }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOW_TRIMS, ELEMENT_CONTAINER__CHILDREN, element, "Trims") { @Override @@ -236,6 +231,24 @@ protected boolean accepted(Object o) { } }); + + MWindow window = (MWindow) element; + if( window.getMainMenu() != null ) { + list.add(0,window.getMainMenu()); + } + + WINDOW__MAIN_MENU.observe(element).addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + if( event.diff.getOldValue() != null ) { + list.remove(event.diff.getOldValue()); + } + + if( event.diff.getNewValue() != null ) { + list.add(0,event.diff.getNewValue()); + } + } + }); return list; } From 806e90d343617c4af0c4e64f94a3648097073c06 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 18 Mar 2010 11:44:07 +0000 Subject: [PATCH 0069/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * making editor editor area scrollable * adding binding support to Window and Part --- .../css/default.css | 4 + .../emf/ui/internal/common/ModelEditor.java | 29 +++- .../common/component/ApplicationEditor.java | 159 +----------------- .../common/component/ControlFactory.java | 139 ++++++++++++++- .../internal/common/component/PartEditor.java | 100 +++++------ .../common/component/PartStackEditor.java | 1 - .../common/component/WindowEditor.java | 1 + 7 files changed, 205 insertions(+), 228 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/css/default.css b/bundles/org.eclipse.e4.tools.emf.editor3x/css/default.css index fea596f24b..751eb8fc18 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/css/default.css +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/css/default.css @@ -16,3 +16,7 @@ .contentContainer { background-color: #fff #fff #cccccc 20% 80%; } + +.formContainer { + background-color: #fff; +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 23bec3c6b4..b8fa812433 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -78,7 +78,11 @@ import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.SashForm; +import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; +import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -148,8 +152,24 @@ public ModelEditor(Composite composite, IModelResource modelProvider, IProject p textLabel.setData("org.eclipse.e4.ui.css.CssClassName", "sectionHeader"); textLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - final Composite contentContainer = new Composite(editingArea, SWT.NONE); - contentContainer.setLayoutData(new GridData(GridData.FILL_BOTH)); + final ScrolledComposite scrolling = new ScrolledComposite(editingArea, SWT.H_SCROLL | SWT.V_SCROLL); + scrolling.setBackgroundMode(SWT.INHERIT_DEFAULT); + scrolling.setData("org.eclipse.e4.ui.css.CssClassName", "formContainer"); + + final Composite contentContainer = new Composite(scrolling, SWT.NONE); + contentContainer.setData("org.eclipse.e4.ui.css.CssClassName", "formContainer"); + scrolling.setExpandHorizontal(true); + scrolling.setExpandVertical(true); + scrolling.setContent(contentContainer); + + scrolling.addControlListener(new ControlAdapter() { + public void controlResized(ControlEvent e) { + Rectangle r = scrolling.getClientArea(); + scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); + } + }); + + scrolling.setLayoutData(new GridData(GridData.FILL_BOTH)); final StackLayout layout = new StackLayout(); contentContainer.setLayout(layout); @@ -181,6 +201,9 @@ public void selectionChanged(SelectionChangedEvent event) { contentContainer.layout(true); } } + + Rectangle r = scrolling.getClientArea(); + scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); } } }); @@ -191,7 +214,7 @@ public void selectionChanged(SelectionChangedEvent event) { private TreeViewer createTreeViewerArea(Composite parent) { parent = new Composite(parent, SWT.NONE); - parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); + parent.setData("org.eclipse.e4.ui.css.CssClassName", "formContainer"); parent.setBackgroundMode(SWT.INHERIT_DEFAULT); FillLayout l = new FillLayout(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 58dfde8fba..4601f74f8b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -12,8 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; -import java.util.Arrays; -import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; @@ -21,34 +19,17 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; @@ -120,149 +101,11 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); } - { - Label l = new Label(parent, SWT.NONE); - l.setText("Bindings"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { - handleAddText(t); - } - } - }); - - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText("Add"); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleAddText(t); - } - }); - - new Label(parent, SWT.NONE); - - final TableViewer viewer = new TableViewer(parent); - viewer.setLabelProvider(new LabelProvider()); - viewer.setContentProvider(new ObservableListContentProvider()); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 200; - viewer.getControl().setLayoutData(gd); - - IEMFListProperty prop = EMFProperties.list(MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS); - viewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; - buttonComp.setLayout(gl); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MApplication container = (MApplication) getMaster().getValue(); - int idx = container.getCommands().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MApplication container = (MApplication) getMaster().getValue(); - int idx = container.getCommands().indexOf(obj) + 1; - if( idx < container.getCommands().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - MApplication el = (MApplication) getMaster().getValue(); - List ids = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), el, MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, ids); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - if( el.getBindingContexts().size() > 0 ) { - viewer.setSelection(new StructuredSelection(el.getBindingContexts().get(0))); - } - } - } - } - }); - } + ControlFactory.createBindingsWidget(parent, this); return parent; } - private void handleAddText( Text tagText) { - if (tagText.getText().trim().length() > 0) { - String[] tags = tagText.getText().split(";"); - for( int i = 0; i < tags.length;i++ ) { - tags[i] = tags[i].trim(); - } - - MApplicationElement appEl = (MApplicationElement) getMaster().getValue(); - Command cmd = AddCommand.create(getEditingDomain(), appEl, MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, Arrays.asList(tags)); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - tagText.setText(""); - } - } - @Override public IObservableList getChildList(Object element) { WritableList list = new WritableList(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 3c42321410..a015606371 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -1,18 +1,25 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component; import java.util.Arrays; +import java.util.List; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.KeyAdapter; @@ -27,6 +34,130 @@ import org.eclipse.swt.widgets.Text; public class ControlFactory { + public static void createBindingsWidget(Composite parent, final AbstractComponentEditor editor) { + Label l = new Label(parent, SWT.NONE); + l.setText("Bindings"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + t.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { + handleAddText( editor, MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, t); + } + } + }); + + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText("Add"); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + handleAddText( editor, MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, t); + } + }); + + new Label(parent, SWT.NONE); + + final TableViewer viewer = new TableViewer(parent); + viewer.setLabelProvider(new LabelProvider()); + viewer.setContentProvider(new ObservableListContentProvider()); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 150; + viewer.getControl().setLayoutData(gd); + + IEMFListProperty prop = EMFProperties.list(MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS); + viewer.setInput(prop.observeDetail(editor.getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MApplication container = (MApplication) editor.getMaster().getValue(); + int idx = container.getCommands().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); + + if( cmd.canExecute() ) { + editor.getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MApplication container = (MApplication) editor.getMaster().getValue(); + int idx = container.getCommands().indexOf(obj) + 1; + if( idx < container.getCommands().size() ) { + Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); + + if( cmd.canExecute() ) { + editor.getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + MApplication el = (MApplication) editor.getMaster().getValue(); + List ids = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(editor.getEditingDomain(), el, MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, ids); + if( cmd.canExecute() ) { + editor.getEditingDomain().getCommandStack().execute(cmd); + if( el.getBindingContexts().size() > 0 ) { + viewer.setSelection(new StructuredSelection(el.getBindingContexts().get(0))); + } + } + } + } + }); + } + public static void createTagsWidget( Composite parent, final AbstractComponentEditor editor ) { Label l = new Label(parent, SWT.NONE); l.setText("Tags"); @@ -38,7 +169,7 @@ public static void createTagsWidget( Composite parent, final AbstractComponentEd @Override public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { - handleAddText(editor, tagText); + handleAddText(editor, MApplicationPackage.Literals.APPLICATION_ELEMENT__TAGS, tagText); } } }); @@ -48,7 +179,7 @@ public void keyPressed(KeyEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - handleAddText(editor, tagText); + handleAddText(editor, MApplicationPackage.Literals.APPLICATION_ELEMENT__TAGS, tagText); } }); b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); @@ -108,7 +239,7 @@ public void widgetSelected(SelectionEvent e) { }); } - private static void handleAddText( AbstractComponentEditor editor, Text tagText) { + private static void handleAddText( AbstractComponentEditor editor, EStructuralFeature feature, Text tagText) { if (tagText.getText().trim().length() > 0) { String[] tags = tagText.getText().split(";"); for( int i = 0; i < tags.length;i++ ) { @@ -116,7 +247,7 @@ private static void handleAddText( AbstractComponentEditor editor, Text tagText) } MApplicationElement appEl = (MApplicationElement) editor.getMaster().getValue(); - Command cmd = AddCommand.create(editor.getEditingDomain(), appEl, MApplicationPackage.Literals.APPLICATION_ELEMENT__TAGS, Arrays.asList(tags)); + Command cmd = AddCommand.create(editor.getEditingDomain(), appEl, feature, Arrays.asList(tags)); if (cmd.canExecute()) { editor.getEditingDomain().getCommandStack().execute(cmd); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 60d5e55052..6b65d9d085 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -192,7 +192,44 @@ public void widgetSelected(SelectionEvent e) { context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); } - + // ------------------------------------------------------------ + ControlFactory.createBindingsWidget(parent, this); + +// // ------------------------------------------------------------ +// { +// Label l = new Label(parent, SWT.NONE); +// l.setText("Variables"); +// l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); +// +// ListViewer viewer = new ListViewer(parent); +// GridData gd = new GridData(GridData.FILL_HORIZONTAL); +// gd.horizontalSpan=2; +// gd.heightHint = 80; +// viewer.getList().setLayoutData(gd); +// } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Properties"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + + TableViewer tableviewer = new TableViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + gd.heightHint = 80; + tableviewer.getTable().setHeaderVisible(true); + tableviewer.getControl().setLayoutData(gd); + + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Key"); + column.getColumn().setWidth(200); + + column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Value"); + column.getColumn().setWidth(200); + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -255,69 +292,8 @@ public String getText(Object element) { b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Variables"); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); - - ListViewer viewer = new ListViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - gd.heightHint = 80; - viewer.getList().setLayoutData(gd); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Properties"); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); - - TableViewer tableviewer = new TableViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - gd.heightHint = 80; - tableviewer.getTable().setHeaderVisible(true); - tableviewer.getControl().setLayoutData(gd); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Key"); - column.getColumn().setWidth(200); - - column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Value"); - column.getColumn().setWidth(200); - } - - ControlFactory.createTagsWidget(parent, this); -// // ------------------------------------------------------------ -// -// l = new Label(parent, SWT.NONE); -// l.setText(""); -// -// Composite booleanContainer = new Composite(parent,SWT.NONE); -// gd = new GridData(GridData.FILL_HORIZONTAL); -// gd.horizontalSpan=2; -// booleanContainer.setBackgroundMode(SWT.INHERIT_DEFAULT); -// booleanContainer.setLayoutData(gd); -// booleanContainer.setLayout(new GridLayout(4,false)); -// -// Button checkbox = new Button(booleanContainer, SWT.CHECK); -// checkbox.setText("to render"); -// -// checkbox = new Button(booleanContainer, SWT.CHECK); -// checkbox.setText("on Top"); -// -// checkbox = new Button(booleanContainer, SWT.CHECK); -// checkbox.setText("visible"); -// -// checkbox = new Button(booleanContainer, SWT.CHECK); -// checkbox.setText("closeable"); - return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 3dc0d67998..e6085c3b2c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -28,7 +28,6 @@ import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MElementContainer; import org.eclipse.e4.ui.model.application.MPart; -import org.eclipse.e4.ui.model.application.MToolBar; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 4377478552..222d4dcd7b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -197,6 +197,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); } + ControlFactory.createBindingsWidget(parent, this); ControlFactory.createTagsWidget(parent, this); return parent; From 1943a9f315b0ded7a60933242957484616daf1ba Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 18 Mar 2010 12:11:00 +0000 Subject: [PATCH 0070/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * hide probably not important parts in the model (need to find a way to make this configurable by the user) --- .../internal/common/component/PartEditor.java | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 6b65d9d085..a7c20159f7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -37,7 +37,6 @@ import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.ListViewer; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; @@ -195,6 +194,7 @@ public void widgetSelected(SelectionEvent e) { // ------------------------------------------------------------ ControlFactory.createBindingsWidget(parent, this); +//TODO Does the user need to edit this? // // ------------------------------------------------------------ // { // Label l = new Label(parent, SWT.NONE); @@ -208,27 +208,27 @@ public void widgetSelected(SelectionEvent e) { // viewer.getList().setLayoutData(gd); // } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Properties"); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); - - TableViewer tableviewer = new TableViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - gd.heightHint = 80; - tableviewer.getTable().setHeaderVisible(true); - tableviewer.getControl().setLayoutData(gd); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Key"); - column.getColumn().setWidth(200); - - column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Value"); - column.getColumn().setWidth(200); - } +// // ------------------------------------------------------------ +// { +// Label l = new Label(parent, SWT.NONE); +// l.setText("Properties"); +// l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); +// +// TableViewer tableviewer = new TableViewer(parent); +// GridData gd = new GridData(GridData.FILL_HORIZONTAL); +// gd.horizontalSpan=2; +// gd.heightHint = 80; +// tableviewer.getTable().setHeaderVisible(true); +// tableviewer.getControl().setLayoutData(gd); +// +// TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); +// column.getColumn().setText("Key"); +// column.getColumn().setWidth(200); +// +// column = new TableViewerColumn(tableviewer, SWT.NONE); +// column.getColumn().setText("Value"); +// column.getColumn().setWidth(200); +// } // ------------------------------------------------------------ { From 8b9ffb2a00859f198057e43ca0add0d5df323375 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 18 Mar 2010 14:05:05 +0000 Subject: [PATCH 0071/1286] Bug 306366 - [Model] Allow ModelComponent to contribute KeyBindings to a BindingTable * add support for new keybinding contribution --- .../common/ComponentLabelProvider.java | 3 - .../emf/ui/internal/common/ModelEditor.java | 5 +- .../component/ModelComponentEditor.java | 41 ++- .../AbstractCommandSelectionDialog.java | 13 +- .../virtual/VModelComponentBindingEditor.java | 237 ++++++++++++++++++ 5 files changed, 284 insertions(+), 15 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java index a06d3302e0..9621c8078d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java @@ -15,10 +15,7 @@ import org.eclipse.jface.viewers.StyledCellLabelProvider; import org.eclipse.jface.viewers.StyledString; import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.jface.viewers.StyledString.Styler; -import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.TextStyle; public class ComponentLabelProvider extends StyledCellLabelProvider { private Image modelComponentsImage; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index b8fa812433..a330295a9b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -61,6 +61,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VControlEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelComponentBindingEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor; @@ -100,6 +101,7 @@ public class ModelEditor { public static final int VIRTUAL_WINDOW_TRIMS = 7; public static final int VIRTUAL_PART_DESCRIPTORS = 8; public static final int VIRTUAL_MODEL_COMP_COMMANDS = 9; + public static final int VIRTUAL_MODEL_COMP_BINDINGS = 10; private Map editorMap = new HashMap(); private AbstractComponentEditor[] virtualEditors; @@ -272,7 +274,8 @@ private void registerVirtualEditors() { new VControlEditor(modelProvider.getEditingDomain(), this), new VWindowTrimEditor(modelProvider.getEditingDomain(), this), new VPartDescriptor(modelProvider.getEditingDomain(), this), - null + new VCommandEditor(modelProvider.getEditingDomain(), this, MApplicationPackage.Literals.MODEL_COMPONENT__COMMANDS), + new VModelComponentBindingEditor(modelProvider.getEditingDomain(), this) }; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index a7eb29f9a3..64be4f2308 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -52,6 +52,8 @@ public class ModelComponentEditor extends AbstractComponentEditor { private IListProperty PART_DESCRIPTOR_CONTAINER__DESCRIPTORS = EMFProperties.list( MApplicationPackage.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS); private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES); + private IListProperty MODEL_COMPONENT__COMMANDS = EMFProperties.list(MApplicationPackage.Literals.MODEL_COMPONENT__COMMANDS); + private IListProperty MODEL_COMPONENT__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.MODEL_COMPONENT__BINDINGS); public ModelComponentEditor(EditingDomain editingDomain) { super(editingDomain); @@ -179,31 +181,36 @@ public String getDescription(Object element) { @Override public IObservableList getChildList(Object element) { WritableList list = new WritableList(); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_MENU, MODEL_COMPONENT__CHILDREN, element, "Menus") { + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { @Override protected boolean accepted(Object o) { - return o instanceof MMenu; + return true; } }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART, MODEL_COMPONENT__CHILDREN, element, "Parts") { + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING_TABLE, BINDING_CONTAINER__BINDINGS, element, "BindingTables") { @Override protected boolean accepted(Object o) { - return o instanceof MPart; + return true; } }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART_DESCRIPTORS, PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, element, "PartDescriptors") { + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_MODEL_COMP_BINDINGS, MODEL_COMPONENT__BINDINGS, element, "KeyBindings") { @Override protected boolean accepted(Object o) { - return o instanceof MPartDescriptor; + return true; } }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { + + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_MODEL_COMP_COMMANDS, MODEL_COMPONENT__COMMANDS, element, "Commands") { @Override protected boolean accepted(Object o) { @@ -211,16 +218,32 @@ protected boolean accepted(Object o) { } }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_MENU, MODEL_COMPONENT__CHILDREN, element, "Menus") { - list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING_TABLE, BINDING_CONTAINER__BINDINGS, element, "BindingTables") { + @Override + protected boolean accepted(Object o) { + return o instanceof MMenu; + } + + }); + list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART, MODEL_COMPONENT__CHILDREN, element, "Parts") { @Override protected boolean accepted(Object o) { - return true; + return o instanceof MPart; } }); + list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART_DESCRIPTORS, PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, element, "PartDescriptors") { + @Override + protected boolean accepted(Object o) { + return o instanceof MPartDescriptor; + } + + }); + return list; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java index 9e8fb32435..a2ccb384d7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java @@ -10,11 +10,16 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MCommand; import org.eclipse.e4.ui.model.application.MModelComponent; +import org.eclipse.e4.ui.model.application.MModelComponents; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.dialogs.TitleAreaDialog; @@ -87,8 +92,12 @@ public void doubleClick(DoubleClickEvent event) { MApplication app = (MApplication) resource.getRoot().get(0); viewer.setInput(app.getCommands()); } else { - MModelComponent comp = (MModelComponent)resource.getRoot().get(0); - viewer.setInput(comp.getCommands()); + MModelComponents components = (MModelComponents)resource.getRoot().get(0); + List commands = new ArrayList(); + for( MModelComponent comp : components.getComponents() ) { + commands.addAll(comp.getCommands()); + } + viewer.setInput(commands); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java new file mode 100644 index 0000000000..56599325fc --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java @@ -0,0 +1,237 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import java.util.List; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.MBindingTable; +import org.eclipse.e4.ui.model.application.MHandler; +import org.eclipse.e4.ui.model.application.MKeyBinding; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VModelComponentBindingEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private ModelEditor editor; + private TableViewer viewer; + + public VModelComponentBindingEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "Commands"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Commands Bla Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + VirtualEntry o = (VirtualEntry)object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Keybindings"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.KEY_SEQUENCE__KEY_SEQUENCE); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("KeySequence"); + column.getColumn().setWidth(100); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.KEY_BINDING__COMMAND, MApplicationPackage.Literals.COMMAND__COMMAND_NAME)); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Command"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Id"); + column.getColumn().setWidth(170); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MBindingTable container = (MBindingTable) getMaster().getValue(); + int idx = container.getBindings().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.MODEL_COMPONENT__BINDINGS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MBindingTable container = (MBindingTable) getMaster().getValue(); + int idx = container.getBindings().indexOf(obj) + 1; + if( idx < container.getBindings().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.MODEL_COMPONENT__BINDINGS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MKeyBinding handler = MApplicationFactory.eINSTANCE.createKeyBinding(); + System.err.println(getMaster().getValue()); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.MODEL_COMPONENT__BINDINGS, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(handler); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List keybinding = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.MODEL_COMPONENT__BINDINGS, keybinding); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } +} From d4265d1fed540644875a007a47808b716f59e739 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 18 Mar 2010 15:37:45 +0000 Subject: [PATCH 0072/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * adding support for InputPart --- .../emf/ui/internal/common/ModelEditor.java | 2 + .../common/component/InputPartEditor.java | 55 +++++++++++++++++++ .../internal/common/component/PartEditor.java | 6 ++ 3 files changed, 63 insertions(+) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index a330295a9b..47bd78b203 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -36,6 +36,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.BindingTableEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.DirectMenuItemEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.HandledMenuItemEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.InputPartEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.KeyBindingEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.CommandEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.DirectToolItemEditor; @@ -308,6 +309,7 @@ private void registerDefaultEditors() { registerEditor(MApplicationPackage.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), this)); registerEditor(MApplicationPackage.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(MApplicationPackage.Literals.BINDING_TABLE, new BindingTableEditor(modelProvider.getEditingDomain(), this)); + registerEditor(MApplicationPackage.Literals.INPUT_PART, new InputPartEditor(modelProvider.getEditingDomain(), project)); } public void registerEditor(EClass eClass, AbstractComponentEditor editor) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java new file mode 100644 index 0000000000..ff97bd39cf --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class InputPartEditor extends PartEditor { + + public InputPartEditor(EditingDomain editingDomain, IProject project) { + super(editingDomain, project); + } + + + @Override + public String getLabel(Object element) { + return "InputPart"; + } + + @Override + protected void createSubformElements(Composite parent, EMFDataBindingContext context, IObservableValue master) { + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("InputURI"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.INPUT__INPUT_URI).observeDetail(master)); + } + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index a7c20159f7..7fd167f8c2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -177,6 +177,8 @@ public void widgetSelected(SelectionEvent e) { }); } + createSubformElements(parent, context, master); + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -296,6 +298,10 @@ public String getText(Object element) { return parent; } + + protected void createSubformElements(Composite parent, EMFDataBindingContext context, IObservableValue master) { + + } @Override public IObservableList getChildList(Object element) { From fd22422a8b5ff5130500525d8a10fd18fa039e97 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 18 Mar 2010 16:57:40 +0000 Subject: [PATCH 0073/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * adding support for live inspecting models From 1f7c8194c3923eea3049211d211734841b15d57c Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 18 Mar 2010 16:58:05 +0000 Subject: [PATCH 0074/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * adding support for live inspecting models From 43d17195ea08789e353365544d4f5caadff155be Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 8 Apr 2010 15:37:39 +0000 Subject: [PATCH 0075/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * made e4 lowercase --- bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml index c1760d3644..72a929d22e 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml @@ -9,7 +9,7 @@ extensions="e4xmi" icon="icons/full/obj16/application_view_tile.png" id="org.eclipse.e4.tools.emf.editor3x.e4wbm" - name="E4 Workbenchmodel Editor"> + name="e4 Workbenchmodel Editor"> From ad52fb12970c1b0a1f500f01e31a2515ab46ca4b Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 16 Apr 2010 15:33:38 +0000 Subject: [PATCH 0076/1286] [Bug 305586] - [Model] Model tweaking round 3 * removed unneeded extension stuff From 4ff8e5ccdf28efbe029593b2f2cfb58fb45ba30b Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 16 Apr 2010 17:28:49 +0000 Subject: [PATCH 0077/1286] [Bug 305586] - [Model] Model tweaking round 3 * merging back changes to head --- .../icons/full/obj16/plugin.png | Bin 0 -> 591 bytes .../plugin.xml | 26 ++ .../wizard/BaseApplicationModelWizard.java | 185 ++++++++++ .../wizard/NewApplicationModelWizard.java | 27 ++ .../wizard/NewContributionModelWizard.java | 27 ++ .../emf/editor3x/wizard/NewModelFilePage.java | 198 +++++++++++ .../.settings/org.eclipse.jdt.core.prefs | 66 +++- .../META-INF/MANIFEST.MF | 3 +- .../icons/full/modelelements/BindingTable.png | Bin 0 -> 728 bytes .../component/AbstractComponentEditor.java | 10 +- .../e4/tools/emf/ui/internal/Messages.java | 311 +++++++++++++++++ .../tools/emf/ui/internal/Messages.properties | 288 ++++++++++++++++ .../ObservableColumnLabelProvider.java | 12 +- .../tools/emf/ui/internal/PatternFilter.java | 6 +- .../tools/emf/ui/internal/StringMatcher.java | 2 +- .../common/ClassContributionCollector.java | 2 - .../common/ComponentLabelProvider.java | 4 +- .../emf/ui/internal/common/ModelEditor.java | 113 +++--- .../common/component/ApplicationEditor.java | 46 ++- .../common/component/BindingTableEditor.java | 67 ++-- .../common/component/CommandEditor.java | 73 ++-- .../common/component/ControlFactory.java | 60 ++-- .../component/DirectMenuItemEditor.java | 17 +- .../component/DirectToolItemEditor.java | 15 +- .../component/HandledMenuItemEditor.java | 78 +++-- .../component/HandledToolItemEditor.java | 136 ++++---- .../common/component/HandlerEditor.java | 31 +- .../common/component/InputPartEditor.java | 9 +- .../common/component/KeyBindingEditor.java | 67 ++-- .../internal/common/component/MenuEditor.java | 100 ++++-- .../common/component/MenuItemEditor.java | 321 ++---------------- .../common/component/MenuSeparatorEditor.java | 112 ++++++ .../component/ModelComponentEditor.java | 67 ++-- .../component/ModelComponentsEditor.java | 33 +- .../component/PartDescriptorEditor.java | 133 ++++---- .../internal/common/component/PartEditor.java | 76 +++-- .../component/PartSashContainerEditor.java | 82 +++-- .../common/component/PartStackEditor.java | 97 ++++-- .../common/component/PerspectiveEditor.java | 215 ++++++++++-- .../component/PerspectiveStackEditor.java | 162 ++++++++- .../common/component/PlaceholderEditor.java | 29 +- .../common/component/ToolBarEditor.java | 60 ++-- .../component/ToolBarSeparatorEditor.java | 110 ++++++ .../common/component/ToolControlEditor.java | 207 +++++++++++ .../common/component/ToolItemEditor.java | 71 +--- ...ndowTrimEditor.java => TrimBarEditor.java} | 39 +-- .../common/component/TrimmedWindowEditor.java | 36 ++ .../common/component/WindowEditor.java | 41 +-- .../AbstractCommandSelectionDialog.java | 11 +- .../dialogs/ContributionClassDialog.java | 4 +- ...HandledMenuItemCommandSelectionDialog.java | 49 +++ ...HandledToolItemCommandSelectionDialog.java | 49 +++ .../HandlerCommandSelectionDialog.java | 8 +- .../KeyBindingCommandSelectionDialog.java | 8 +- .../virtual/VBindingTableEditor.java | 84 ++--- .../component/virtual/VCommandEditor.java | 15 +- .../component/virtual/VHandlerEditor.java | 25 +- .../common/component/virtual/VMenuEditor.java | 20 +- .../virtual/VModelComponentBindingEditor.java | 37 +- .../component/virtual/VPartDescriptor.java | 25 +- ...lEditor.java => VWindowControlEditor.java} | 36 +- .../component/virtual/VWindowEditor.java | 61 ++-- .../component/virtual/VWindowTrimEditor.java | 12 +- 63 files changed, 3126 insertions(+), 1188 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/plugin.png create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/BaseApplicationModelWizard.java create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewApplicationModelWizard.java create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewContributionModelWizard.java create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewModelFilePage.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingTable.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java rename bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/{WindowTrimEditor.java => TrimBarEditor.java} (86%) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java rename bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/{VControlEditor.java => VWindowControlEditor.java} (86%) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/plugin.png b/bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/plugin.png new file mode 100644 index 0000000000000000000000000000000000000000..6187b15aec001b7080b51a5f944f07591f26cc15 GIT binary patch literal 591 zcmV-V0eEcNHZMNv|IbJ-M`( zKwWL~opzjJe^WpCmV9E;(0&ut2;4va_(#>M8)>9$R5viQnf(Nkh~VM$y>J(jqb$cj z+nL1Nm|mV)Gm|9MnHf*7Ja4OEAQz__^LRKOLEwqpiGV^^A*T=#&inGm-62Xs;dnSp zKj&H9T*boh2i)W+(n27l!C)>fq|L%VB1i ziC4p;NwV_}ZjW7$LRW#(_bKF#hp=!IqNO26Z*w2+LEwx{PVnZ&Sn}T;mtzb$;qA*nT@@+ zV5uQ@iXDTPoTbV#FRr~z04|PPh`wXTNoCm9*tG&?e3+fYl>K6+&3|Cc$KOpL`ER+_ dcRl5U#9zn6ZO}GF + + + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/BaseApplicationModelWizard.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/BaseApplicationModelWizard.java new file mode 100644 index 0000000000..b8bc38accd --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/BaseApplicationModelWizard.java @@ -0,0 +1,185 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.editor3x.wizard; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.*; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; + +import org.eclipse.ui.*; +import org.eclipse.ui.actions.WorkspaceModifyOperation; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.ISetSelectionTarget; + +public abstract class BaseApplicationModelWizard extends Wizard implements INewWizard { + private NewModelFilePage page; + private ISelection selection; + + protected IWorkbench workbench; + + /** + * Constructor for NewApplicationModelWizard. + */ + public BaseApplicationModelWizard() { + super(); + setNeedsProgressMonitor(true); + } + + /** + * Adding the page to the wizard. + */ + + public void addPages() { + page = new NewModelFilePage(selection,getDefaultFileName()); + addPage(page); + } + + public abstract String getDefaultFileName(); + + @Override + public boolean performFinish() { + try { + // Remember the file. + // + final IFile modelFile = getModelFile(); + + // Do the work within an operation. + // + WorkspaceModifyOperation operation = + new WorkspaceModifyOperation() { + @Override + protected void execute(IProgressMonitor progressMonitor) { + try { + // Create a resource set + // + ResourceSet resourceSet = new ResourceSetImpl(); + + // Get the URI of the model file. + // + URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); + + // Create a resource for this file. + // + Resource resource = resourceSet.createResource(fileURI); + + // Add the initial model object to the contents. + // + EObject rootObject = createInitialModel(); + if (rootObject != null) { + resource.getContents().add(rootObject); + } + + // Save the contents of the resource to the file system. + // + Map options = new HashMap(); + resource.save(options); + } + catch (Exception exception) { + throw new RuntimeException(exception); + } + finally { + progressMonitor.done(); + } + } + }; + + getContainer().run(false, false, operation); + + // Select the new file resource in the current view. + // + IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); + IWorkbenchPage page = workbenchWindow.getActivePage(); + final IWorkbenchPart activePart = page.getActivePart(); + if (activePart instanceof ISetSelectionTarget) { + final ISelection targetSelection = new StructuredSelection(modelFile); + getShell().getDisplay().asyncExec + (new Runnable() { + public void run() { + ((ISetSelectionTarget)activePart).selectReveal(targetSelection); + } + }); + } + + // Open an editor on the new file. + // + try { + page.openEditor + (new FileEditorInput(modelFile), + workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); + } + catch (PartInitException exception) { + MessageDialog.openError(workbenchWindow.getShell(), "Could not init editor", exception.getMessage()); //$NON-NLS-1$ + return false; + } + + return true; + } + catch (Exception exception) { + MessageDialog.openError(getShell(), "Error", exception.getMessage()); + return false; + } + } + + protected abstract EObject createInitialModel(); + + private IFile getModelFile() throws CoreException { + String containerName = page.getContainerName(); + String fileName = page.getFileName(); + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + IResource resource = root.findMember(new Path(containerName)); + if (!resource.exists() || !(resource instanceof IContainer)) { + throwCoreException("Container \"" + containerName + + "\" does not exist."); + } + IContainer container = (IContainer) resource; + return container.getFile(new Path(fileName)); + } + + private void throwCoreException(String message) throws CoreException { + IStatus status = new Status(IStatus.ERROR, + "org.eclipse.e4.tools.emf.editor3x", IStatus.OK, message, null); + throw new CoreException(status); + } + + /** + * We will accept the selection in the workbench to see if we can initialize + * from it. + * + * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) + */ + public void init(IWorkbench workbench, IStructuredSelection selection) { + this.workbench = workbench; + this.selection = selection; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewApplicationModelWizard.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewApplicationModelWizard.java new file mode 100644 index 0000000000..ed161a7e7c --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewApplicationModelWizard.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.editor3x.wizard; + +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.emf.ecore.EObject; + + +public class NewApplicationModelWizard extends BaseApplicationModelWizard { + + @Override + public String getDefaultFileName() { + return "Application.e4xmi"; + } + + protected EObject createInitialModel() { + return (EObject) MApplicationFactory.INSTANCE.createApplication(); + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewContributionModelWizard.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewContributionModelWizard.java new file mode 100644 index 0000000000..00706fd70a --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewContributionModelWizard.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.editor3x.wizard; + +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.emf.ecore.EObject; + + +public class NewContributionModelWizard extends BaseApplicationModelWizard { + + @Override + public String getDefaultFileName() { + return "components.e4xmi"; + } + + protected EObject createInitialModel() { + return (EObject) MApplicationFactory.INSTANCE.createModelComponents(); + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewModelFilePage.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewModelFilePage.java new file mode 100644 index 0000000000..2f60c2d8d7 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewModelFilePage.java @@ -0,0 +1,198 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.editor3x.wizard; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.dialogs.ContainerSelectionDialog; + +/** + * The "New" wizard page allows setting the container for the new file as well + * as the file name. The page will only accept file name without the extension + * OR with the extension that matches the expected one (e4xmi). + */ + +public class NewModelFilePage extends WizardPage { + private Text containerText; + + private Text fileText; + + private ISelection selection; + + private String defaultFilename; + + /** + * Constructor for SampleNewWizardPage. + * + * @param pageName + */ + public NewModelFilePage(ISelection selection, String defaultFilename) { + super("wizardPage"); + setTitle("Multi-page Editor File"); + setDescription("This wizard creates a new file with *.e4xmi extension that can be opened by a multi-page editor."); + this.selection = selection; + this.defaultFilename = defaultFilename; + } + + /** + * @see IDialogPage#createControl(Composite) + */ + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(); + container.setLayout(layout); + layout.numColumns = 3; + layout.verticalSpacing = 9; + Label label = new Label(container, SWT.NULL); + label.setText("&Container:"); + + containerText = new Text(container, SWT.BORDER | SWT.SINGLE); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + containerText.setLayoutData(gd); + containerText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + dialogChanged(); + } + }); + + Button button = new Button(container, SWT.PUSH); + button.setText("Browse..."); + button.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + handleBrowse(); + } + }); + label = new Label(container, SWT.NULL); + label.setText("&File name:"); + + fileText = new Text(container, SWT.BORDER | SWT.SINGLE); + gd = new GridData(GridData.FILL_HORIZONTAL); + fileText.setLayoutData(gd); + fileText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + dialogChanged(); + } + }); + initialize(); + dialogChanged(); + setControl(container); + } + + /** + * Tests if the current workbench selection is a suitable container to use. + */ + + private void initialize() { + if (selection != null && selection.isEmpty() == false + && selection instanceof IStructuredSelection) { + IStructuredSelection ssel = (IStructuredSelection) selection; + if (ssel.size() > 1) + return; + Object obj = ssel.getFirstElement(); + if (obj instanceof IResource) { + IContainer container; + if (obj instanceof IContainer) + container = (IContainer) obj; + else + container = ((IResource) obj).getParent(); + containerText.setText(container.getFullPath().toString()); + } + } + fileText.setText(defaultFilename); + } + + /** + * Uses the standard container selection dialog to choose the new value for + * the container field. + */ + + private void handleBrowse() { + ContainerSelectionDialog dialog = new ContainerSelectionDialog( + getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, + "Select new file container"); + if (dialog.open() == ContainerSelectionDialog.OK) { + Object[] result = dialog.getResult(); + if (result.length == 1) { + containerText.setText(((Path) result[0]).toString()); + } + } + } + + /** + * Ensures that both text fields are set. + */ + + private void dialogChanged() { + IResource container = ResourcesPlugin.getWorkspace().getRoot() + .findMember(new Path(getContainerName())); + String fileName = getFileName(); + + if (getContainerName().length() == 0) { + updateStatus("File container must be specified"); + return; + } + if (container == null + || (container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) { + updateStatus("File container must exist"); + return; + } + if (!container.isAccessible()) { + updateStatus("Project must be writable"); + return; + } + if (fileName.length() == 0) { + updateStatus("File name must be specified"); + return; + } + if (fileName.replace('\\', '/').indexOf('/', 1) > 0) { + updateStatus("File name must be valid"); + return; + } + int dotLoc = fileName.lastIndexOf('.'); + if (dotLoc != -1) { + String ext = fileName.substring(dotLoc + 1); + if (ext.equalsIgnoreCase("e4xmi") == false) { + updateStatus("File extension must be \"e4xmi\""); + return; + } + } + updateStatus(null); + } + + private void updateStatus(String message) { + setErrorMessage(message); + setPageComplete(message == null); + } + + public String getContainerName() { + return containerText.getText(); + } + + public String getFileName() { + return fileText.getText(); + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs index 44c830d92b..47b9e1b0ba 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,10 +1,74 @@ -#Sun Mar 07 11:22:58 CET 2010 +#Sun Apr 11 23:33:47 CEST 2010 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.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.5 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index d622a13711..9d7c30fb81 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.emf.databinding.edit;bundle-version="1.2.0", com.ibm.icu;bundle-version="4.2.1", org.eclipse.core.resources;bundle-version="3.6.0", - org.eclipse.e4.core.services;bundle-version="0.9.1" + org.eclipse.e4.core.services;bundle-version="0.9.1", + org.eclipse.osgi;bundle-version="3.6.0" Bundle-ActivationPolicy: lazy Import-Package: javax.inject;version="1.0.0", org.osgi.framework;version="1.5.0" diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingTable.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingTable.png new file mode 100644 index 0000000000000000000000000000000000000000..decac8a62e9349cb62ef1c4ea13312bf7c7b8030 GIT binary patch literal 728 zcmV;}0w?{6P)<_L=-A5W!r^l6;r`F>{yEp7wdQ}83!rCswNq=_ zq*jNNQb+|tDWp_Lr4dr4g+vOCRBEEDwY1U&ptQczSefnpm(CAfhmP(LNTs|0gWq2v zlt4&P#};uo!MS~DaC{N8 zCc_0sd|7PSe?371F2g}XWgdg$NiJ9B?;%LfL$Ni4Pa&qpcOjIeH(99(9V2I`$*Ld>uIkVFf6crZY_xlO|{6Tm3 z1o4FhjvYTmZOwVY;c&YXKnQ^b!l4;FIR^oF)OinK+qAT_P*qh$eSJN3b#(~arm3|Z z0FTGx-t|Ch%1aM3{dqDqst+F{gdh+IV47xXfGi886g@AVaq&Ve(P(tTp|$4j%daEC zmKCeXd2{W{Th5-WpxEalE7M6Lksufh;&!_!DJh|#pn%_-idb~s9v*r>=Scs~Wo2bX zQBjfKG|hqH;^I8F+id{OrKP1dAnNsc2Y`&t%}p7L#gdj~HT(fFX--g%a!N-40000< KMNUMnLSTZ?Bt^mi literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index 662d39cecf..c9a5e8dc88 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -30,11 +30,11 @@ public abstract class AbstractComponentEditor { private static Map IMAGE_MAP = new HashMap(); private static final String[] IMAGES = { - "/icons/full/obj16/zoom.png", - "/icons/full/obj16/table_add.png", - "/icons/full/obj16/table_delete.png", - "/icons/full/obj16/arrow_up.png", - "/icons/full/obj16/arrow_down.png", + "/icons/full/obj16/zoom.png", //$NON-NLS-1$ + "/icons/full/obj16/table_add.png", //$NON-NLS-1$ + "/icons/full/obj16/table_delete.png", //$NON-NLS-1$ + "/icons/full/obj16/arrow_up.png", //$NON-NLS-1$ + "/icons/full/obj16/arrow_down.png" //$NON-NLS-1$ }; private WritableValue master = new WritableValue(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java new file mode 100644 index 0000000000..d1602bed87 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -0,0 +1,311 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal; + +import org.eclipse.osgi.util.NLS; + +public class Messages { + + public static String ApplicationEditor_Label; + public static String ApplicationEditor_Description; + public static String ApplicationEditor_Id; + public static String ApplicationEditor_Handlers; + public static String ApplicationEditor_PartDescriptors; + public static String ApplicationEditor_BindingTables; + public static String ApplicationEditor_Commands; + public static String ApplicationEditor_Windows; + + public static String BindingTableEditor_Label; + public static String BindingTableEditor_Description; + public static String BindingTableEditor_Id; + public static String BindingTableEditor_ContextId; + public static String BindingTableEditor_Find; + public static String BindingTableEditor_Keybindings; + public static String BindingTableEditor_KeySequence; + public static String BindingTableEditor_Command; + public static String BindingTableEditor_Up; + public static String BindingTableEditor_Down; + public static String BindingTableEditor_Add; + public static String BindingTableEditor_Remove; + + public static String CommandEditor_Label; + public static String CommandEditor_Description; + public static String CommandEditor_Id; + public static String CommandEditor_Name; + public static String CommandEditor_LabelDescription; + public static String CommandEditor_Parameters; + public static String CommandEditor_ParameterName; + public static String CommandEditor_ParameterTypeId; + public static String CommandEditor_ParameterOptional; + public static String CommandEditor_ParameterOptional_No; + public static String CommandEditor_ParameterOptional_Yes; + public static String CommandEditor_Up; + public static String CommandEditor_Down; + public static String CommandEditor_Add; + public static String CommandEditor_Remove; + + public static String DirectMenuItemEditor_Label; + public static String DirectMenuItemEditor_Description; + public static String DirectMenuItemEditor_ClassURI; + public static String DirectMenuItemEditor_Find; + + public static String ControlFactory_BindingContexts; + public static String ControlFactory_Add; + public static String ControlFactory_Up; + public static String ControlFactory_Down; + public static String ControlFactory_Remove; + public static String ControlFactory_Tags; + public static String ControlFactory_Key; + public static String ControlFactory_Value; + + public static String DirectToolItemEditor_ClassURI; + public static String DirectToolItemEditor_Find; + public static String DirectToolItemEditor_Label; + public static String DirectToolItemEditor_Description; + + public static String HandledMenuItemEditor_Label; + public static String HandledMenuItemEditor_Description; + public static String HandledMenuItemEditor_Command; + public static String HandledMenuItemEditor_Find; + public static String HandledMenuItemEditor_Parameters; + public static String HandledMenuItemEditor_Tag; + public static String HandledMenuItemEditor_Value; + public static String HandledMenuItemEditor_Up; + public static String HandledMenuItemEditor_Down; + public static String HandledMenuItemEditor_Add; + public static String HandledMenuItemEditor_Remove; + + public static String HandledToolItemEditor_Command; + public static String HandledToolItemEditor_Find; + public static String HandledToolItemEditor_Parameters; + public static String HandledToolItemEditor_ParametersName; + public static String HandledToolItemEditor_ParametersValue; + public static String HandledToolItemEditor_Up; + public static String HandledToolItemEditor_Down; + public static String HandledToolItemEditor_Add; + public static String HandledToolItemEditor_Remove; + public static String HandledToolItemEditor_Label; + public static String HandledToolItemEditor_Description; + + public static String HandlerEditor_Label; + public static String HandlerEditor_Description; + public static String HandlerEditor_Id; + public static String HandlerEditor_Command; + public static String HandlerEditor_Find; + public static String HandlerEditor_ClassURI; + + public static String InputPartEditor_Label; + public static String InputPartEditor_InputURI; + + public static String KeyBindingEditor_Label; + public static String KeyBindingEditor_Description; + public static String KeyBindingEditor_Id; + public static String KeyBindingEditor_Sequence; + public static String KeyBindingEditor_Command; + public static String KeyBindingEditor_Find; + public static String KeyBindingEditor_Parameters; + public static String KeyBindingEditor_ParametersKey; + public static String KeyBindingEditor_ParametersValue; + public static String KeyBindingEditor_Up; + public static String KeyBindingEditor_Down; + public static String KeyBindingEditor_Add; + public static String KeyBindingEditor_Remove; + + public static String MenuEditor_Label; + public static String MenuEditor_Description; + public static String MenuEditor_Id; + public static String MenuEditor_MenuItems; + public static String MenuEditor_MenuItemType; + public static String MenuEditor_MenuItemItemType; + public static String MenuEditor_Up; + public static String MenuEditor_Down; + public static String MenuEditor_HandledMenuItem; + public static String MenuEditor_Separator; + public static String MenuEditor_Menu; + public static String MenuEditor_DirectMenuItem; + public static String MenuEditor_Remove; + public static String MenuEditor_LabelLabel; + public static String MenuEditor_Tooltip; + public static String MenuEditor_IconURI; + + + public static String MenuItemEditor_Id; + public static String MenuItemEditor_Type; + public static String MenuItemEditor_Label; + public static String MenuItemEditor_Tooltip; + public static String MenuItemEditor_IconURI; + public static String MenuItemEditor_Find; + + public static String MenuSeparatorEditor_Label; + public static String MenuSeparatorEditor_Id; + + public static String ModelComponentEditor_Id; + public static String ModelComponentEditor_ParentId; + public static String ModelComponentEditor_Find; + public static String ModelComponentEditor_PositionInParent; + public static String ModelComponentEditor_Processor; + public static String ModelComponentEditor_Tags; + public static String ModelComponentEditor_Label; + public static String ModelComponentEditor_Description; + public static String ModelComponentEditor_Handlers; + public static String ModelComponentEditor_BindingTables; + public static String ModelComponentEditor_KeyBindings; + public static String ModelComponentEditor_Commands; + public static String ModelComponentEditor_Menus; + public static String ModelComponentEditor_Parts; + public static String ModelComponentEditor_PartDescriptors; + public static String ModelComponentEditor_DetailParentId; + + public static String ModelComponentsEditor_Label; + public static String ModelComponentsEditor_Description; + public static String ModelComponentsEditor_ModelContributions; + public static String ModelComponentsEditor_Up; + public static String ModelComponentsEditor_Down; + public static String ModelComponentsEditor_Add; + public static String ModelComponentsEditor_Remove; + + public static String PartDescriptorEditor_Label; + public static String PartDescriptorEditor_Descriptor; + public static String PartDescriptorEditor_Id; + public static String PartDescriptorEditor_LabelLabel; + public static String PartDescriptorEditor_Tooltip; + public static String PartDescriptorEditor_IconURI; + public static String PartDescriptorEditor_Find; + public static String PartDescriptorEditor_ClassURI; + public static String PartDescriptorEditor_Dirtyable; + public static String PartDescriptorEditor_Closeable; + public static String PartDescriptorEditor_Multiple; + public static String PartDescriptorEditor_Category; + public static String PartDescriptorEditor_PersitedState; + public static String PartDescriptorEditor_PersitedStateKey; + public static String PartDescriptorEditor_PersitedStateValue; + public static String PartDescriptorEditor_Add; + public static String PartDescriptorEditor_Remove; + public static String PartDescriptorEditor_Variables; + public static String PartDescriptorEditor_Properties; + public static String PartDescriptorEditor_PropertiesKey; + public static String PartDescriptorEditor_PropertiesValue; + public static String PartDescriptorEditor_Menus; + public static String PartDescriptorEditor_Handlers; + public static String PartDescriptorEditor_ContainerData; + + public static String PartEditor_Label; + public static String PartEditor_Description; + public static String PartEditor_Id; + public static String PartEditor_LabelLabel; + public static String PartEditor_Tooltip; + public static String PartEditor_IconURI; + public static String PartEditor_Find; + public static String PartEditor_ClassURI; + public static String PartEditor_Closeable; + public static String PartEditor_PersitedState; + public static String PartEditor_PersitedStateKey; + public static String PartEditor_PersitedStateValue; + public static String PartEditor_Add; + public static String PartEditor_Remove; + public static String PartEditor_Menus; + public static String PartEditor_Handlers; + public static String PartEditor_ContainerData; + + public static String PartSashContainerEditor_Label; + public static String PartSashContainerEditor_Description; + public static String PartSashContainerEditor_Id; + public static String PartSashContainerEditor_Orientation; + public static String PartSashContainerEditor_Vertical; + public static String PartSashContainerEditor_Horizontal; + public static String PartSashContainerEditor_SelectedElement; + public static String PartSashContainerEditor_Controls; + public static String PartSashContainerEditor_Up; + public static String PartSashContainerEditor_Down; + public static String PartSashContainerEditor_Remove; + public static String PartSashContainerEditor_ContainerData; + + public static String PartStackEditor_Label; + public static String PartStackEditor_Description; + public static String PartStackEditor_Id; + public static String PartStackEditor_SelectedElement; + public static String PartStackEditor_Parts; + public static String PartStackEditor_Up; + public static String PartStackEditor_Down; + public static String PartStackEditor_Remove; + public static String PartStackEditor_ContainerData; + + public static String PerspectiveEditor_Label; + public static String PerspectiveEditor_Description; + public static String PerspectiveEditor_Id; + public static String PerspectiveEditor_SelectedElement; + public static String PerspectiveEditor_Tooltip; + public static String PerspectiveEditor_IconURI; + public static String PerspectiveEditor_Find; + public static String PerspectiveEditor_Controls; + public static String PerspectiveEditor_Up; + public static String PerspectiveEditor_Down; + public static String PerspectiveEditor_Remove; + + public static String PerspectiveStackEditor_Perspectives; + public static String PerspectiveStackEditor_Label; + public static String PerspectiveStackEditor_Description; + public static String PerspectiveStackEditor_Id; + public static String PerspectiveStackEditor_SelectedElement; + + public static String PlaceholderEditor_Label; + public static String PlaceholderEditor_Descriptor; + public static String PlaceholderEditor_Id; + + public static String ToolBarEditor_Label; + public static String ToolBarEditor_Description; + public static String ToolBarEditor_Id; + public static String ToolBarEditor_ToolbarItems; + public static String ToolBarEditor_ToolbarItemsType; + public static String ToolBarEditor_ToolbarItemsItemType; + public static String ToolBarEditor_Up; + public static String ToolBarEditor_Down; + public static String ToolBarEditor_HandledToolItem; + public static String ToolBarEditor_DirectToolItem; + public static String ToolBarEditor_ToolControl; + public static String ToolBarEditor_Separator; + public static String ToolBarEditor_Remove; + + public static String ToolBarSeparatorEditor_Label; + public static String ToolBarSeparatorEditor_Id; + + public static String ToolControlEditor_Label; + public static String ToolControlEditor_Description; + public static String ToolControlEditor_Id; + public static String ToolControlEditor_ClassURI; + + public static String VBindingTableEditor_Label; + public static String VBindingTableEditor_Description; + public static String VBindingTableEditor_Contexts; + public static String VBindingTableEditor_Name; + public static String VBindingTableEditor_LabelDescription; + public static String VBindingTableEditor_Id; + public static String VBindingTableEditor_Up; + public static String VBindingTableEditor_Down; + public static String VBindingTableEditor_Add; + public static String VBindingTableEditor_Remove; + + + + + + + + + + + + + + static { + NLS.initializeMessages(Messages.class.getName(), Messages.class); + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties new file mode 100644 index 0000000000..290dd336c7 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -0,0 +1,288 @@ +# ****************************************************************************** +# * Copyright (c) 2010 BestSolution.at and others. +# * All rights reserved. This program and the accompanying materials +# * are made available under the terms of the Eclipse Public License v1.0 +# * which accompanies this distribution, and is available at +# * http://www.eclipse.org/legal/epl-v10.html +# * +# * Contributors: +# * Tom Schindl - initial API and implementation +# ****************************************************************************** +ApplicationEditor_Label=Application +ApplicationEditor_Description=Application bla, bla, bla +ApplicationEditor_Id=Id +ApplicationEditor_Handlers=Handlers +ApplicationEditor_PartDescriptors=Part Descriptors +ApplicationEditor_BindingTables=BindingTables +ApplicationEditor_Commands=Commands +ApplicationEditor_Windows=Windows + +BindingTableEditor_Label=BindingTable +BindingTableEditor_Description=BindingTable bla bla bla +BindingTableEditor_Id=Id +BindingTableEditor_ContextId=Context Id +BindingTableEditor_Find=Find ... +BindingTableEditor_Keybindings=Keybindings +BindingTableEditor_KeySequence=KeySequence +BindingTableEditor_Command=Command +BindingTableEditor_Up=Up +BindingTableEditor_Down=Down +BindingTableEditor_Add=Add ... +BindingTableEditor_Remove=Remove + +CommandEditor_Label=Command +CommandEditor_Description=Command bla bla bla +CommandEditor_Id=Id +CommandEditor_Name=Name +CommandEditor_LabelDescription=Description +CommandEditor_Parameters=Parameters +CommandEditor_ParameterName=Name +CommandEditor_ParameterTypeId=Type-Id +CommandEditor_ParameterOptional=Optional +CommandEditor_ParameterOptional_Yes=yes +CommandEditor_ParameterOptional_No=no +CommandEditor_Up=Up +CommandEditor_Down=Down +CommandEditor_Add=Add ... +CommandEditor_Remove=Remove + +DirectMenuItemEditor_Label=DirectMenuItem +DirectMenuItemEditor_Description=DirectMenuItem bla bla bla +DirectMenuItemEditor_ClassURI=Class URI +DirectMenuItemEditor_Find=Find ... + +ControlFactory_BindingContexts=Binding Contexts +ControlFactory_Add=Add ... +ControlFactory_Up=Up +ControlFactory_Down=Down +ControlFactory_Remove=Remove +ControlFactory_Tags=Tags +ControlFactory_Key=Key +ControlFactory_Value=Value + +DirectToolItemEditor_ClassURI=Class URI +DirectToolItemEditor_Find=Find ... +DirectToolItemEditor_Label=Direct Tool Item +DirectToolItemEditor_Description=Direct Tool Item bla bla bla + +HandledMenuItemEditor_Label=HandledMenuItem +HandledMenuItemEditor_Description=HandledMenuItem bla bla bla +HandledMenuItemEditor_Command=Command +HandledMenuItemEditor_Find=Find ... +HandledMenuItemEditor_Parameters=Parameters +HandledMenuItemEditor_Tag=Tag +HandledMenuItemEditor_Value=Value +HandledMenuItemEditor_Up=Up +HandledMenuItemEditor_Down=Down +HandledMenuItemEditor_Add=Add ... +HandledMenuItemEditor_Remove=Remove + +HandledToolItemEditor_Command=Command +HandledToolItemEditor_Find=Find ... +HandledToolItemEditor_Parameters=Parameters +HandledToolItemEditor_ParametersName=Name +HandledToolItemEditor_ParametersValue=Value +HandledToolItemEditor_Up=Up +HandledToolItemEditor_Down=Down +HandledToolItemEditor_Add=Add ... +HandledToolItemEditor_Remove=Remove +HandledToolItemEditor_Label=Handled Tool Item +HandledToolItemEditor_Description=Handled Tool Item bla bla bla + +HandlerEditor_Label=Handler +HandlerEditor_Description=Handler bla bla bla +HandlerEditor_Id=Id +HandlerEditor_Command=Command +HandlerEditor_Find=Find ... +HandlerEditor_ClassURI=Class URI + +InputPartEditor_Label=InputPart +InputPartEditor_InputURI=Input URI + +KeyBindingEditor_Label=Binding +KeyBindingEditor_Description=Binding bla bla bla +KeyBindingEditor_Id=Id +KeyBindingEditor_Sequence=Sequence +KeyBindingEditor_Command=Command +KeyBindingEditor_Find=Find ... +KeyBindingEditor_Parameters=Parameters +KeyBindingEditor_ParametersKey=Key +KeyBindingEditor_ParametersValue=Value +KeyBindingEditor_Up=Up +KeyBindingEditor_Down=Down +KeyBindingEditor_Add=Add ... +KeyBindingEditor_Remove=Remove + +MenuEditor_Label=Menu +MenuEditor_Description=Menu bla bla bla +MenuEditor_Id=Id +MenuEditor_MenuItems=MenuItems +MenuEditor_MenuItemType=Type +MenuEditor_MenuItemItemType=Item Type +MenuEditor_Up=Up +MenuEditor_Down=Down +MenuEditor_HandledMenuItem=Handled MenuItem +MenuEditor_Separator=Separator +MenuEditor_Menu=Menu +MenuEditor_Remove=Remove +MenuEditor_DirectMenuItem=Direct MenuItem +MenuEditor_LabelLabel=Label +MenuEditor_Tooltip=Tooltip +MenuEditor_IconURI=Icon URI + +MenuItemEditor_Id=Id +MenuItemEditor_Type=Type +MenuItemEditor_Label=Label +MenuItemEditor_Tooltip=Tooltip +MenuItemEditor_IconURI=Icon URI +MenuItemEditor_Find=Find ... + + +MenuSeparatorEditor_Label=Separator +MenuSeparatorEditor_Id=Id + +ModelComponentEditor_Id=Id +ModelComponentEditor_ParentId=Parent-Id +ModelComponentEditor_Find=Find ... +ModelComponentEditor_PositionInParent=Position in Parent +ModelComponentEditor_Processor=Processor +ModelComponentEditor_Tags=Tags +ModelComponentEditor_Label=Model Component +ModelComponentEditor_Description=The model component ... bla bla bla +ModelComponentEditor_Handlers=Handlers +ModelComponentEditor_BindingTables=BindingTables +ModelComponentEditor_KeyBindings=KeyBindings +ModelComponentEditor_Commands=Commands +ModelComponentEditor_Menus=Menus +ModelComponentEditor_Parts=Parts +ModelComponentEditor_PartDescriptors=PartDescriptors +ModelComponentEditor_DetailParentId=parentId + +ModelComponentsEditor_Label=Model Components +ModelComponentsEditor_Description=Some bla bla bla bla +ModelComponentsEditor_ModelContributions=Model Contributions +ModelComponentsEditor_Up=Up +ModelComponentsEditor_Down=Down +ModelComponentsEditor_Add=Add +ModelComponentsEditor_Remove=Remove + +PartDescriptorEditor_Label=PartDescriptor +PartDescriptorEditor_Descriptor=PartDescriptor Bla Bla Bla Bla +PartDescriptorEditor_Id=Id +PartDescriptorEditor_LabelLabel=Label +PartDescriptorEditor_Tooltip=Tooltip +PartDescriptorEditor_IconURI=Icon URI +PartDescriptorEditor_Find=Find ... +PartDescriptorEditor_ClassURI=Class URI +PartDescriptorEditor_Dirtyable=Dirtyable +PartDescriptorEditor_Closeable=Closeable +PartDescriptorEditor_Multiple=Multiple +PartDescriptorEditor_Category=Category +PartDescriptorEditor_PersitedState=Persited State +PartDescriptorEditor_PersitedStateKey=Key +PartDescriptorEditor_PersitedStateValue=Value +PartDescriptorEditor_Add=Add ... +PartDescriptorEditor_Remove=Remove +PartDescriptorEditor_Variables=Variables +PartDescriptorEditor_Properties=Properties +PartDescriptorEditor_PropertiesKey=Key +PartDescriptorEditor_PropertiesValue=Value +PartDescriptorEditor_Menus=Menus +PartDescriptorEditor_Handlers=Handlers +PartDescriptorEditor_ContainerData=Container Data + +PartEditor_Label=Part +PartEditor_Description=Part Bla Bla Bla Bla +PartEditor_Id=Id +PartEditor_LabelLabel=Label +PartEditor_Tooltip=Tooltip +PartEditor_IconURI=Icon URI +PartEditor_Find=Find ... +PartEditor_ClassURI=Class URI +PartEditor_Closeable=Closeable +PartEditor_PersitedState=Persisted State +PartEditor_PersitedStateKey=Key +PartEditor_PersitedStateValue=Value +PartEditor_Add=Add ... +PartEditor_Remove=Remove +PartEditor_Menus=Menus +PartEditor_Handlers=Handlers + +PartSashContainerEditor_Label=Sash +PartSashContainerEditor_Description=Sash bla bla bla +PartSashContainerEditor_Id=Id +PartSashContainerEditor_Orientation=Orientation +PartSashContainerEditor_Vertical=Vertical +PartSashContainerEditor_Horizontal=Horizontal +PartSashContainerEditor_SelectedElement=Selected Element +PartSashContainerEditor_Controls=Controls +PartSashContainerEditor_Up=Up +PartSashContainerEditor_Down=Down +PartSashContainerEditor_Remove=Remove +PartSashContainerEditor_ContainerData=Container Data + +PartStackEditor_Label=Part Stack +PartStackEditor_Description=Stack bla bla bla +PartStackEditor_Id=Id +PartStackEditor_SelectedElement=Selected Element +PartStackEditor_Parts=Parts +PartStackEditor_Up=Up +PartStackEditor_Down=Down +PartStackEditor_Remove=Remove +PartStackEditor_ContainerData=Container Data + +PerspectiveEditor_Label=Perspective +PerspectiveEditor_Description=Perspective Bla Bla Bla +PerspectiveEditor_Id=Id +PerspectiveEditor_SelectedElement=Selected Element +PerspectiveEditor_Label=Label +PerspectiveEditor_Tooltip=Tooltip +PerspectiveEditor_IconURI=Icon URI +PerspectiveEditor_Find=Find ... +PerspectiveEditor_Controls=Controls +PerspectiveEditor_Up=Up +PerspectiveEditor_Down=Down +PerspectiveEditor_Remove=Remove +PartEditor_ContainerData=Container Data + +PerspectiveStackEditor_Label=Perspective Stack +PerspectiveStackEditor_Description=Perspective Stack Bla Bla Bla +PerspectiveStackEditor_Id=Id +PerspectiveStackEditor_SelectedElement=Selected Element +PerspectiveStackEditor_Perspectives=Perspectives + +PlaceholderEditor_Label=Placeholder +PlaceholderEditor_Descriptor=Placeholder Bla Bla Bla Bla +PlaceholderEditor_Id=Id + +ToolBarEditor_Label=Toolbar +ToolBarEditor_Description=Toolbar bla bla bla +ToolBarEditor_Id=Id +ToolBarEditor_ToolbarItems=Toolbar Items +ToolBarEditor_ToolbarItemsType=Type +ToolBarEditor_ToolbarItemsItemType=Item-Type +ToolBarEditor_Up=Up +ToolBarEditor_Down=Down +ToolBarEditor_HandledToolItem=Handled ToolItem +ToolBarEditor_DirectToolItem=Direct ToolItem +ToolBarEditor_ToolControl=Tool Control +ToolBarEditor_Separator=Separator +ToolBarEditor_Remove=Remove + +ToolBarSeparatorEditor_Label=Separator +ToolBarSeparatorEditor_Id=Id + +ToolControlEditor_Label=ToolControl +ToolControlEditor_Description=ToolControl bla bla bla +ToolControlEditor_Id=Id + +VBindingTableEditor_Label=Binding Configuration +VBindingTableEditor_Description=Binding Configuration Bla Bla Bla Bla +VBindingTableEditor_Contexts=Contexts +VBindingTableEditor_Name=Name +VBindingTableEditor_LabelDescription=Description +VBindingTableEditor_Id=Id +VBindingTableEditor_Up=Up +VBindingTableEditor_Down=Down +VBindingTableEditor_Add=Add ... +VBindingTableEditor_Remove=Remove \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java index 0647a798cd..c1207886cc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal; import java.util.Set; @@ -71,7 +81,7 @@ public void update(ViewerCell cell) { public String getText(M element) { Object value = attributeMaps[0].get(element); - return value == null ? "" : value.toString(); + return value == null ? "" : value.toString(); //$NON-NLS-1$ } public Font getFont(M element) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java index 23ff9a5051..6fc7603db0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java @@ -38,12 +38,12 @@ public class PatternFilter extends ViewerFilter { /* * Cache of filtered elements in the tree */ - private Map cache = new HashMap(); + private Map cache = new HashMap(); /* * Maps parent elements to TRUE or FALSE */ - private Map foundAnyCache = new HashMap(); + private Map foundAnyCache = new HashMap(); private boolean useCache = false; @@ -288,7 +288,7 @@ protected boolean isLeafMatch(Viewer viewer, Object element){ * @return an array of words */ private String[] getWords(String text){ - List words = new ArrayList(); + List words = new ArrayList(); // Break the text up into words, separating based on whitespace and // common punctuation. // Previously used String.split(..., "\\W"), where "\W" is a regular diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java index ddde765f1c..cfd8768709 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java @@ -284,7 +284,7 @@ private void parseWildCards() { } } - Vector temp = new Vector(); + Vector temp = new Vector(); int pos = 0; StringBuffer buf = new StringBuffer(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java index a976bc2261..f7b4a5a109 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java @@ -21,12 +21,10 @@ public class ClassContributionCollector { private CopyOnWriteArrayList providers = new CopyOnWriteArrayList(); public void addContributor(IClassContributionProvider contributor) { - System.err.println("Add Contributor: " + contributor); providers.add(contributor); } public void removeContributor(IClassContributionProvider contributor) { - System.err.println("Remove Contributor: " + contributor); providers.remove(contributor); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java index 9621c8078d..1ee616330e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java @@ -44,7 +44,7 @@ public void update(final ViewerCell cell) { cell.setText(label); } else { StyledString styledString = new StyledString(label, null); - styledString.append(" - " + detailText, StyledString.DECORATIONS_STYLER); + styledString.append(" - " + detailText, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); } @@ -56,7 +56,7 @@ public void update(final ViewerCell cell) { String s = cell.getElement().toString(); cell.setText(s); } else { - cell.setText(cell.getElement()+""); + cell.setText(cell.getElement().toString()); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 47bd78b203..eef4517ecc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -15,8 +15,6 @@ import java.util.List; import java.util.Map; -import javax.inject.Inject; - import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.map.IMapChangeListener; @@ -43,7 +41,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.HandledToolItemEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.HandlerEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuSeparatorEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ModelComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ModelComponentsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PartDescriptorEditor; @@ -54,19 +52,25 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.PerspectiveStackEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PlaceholderEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolItemEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarSeparatorEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolControlEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.TrimBarEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.TrimmedWindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowTrimEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VBindingTableEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VCommandEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VControlEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowControlEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelComponentBindingEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor; -import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.ecore.EClass; @@ -92,17 +96,20 @@ import org.eclipse.swt.widgets.Label; public class ModelEditor { - public static final int VIRTUAL_MENU = 0; + private static final String CSS_CLASS_KEY = "org.eclipse.e4.ui.css.CssClassName"; //$NON-NLS-1$ + + public static final int VIRTUAL_PART_MENU = 0; public static final int VIRTUAL_PART = 1; public static final int VIRTUAL_HANDLER = 2; public static final int VIRTUAL_BINDING_TABLE = 3; public static final int VIRTUAL_COMMAND = 4; public static final int VIRTUAL_WINDOWS = 5; public static final int VIRTUAL_WINDOW_CONTROLS = 6; - public static final int VIRTUAL_WINDOW_TRIMS = 7; - public static final int VIRTUAL_PART_DESCRIPTORS = 8; - public static final int VIRTUAL_MODEL_COMP_COMMANDS = 9; - public static final int VIRTUAL_MODEL_COMP_BINDINGS = 10; + public static final int VIRTUAL_PART_DESCRIPTORS = 7; + public static final int VIRTUAL_MODEL_COMP_COMMANDS = 8; + public static final int VIRTUAL_MODEL_COMP_BINDINGS = 9; + public static final int VIRTUAL_PARTDESCRIPTOR_MENU = 10; + public static final int VIRTUAL_TRIMMED_WINDOW_TRIMS = 11; private Map editorMap = new HashMap(); private AbstractComponentEditor[] virtualEditors; @@ -115,7 +122,6 @@ public class ModelEditor { private IModelResource modelProvider; private IProject project; - @Inject public ModelEditor(Composite composite, IModelResource modelProvider, IProject project) { this.modelProvider = modelProvider; this.project = project; @@ -144,7 +150,7 @@ public ModelEditor(Composite composite, IModelResource modelProvider, IProject p Composite headerContainer = new Composite(editingArea, SWT.NONE); headerContainer.setBackgroundMode(SWT.INHERIT_DEFAULT); - headerContainer.setData("org.eclipse.e4.ui.css.CssClassName", "headerSectionContainer"); + headerContainer.setData(CSS_CLASS_KEY, "headerSectionContainer"); //$NON-NLS-1$ headerContainer.setLayout(new GridLayout(2, false)); headerContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -152,15 +158,15 @@ public ModelEditor(Composite composite, IModelResource modelProvider, IProject p iconLabel.setLayoutData(new GridData(20, 20)); final Label textLabel = new Label(headerContainer, SWT.NONE); - textLabel.setData("org.eclipse.e4.ui.css.CssClassName", "sectionHeader"); + textLabel.setData(CSS_CLASS_KEY, "sectionHeader"); //$NON-NLS-1$ textLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final ScrolledComposite scrolling = new ScrolledComposite(editingArea, SWT.H_SCROLL | SWT.V_SCROLL); scrolling.setBackgroundMode(SWT.INHERIT_DEFAULT); - scrolling.setData("org.eclipse.e4.ui.css.CssClassName", "formContainer"); + scrolling.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ final Composite contentContainer = new Composite(scrolling, SWT.NONE); - contentContainer.setData("org.eclipse.e4.ui.css.CssClassName", "formContainer"); + contentContainer.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ scrolling.setExpandHorizontal(true); scrolling.setExpandVertical(true); scrolling.setContent(contentContainer); @@ -217,7 +223,7 @@ public void selectionChanged(SelectionChangedEvent event) { private TreeViewer createTreeViewerArea(Composite parent) { parent = new Composite(parent, SWT.NONE); - parent.setData("org.eclipse.e4.ui.css.CssClassName", "formContainer"); + parent.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ parent.setBackgroundMode(SWT.INHERIT_DEFAULT); FillLayout l = new FillLayout(); @@ -266,17 +272,18 @@ public void handleMapChange(MapChangeEvent event) { } private void registerVirtualEditors() { - virtualEditors = new AbstractComponentEditor[] { new VMenuEditor(modelProvider.getEditingDomain(), this), // V-Menu + virtualEditors = new AbstractComponentEditor[] { new VMenuEditor(modelProvider.getEditingDomain(), this, BasicPackageImpl.Literals.PART__MENUS), // V-Menu null, // V-Part new VHandlerEditor(modelProvider.getEditingDomain(), this), new VBindingTableEditor(modelProvider.getEditingDomain(), this), - new VCommandEditor(modelProvider.getEditingDomain(), this, MApplicationPackage.Literals.APPLICATION__COMMANDS), + new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.APPLICATION__COMMANDS), new VWindowEditor(modelProvider.getEditingDomain(), this), - new VControlEditor(modelProvider.getEditingDomain(), this), - new VWindowTrimEditor(modelProvider.getEditingDomain(), this), + new VWindowControlEditor(modelProvider.getEditingDomain(), this), new VPartDescriptor(modelProvider.getEditingDomain(), this), - new VCommandEditor(modelProvider.getEditingDomain(), this, MApplicationPackage.Literals.MODEL_COMPONENT__COMMANDS), - new VModelComponentBindingEditor(modelProvider.getEditingDomain(), this) + new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.MODEL_COMPONENT__COMMANDS), + new VModelComponentBindingEditor(modelProvider.getEditingDomain(), this), + new VMenuEditor(modelProvider.getEditingDomain(), this, org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS), + new VWindowTrimEditor(modelProvider.getEditingDomain(), this) }; } @@ -285,31 +292,39 @@ public void setSelection(Object element) { } private void registerDefaultEditors() { - registerEditor(MApplicationPackage.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain())); - registerEditor(MApplicationPackage.Literals.MODEL_COMPONENTS, new ModelComponentsEditor(modelProvider.getEditingDomain(),this)); - registerEditor(MApplicationPackage.Literals.MODEL_COMPONENT, new ModelComponentEditor(modelProvider.getEditingDomain())); - registerEditor(MApplicationPackage.Literals.PART, new PartEditor(modelProvider.getEditingDomain(),project)); - registerEditor(MApplicationPackage.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain(),project)); - registerEditor(MApplicationPackage.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(),modelProvider)); - registerEditor(MApplicationPackage.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain(),modelProvider,project)); - registerEditor(MApplicationPackage.Literals.COMMAND, new CommandEditor(modelProvider.getEditingDomain())); - registerEditor(MApplicationPackage.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain())); - registerEditor(MApplicationPackage.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MApplicationPackage.Literals.PART_STACK, new PartStackEditor(modelProvider.getEditingDomain(),this)); - registerEditor(MApplicationPackage.Literals.WINDOW_TRIM, new WindowTrimEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MApplicationPackage.Literals.TOOL_BAR, new ToolBarEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MApplicationPackage.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain(),project)); - registerEditor(MApplicationPackage.Literals.HANDLED_TOOL_ITEM, new HandledToolItemEditor(modelProvider.getEditingDomain())); - registerEditor(MApplicationPackage.Literals.TOOL_ITEM, new ToolItemEditor(modelProvider.getEditingDomain())); - registerEditor(MApplicationPackage.Literals.PERSPECTIVE_STACK, new PerspectiveStackEditor(modelProvider.getEditingDomain())); - registerEditor(MApplicationPackage.Literals.PERSPECTIVE, new PerspectiveEditor(modelProvider.getEditingDomain())); - registerEditor(MApplicationPackage.Literals.PLACEHOLDER, new PlaceholderEditor(modelProvider.getEditingDomain())); - registerEditor(MApplicationPackage.Literals.MENU, new MenuEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MApplicationPackage.Literals.MENU_ITEM, new MenuItemEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MApplicationPackage.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MApplicationPackage.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this, project)); - registerEditor(MApplicationPackage.Literals.BINDING_TABLE, new BindingTableEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MApplicationPackage.Literals.INPUT_PART, new InputPartEditor(modelProvider.getEditingDomain(), project)); + registerEditor(ApplicationPackageImpl.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain())); + registerEditor(ApplicationPackageImpl.Literals.MODEL_COMPONENTS, new ModelComponentsEditor(modelProvider.getEditingDomain(),this)); + registerEditor(ApplicationPackageImpl.Literals.MODEL_COMPONENT, new ModelComponentEditor(modelProvider.getEditingDomain())); + + registerEditor(CommandsPackageImpl.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(),modelProvider)); + registerEditor(CommandsPackageImpl.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain(),modelProvider,project)); + registerEditor(CommandsPackageImpl.Literals.COMMAND, new CommandEditor(modelProvider.getEditingDomain())); + registerEditor(CommandsPackageImpl.Literals.BINDING_TABLE, new BindingTableEditor(modelProvider.getEditingDomain(), this)); + + registerEditor(MenuPackageImpl.Literals.TOOL_BAR, new ToolBarEditor(modelProvider.getEditingDomain(), this)); + registerEditor(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain(),project)); + registerEditor(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, new HandledToolItemEditor(modelProvider.getEditingDomain(),modelProvider)); + registerEditor(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, new ToolBarSeparatorEditor(modelProvider.getEditingDomain())); + registerEditor(MenuPackageImpl.Literals.TOOL_CONTROL, new ToolControlEditor(modelProvider.getEditingDomain(),project)); + + registerEditor(MenuPackageImpl.Literals.MENU, new MenuEditor(modelProvider.getEditingDomain(), this)); + registerEditor(MenuPackageImpl.Literals.MENU_SEPARATOR, new MenuSeparatorEditor(modelProvider.getEditingDomain())); + registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), modelProvider)); + registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this, project)); + + registerEditor(BasicPackageImpl.Literals.PART, new PartEditor(modelProvider.getEditingDomain(),project)); + registerEditor(BasicPackageImpl.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain())); + registerEditor(BasicPackageImpl.Literals.TRIMMED_WINDOW, new TrimmedWindowEditor(modelProvider.getEditingDomain())); + registerEditor(BasicPackageImpl.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor(modelProvider.getEditingDomain(), this)); + registerEditor(BasicPackageImpl.Literals.PART_STACK, new PartStackEditor(modelProvider.getEditingDomain(),this)); + registerEditor(BasicPackageImpl.Literals.INPUT_PART, new InputPartEditor(modelProvider.getEditingDomain(), project)); + registerEditor(BasicPackageImpl.Literals.TRIM_BAR, new TrimBarEditor(modelProvider.getEditingDomain(), this)); + + registerEditor(org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain(),project)); + + registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, new PerspectiveStackEditor(modelProvider.getEditingDomain(),this)); + registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE, new PerspectiveEditor(modelProvider.getEditingDomain(),this)); + registerEditor(AdvancedPackageImpl.Literals.PLACEHOLDER, new PlaceholderEditor(modelProvider.getEditingDomain())); } public void registerEditor(EClass eClass, AbstractComponentEditor editor) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 4601f74f8b..a63049b7ef 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -17,9 +17,13 @@ import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.edit.EMFEditProperties; @@ -41,10 +45,11 @@ public class ApplicationEditor extends AbstractComponentEditor { private Image image; private EMFDataBindingContext context; - private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); - private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES); - private IListProperty APPLICATION__COMMANDS = EMFProperties.list(MApplicationPackage.Literals.APPLICATION__COMMANDS); - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); + private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES); + private IListProperty APPLICATION__COMMANDS = EMFProperties.list(ApplicationPackageImpl.Literals.APPLICATION__COMMANDS); + private IListProperty PART_DESCRIPTOR_CONTAINER__DESCRIPTORS = EMFProperties.list(BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS); + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); public ApplicationEditor(EditingDomain editingDomain) { super(editingDomain); @@ -54,7 +59,7 @@ public ApplicationEditor(EditingDomain editingDomain) { public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Application.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Application.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -66,12 +71,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Application"; + return Messages.ApplicationEditor_Label; } @Override public String getDescription(Object element) { - return "Application bla, bla, bla"; + return Messages.ApplicationEditor_Description; } @Override @@ -92,13 +97,13 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) { Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.ApplicationEditor_Id); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } ControlFactory.createBindingsWidget(parent, this); @@ -109,7 +114,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) @Override public IObservableList getChildList(Object element) { WritableList list = new WritableList(); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.ApplicationEditor_Handlers) { @Override protected boolean accepted(Object o) { @@ -117,8 +122,17 @@ protected boolean accepted(Object o) { } }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART_DESCRIPTORS, PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, element, Messages.ApplicationEditor_PartDescriptors) { - list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING_TABLE, BINDING_CONTAINER__BINDINGS, element, "BindingTables") { + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING_TABLE, BINDING_CONTAINER__BINDINGS, element, Messages.ApplicationEditor_BindingTables) { @Override protected boolean accepted(Object o) { @@ -127,7 +141,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_COMMAND, APPLICATION__COMMANDS, element, "Commands") { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_COMMAND, APPLICATION__COMMANDS, element, Messages.ApplicationEditor_Commands) { @Override protected boolean accepted(Object o) { @@ -136,7 +150,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOWS, ELEMENT_CONTAINER__CHILDREN, element, "Windows") { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOWS, ELEMENT_CONTAINER__CHILDREN, element, Messages.ApplicationEditor_Windows) { @Override protected boolean accepted(Object o) { @@ -150,8 +164,6 @@ protected boolean accepted(Object o) { @Override public String getDetailLabel(Object element) { - // TODO Auto-generated method stub return null; } - -} +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index 382baea5f1..a7506e0d97 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -17,13 +17,15 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MBindingTable; -import org.eclipse.e4.ui.model.application.MHandler; -import org.eclipse.e4.ui.model.application.MKeyBinding; +import org.eclipse.e4.ui.model.application.commands.MBindingTable; +import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.commands.MKeyBinding; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; @@ -61,7 +63,7 @@ public class BindingTableEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private ModelEditor editor; - private IListProperty BINDING_TABLE__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_TABLE__BINDINGS); + private IListProperty BINDING_TABLE__BINDINGS = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS); public BindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { @@ -73,7 +75,8 @@ public BindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/BindingTable.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingTable.png")); //$NON-NLS-1$ +// image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/BindingTable.gif")); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -85,12 +88,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "BindingTable"; + return Messages.BindingTableEditor_Label; } @Override public String getDescription(Object element) { - return "BindingTable bla bla bla"; + return Messages.BindingTableEditor_Description; } @Override @@ -111,31 +114,31 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { { Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.BindingTableEditor_Id); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } { Label l = new Label(parent, SWT.NONE); - l.setText("Context Id"); + l.setText(Messages.BindingTableEditor_ContextId); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.BINDING_TABLE__BINDING_CONTEXT_ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID).observeDetail(getMaster())); Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText("Find ..."); + b.setText(Messages.BindingTableEditor_Find); } { Label l = new Label(parent, SWT.NONE); - l.setText("Keybindings"); + l.setText(Messages.BindingTableEditor_Keybindings); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); final TableViewer viewer = new TableViewer(parent); @@ -148,33 +151,33 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { viewer.getTable().setHeaderVisible(true); { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.KEY_SEQUENCE__KEY_SEQUENCE); + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_SEQUENCE__KEY_SEQUENCE); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("KeySequence"); + column.getColumn().setText(Messages.BindingTableEditor_KeySequence); column.getColumn().setWidth(100); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.KEY_BINDING__COMMAND, MApplicationPackage.Literals.COMMAND__COMMAND_NAME)); + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.KEY_BINDING__COMMAND, CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME)); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Command"); + column.getColumn().setText(Messages.BindingTableEditor_Command); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Id"); + column.getColumn().setText(Messages.BindingTableEditor_Id); column.getColumn().setWidth(170); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - IEMFListProperty prop = EMFProperties.list(MApplicationPackage.Literals.BINDING_TABLE__BINDINGS); + IEMFListProperty prop = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS); viewer.setInput(prop.observeDetail(getMaster())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -187,7 +190,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.BindingTableEditor_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -200,7 +203,7 @@ public void widgetSelected(SelectionEvent e) { MBindingTable container = (MBindingTable) getMaster().getValue(); int idx = container.getBindings().indexOf(obj) - 1; if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_TABLE__BINDINGS, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -214,7 +217,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.BindingTableEditor_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -227,7 +230,7 @@ public void widgetSelected(SelectionEvent e) { MBindingTable container = (MBindingTable) getMaster().getValue(); int idx = container.getBindings().indexOf(obj) + 1; if( idx < container.getBindings().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_TABLE__BINDINGS, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -241,15 +244,15 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.BindingTableEditor_Add); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MKeyBinding handler = MApplicationFactory.eINSTANCE.createKeyBinding(); + MKeyBinding handler = MCommandsFactory.INSTANCE.createKeyBinding(); System.err.println(getMaster().getValue()); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_TABLE__BINDINGS, handler); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS, handler); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); @@ -259,7 +262,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.BindingTableEditor_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -267,7 +270,7 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { if( ! viewer.getSelection().isEmpty() ) { List keybinding = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_TABLE__BINDINGS, keybinding); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS, keybinding); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } @@ -298,7 +301,7 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { return new FeaturePath[] { - FeaturePath.fromList(MApplicationPackage.Literals.BINDING_TABLE__BINDING_CONTEXT_ID) + FeaturePath.fromList(CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID) }; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 85b70bb6bd..d22f35d85d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -15,11 +15,13 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MCommand; -import org.eclipse.e4.ui.model.application.MCommandParameter; +import org.eclipse.e4.ui.model.application.commands.MCommand; +import org.eclipse.e4.ui.model.application.commands.MCommandParameter; +import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; @@ -70,7 +72,7 @@ public CommandEditor(EditingDomain editingDomain) { public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Command.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Command.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -82,12 +84,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Command"; + return Messages.CommandEditor_Label; } @Override public String getDescription(Object element) { - return "Command bla bla bla"; + return Messages.CommandEditor_Description; } @Override @@ -108,31 +110,31 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { { Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.CommandEditor_Id); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Name"); + l.setText(Messages.CommandEditor_Name); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND__COMMAND_NAME).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME).observeDetail(getMaster())); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Description"); + l.setText(Messages.CommandEditor_LabelDescription); l.setLayoutData(new GridData(GridData.BEGINNING,GridData.BEGINNING,false,false)); Text t = new Text(parent, SWT.BORDER|SWT.H_SCROLL|SWT.V_SCROLL); @@ -140,13 +142,13 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { gd.horizontalSpan = 2; gd.heightHint=100; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND__DESCRIPTION).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__DESCRIPTION).observeDetail(getMaster())); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Parameters"); + l.setText(Messages.CommandEditor_Parameters); l.setLayoutData(new GridData(GridData.BEGINNING,GridData.BEGINNING,false,false)); final TableViewer viewer = new TableViewer(parent,SWT.FULL_SELECTION|SWT.MULTI|SWT.BORDER); @@ -159,10 +161,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { viewer.getControl().setLayoutData(gd); { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND_PARAMETER__NAME); + IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__NAME); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Name"); + column.getColumn().setText(Messages.CommandEditor_ParameterName); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); column.setEditingSupport(new EditingSupport(viewer) { @@ -170,7 +172,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { @Override protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.COMMAND_PARAMETER__NAME, value); + Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.COMMAND_PARAMETER__NAME, value); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } @@ -179,7 +181,7 @@ protected void setValue(Object element, Object value) { @Override protected Object getValue(Object element) { MCommandParameter obj = (MCommandParameter) element; - return obj.getName() != null ? obj.getName() : ""; + return obj.getName() != null ? obj.getName() : ""; //$NON-NLS-1$ } @Override @@ -195,10 +197,10 @@ protected boolean canEdit(Object element) { } { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND_PARAMETER__TYPE_ID); + IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__TYPE_ID); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Type-Id"); + column.getColumn().setText(Messages.CommandEditor_ParameterTypeId); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); column.setEditingSupport(new EditingSupport(viewer) { @@ -206,7 +208,7 @@ protected boolean canEdit(Object element) { @Override protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.COMMAND_PARAMETER__TYPE_ID, value); + Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.COMMAND_PARAMETER__TYPE_ID, value); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } @@ -215,7 +217,7 @@ protected void setValue(Object element, Object value) { @Override protected Object getValue(Object element) { MCommandParameter obj = (MCommandParameter) element; - return obj.getTypeId() != null ? obj.getTypeId() : ""; + return obj.getTypeId() != null ? obj.getTypeId() : ""; //$NON-NLS-1$ } @Override @@ -231,24 +233,24 @@ protected boolean canEdit(Object element) { } { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND_PARAMETER__OPTIONAL); + IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__OPTIONAL); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Optional"); + column.getColumn().setText(Messages.CommandEditor_ParameterOptional); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements())) { @Override public String getText(MCommandParameter element) { - return element.isOptional() ? "yes" : "no"; + return element.isOptional() ? Messages.CommandEditor_ParameterOptional_Yes : Messages.CommandEditor_ParameterOptional_No; } }); column.setEditingSupport(new EditingSupport(viewer) { - private ComboBoxCellEditor editor = new ComboBoxCellEditor(viewer.getTable(), new String[] { "yes", "no" }); + private ComboBoxCellEditor editor = new ComboBoxCellEditor(viewer.getTable(), new String[] { Messages.CommandEditor_ParameterOptional_Yes, Messages.CommandEditor_ParameterOptional_No }); @Override protected void setValue(Object element, Object value) { int idx = ((Number)value).intValue(); - Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.COMMAND_PARAMETER__OPTIONAL, idx == 0); + Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.COMMAND_PARAMETER__OPTIONAL, idx == 0); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } @@ -286,7 +288,7 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even TableViewerEditor.create(viewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); - IEMFEditListProperty mProp = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.COMMAND__PARAMETERS); + IEMFEditListProperty mProp = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__PARAMETERS); viewer.setInput(mProp.observeDetail(getMaster())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -299,24 +301,24 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.CommandEditor_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.CommandEditor_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.CommandEditor_Add); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MCommandParameter param = MApplicationFactory.eINSTANCE.createCommandParameter(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.COMMAND__PARAMETERS, param); + MCommandParameter param = MCommandsFactory.INSTANCE.createCommandParameter(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.COMMAND__PARAMETERS, param); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -326,7 +328,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.CommandEditor_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); } @@ -338,7 +340,6 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } @@ -355,7 +356,7 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { return new FeaturePath[] { - FeaturePath.fromList(MApplicationPackage.Literals.COMMAND__COMMAND_NAME) + FeaturePath.fromList(CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME) }; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index a015606371..b918e975c4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -1,12 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; import java.util.Arrays; import java.util.List; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFListProperty; @@ -36,7 +48,7 @@ public class ControlFactory { public static void createBindingsWidget(Composite parent, final AbstractComponentEditor editor) { Label l = new Label(parent, SWT.NONE); - l.setText("Bindings"); + l.setText(Messages.ControlFactory_BindingContexts); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); final Text t = new Text(parent, SWT.BORDER); @@ -45,19 +57,19 @@ public static void createBindingsWidget(Composite parent, final AbstractComponen @Override public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { - handleAddText( editor, MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, t); + handleAddText( editor, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, t); } } }); Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText("Add"); + b.setText(Messages.ControlFactory_Add); b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - handleAddText( editor, MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, t); + handleAddText( editor, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, t); } }); @@ -70,7 +82,7 @@ public void widgetSelected(SelectionEvent e) { gd.heightHint = 150; viewer.getControl().setLayoutData(gd); - IEMFListProperty prop = EMFProperties.list(MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS); + IEMFListProperty prop = EMFProperties.list(CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS); viewer.setInput(prop.observeDetail(editor.getMaster())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -83,7 +95,7 @@ public void widgetSelected(SelectionEvent e) { buttonComp.setLayout(gl); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ControlFactory_Up); b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -96,7 +108,7 @@ public void widgetSelected(SelectionEvent e) { MApplication container = (MApplication) editor.getMaster().getValue(); int idx = container.getCommands().indexOf(obj) - 1; if( idx >= 0 ) { - Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); + Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); if( cmd.canExecute() ) { editor.getEditingDomain().getCommandStack().execute(cmd); @@ -110,7 +122,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ControlFactory_Down); b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -123,7 +135,7 @@ public void widgetSelected(SelectionEvent e) { MApplication container = (MApplication) editor.getMaster().getValue(); int idx = container.getCommands().indexOf(obj) + 1; if( idx < container.getCommands().size() ) { - Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); + Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); if( cmd.canExecute() ) { editor.getEditingDomain().getCommandStack().execute(cmd); @@ -137,7 +149,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ControlFactory_Remove); b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -146,7 +158,7 @@ public void widgetSelected(SelectionEvent e) { if( ! viewer.getSelection().isEmpty() ) { MApplication el = (MApplication) editor.getMaster().getValue(); List ids = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(editor.getEditingDomain(), el, MApplicationPackage.Literals.BINDINGS__BINDING_CONTEXTS, ids); + Command cmd = RemoveCommand.create(editor.getEditingDomain(), el, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, ids); if( cmd.canExecute() ) { editor.getEditingDomain().getCommandStack().execute(cmd); if( el.getBindingContexts().size() > 0 ) { @@ -160,7 +172,7 @@ public void widgetSelected(SelectionEvent e) { public static void createTagsWidget( Composite parent, final AbstractComponentEditor editor ) { Label l = new Label(parent, SWT.NONE); - l.setText("Tags"); + l.setText(Messages.ControlFactory_Tags); l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); final Text tagText = new Text(parent, SWT.BORDER); @@ -169,17 +181,17 @@ public static void createTagsWidget( Composite parent, final AbstractComponentEd @Override public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { - handleAddText(editor, MApplicationPackage.Literals.APPLICATION_ELEMENT__TAGS, tagText); + handleAddText(editor, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, tagText); } } }); Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText("Add"); + b.setText(Messages.ControlFactory_Add); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - handleAddText(editor, MApplicationPackage.Literals.APPLICATION_ELEMENT__TAGS, tagText); + handleAddText(editor, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, tagText); } }); b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); @@ -198,7 +210,7 @@ public String getText(Object element) { gd.heightHint = 120; viewer.getControl().setLayoutData(gd); - IEMFEditListProperty prop = EMFEditProperties.list(editor.getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__TAGS); + IEMFEditListProperty prop = EMFEditProperties.list(editor.getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS); viewer.setInput(prop.observeDetail(editor.getMaster())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -211,17 +223,17 @@ public String getText(Object element) { buttonComp.setLayout(gl); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ControlFactory_Up); b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ControlFactory_Down); b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ControlFactory_Remove); b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -230,7 +242,7 @@ public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if( ! s.isEmpty() ) { MApplicationElement appEl = (MApplicationElement) editor.getMaster().getValue(); - Command cmd = RemoveCommand.create(editor.getEditingDomain(), appEl, MApplicationPackage.Literals.APPLICATION_ELEMENT__TAGS, s.toList()); + Command cmd = RemoveCommand.create(editor.getEditingDomain(), appEl, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, s.toList()); if( cmd.canExecute() ) { editor.getEditingDomain().getCommandStack().execute(cmd); } @@ -241,7 +253,7 @@ public void widgetSelected(SelectionEvent e) { private static void handleAddText( AbstractComponentEditor editor, EStructuralFeature feature, Text tagText) { if (tagText.getText().trim().length() > 0) { - String[] tags = tagText.getText().split(";"); + String[] tags = tagText.getText().split(";"); //$NON-NLS-1$ for( int i = 0; i < tags.length;i++ ) { tags[i] = tags[i].trim(); } @@ -251,7 +263,7 @@ private static void handleAddText( AbstractComponentEditor editor, EStructuralFe if (cmd.canExecute()) { editor.getEditingDomain().getCommandStack().execute(cmd); } - tagText.setText(""); + tagText.setText(""); //$NON-NLS-1$ } } -} +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index b7065fd31f..e5b37626c1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -15,10 +15,11 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MContribution; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; @@ -40,7 +41,7 @@ public class DirectMenuItemEditor extends MenuItemEditor { private IProject project; public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor); + super(editingDomain); this.project = project; } @@ -48,7 +49,7 @@ public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IPr public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/DirectMenuItem.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/DirectMenuItem.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -60,12 +61,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "DirectMenuItem"; + return Messages.DirectMenuItemEditor_Label; } @Override public String getDescription(Object element) { - return "DirectMenuItem bla bla bla"; + return Messages.DirectMenuItemEditor_Description; } @Override @@ -75,15 +76,15 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Class URI"); + l.setText(Messages.DirectMenuItemEditor_ClassURI); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText("Find ..."); + b.setText(Messages.DirectMenuItemEditor_Find); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index b076239a69..fd096578bc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -15,9 +15,10 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MContribution; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; @@ -47,7 +48,7 @@ public DirectToolItemEditor(EditingDomain editingDomain, IProject project) { public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/DirectToolItem.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/DirectToolItem.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -63,14 +64,14 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); Label l = new Label(parent, SWT.NONE); - l.setText("Class URI"); + l.setText(Messages.DirectToolItemEditor_ClassURI); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value( getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value( getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); - b.setText("Find ..."); + b.setText(Messages.DirectToolItemEditor_Find); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @@ -84,11 +85,11 @@ public void widgetSelected(SelectionEvent e) { @Override public String getLabel(Object element) { - return "Direct Tool Item"; + return Messages.DirectToolItemEditor_Label; } @Override public String getDescription(Object element) { - return "Direct Tool Item bla bla bla"; + return Messages.DirectToolItemEditor_Description; } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index adf83a1fe3..1689160059 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -14,12 +14,17 @@ import java.net.URL; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MHandledItem; -import org.eclipse.e4.ui.model.application.MParameter; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledMenuItemCommandSelectionDialog; +import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.commands.MParameter; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; @@ -58,16 +63,18 @@ public class HandledMenuItemEditor extends MenuItemEditor { private Image image; + private IModelResource resource; - public HandledMenuItemEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); + public HandledMenuItemEditor(EditingDomain editingDomain, IModelResource resource) { + super(editingDomain); + this.resource = resource; } @Override public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/HandledMenuItem.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/HandledMenuItem.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -79,12 +86,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "HandledMenuItem"; + return Messages.HandledMenuItemEditor_Label; } @Override public String getDescription(Object element) { - return "HandledMenuItem bla bla bla"; + return Messages.HandledMenuItemEditor_Description; } @Override @@ -94,23 +101,30 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Command"); + l.setText(Messages.HandledMenuItemEditor_Command); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEnabled(false); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLED_ITEM__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(master)); - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText("Find ..."); + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText(Messages.HandledMenuItemEditor_Find); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + HandledMenuItemCommandSelectionDialog dialog = new HandledMenuItemCommandSelectionDialog(b.getShell(), (MHandledItem) getMaster().getValue(), resource); + dialog.open(); + } + }); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Parameters"); + l.setText(Messages.HandledMenuItemEditor_Parameters); l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); final TableViewer tableviewer = new TableViewer(parent); @@ -123,10 +137,10 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con tableviewer.setContentProvider(cp); { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__TAG); + IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__NAME); TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Tag"); + column.getColumn().setText(Messages.HandledMenuItemEditor_Tag); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); column.setEditingSupport(new EditingSupport(tableviewer) { @@ -134,7 +148,7 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con @Override protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.PARAMETER__TAG, value); + Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.PARAMETER__NAME, value); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } @@ -142,8 +156,8 @@ protected void setValue(Object element, Object value) { @Override protected Object getValue(Object element) { - String val = ((MParameter) element).getTag(); - return val == null ? "" : val; + String val = ((MParameter) element).getName(); + return val == null ? "" : val; //$NON-NLS-1$ } @Override @@ -159,10 +173,10 @@ protected boolean canEdit(Object element) { } { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__VALUE); + IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__VALUE); TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Value"); + column.getColumn().setText(Messages.HandledMenuItemEditor_Value); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); column.setEditingSupport(new EditingSupport(tableviewer) { @@ -170,7 +184,7 @@ protected boolean canEdit(Object element) { @Override protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.PARAMETER__VALUE, value); + Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.PARAMETER__VALUE, value); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } @@ -179,7 +193,7 @@ protected void setValue(Object element, Object value) { @Override protected Object getValue(Object element) { String val = ((MParameter) element).getValue(); - return val == null ? "" : val; + return val == null ? "" : val; //$NON-NLS-1$ } @Override @@ -205,7 +219,7 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even }; TableViewerEditor.create(tableviewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS); + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); tableviewer.setInput(prop.observeDetail(master)); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -218,25 +232,25 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.HandledMenuItemEditor_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.HandledMenuItemEditor_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.HandledMenuItemEditor_Add); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { MHandledItem item = (MHandledItem) master.getValue(); - MParameter param = MApplicationFactory.eINSTANCE.createParameter(); - Command cmd = AddCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS, param); + MParameter param = MCommandsFactory.INSTANCE.createParameter(); + Command cmd = AddCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, param); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); tableviewer.editElement(param, 0); @@ -245,14 +259,14 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.HandledMenuItemEditor_Remove); b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection) tableviewer.getSelection(); if (!s.isEmpty()) { MHandledItem item = (MHandledItem) master.getValue(); - Command cmd = RemoveCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS, s.toList()); + Command cmd = RemoveCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, s.toList()); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index be54826183..a442f71d2f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -14,11 +14,17 @@ import java.net.URL; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MHandledItem; -import org.eclipse.e4.ui.model.application.MParameter; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledToolItemCommandSelectionDialog; +import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.commands.MParameter; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; @@ -57,16 +63,18 @@ public class HandledToolItemEditor extends ToolItemEditor { private Image image; + private IModelResource resource; - public HandledToolItemEditor(EditingDomain editingDomain) { + public HandledToolItemEditor(EditingDomain editingDomain, IModelResource resource) { super(editingDomain); + this.resource = resource; } @Override public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/HandledToolItem.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/HandledToolItem.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -80,23 +88,32 @@ public Image getImage(Object element, Display display) { protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, final WritableValue master) { IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - Label l = new Label(parent, SWT.NONE); - l.setText("Command"); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setEnabled(false); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value( getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLED_ITEM__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(master)); - - Button b = new Button(parent, SWT.PUSH|SWT.FLAT); - b.setText("Find ..."); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.HandledToolItemEditor_Command); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + t.setEnabled(false); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(master)); + + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText(Messages.HandledToolItemEditor_Find); + b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + HandledToolItemCommandSelectionDialog dialog = new HandledToolItemCommandSelectionDialog(b.getShell(), (MHandledItem) getMaster().getValue(), resource); + dialog.open(); + } + }); + } // ------------------------------------------------------------ - l = new Label(parent, SWT.NONE); - l.setText("Parameters"); + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.HandledToolItemEditor_Parameters); l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); final TableViewer tableviewer = new TableViewer(parent); @@ -107,12 +124,12 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext ObservableListContentProvider cp = new ObservableListContentProvider(); tableviewer.setContentProvider(cp); - + { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__TAG); - + IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__NAME); + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Tag"); + column.getColumn().setText(Messages.HandledToolItemEditor_ParametersName); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); column.setEditingSupport(new EditingSupport(tableviewer) { @@ -120,16 +137,16 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext @Override protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.PARAMETER__TAG, value); - if( cmd.canExecute() ) { + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.PARAMETER__NAME, value); + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } @Override protected Object getValue(Object element) { - String val = ((MParameter)element).getTag(); - return val == null ? "" : val; + String val = ((MParameter) element).getName(); + return val == null ? "" : val; //$NON-NLS-1$ } @Override @@ -145,10 +162,10 @@ protected boolean canEdit(Object element) { } { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__VALUE); - + IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__VALUE); + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Value"); + column.getColumn().setText(Messages.HandledToolItemEditor_ParametersValue); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); column.setEditingSupport(new EditingSupport(tableviewer) { @@ -156,16 +173,16 @@ protected boolean canEdit(Object element) { @Override protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.PARAMETER__VALUE, value); - if( cmd.canExecute() ) { + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.PARAMETER__VALUE, value); + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } @Override protected Object getValue(Object element) { - String val = ((MParameter)element).getValue(); - return val == null ? "" : val; + String val = ((MParameter) element).getValue(); + return val == null ? "" : val; //$NON-NLS-1$ } @Override @@ -180,53 +197,50 @@ protected boolean canEdit(Object element) { }); } - ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(tableviewer) { @Override protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { - boolean singleSelect = ((IStructuredSelection)tableviewer.getSelection()).size() == 1; - boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent)event.sourceEvent).button == 1; + boolean singleSelect = ((IStructuredSelection) tableviewer.getSelection()).size() == 1; + boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent) event.sourceEvent).button == 1; - return singleSelect && (isLeftDoubleMouseSelect - || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC - || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); + return singleSelect && (isLeftDoubleMouseSelect || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); } }; TableViewerEditor.create(tableviewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS); + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); tableviewer.setInput(prop.observeDetail(getMaster())); - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.HandledToolItemEditor_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.HandledToolItemEditor_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.HandledToolItemEditor_Add); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { MHandledItem item = (MHandledItem) master.getValue(); - MParameter param = MApplicationFactory.eINSTANCE.createParameter(); - Command cmd = AddCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS, param); - if( cmd.canExecute() ) { + MParameter param = MCommandsFactory.INSTANCE.createParameter(); + Command cmd = AddCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, param); + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } tableviewer.editElement(param, 0); @@ -234,15 +248,15 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.HandledToolItemEditor_Remove); b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection) tableviewer.getSelection(); - if( !s.isEmpty() ) { + if (!s.isEmpty()) { MHandledItem item = (MHandledItem) master.getValue(); - Command cmd = RemoveCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.HANDLED_ITEM__PARAMETERS, s.toList()); - if( cmd.canExecute() ) { + Command cmd = RemoveCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, s.toList()); + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } @@ -256,11 +270,11 @@ public void widgetSelected(SelectionEvent e) { @Override public String getLabel(Object element) { - return "Handled Tool Item"; + return Messages.HandledToolItemEditor_Label; } @Override public String getDescription(Object element) { - return "Handled Tool Item bla bla bla"; + return Messages.HandledToolItemEditor_Description; } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 714683ffd3..5507efc4c8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -17,11 +17,13 @@ import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandlerCommandSelectionDialog; -import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.MHandler; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; @@ -57,7 +59,7 @@ public HandlerEditor(EditingDomain editingDomain, IModelResource resource, IProj public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Handler.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Handler.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -68,12 +70,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Handler"; + return Messages.HandlerEditor_Label; } @Override public String getDescription(Object element) { - return "Handler bla bla bla"; + return Messages.HandlerEditor_Description; } @Override @@ -95,27 +97,27 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.HandlerEditor_Id); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Command"); + l.setText(Messages.HandlerEditor_Command); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEnabled(false); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLER__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.HANDLER__COMMAND, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(getMaster())); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText("Find ..."); + b.setText(Messages.HandlerEditor_Find); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @@ -130,15 +132,15 @@ public void widgetSelected(SelectionEvent e) { // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Class URI"); + l.setText(Messages.HandlerEditor_ClassURI); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster())); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); - b.setText("Find ..."); + b.setText(Messages.HandlerEditor_Find); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -156,7 +158,6 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } @@ -172,6 +173,6 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(MApplicationPackage.Literals.HANDLER__COMMAND, MApplicationPackage.Literals.COMMAND__COMMAND_NAME) }; + return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.HANDLER__COMMAND, CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME) }; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java index ff97bd39cf..c81967a887 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java @@ -12,7 +12,8 @@ import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.resources.IProject; -import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; @@ -33,7 +34,7 @@ public InputPartEditor(EditingDomain editingDomain, IProject project) { @Override public String getLabel(Object element) { - return "InputPart"; + return Messages.InputPartEditor_Label; } @Override @@ -43,13 +44,13 @@ protected void createSubformElements(Composite parent, EMFDataBindingContext con // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("InputURI"); + l.setText(Messages.InputPartEditor_InputURI); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.INPUT__INPUT_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.INPUT__INPUT_URI).observeDetail(master)); } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index baf05e7824..8ec5723aa9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -17,12 +17,14 @@ import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.KeyBindingCommandSelectionDialog; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MKeyBinding; -import org.eclipse.e4.ui.model.application.MKeySequence; -import org.eclipse.e4.ui.model.application.MParameter; +import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; +import org.eclipse.e4.ui.model.application.commands.MKeyBinding; +import org.eclipse.e4.ui.model.application.commands.MKeySequence; +import org.eclipse.e4.ui.model.application.commands.MParameter; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; @@ -73,7 +75,7 @@ public KeyBindingEditor(EditingDomain editingDomain, IModelResource resource) { public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/KeyBinding.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/KeyBinding.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -85,12 +87,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Binding"; + return Messages.KeyBindingEditor_Label; } @Override public String getDescription(Object element) { - return "Binding bla bla bla"; + return Messages.KeyBindingEditor_Description; } @Override @@ -112,39 +114,39 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.KeyBindingEditor_Id); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Sequence"); + l.setText(Messages.KeyBindingEditor_Sequence); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.KEY_SEQUENCE__KEY_SEQUENCE).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_SEQUENCE__KEY_SEQUENCE).observeDetail(getMaster())); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Command"); + l.setText(Messages.KeyBindingEditor_Command); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEnabled(false); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.KEY_BINDING__COMMAND, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID)).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.KEY_BINDING__COMMAND, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(getMaster())); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText("Find ..."); + b.setText(Messages.KeyBindingEditor_Find); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @@ -157,7 +159,7 @@ public void widgetSelected(SelectionEvent e) { } Label l = new Label(parent, SWT.NONE); - l.setText("Parameters"); + l.setText(Messages.KeyBindingEditor_Parameters); l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); final TableViewer tableviewer = new TableViewer(parent); @@ -165,23 +167,23 @@ public void widgetSelected(SelectionEvent e) { gd.heightHint = 120; tableviewer.getTable().setHeaderVisible(true); tableviewer.getControl().setLayoutData(gd); - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.KEY_BINDING__PARAMETERS); + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS); TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Tag"); + column.getColumn().setText(Messages.KeyBindingEditor_ParametersKey); column.getColumn().setWidth(200); column.setEditingSupport(new EditingSupport(tableviewer) { private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); @Override protected void setValue(Object element, Object value) { - ((MParameter) element).setTag((String) value); + ((MParameter) element).setName((String) value); } @Override protected Object getValue(Object element) { - String val = ((MParameter) element).getTag(); - return val == null ? "" : val; + String val = ((MParameter) element).getName(); + return val == null ? "" : val; //$NON-NLS-1$ } @Override @@ -196,7 +198,7 @@ protected boolean canEdit(Object element) { }); column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Value"); + column.getColumn().setText(Messages.KeyBindingEditor_ParametersValue); column.getColumn().setWidth(200); column.setEditingSupport(new EditingSupport(tableviewer) { private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); @@ -209,7 +211,7 @@ protected void setValue(Object element, Object value) { @Override protected Object getValue(Object element) { String val = ((MParameter) element).getValue(); - return val == null ? "" : val; + return val == null ? "" : val; //$NON-NLS-1$ } @Override @@ -234,7 +236,7 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even }; TableViewerEditor.create(tableviewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); - ViewerSupport.bind(tableviewer, prop.observeDetail(getMaster()), new IValueProperty[] { EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__TAG), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PARAMETER__VALUE) }); + ViewerSupport.bind(tableviewer, prop.observeDetail(getMaster()), new IValueProperty[] { EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__NAME), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__VALUE) }); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); @@ -246,25 +248,25 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.KeyBindingEditor_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.KeyBindingEditor_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.KeyBindingEditor_Add); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { MKeyBinding item = (MKeyBinding) getMaster().getValue(); - MParameter param = MApplicationFactory.eINSTANCE.createParameter(); - Command cmd = AddCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.KEY_BINDING__PARAMETERS, param); + MParameter param = MCommandsFactory.INSTANCE.createParameter(); + Command cmd = AddCommand.create(getEditingDomain(), item, CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS, param); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } @@ -273,14 +275,14 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.KeyBindingEditor_Remove); b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection) tableviewer.getSelection(); if (!s.isEmpty()) { MKeyBinding item = (MKeyBinding) getMaster().getValue(); - Command cmd = RemoveCommand.create(getEditingDomain(), item, MApplicationPackage.Literals.KEY_BINDING__PARAMETERS, s.toList()); + Command cmd = RemoveCommand.create(getEditingDomain(), item, CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS, s.toList()); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } @@ -298,7 +300,6 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } @@ -313,6 +314,6 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(MApplicationPackage.Literals.KEY_SEQUENCE__KEY_SEQUENCE) }; + return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.KEY_SEQUENCE__KEY_SEQUENCE) }; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 9cd961c986..35f3aff47e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -18,15 +18,16 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.ItemType; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MElementContainer; -import org.eclipse.e4.ui.model.application.MHandler; -import org.eclipse.e4.ui.model.application.MMenuItem; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; @@ -34,6 +35,7 @@ import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; @@ -67,7 +69,7 @@ public class MenuEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private ModelEditor editor; - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private class Struct { private final String label; @@ -90,7 +92,7 @@ public MenuEditor(EditingDomain editingDomain, ModelEditor editor) { public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Menu.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Menu.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -102,12 +104,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Menu"; + return Messages.MenuEditor_Label; } @Override public String getDescription(Object element) { - return "Menu bla bla bla"; + return Messages.MenuEditor_Description; } @Override @@ -129,19 +131,57 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.MenuEditor_Id); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("MenuItems"); + l.setText(Messages.MenuEditor_LabelLabel); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.MenuEditor_Tooltip); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.MenuEditor_IconURI); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setText(Messages.MenuItemEditor_Find); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.MenuEditor_MenuItems); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); final TableViewer viewer = new TableViewer(parent); @@ -155,21 +195,21 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Type"); + column.getColumn().setText(Messages.MenuEditor_MenuItemType); column.getColumn().setWidth(300); column.setLabelProvider(new ComponentLabelProvider(editor)); } { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ITEM__TYPE); + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("ItemType"); + column.getColumn().setText(Messages.MenuEditor_MenuItemItemType); column.getColumn().setWidth(100); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(master)); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -182,7 +222,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.MenuEditor_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -195,7 +235,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); @@ -209,7 +249,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.MenuEditor_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -222,7 +262,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); @@ -246,8 +286,8 @@ public String getText(Object element) { } }); - Struct defaultStruct = new Struct("MenuItem", MApplicationPackage.Literals.MENU_ITEM, false); - childrenDropDown.setInput(new Struct[] { new Struct("Separator", MApplicationPackage.Literals.MENU_ITEM, true), defaultStruct, new Struct("Handled MenuItem", MApplicationPackage.Literals.HANDLED_MENU_ITEM, false), new Struct("Direct MenuItem", MApplicationPackage.Literals.DIRECT_MENU_ITEM, false) }); + Struct defaultStruct = new Struct(Messages.MenuEditor_HandledMenuItem, MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false); + childrenDropDown.setInput(new Struct[] { new Struct(Messages.MenuEditor_Separator, MenuPackageImpl.Literals.MENU_SEPARATOR, true), new Struct(Messages.MenuEditor_Menu, MenuPackageImpl.Literals.MENU, false), defaultStruct, new Struct(Messages.MenuEditor_DirectMenuItem, MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false) }); childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); @@ -259,13 +299,9 @@ public void widgetSelected(SelectionEvent e) { if (!childrenDropDown.getSelection().isEmpty()) { Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); EClass eClass = struct.eClass; - MMenuItem eObject = (MMenuItem) MApplicationFactory.eINSTANCE.create(eClass); - - if (struct.separator) { - eObject.setType(ItemType.SEPARATOR); - } + MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); @@ -278,7 +314,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.MenuEditor_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -286,7 +322,7 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { List keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } @@ -295,7 +331,7 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createTagsWidget(parent, this); + ControlFactory.createTagsWidget(parent, this); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index b6d099e637..d1a1b68890 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -12,52 +12,27 @@ import java.net.MalformedURLException; import java.net.URL; -import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.ItemType; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MElementContainer; -import org.eclipse.e4.ui.model.application.MHandler; -import org.eclipse.e4.ui.model.application.MMenuItem; -import org.eclipse.e4.ui.model.application.MUILabel; -import org.eclipse.emf.common.command.Command; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUILabel; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.ItemType; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.databinding.viewers.ViewerProperties; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -67,51 +42,21 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; -public class MenuItemEditor extends AbstractComponentEditor { +public abstract class MenuItemEditor extends AbstractComponentEditor { private Composite composite; private Image menuImage; - private Image separatorImage; private EMFDataBindingContext context; - private ModelEditor editor; - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); - - private class Struct { - private final String label; - private final EClass eClass; - private final boolean separator; - - public Struct(String label, EClass eClass, boolean separator) { - this.label = label; - this.eClass = eClass; - this.separator = separator; - } - } - - public MenuItemEditor(EditingDomain editingDomain, ModelEditor editor) { + public MenuItemEditor(EditingDomain editingDomain) { super(editingDomain); - this.editor = editor; } @Override public Image getImage(Object element, Display display) { - MMenuItem item = (MMenuItem) element; - if (item.getType() == ItemType.SEPARATOR) { - if (separatorImage == null) { - try { - separatorImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/MenuItem_separator.gif")); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return separatorImage; - } else { if (menuImage == null) { try { - menuImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/MenuItem.gif")); + menuImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/MenuItem.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -119,23 +64,6 @@ public Image getImage(Object element, Display display) { } return menuImage; - } - } - - @Override - public String getLabel(Object element) { - MMenuItem item = (MMenuItem) element; - if (item.getType() == ItemType.SEPARATOR) { - return "Separator"; - } else { - return "MenuItem"; - } - - } - - @Override - public String getDescription(Object element) { - return "MenuItem bla bla bla"; } @Override @@ -149,51 +77,6 @@ public Composite getEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - final Composite container = new Composite(parent, SWT.NONE); - final StackLayout layout = new StackLayout(); - container.setLayout(layout); - - final Composite menuFormComposite = createMenuItemForm(container, context, master); - final Composite separatorComposite = createSeparatorForm(container, context, master); - - getMaster().addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - MMenuItem item = (MMenuItem) event.diff.getNewValue(); - if (item.getType() == ItemType.SEPARATOR) { - layout.topControl = separatorComposite; - } else { - layout.topControl = menuFormComposite; - } - container.layout(true, true); - } - }); - - return container; - } - - private Composite createSeparatorForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Id"); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); - } - - return parent; - } - - private Composite createMenuItemForm(Composite parent, EMFDataBindingContext context, WritableValue master) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); @@ -202,20 +85,20 @@ private Composite createMenuItemForm(Composite parent, EMFDataBindingContext con // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.MenuItemEditor_Id); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } if (this.getClass() != MenuItemEditor.class) { // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Type"); + l.setText(Messages.MenuItemEditor_Type); ComboViewer viewer = new ComboViewer(parent); viewer.setContentProvider(new ArrayContentProvider()); @@ -223,7 +106,7 @@ private Composite createMenuItemForm(Composite parent, EMFDataBindingContext con GridData gd = new GridData(); gd.horizontalSpan = 2; viewer.getControl().setLayoutData(gd); - IObservableValue itemTypeObs = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ITEM__TYPE).observeDetail(master); + IObservableValue itemTypeObs = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(master); context.bindValue(ViewerProperties.singleSelection().observe(viewer), itemTypeObs); } } @@ -231,39 +114,39 @@ private Composite createMenuItemForm(Composite parent, EMFDataBindingContext con // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Label"); + l.setText(Messages.MenuItemEditor_Label); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Tooltip"); + l.setText(Messages.MenuItemEditor_Tooltip); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Icon URI"); + l.setText(Messages.MenuItemEditor_IconURI); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText("Find ..."); + b.setText(Messages.MenuItemEditor_Find); } createFormSubTypeForm(parent, context, master); @@ -273,169 +156,11 @@ private Composite createMenuItemForm(Composite parent, EMFDataBindingContext con return parent; } - protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("MenuItems"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - final TableViewer viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Type"); - column.getColumn().setWidth(300); - column.setLabelProvider(new ComponentLabelProvider(editor)); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ITEM__TYPE); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("ItemType"); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } - - IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(master)); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer container = (MElementContainer) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer container = (MElementContainer) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - Struct struct = (Struct) element; - return struct.label; - } - }); - - Struct defaultStruct = new Struct("MenuItem", MApplicationPackage.Literals.MENU_ITEM, false); - childrenDropDown.setInput(new Struct[] { new Struct("Separator", MApplicationPackage.Literals.MENU_ITEM, true), defaultStruct, new Struct("Handled MenuItem", MApplicationPackage.Literals.HANDLED_MENU_ITEM, false), new Struct("Direct MenuItem", MApplicationPackage.Literals.DIRECT_MENU_ITEM, false) }); - childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!childrenDropDown.getSelection().isEmpty()) { - Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - EClass eClass = struct.eClass; - MMenuItem eObject = (MMenuItem) MApplicationFactory.eINSTANCE.create(eClass); - - if (struct.separator) { - eObject.setType(ItemType.SEPARATOR); - } - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - if (!struct.separator) { - editor.setSelection(eObject); - } - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - } + protected abstract void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, WritableValue master); @Override public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); + return null; } @Override @@ -449,6 +174,6 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(MApplicationPackage.Literals.UI_LABEL__LABEL) }; + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java new file mode 100644 index 0000000000..2f2af5925a --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class MenuSeparatorEditor extends AbstractComponentEditor { + private Image separatorImage; + private Composite composite; + private EMFDataBindingContext context; + + public MenuSeparatorEditor(EditingDomain editingDomain) { + super(editingDomain); + } + + @Override + public Image getImage(Object element, Display display) { + if (separatorImage == null) { + try { + separatorImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/MenuSeparator.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return separatorImage; + } + + @Override + public String getLabel(Object element) { + return Messages.MenuSeparatorEditor_Label; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return null; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + composite = createForm(parent, context, getMaster()); + } + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.MenuSeparatorEditor_Id); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + } + + //TODO Should we add visible to mimic a GroupMarker of 3.x + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index 64be4f2308..f527de9db4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -17,13 +17,16 @@ import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MMenu; import org.eclipse.e4.ui.model.application.MModelComponent; -import org.eclipse.e4.ui.model.application.MPart; -import org.eclipse.e4.ui.model.application.MPartDescriptor; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; +import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; +import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; @@ -48,12 +51,12 @@ public class ModelComponentEditor extends AbstractComponentEditor { private Image image; private EMFDataBindingContext context; - private IListProperty MODEL_COMPONENT__CHILDREN = EMFProperties.list( MApplicationPackage.Literals.MODEL_COMPONENT__CHILDREN); - private IListProperty PART_DESCRIPTOR_CONTAINER__DESCRIPTORS = EMFProperties.list( MApplicationPackage.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS); - private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); - private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES); - private IListProperty MODEL_COMPONENT__COMMANDS = EMFProperties.list(MApplicationPackage.Literals.MODEL_COMPONENT__COMMANDS); - private IListProperty MODEL_COMPONENT__BINDINGS = EMFProperties.list(MApplicationPackage.Literals.MODEL_COMPONENT__BINDINGS); + private IListProperty MODEL_COMPONENT__CHILDREN = EMFProperties.list( ApplicationPackageImpl.Literals.MODEL_COMPONENT__CHILDREN); + private IListProperty PART_DESCRIPTOR_CONTAINER__DESCRIPTORS = EMFProperties.list( BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS); + private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); + private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES); + private IListProperty MODEL_COMPONENT__COMMANDS = EMFProperties.list(ApplicationPackageImpl.Literals.MODEL_COMPONENT__COMMANDS); + private IListProperty MODEL_COMPONENT__BINDINGS = EMFProperties.list(ApplicationPackageImpl.Literals.MODEL_COMPONENT__BINDINGS); public ModelComponentEditor(EditingDomain editingDomain) { super(editingDomain); @@ -93,52 +96,52 @@ private Composite createForm(Composite parent) { IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.ModelComponentEditor_Id); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); // ------------------------------------------------------------ l = new Label(parent, SWT.NONE); - l.setText("Parent-Id"); + l.setText(Messages.ModelComponentEditor_ParentId); t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__PARENT_ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__PARENT_ID).observeDetail(getMaster())); Button b = new Button(parent, SWT.PUSH|SWT.FLAT); - b.setText("Find ..."); + b.setText(Messages.ModelComponentEditor_Find); // ------------------------------------------------------------ l = new Label(parent, SWT.NONE); - l.setText("Position in Parent"); + l.setText(Messages.ModelComponentEditor_PositionInParent); t = new Text(parent, SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__POSITION_IN_PARENT).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__POSITION_IN_PARENT).observeDetail(getMaster())); // ------------------------------------------------------------ l = new Label(parent, SWT.NONE); - l.setText("Processor"); + l.setText(Messages.ModelComponentEditor_Processor); t = new Text(parent, SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.MODEL_COMPONENT__PROCESSOR).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__PROCESSOR).observeDetail(getMaster())); // ------------------------------------------------------------ l = new Label(parent, SWT.NONE); - l.setText("Tags"); + l.setText(Messages.ModelComponentEditor_Tags); t = new Text(parent, SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); @@ -159,7 +162,7 @@ private Composite createForm(Composite parent) { public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ModelComponent.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ModelComponent.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -170,19 +173,19 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Model Component"; + return Messages.ModelComponentEditor_Label; } @Override public String getDescription(Object element) { - return "The model component ... bla bla bla"; + return Messages.ModelComponentEditor_Description; } @Override public IObservableList getChildList(Object element) { WritableList list = new WritableList(); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.ModelComponentEditor_Handlers) { @Override protected boolean accepted(Object o) { @@ -191,7 +194,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING_TABLE, BINDING_CONTAINER__BINDINGS, element, "BindingTables") { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING_TABLE, BINDING_CONTAINER__BINDINGS, element, Messages.ModelComponentEditor_BindingTables) { @Override protected boolean accepted(Object o) { @@ -200,7 +203,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_MODEL_COMP_BINDINGS, MODEL_COMPONENT__BINDINGS, element, "KeyBindings") { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_MODEL_COMP_BINDINGS, MODEL_COMPONENT__BINDINGS, element, Messages.ModelComponentEditor_KeyBindings) { @Override protected boolean accepted(Object o) { @@ -210,7 +213,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_MODEL_COMP_COMMANDS, MODEL_COMPONENT__COMMANDS, element, "Commands") { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_MODEL_COMP_COMMANDS, MODEL_COMPONENT__COMMANDS, element, Messages.ModelComponentEditor_Commands) { @Override protected boolean accepted(Object o) { @@ -219,7 +222,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_MENU, MODEL_COMPONENT__CHILDREN, element, "Menus") { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART_MENU, MODEL_COMPONENT__CHILDREN, element, Messages.ModelComponentEditor_Menus) { @Override protected boolean accepted(Object o) { @@ -227,7 +230,7 @@ protected boolean accepted(Object o) { } }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART, MODEL_COMPONENT__CHILDREN, element, "Parts") { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART, MODEL_COMPONENT__CHILDREN, element, Messages.ModelComponentEditor_Parts) { @Override protected boolean accepted(Object o) { @@ -235,7 +238,7 @@ protected boolean accepted(Object o) { } }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART_DESCRIPTORS, PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, element, "PartDescriptors") { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART_DESCRIPTORS, PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, element, Messages.ModelComponentEditor_PartDescriptors) { @Override protected boolean accepted(Object o) { @@ -251,7 +254,7 @@ protected boolean accepted(Object o) { public String getDetailLabel(Object element) { MModelComponent o = (MModelComponent) element; if( o.getParentID() != null ) { - return "parentId: " + o.getParentID(); + return Messages.ModelComponentEditor_DetailParentId + ": " + o.getParentID(); //$NON-NLS-1$ } return null; } @@ -259,7 +262,7 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { return new FeaturePath[] { - FeaturePath.fromList(MApplicationPackage.Literals.MODEL_COMPONENT__PARENT_ID) + FeaturePath.fromList(ApplicationPackageImpl.Literals.MODEL_COMPONENT__PARENT_ID) }; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java index 4e6c714512..a081f2848a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java @@ -17,12 +17,13 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MModelComponent; import org.eclipse.e4.ui.model.application.MModelComponents; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFListProperty; @@ -47,7 +48,7 @@ public class ModelComponentsEditor extends AbstractComponentEditor { - private IListProperty MODEL_COMPONENTS__COMPONENTS = EMFProperties.list(MApplicationPackage.Literals.MODEL_COMPONENTS__COMPONENTS); + private IListProperty MODEL_COMPONENTS__COMPONENTS = EMFProperties.list(ApplicationPackageImpl.Literals.MODEL_COMPONENTS__COMPONENTS); private Composite composite; private Image image; @@ -62,7 +63,7 @@ public ModelComponentsEditor(EditingDomain editingDomain, ModelEditor editor) { public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ModelComponents.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ModelComponents.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -73,12 +74,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Model Components"; + return Messages.ModelComponentsEditor_Label; } @Override public String getDescription(Object element) { - return "Some bla bla bla bla"; + return Messages.ModelComponentsEditor_Description; } @Override @@ -96,7 +97,7 @@ private Composite createForm(Composite parent) { { Label l = new Label(parent, SWT.NONE); - l.setText("Model Contributions"); + l.setText(Messages.ModelComponentsEditor_ModelContributions); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); final TableViewer viewer = new TableViewer(parent); @@ -106,7 +107,7 @@ private Composite createForm(Composite parent) { gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - IEMFListProperty prop = EMFProperties.list(MApplicationPackage.Literals.MODEL_COMPONENTS__COMPONENTS); + IEMFListProperty prop = EMFProperties.list(ApplicationPackageImpl.Literals.MODEL_COMPONENTS__COMPONENTS); viewer.setInput(prop.observeDetail(getMaster())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -119,7 +120,7 @@ private Composite createForm(Composite parent) { buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelComponentsEditor_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -132,7 +133,7 @@ public void widgetSelected(SelectionEvent e) { MModelComponents container = (MModelComponents) getMaster().getValue(); int idx = container.getComponents().indexOf(obj) - 1; if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.MODEL_COMPONENTS__COMPONENTS, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENTS__COMPONENTS, obj, idx); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); @@ -146,7 +147,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelComponentsEditor_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -159,7 +160,7 @@ public void widgetSelected(SelectionEvent e) { MModelComponents container = (MModelComponents) getMaster().getValue(); int idx = container.getComponents().indexOf(obj) + 1; if (idx < container.getComponents().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.MODEL_COMPONENTS__COMPONENTS, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENTS__COMPONENTS, obj, idx); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); @@ -173,15 +174,15 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add"); + b.setText(Messages.ModelComponentsEditor_Add); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MModelComponent component = MApplicationFactory.eINSTANCE.createModelComponent(); + MModelComponent component = MApplicationFactory.INSTANCE.createModelComponent(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.MODEL_COMPONENTS__COMPONENTS, component); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENTS__COMPONENTS, component); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); @@ -191,7 +192,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelComponentsEditor_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -200,7 +201,7 @@ public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { List elements = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.MODEL_COMPONENTS__COMPONENTS, elements); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENTS__COMPONENTS, elements); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index f012cd6830..0e603ee683 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -20,12 +20,16 @@ import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.MPart; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; +import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; @@ -59,8 +63,8 @@ public class PartDescriptorEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IProject project; - private IListProperty PART__MENUS = EMFProperties.list(MApplicationPackage.Literals.PART__MENUS); - private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); + private IListProperty PART__MENUS = EMFProperties.list(BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS); + private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); public PartDescriptorEditor(EditingDomain editingDomain, IProject project) { super(editingDomain); @@ -71,7 +75,7 @@ public PartDescriptorEditor(EditingDomain editingDomain, IProject project) { public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Part.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Part.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -83,12 +87,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "PartDescriptor"; + return Messages.PartDescriptorEditor_Label; } @Override public String getDescription(Object element) { - return "PartDescriptor Bla Bla Bla Bla"; + return Messages.PartDescriptorEditor_Descriptor; } @Override @@ -110,65 +114,65 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.PartDescriptorEditor_Id); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Label"); + l.setText(Messages.PartDescriptorEditor_LabelLabel); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Tooltip"); + l.setText(Messages.PartDescriptorEditor_Tooltip); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Icon URI"); + l.setText(Messages.PartDescriptorEditor_IconURI); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText("Find ..."); + b.setText(Messages.PartDescriptorEditor_Find); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Class URI"); + l.setText(Messages.PartDescriptorEditor_ClassURI); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CONTRIBUTION_URI).observeDetail(master)); final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText("Find ..."); + b.setText(Messages.PartDescriptorEditor_Find); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -181,12 +185,39 @@ public void widgetSelected(SelectionEvent e) { // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Closeable"); + l.setText(Messages.PartDescriptorEditor_ContainerData); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.PartDescriptorEditor_Dirtyable); + + Button checkbox = new Button(parent, SWT.CHECK); + checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); + + IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__DIRTYABLE); + IWidgetValueProperty uiProp = WidgetProperties.selection(); + + context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); + } + + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.PartDescriptorEditor_Closeable); Button checkbox = new Button(parent, SWT.CHECK); checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); - IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PART__CLOSEABLE); + IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CLOSEABLE); IWidgetValueProperty uiProp = WidgetProperties.selection(); context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); @@ -195,12 +226,12 @@ public void widgetSelected(SelectionEvent e) { // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Multiple"); + l.setText(Messages.PartDescriptorEditor_Multiple); Button checkbox = new Button(parent, SWT.CHECK); checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); - IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PART_DESCRIPTOR__ALLOW_MULTIPLE); + IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__ALLOW_MULTIPLE); IWidgetValueProperty uiProp = WidgetProperties.selection(); context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); @@ -209,17 +240,17 @@ public void widgetSelected(SelectionEvent e) { // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Category"); + l.setText(Messages.PartDescriptorEditor_Category); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL,GridData.BEGINNING, true, false, 2, 1)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PART_DESCRIPTOR__CATEGORY).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CATEGORY).observeDetail(master)); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Persited State"); + l.setText(Messages.PartDescriptorEditor_PersitedState); l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); TableViewer tableviewer = new TableViewer(parent); @@ -231,7 +262,7 @@ public void widgetSelected(SelectionEvent e) { tableviewer.getControl().setLayoutData(gd); TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Key"); + column.getColumn().setText(Messages.PartDescriptorEditor_PersitedStateKey); column.getColumn().setWidth(200); column.setLabelProvider(new ColumnLabelProvider() { @SuppressWarnings("unchecked") @@ -244,7 +275,7 @@ public String getText(Object element) { //FIXME How can we react upon changes in the Map-Value? column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Value"); + column.getColumn().setText(Messages.PartDescriptorEditor_PersitedStateValue); column.getColumn().setWidth(200); column.setLabelProvider(new ColumnLabelProvider() { @SuppressWarnings("unchecked") @@ -255,7 +286,7 @@ public String getText(Object element) { } }); - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__PERSISTED_STATE); + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE); tableviewer.setInput(prop.observeDetail(getMaster())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -268,12 +299,12 @@ public String getText(Object element) { buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.PartDescriptorEditor_Add); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.PartDescriptorEditor_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); } @@ -281,7 +312,7 @@ public String getText(Object element) { // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Variables"); + l.setText(Messages.PartDescriptorEditor_Variables); l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); ListViewer viewer = new ListViewer(parent); @@ -294,7 +325,7 @@ public String getText(Object element) { // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Properties"); + l.setText(Messages.PartDescriptorEditor_Properties); l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); TableViewer tableviewer = new TableViewer(parent); @@ -305,48 +336,24 @@ public String getText(Object element) { tableviewer.getControl().setLayoutData(gd); TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Key"); + column.getColumn().setText(Messages.PartDescriptorEditor_PropertiesKey); column.getColumn().setWidth(200); column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Value"); + column.getColumn().setText(Messages.PartDescriptorEditor_PropertiesValue); column.getColumn().setWidth(200); } ControlFactory.createTagsWidget(parent, this); -// // ------------------------------------------------------------ -// -// l = new Label(parent, SWT.NONE); -// l.setText(""); -// -// Composite booleanContainer = new Composite(parent,SWT.NONE); -// gd = new GridData(GridData.FILL_HORIZONTAL); -// gd.horizontalSpan=2; -// booleanContainer.setBackgroundMode(SWT.INHERIT_DEFAULT); -// booleanContainer.setLayoutData(gd); -// booleanContainer.setLayout(new GridLayout(4,false)); -// -// Button checkbox = new Button(booleanContainer, SWT.CHECK); -// checkbox.setText("to render"); -// -// checkbox = new Button(booleanContainer, SWT.CHECK); -// checkbox.setText("on Top"); -// -// checkbox = new Button(booleanContainer, SWT.CHECK); -// checkbox.setText("visible"); -// -// checkbox = new Button(booleanContainer, SWT.CHECK); -// checkbox.setText("closeable"); - return parent; } @Override public IObservableList getChildList(Object element) { WritableList list = new WritableList(); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_MENU, PART__MENUS, element, "Menus") { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_PARTDESCRIPTOR_MENU, PART__MENUS, element, Messages.PartDescriptorEditor_Menus) { @Override protected boolean accepted(Object o) { @@ -355,7 +362,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.PartDescriptorEditor_Handlers) { @Override protected boolean accepted(Object o) { @@ -369,14 +376,14 @@ protected boolean accepted(Object o) { @Override public String getDetailLabel(Object element) { - MPart o = (MPart) element; + MPartDescriptor o = (MPartDescriptor) element; return o.getLabel(); } @Override public FeaturePath[] getLabelProperties() { return new FeaturePath[] { - FeaturePath.fromList(MApplicationPackage.Literals.UI_LABEL__LABEL) + FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 7fd167f8c2..1bfedacb40 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -20,12 +20,16 @@ import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.MPart; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; @@ -58,8 +62,8 @@ public class PartEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IProject project; - private IListProperty PART__MENUS = EMFProperties.list(MApplicationPackage.Literals.PART__MENUS); - private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); + private IListProperty PART__MENUS = EMFProperties.list(BasicPackageImpl.Literals.PART__MENUS); + private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); public PartEditor(EditingDomain editingDomain, IProject project) { super(editingDomain); @@ -70,7 +74,7 @@ public PartEditor(EditingDomain editingDomain, IProject project) { public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Part.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Part.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -82,12 +86,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Part"; + return Messages.PartEditor_Label; } @Override public String getDescription(Object element) { - return "Part Bla Bla Bla Bla"; + return Messages.PartEditor_Description; } @Override @@ -109,65 +113,65 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.PartEditor_Id); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Label"); + l.setText(Messages.PartEditor_LabelLabel); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Tooltip"); + l.setText(Messages.PartEditor_Tooltip); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Icon URI"); + l.setText(Messages.PartEditor_IconURI); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText("Find ..."); + b.setText(Messages.PartEditor_Find); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Class URI"); + l.setText(Messages.PartEditor_ClassURI); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText("Find ..."); + b.setText(Messages.PartEditor_Find); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -177,17 +181,29 @@ public void widgetSelected(SelectionEvent e) { }); } + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.PartEditor_ContainerData); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); + } + createSubformElements(parent, context, master); // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Closeable"); + l.setText(Messages.PartEditor_Closeable); Button checkbox = new Button(parent, SWT.CHECK); checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); - IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PART__CLOSEABLE); + IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART__CLOSEABLE); IWidgetValueProperty uiProp = WidgetProperties.selection(); context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); @@ -235,7 +251,7 @@ public void widgetSelected(SelectionEvent e) { // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Persited State"); + l.setText(Messages.PartEditor_PersitedState); l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); TableViewer tableviewer = new TableViewer(parent); @@ -247,7 +263,7 @@ public void widgetSelected(SelectionEvent e) { tableviewer.getControl().setLayoutData(gd); TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Key"); + column.getColumn().setText(Messages.PartEditor_PersitedStateKey); column.getColumn().setWidth(200); column.setLabelProvider(new ColumnLabelProvider() { @SuppressWarnings("unchecked") @@ -260,7 +276,7 @@ public String getText(Object element) { //FIXME How can we react upon changes in the Map-Value? column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Value"); + column.getColumn().setText(Messages.PartEditor_PersitedStateValue); column.getColumn().setWidth(200); column.setLabelProvider(new ColumnLabelProvider() { @SuppressWarnings("unchecked") @@ -271,7 +287,7 @@ public String getText(Object element) { } }); - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__PERSISTED_STATE); + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE); tableviewer.setInput(prop.observeDetail(getMaster())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -284,12 +300,12 @@ public String getText(Object element) { buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.PartEditor_Add); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.PartEditor_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); } @@ -306,7 +322,7 @@ protected void createSubformElements(Composite parent, EMFDataBindingContext con @Override public IObservableList getChildList(Object element) { WritableList list = new WritableList(); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_MENU, PART__MENUS, element, "Menus") { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART_MENU, PART__MENUS, element, Messages.PartEditor_Menus) { @Override protected boolean accepted(Object o) { @@ -315,7 +331,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.PartEditor_Handlers) { @Override protected boolean accepted(Object o) { @@ -336,7 +352,7 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { return new FeaturePath[] { - FeaturePath.fromList(MApplicationPackage.Literals.UI_LABEL__LABEL) + FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index b815c75844..5ba46b78cf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -22,12 +22,14 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MElementContainer; -import org.eclipse.e4.ui.model.application.MPartSashContainer; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; @@ -38,6 +40,7 @@ import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; @@ -74,7 +77,7 @@ public class PartSashContainerEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private ModelEditor editor; - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); public PartSashContainerEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); @@ -87,7 +90,7 @@ public Image getImage(Object element, Display display) { if( vImage == null && ! horizontal ) { try { - vImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/PartSashContainer_vertical.gif")); + vImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/PartSashContainer_vertical.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -96,7 +99,7 @@ public Image getImage(Object element, Display display) { if( hImage == null && horizontal ) { try { - hImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/PartSashContainer.gif")); + hImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/PartSashContainer.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -112,12 +115,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Sash"; + return Messages.PartSashContainerEditor_Label; } @Override public String getDescription(Object element) { - return "Sash bla bla bla"; + return Messages.PartSashContainerEditor_Description; } @Override @@ -140,19 +143,19 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.PartSashContainerEditor_Id); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Orientation"); + l.setText(Messages.PartSashContainerEditor_Orientation); ComboViewer viewer = new ComboViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -162,30 +165,30 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte viewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { - return ((Boolean)element).booleanValue() ? "Horizontal" : "Vertical"; + return ((Boolean)element).booleanValue() ? Messages.PartSashContainerEditor_Horizontal : Messages.PartSashContainerEditor_Vertical; } }); viewer.setInput(new Boolean[] { Boolean.TRUE, Boolean.FALSE }); IViewerValueProperty vProp = ViewerProperties.singleSelection(); - context.bindValue(vProp.observe(viewer), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.GENERIC_TILE__HORIZONTAL).observeDetail(getMaster())); + context.bindValue(vProp.observe(viewer), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL).observeDetail(getMaster())); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Selected Element"); + l.setText(Messages.PartSashContainerEditor_SelectedElement); ComboViewer viewer = new ComboViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; viewer.getControl().setLayoutData(gd); - IEMFEditListProperty listProp = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); + IEMFEditListProperty listProp = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); IViewerValueProperty vProp = ViewerProperties.singleSelection(); final Binding[] binding = new Binding[1]; final IObservableValue uiObs = vProp.observe(viewer); - final IObservableValue mObs = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(getMaster()); + final IObservableValue mObs = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(getMaster()); getMaster().addValueChangeListener(new IValueChangeListener() { public void handleValueChange(ValueChangeEvent event) { @@ -205,12 +208,24 @@ public void handleValueChange(ValueChangeEvent event) { } }); } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.PartSashContainerEditor_ContainerData); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); + } ControlFactory.createTagsWidget(parent, this); { Label l = new Label(parent, SWT.NONE); - l.setText("Controls"); + l.setText(Messages.PartSashContainerEditor_Controls); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); final TableViewer viewer = new TableViewer(parent); @@ -221,7 +236,7 @@ public void handleValueChange(ValueChangeEvent event) { viewer.setContentProvider(cp); viewer.setLabelProvider(new ComponentLabelProvider(editor)); - IEMFListProperty prop = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(getMaster())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -234,7 +249,7 @@ public void handleValueChange(ValueChangeEvent event) { buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.PartSashContainerEditor_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); b.addSelectionListener(new SelectionAdapter() { @@ -247,7 +262,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -261,7 +276,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.PartSashContainerEditor_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); b.addSelectionListener(new SelectionAdapter() { @@ -274,7 +289,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if( idx < container.getChildren().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -298,11 +313,12 @@ public String getText(Object element) { } }); childrenDropDown.setInput(new EClass[] { - MApplicationPackage.Literals.PART_SASH_CONTAINER, - MApplicationPackage.Literals.PART_STACK, - MApplicationPackage.Literals.PART + BasicPackageImpl.Literals.PART_SASH_CONTAINER, + BasicPackageImpl.Literals.PART_STACK, + BasicPackageImpl.Literals.PART, + BasicPackageImpl.Literals.INPUT_PART }); - childrenDropDown.setSelection(new StructuredSelection(MApplicationPackage.Literals.PART_SASH_CONTAINER)); + childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); @@ -312,9 +328,9 @@ public String getText(Object element) { public void widgetSelected(SelectionEvent e) { if( ! childrenDropDown.getSelection().isEmpty() ) { EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); - EObject eObject = MApplicationFactory.eINSTANCE.create(eClass); + EObject eObject = EcoreUtil.create(eClass); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -325,7 +341,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.PartSashContainerEditor_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); b.addSelectionListener(new SelectionAdapter() { @@ -334,7 +350,7 @@ public void widgetSelected(SelectionEvent e) { if( ! viewer.getSelection().isEmpty() ) { List elements = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, elements); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } @@ -360,7 +376,7 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { return new FeaturePath[] { - FeaturePath.fromList(MApplicationPackage.Literals.GENERIC_TILE__HORIZONTAL) + FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL) }; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index e6085c3b2c..8f6597fcf0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -22,12 +22,13 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MElementContainer; -import org.eclipse.e4.ui.model.application.MPart; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; @@ -35,6 +36,9 @@ import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; @@ -45,8 +49,10 @@ import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.databinding.viewers.ViewerProperties; import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; @@ -68,7 +74,7 @@ public class PartStackEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private ModelEditor editor; - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); public PartStackEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); @@ -79,7 +85,7 @@ public PartStackEditor(EditingDomain editingDomain, ModelEditor editor) { public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/PartStack.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/PartStack.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -91,12 +97,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Part Stack"; + return Messages.PartStackEditor_Label; } @Override public String getDescription(Object element) { - return "Stack bla bla bla"; + return Messages.PartStackEditor_Description; } @Override @@ -119,31 +125,31 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.PartStackEditor_Id); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Selected Element"); + l.setText(Messages.PartStackEditor_SelectedElement); ComboViewer viewer = new ComboViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; viewer.getControl().setLayoutData(gd); - IEMFEditListProperty listProp = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL); + IEMFEditListProperty listProp = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL); IViewerValueProperty vProp = ViewerProperties.singleSelection(); final Binding[] binding = new Binding[1]; final IObservableValue uiObs = vProp.observe(viewer); - final IObservableValue mObs = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(getMaster()); + final IObservableValue mObs = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(getMaster()); getMaster().addValueChangeListener(new IValueChangeListener() { public void handleValueChange(ValueChangeEvent event) { @@ -167,7 +173,19 @@ public void handleValueChange(ValueChangeEvent event) { // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Parts"); + l.setText(Messages.PartStackEditor_ContainerData); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.PartStackEditor_Parts); final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); @@ -177,12 +195,12 @@ public void handleValueChange(ValueChangeEvent event) { viewer.getControl().setLayoutData(gd); - IEMFListProperty prop = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(getMaster())); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); + GridLayout gl = new GridLayout(2,false); gl.marginLeft=0; gl.marginRight=0; gl.marginWidth=0; @@ -190,9 +208,9 @@ public void handleValueChange(ValueChangeEvent event) { buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.PartStackEditor_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -203,7 +221,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -217,9 +235,9 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.PartStackEditor_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -230,7 +248,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if( idx < container.getChildren().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -243,35 +261,54 @@ public void widgetSelected(SelectionEvent e) { } }); + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + EClass eclass = (EClass) element; + return eclass.getName(); + } + }); + childrenDropDown.setInput(new EClass[] { + BasicPackageImpl.Literals.PART_SASH_CONTAINER, + BasicPackageImpl.Literals.PART_STACK, + BasicPackageImpl.Literals.PART, + BasicPackageImpl.Literals.INPUT_PART + }); + childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add Part"); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MPart part = MApplicationFactory.eINSTANCE.createPart(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, part); + EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); + EObject eObject = EcoreUtil.create(eClass); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(part); + editor.setSelection(eObject); } } }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.PartStackEditor_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if( ! viewer.getSelection().isEmpty() ) { List elements = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, elements); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 70730a4568..c2b152b1bb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -1,7 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; import java.net.MalformedURLException; import java.net.URL; +import java.util.List; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -11,22 +22,45 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MPerspective; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; +import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.databinding.viewers.ViewerProperties; import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -40,18 +74,20 @@ public class PerspectiveEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; + private ModelEditor editor; - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - public PerspectiveEditor(EditingDomain editingDomain) { + public PerspectiveEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); + this.editor = editor; } @Override public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Perspective.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Perspective.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -63,7 +99,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Perspective"; + return Messages.PerspectiveEditor_Label; } @Override @@ -79,13 +115,13 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { return new FeaturePath[] { - FeaturePath.fromList(MApplicationPackage.Literals.UI_LABEL__LABEL) + FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; } @Override public String getDescription(Object element) { - return "Perspective Bla Bla Bla"; + return Messages.PerspectiveEditor_Description; } @Override @@ -107,31 +143,31 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.PerspectiveEditor_Id); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Selected Element"); + l.setText(Messages.PerspectiveEditor_SelectedElement); ComboViewer viewer = new ComboViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; viewer.getControl().setLayoutData(gd); - IEMFEditListProperty listProp = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); + IEMFEditListProperty listProp = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); IViewerValueProperty vProp = ViewerProperties.singleSelection(); final Binding[] binding = new Binding[1]; final IObservableValue uiObs = vProp.observe(viewer); - final IObservableValue mObs = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(getMaster()); + final IObservableValue mObs = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(getMaster()); getMaster().addValueChangeListener(new IValueChangeListener() { public void handleValueChange(ValueChangeEvent event) { @@ -155,40 +191,177 @@ public void handleValueChange(ValueChangeEvent event) { // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Label"); + l.setText(Messages.PerspectiveEditor_Label); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Tooltip"); + l.setText(Messages.PerspectiveEditor_Tooltip); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Icon URI"); + l.setText(Messages.PerspectiveEditor_IconURI); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText("Find ..."); + b.setText(Messages.PerspectiveEditor_Find); } + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.PerspectiveEditor_Controls); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final TableViewer viewer = new TableViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 200; + viewer.getControl().setLayoutData(gd); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + viewer.setLabelProvider(new ComponentLabelProvider(editor)); + + IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + viewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(2,false); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.PerspectiveEditor_Up); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.PerspectiveEditor_Down); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if( idx < container.getChildren().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + EClass eclass = (EClass) element; + return eclass.getName(); + } + }); + childrenDropDown.setInput(new EClass[] { + BasicPackageImpl.Literals.PART_SASH_CONTAINER, + BasicPackageImpl.Literals.PART_STACK, + BasicPackageImpl.Literals.PART, + BasicPackageImpl.Literals.INPUT_PART, + AdvancedPackageImpl.Literals.PLACEHOLDER + }); + childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! childrenDropDown.getSelection().isEmpty() ) { + EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); + EObject eObject = EcoreUtil.create(eClass); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(eObject); + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.PerspectiveEditor_Remove); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List elements = ((IStructuredSelection)viewer.getSelection()).toList(); + + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + ControlFactory.createTagsWidget(parent, this); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 31624f5fc1..276555f986 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -12,6 +12,7 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.List; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -21,23 +22,42 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.ui.model.application.MApplicationPackage; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.advanced.MAdvancedFactory; +import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.databinding.viewers.ViewerProperties; import org.eclipse.jface.databinding.viewers.ViewerSupport; import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; @@ -47,18 +67,20 @@ public class PerspectiveStackEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; + private ModelEditor modelEditor; - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - public PerspectiveStackEditor(EditingDomain editingDomain) { + public PerspectiveStackEditor(EditingDomain editingDomain, ModelEditor modelEditor) { super(editingDomain); + this.modelEditor = modelEditor; } @Override public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/PerspectiveStack.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/PerspectiveStack.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -70,7 +92,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Perspective Stack"; + return Messages.PerspectiveStackEditor_Label; } @Override @@ -80,7 +102,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Perspective Stack Bla Bla Bla"; + return Messages.PerspectiveStackEditor_Description; } @Override @@ -103,31 +125,31 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.PerspectiveStackEditor_Id); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Selected Element"); + l.setText(Messages.PerspectiveStackEditor_SelectedElement); ComboViewer viewer = new ComboViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; viewer.getControl().setLayoutData(gd); - IEMFEditListProperty listProp = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL); + IEMFEditListProperty listProp = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL); IViewerValueProperty vProp = ViewerProperties.singleSelection(); final Binding[] binding = new Binding[1]; final IObservableValue uiObs = vProp.observe(viewer); - final IObservableValue mObs = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(getMaster()); + final IObservableValue mObs = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(getMaster()); getMaster().addValueChangeListener(new IValueChangeListener() { public void handleValueChange(ValueChangeEvent event) { @@ -147,6 +169,122 @@ public void handleValueChange(ValueChangeEvent event) { } }); } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.PerspectiveStackEditor_Perspectives); + + final TableViewer viewer = new TableViewer(parent); + viewer.setContentProvider(new ObservableListContentProvider()); + viewer.setLabelProvider(new ComponentLabelProvider(modelEditor)); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + + + IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + viewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.PartStackEditor_Up); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.PartStackEditor_Down); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if( idx < container.getChildren().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MPerspective eObject = MAdvancedFactory.INSTANCE.createPerspective(); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + modelEditor.setSelection(eObject); + } + } + }); + + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.PartStackEditor_Remove); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List elements = ((IStructuredSelection)viewer.getSelection()).toList(); + + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } ControlFactory.createTagsWidget(parent, this); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 90b8d08cc0..690708f0b1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -16,9 +16,10 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MPlaceholder; -import org.eclipse.e4.ui.model.application.MUILabel; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUILabel; +import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; @@ -47,7 +48,7 @@ public PlaceholderEditor(EditingDomain editingDomain) { public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Placeholder.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Placeholder.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -59,7 +60,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Placeholder"; + return Messages.PlaceholderEditor_Label; } @Override @@ -72,17 +73,17 @@ public String getDetailLabel(Object element) { if( pl.getRef() instanceof MUILabel ) { MUILabel label = (MUILabel) pl.getRef(); if( label.getLabel() != null && label.getLabel().trim().length() > 0 ) { - b.append(" (" + label.getLabel() + ")"); + b.append(" (" + label.getLabel() + ")"); //$NON-NLS-1$//$NON-NLS-2$ } else if( label.getTooltip() != null && label.getTooltip().trim().length() > 0 ) { - b.append(" (" + label.getTooltip() + ")"); + b.append(" (" + label.getTooltip() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ } else { - if( pl.getRef().getId() != null && pl.getRef().getId().trim().length() > 0 ) { - b.append(pl.getRef().getId()); + if( pl.getRef().getElementId() != null && pl.getRef().getElementId().trim().length() > 0 ) { + b.append(pl.getRef().getElementId()); } } } else { - if( pl.getRef().getId() != null && pl.getRef().getId().trim().length() > 0 ) { - b.append(" (" + pl.getRef().getId() + ")"); + if( pl.getRef().getElementId() != null && pl.getRef().getElementId().trim().length() > 0 ) { + b.append(" (" + pl.getRef().getElementId() + ")"); //$NON-NLS-1$//$NON-NLS-2$ } } @@ -94,7 +95,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Placeholder Bla Bla Bla Bla"; + return Messages.PlaceholderEditor_Descriptor; } @Override @@ -116,13 +117,13 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.PlaceholderEditor_Id); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 552d287987..0574facaad 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -18,15 +18,16 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.ItemType; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MElementContainer; -import org.eclipse.e4.ui.model.application.MHandler; -import org.eclipse.e4.ui.model.application.MToolItem; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; @@ -34,6 +35,7 @@ import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; @@ -67,7 +69,7 @@ public class ToolBarEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private ModelEditor editor; - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private class Struct { private final String label; @@ -91,7 +93,7 @@ public ToolBarEditor(EditingDomain editingDomain, ModelEditor editor) { public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Toolbar.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Toolbar.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -102,12 +104,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Toolbar"; + return Messages.ToolBarEditor_Label; } @Override public String getDescription(Object element) { - return "Toolbar bla bla bla"; + return Messages.ToolBarEditor_Description; } @Override @@ -129,19 +131,19 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.ToolBarEditor_Id); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("ToolbarItems"); + l.setText(Messages.ToolBarEditor_ToolbarItems); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); final TableViewer viewer = new TableViewer(parent); @@ -155,21 +157,21 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Type"); + column.getColumn().setText(Messages.ToolBarEditor_ToolbarItemsType); column.getColumn().setWidth(300); column.setLabelProvider(new ComponentLabelProvider(editor)); } { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ITEM__TYPE); + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("ItemType"); + column.getColumn().setText(Messages.ToolBarEditor_ToolbarItemsItemType); column.getColumn().setWidth(100); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(master)); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -182,7 +184,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ToolBarEditor_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -195,7 +197,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); @@ -209,7 +211,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ToolBarEditor_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -222,7 +224,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); @@ -246,8 +248,8 @@ public String getText(Object element) { } }); - Struct defaultStruct = new Struct("Handled ToolItem", MApplicationPackage.Literals.HANDLED_TOOL_ITEM, false); - childrenDropDown.setInput(new Struct[] { defaultStruct, new Struct("Direct ToolItem", MApplicationPackage.Literals.DIRECT_TOOL_ITEM, false), new Struct("Separator", MApplicationPackage.Literals.TOOL_ITEM, true) }); + Struct defaultStruct = new Struct(Messages.ToolBarEditor_HandledToolItem, MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, false); + childrenDropDown.setInput(new Struct[] { defaultStruct, new Struct(Messages.ToolBarEditor_DirectToolItem, MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, false), new Struct(Messages.ToolBarEditor_ToolControl, MenuPackageImpl.Literals.TOOL_CONTROL, false), new Struct(Messages.ToolBarEditor_Separator, MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, true) }); childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); @@ -259,13 +261,9 @@ public void widgetSelected(SelectionEvent e) { if (!childrenDropDown.getSelection().isEmpty()) { Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); EClass eClass = struct.eClass; - MToolItem eObject = (MToolItem) MApplicationFactory.eINSTANCE.create(eClass); + MToolBarElement eObject = (MToolBarElement) EcoreUtil.create(eClass); - if (struct.separator) { - eObject.setType(ItemType.SEPARATOR); - } - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); @@ -278,7 +276,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ToolBarEditor_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -286,7 +284,7 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { List keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java new file mode 100644 index 0000000000..2ef4e6cd72 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -0,0 +1,110 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class ToolBarSeparatorEditor extends AbstractComponentEditor { + private Image separatorImage; + private Composite composite; + private EMFDataBindingContext context; + + public ToolBarSeparatorEditor(EditingDomain editingDomain) { + super(editingDomain); + } + + @Override + public Image getImage(Object element, Display display) { + if (separatorImage == null) { + try { + separatorImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ToolBarSeparator.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return separatorImage; + } + + @Override + public String getLabel(Object element) { + return Messages.ToolBarSeparatorEditor_Label; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return null; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + composite = createForm(parent, context, getMaster()); + } + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.ToolBarSeparatorEditor_Id); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + } + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java new file mode 100644 index 0000000000..429fe92971 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -0,0 +1,207 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Map.Entry; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; +import org.eclipse.e4.ui.model.application.MContribution; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class ToolControlEditor extends AbstractComponentEditor { + private Image image; + private EMFDataBindingContext context; + private Composite composite; + private IProject project; + + public ToolControlEditor(EditingDomain editingDomain, IProject project) { + super(editingDomain); + this.project = project; + } + + @Override + public String getLabel(Object element) { + return Messages.ToolControlEditor_Label; + } + + @Override + public String getDescription(Object element) { + return Messages.ToolControlEditor_Description; + } + + @Override + public Image getImage(Object element, Display display) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ToolControl.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + public String getDetailLabel(Object element) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + composite = createForm(parent, context, getMaster()); + } + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context2, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.ToolControlEditor_Id); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.ToolControlEditor_ClassURI); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); + + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setText("Find ..."); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue()); + dialog.open(); + } + }); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Persited State"); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + + TableViewer tableviewer = new TableViewer(parent); + tableviewer.getTable().setHeaderVisible(true); + ObservableListContentProvider cp = new ObservableListContentProvider(); + tableviewer.setContentProvider(cp); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 80; + tableviewer.getControl().setLayoutData(gd); + + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Key"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ColumnLabelProvider() { + @SuppressWarnings("unchecked") + @Override + public String getText(Object element) { + Entry entry = (Entry) element; + return entry.getKey(); + } + }); + + //FIXME How can we react upon changes in the Map-Value? + column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Value"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ColumnLabelProvider() { + @SuppressWarnings("unchecked") + @Override + public String getText(Object element) { + Entry entry = (Entry) element; + return entry.getValue(); + } + }); + + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE); + tableviewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + } + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 345d3b77ae..9bf6c0103a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -10,17 +10,16 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.ui.model.application.ItemType; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MToolItem; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.ItemType; +import org.eclipse.e4.ui.model.application.ui.menu.MToolItem; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; @@ -31,48 +30,21 @@ import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; -public class ToolItemEditor extends AbstractComponentEditor { +public abstract class ToolItemEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; public ToolItemEditor(EditingDomain editingDomain) { super(editingDomain); } - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ToolItem_separator.gif")); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return "Separator"; - } - - @Override - public String getDescription(Object element) { - return "Separator bla bla bla"; - } - @Override public Composite getEditor(Composite parent, Object object) { if (composite == null) { @@ -96,11 +68,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); - if (this.getClass() != ToolItemEditor.class) { - createFormSubTypeForm(parent, context, master); - } + createFormSubTypeForm(parent, context, master); return parent; } @@ -119,7 +89,7 @@ private void createFormSubTypeForm(Composite parent, EMFDataBindingContext conte GridData gd = new GridData(); gd.horizontalSpan = 2; viewer.getControl().setLayoutData(gd); - IObservableValue itemTypeObs = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.ITEM__TYPE).observeDetail(master); + IObservableValue itemTypeObs = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(master); context.bindValue(ViewerProperties.singleSelection().observe(viewer), itemTypeObs); } @@ -132,7 +102,7 @@ private void createFormSubTypeForm(Composite parent, EMFDataBindingContext conte GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); } // ------------------------------------------------------------ @@ -144,7 +114,7 @@ private void createFormSubTypeForm(Composite parent, EMFDataBindingContext conte GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); } // ------------------------------------------------------------ @@ -154,7 +124,7 @@ private void createFormSubTypeForm(Composite parent, EMFDataBindingContext conte Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText("Find ..."); @@ -182,23 +152,16 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { MToolItem item = (MToolItem) element; - if (item.getType() == ItemType.SEPARATOR) { - return null; - } else { - if (item.getLabel() != null && item.getLabel().trim().length() > 0) { - return item.getLabel(); - } else if (item.getTooltip() != null && item.getTooltip().trim().length() > 0) { - return item.getTooltip(); - } + if (item.getLabel() != null && item.getLabel().trim().length() > 0) { + return item.getLabel(); + } else if (item.getTooltip() != null && item.getTooltip().trim().length() > 0) { + return item.getTooltip(); } return null; } @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { - FeaturePath.fromList(MApplicationPackage.Literals.UI_LABEL__LABEL), - FeaturePath.fromList(MApplicationPackage.Literals.UI_LABEL__TOOLTIP) - }; + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__TOOLTIP) }; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java similarity index 86% rename from bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java rename to bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index b95636fe5c..033eafa103 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -21,12 +21,13 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MElementContainer; -import org.eclipse.e4.ui.model.application.MToolBar; -import org.eclipse.e4.ui.model.application.MTrimContainer; -import org.eclipse.e4.ui.model.application.SideValue; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MGenericTrimContainer; +import org.eclipse.e4.ui.model.application.ui.SideValue; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; +import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; @@ -58,16 +59,16 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; -public class WindowTrimEditor extends AbstractComponentEditor { +public class TrimBarEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; private ModelEditor editor; - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - public WindowTrimEditor(EditingDomain editingDomain, ModelEditor editor) { + public TrimBarEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); this.editor = editor; } @@ -122,7 +123,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -136,7 +137,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(); gd.horizontalSpan = 2; viewer.getControl().setLayoutData(gd); - IObservableValue sideValueObs = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.TRIM_CONTAINER__SIDE).observeDetail(master); + IObservableValue sideValueObs = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.GENERIC_TRIM_CONTAINER__SIDE).observeDetail(master); context.bindValue(ViewerProperties.singleSelection().observe(viewer), sideValueObs); } @@ -153,7 +154,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - IEMFListProperty prop = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(getMaster())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -179,7 +180,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -206,7 +207,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if( idx < container.getChildren().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -226,8 +227,8 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MToolBar toolbar = MApplicationFactory.eINSTANCE.createToolBar(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar); + MToolBar toolbar = MMenuFactory.INSTANCE.createToolBar(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -247,7 +248,7 @@ public void widgetSelected(SelectionEvent e) { if( ! viewer.getSelection().isEmpty() ) { List elements = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, elements); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } @@ -266,7 +267,7 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { - MTrimContainer trim = (MTrimContainer) element; + MGenericTrimContainer trim = (MGenericTrimContainer) element; if( trim.getSide() != null ) { return trim.getSide().toString(); @@ -278,7 +279,7 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { return new FeaturePath[] { - FeaturePath.fromList(MApplicationPackage.Literals.TRIM_CONTAINER__SIDE) + FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TRIM_CONTAINER__SIDE) }; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java new file mode 100644 index 0000000000..aabc235345 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java @@ -0,0 +1,36 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.edit.domain.EditingDomain; + +public class TrimmedWindowEditor extends WindowEditor { + private IListProperty TRIMMED_WINDOW__TRIM_BARS = EMFProperties.list(BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS); + + public TrimmedWindowEditor(EditingDomain editingDomain) { + super(editingDomain); + } + + public IObservableList getChildList(Object element) { + IObservableList list = super.getChildList(element); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_TRIMMED_WINDOW_TRIMS, TRIMMED_WINDOW__TRIM_BARS, element, "TrimBars") { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + return list; + } + + @Override + public String getLabel(Object element) { + return "Trimmed Window"; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 222d4dcd7b..e2d17d25b3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -23,9 +23,11 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MWindow; -import org.eclipse.e4.ui.model.application.MWindowTrim; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.basic.MWindow; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; @@ -49,9 +51,10 @@ public class WindowEditor extends AbstractComponentEditor { private Image image; private EMFDataBindingContext context; - private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS); - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); - private IValueProperty WINDOW__MAIN_MENU = EMFProperties.value(MApplicationPackage.Literals.WINDOW__MAIN_MENU); + private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); + private IListProperty WINDOW__WINDOWS = EMFProperties.list(BasicPackageImpl.Literals.WINDOW__WINDOWS); + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + private IValueProperty WINDOW__MAIN_MENU = EMFProperties.value(BasicPackageImpl.Literals.WINDOW__MAIN_MENU); public WindowEditor(EditingDomain editingDomain) { super(editingDomain); @@ -107,7 +110,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -119,7 +122,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__X).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__X).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -131,7 +134,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__Y).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__Y).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -143,7 +146,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__WIDTH).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__WIDTH).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -155,7 +158,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__HEIGHT).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__HEIGHT).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -167,7 +170,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); } // ------------------------------------------------------------ @@ -179,7 +182,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); } // ------------------------------------------------------------ @@ -189,7 +192,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText("Find ..."); @@ -214,12 +217,12 @@ protected boolean accepted(Object o) { } }); - - list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOW_TRIMS, ELEMENT_CONTAINER__CHILDREN, element, "Trims") { + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOWS, WINDOW__WINDOWS, element, "Windows") { @Override protected boolean accepted(Object o) { - return o instanceof MWindowTrim; + return true; } }); @@ -228,7 +231,7 @@ protected boolean accepted(Object o) { @Override protected boolean accepted(Object o) { - return !(o instanceof MWindowTrim); + return true; } }); @@ -266,7 +269,7 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { return new FeaturePath[] { - FeaturePath.fromList(MApplicationPackage.Literals.UI_LABEL__LABEL) + FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java index a2ccb384d7..87a3710792 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java @@ -13,13 +13,12 @@ import java.util.ArrayList; import java.util.List; -import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MCommand; import org.eclipse.e4.ui.model.application.MModelComponent; import org.eclipse.e4.ui.model.application.MModelComponents; +import org.eclipse.e4.ui.model.application.commands.MCommand; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.dialogs.TitleAreaDialog; @@ -145,8 +144,8 @@ public void update(final ViewerCell cell) { if( cmd.getDescription() != null ) { styledString.append(" - " + cmd.getDescription(),StyledString.DECORATIONS_STYLER); } - if( cmd.getId() != null ) { - styledString.append(" - " + cmd.getId(),StyledString.DECORATIONS_STYLER); + if( cmd.getElementId() != null ) { + styledString.append(" - " + cmd.getElementId(),StyledString.DECORATIONS_STYLER); } cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); @@ -167,8 +166,8 @@ public String getText(Object element) { s += " " + command.getDescription(); } - if( command.getId() != null ) { - s += " " + command.getId(); + if( command.getElementId() != null ) { + s += " " + command.getElementId(); } return s; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java index d12ccd5362..e0fd19c8ad 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -17,8 +17,8 @@ import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionResultHandler; import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Filter; import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; -import org.eclipse.e4.ui.model.application.MApplicationPackage; import org.eclipse.e4.ui.model.application.MContribution; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; @@ -155,7 +155,7 @@ protected void okPressed() { if( ! s.isEmpty() ) { ContributionData cd = (ContributionData) s.getFirstElement(); String uri = "platform:/plugin/" + cd.bundleName + "/" + cd.className; - Command cmd = SetCommand.create(editingDomain, contribution, MApplicationPackage.Literals.CONTRIBUTION__URI, uri); + Command cmd = SetCommand.create(editingDomain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, uri); if( cmd.canExecute() ) { editingDomain.getCommandStack().execute(cmd); super.okPressed(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java new file mode 100644 index 0000000000..39f72ebd90 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.ui.model.application.commands.MCommand; +import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.widgets.Shell; + +public class HandledMenuItemCommandSelectionDialog extends AbstractCommandSelectionDialog { + private MHandledItem handler; + + public HandledMenuItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource) { + super(parentShell, resource); + this.handler = handler; + } + + @Override + protected String getShellTitle() { + return "MenuItem Command"; + } + + @Override + protected String getDialogTitle() { + return "MenuItem-Command"; + } + + @Override + protected String getDialogMessage() { + return "Connect the MenuItem to a command"; + } + + @Override + protected Command createStoreCommand( EditingDomain editingDomain, MCommand command) { + return SetCommand.create(editingDomain, handler, MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND, command); + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java new file mode 100644 index 0000000000..8f9b0345d5 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.ui.model.application.commands.MCommand; +import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.widgets.Shell; + +public class HandledToolItemCommandSelectionDialog extends AbstractCommandSelectionDialog { + private MHandledItem handler; + + public HandledToolItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource) { + super(parentShell, resource); + this.handler = handler; + } + + @Override + protected String getShellTitle() { + return "ToolItem Command"; + } + + @Override + protected String getDialogTitle() { + return "ToolItem-Command"; + } + + @Override + protected String getDialogMessage() { + return "Connect the ToolItem to a command"; + } + + @Override + protected Command createStoreCommand( EditingDomain editingDomain, MCommand command) { + return SetCommand.create(editingDomain, handler, MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND, command); + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java index 3532bf70d5..ace3d85758 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java @@ -11,9 +11,9 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MCommand; -import org.eclipse.e4.ui.model.application.MHandler; +import org.eclipse.e4.ui.model.application.commands.MCommand; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; @@ -44,6 +44,6 @@ protected String getDialogMessage() { @Override protected Command createStoreCommand( EditingDomain editingDomain, MCommand command) { - return SetCommand.create(editingDomain, handler, MApplicationPackage.Literals.HANDLER__COMMAND, command); + return SetCommand.create(editingDomain, handler, CommandsPackageImpl.Literals.HANDLER__COMMAND, command); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java index 6b7ed917ce..bda337ad84 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java @@ -11,9 +11,9 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MCommand; -import org.eclipse.e4.ui.model.application.MKeyBinding; +import org.eclipse.e4.ui.model.application.commands.MCommand; +import org.eclipse.e4.ui.model.application.commands.MKeyBinding; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; @@ -44,6 +44,6 @@ protected String getDialogMessage() { @Override protected Command createStoreCommand( EditingDomain editingDomain, MCommand command) { - return SetCommand.create(editingDomain, binding, MApplicationPackage.Literals.KEY_BINDING__COMMAND, command); + return SetCommand.create(editingDomain, binding, CommandsPackageImpl.Literals.KEY_BINDING__COMMAND, command); } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index 9c3df275a6..fd90c78309 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -22,15 +22,17 @@ import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MBindingContainer; -import org.eclipse.e4.ui.model.application.MBindingContext; -import org.eclipse.e4.ui.model.application.MBindingTable; +import org.eclipse.e4.ui.model.application.commands.MBindingContext; +import org.eclipse.e4.ui.model.application.commands.MBindingTable; +import org.eclipse.e4.ui.model.application.commands.MBindingTableContainer; +import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.command.CompoundCommand; import org.eclipse.emf.databinding.EMFDataBindingContext; @@ -89,7 +91,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Binding Configuration"; + return Messages.VBindingTableEditor_Label; } @Override @@ -99,7 +101,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Binding Configuration Bla Bla Bla Bla"; + return Messages.VBindingTableEditor_Description; } @Override @@ -120,7 +122,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); - l.setText("Contexts"); + l.setText(Messages.VBindingTableEditor_Contexts); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); contextsViewer = new TreeViewer(parent); @@ -133,7 +135,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr final WritableList list = new WritableList(); - IEMFValueProperty listProp = EMFProperties.value(MApplicationPackage.Literals.BINDING_CONTAINER__ROOT_CONTEXT); + IEMFValueProperty listProp = EMFProperties.value(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT); IObservableValue val = listProp.observeDetail(getMaster()); val.addValueChangeListener(new IValueChangeListener() { @@ -151,10 +153,10 @@ public void handleValueChange(ValueChangeEvent event) { { - IEMFValueProperty prop = EMFProperties.value(MApplicationPackage.Literals.BINDING_CONTEXT__NAME); + IEMFValueProperty prop = EMFProperties.value(CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME); TreeViewerColumn column = new TreeViewerColumn(contextsViewer, SWT.NONE); - column.getColumn().setText("Name"); + column.getColumn().setText(Messages.VBindingTableEditor_Name); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(pv.getKnownElements()))); column.setEditingSupport(new EditingSupport(contextsViewer) { @@ -162,7 +164,7 @@ public void handleValueChange(ValueChangeEvent event) { @Override protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.BINDING_CONTEXT__NAME, value); + Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME, value); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } @@ -171,7 +173,7 @@ protected void setValue(Object element, Object value) { @Override protected Object getValue(Object element) { MBindingContext ctx = (MBindingContext) element; - return ctx.getName() != null ? ctx.getName() : ""; + return ctx.getName() != null ? ctx.getName() : ""; //$NON-NLS-1$ } @Override @@ -187,10 +189,10 @@ protected boolean canEdit(Object element) { } { - IEMFValueProperty prop = EMFProperties.value(MApplicationPackage.Literals.BINDING_CONTEXT__DESCRIPTION); + IEMFValueProperty prop = EMFProperties.value(CommandsPackageImpl.Literals.BINDING_CONTEXT__DESCRIPTION); TreeViewerColumn column = new TreeViewerColumn(contextsViewer, SWT.NONE); - column.getColumn().setText("Description"); + column.getColumn().setText(Messages.VBindingTableEditor_LabelDescription); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(pv.getKnownElements()))); column.setEditingSupport(new EditingSupport(contextsViewer) { @@ -198,7 +200,7 @@ protected boolean canEdit(Object element) { @Override protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.BINDING_CONTEXT__DESCRIPTION, value); + Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.BINDING_CONTEXT__DESCRIPTION, value); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } @@ -207,7 +209,7 @@ protected void setValue(Object element, Object value) { @Override protected Object getValue(Object element) { MBindingContext ctx = (MBindingContext) element; - return ctx.getDescription() != null ? ctx.getDescription() : ""; + return ctx.getDescription() != null ? ctx.getDescription() : ""; //$NON-NLS-1$ } @Override @@ -223,10 +225,10 @@ protected boolean canEdit(Object element) { } { - IEMFValueProperty prop = EMFProperties.value(MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); + IEMFValueProperty prop = EMFProperties.value(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); TreeViewerColumn column = new TreeViewerColumn(contextsViewer, SWT.NONE); - column.getColumn().setText("Id"); + column.getColumn().setText(Messages.VBindingTableEditor_Id); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(pv.getKnownElements()))); column.setEditingSupport(new EditingSupport(contextsViewer) { @@ -234,7 +236,7 @@ protected boolean canEdit(Object element) { @Override protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, MApplicationPackage.Literals.APPLICATION_ELEMENT__ID, value); + Command cmd = SetCommand.create(getEditingDomain(), element, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, value); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } @@ -243,7 +245,7 @@ protected void setValue(Object element, Object value) { @Override protected Object getValue(Object element) { MBindingContext ctx = (MBindingContext) element; - return ctx.getId() != null ? ctx.getId() : ""; + return ctx.getElementId() != null ? ctx.getElementId() : ""; //$NON-NLS-1$ } @Override @@ -269,7 +271,7 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); } }; - TreeViewerEditor.create(contextsViewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); + TreeViewerEditor.create(contextsViewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.KEEP_EDITOR_ON_DOUBLE_CLICK); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -282,36 +284,36 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.VBindingTableEditor_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.VBindingTableEditor_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.VBindingTableEditor_Add); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection) contextsViewer.getSelection(); - MBindingContext context = MApplicationFactory.eINSTANCE.createBindingContext(); + MBindingContext context = MCommandsFactory.INSTANCE.createBindingContext(); MBindingContext parentContext = null; if( ! s.isEmpty() ) { parentContext = (MBindingContext) s.getFirstElement(); - Command cmd = AddCommand.create(getEditingDomain(), parentContext, MApplicationPackage.Literals.BINDING_CONTEXT__CHILDREN, context); + Command cmd = AddCommand.create(getEditingDomain(), parentContext, CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN, context); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); contextsViewer.setSelection(new StructuredSelection(context)); } - } else if( s.isEmpty() && ((MBindingContainer)getMaster().getValue()).getRootContext() == null ) { - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__ROOT_CONTEXT, context); + } else if( s.isEmpty() && ((MBindingTableContainer)getMaster().getValue()).getRootContext() == null ) { + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT, context); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); contextsViewer.setSelection(new StructuredSelection(context)); @@ -323,7 +325,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.VBindingTableEditor_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -336,14 +338,14 @@ public void widgetSelected(SelectionEvent e) { for( Object o : s.toArray() ) { MBindingContext ctx = (MBindingContext) o; EObject owner = ((EObject)ctx).eContainer(); - if( owner instanceof MBindingContainer ) { - Command cmd = SetCommand.create(getEditingDomain(), owner, MApplicationPackage.Literals.BINDING_CONTAINER__ROOT_CONTEXT, null); + if( owner instanceof MBindingTableContainer ) { + Command cmd = SetCommand.create(getEditingDomain(), owner, CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT, null); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); return; } } else { - commands.add(RemoveCommand.create(getEditingDomain(), owner, MApplicationPackage.Literals.BINDING_CONTEXT__CHILDREN, ctx)); + commands.add(RemoveCommand.create(getEditingDomain(), owner, CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN, ctx)); } } @@ -389,10 +391,10 @@ public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection) bindingViewer.getSelection(); if (s.size() == 1) { Object obj = s.getFirstElement(); - MBindingContainer container = (MBindingContainer) getMaster().getValue(); + MBindingTableContainer container = (MBindingTableContainer) getMaster().getValue(); int idx = container.getBindingTables().indexOf(obj) - 1; if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES, obj, idx); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); @@ -416,10 +418,10 @@ public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection) bindingViewer.getSelection(); if (s.size() == 1) { Object obj = s.getFirstElement(); - MBindingContainer container = (MBindingContainer) getMaster().getValue(); + MBindingTableContainer container = (MBindingTableContainer) getMaster().getValue(); int idx = container.getBindingTables().indexOf(obj) + 1; if (idx < container.getBindingTables().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES, obj, idx); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); @@ -439,8 +441,8 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MBindingTable command = MApplicationFactory.eINSTANCE.createBindingTable(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES, command); + MBindingTable command = MCommandsFactory.INSTANCE.createBindingTable(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES, command); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); @@ -458,7 +460,7 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { if (!bindingViewer.getSelection().isEmpty()) { List commands = ((IStructuredSelection) bindingViewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.BINDING_CONTAINER__BINDING_TABLES, commands); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES, commands); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } @@ -477,7 +479,7 @@ public IObservableList getChildList(Object element) { } private class ObservableFactoryImpl implements IObservableFactory { - private IEMFListProperty prop = EMFProperties.list(MApplicationPackage.Literals.BINDING_CONTEXT__CHILDREN); + private IEMFListProperty prop = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN); public IObservable createObservable(Object target) { if( target instanceof IObservableList ) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index 26be242d71..91ee4b8eba 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -19,10 +19,11 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MCommand; -import org.eclipse.e4.ui.model.application.MHandler; +import org.eclipse.e4.ui.model.application.commands.MCommand; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsFactoryImpl; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; @@ -113,7 +114,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, viewer.getTable().setHeaderVisible(true); { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.COMMAND__COMMAND_NAME); + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Name"); @@ -122,7 +123,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, } { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Id"); @@ -200,7 +201,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MCommand command = MApplicationFactory.eINSTANCE.createCommand(); + MCommand command = CommandsFactoryImpl.eINSTANCE.createCommand(); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, command); if( cmd.canExecute() ) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index 28b4d8a892..a522ebfb42 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -18,10 +18,11 @@ import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MHandler; -import org.eclipse.e4.ui.model.application.MHandlerContainer; +import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.commands.MHandlerContainer; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; @@ -109,7 +110,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, viewer.getTable().setHeaderVisible(true); { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.HANDLER__COMMAND, MApplicationPackage.Literals.COMMAND__COMMAND_NAME)); + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.HANDLER__COMMAND, CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME)); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Command"); @@ -118,7 +119,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, } { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.CONTRIBUTION__URI); + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Class"); @@ -127,7 +128,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, } { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Id"); @@ -158,7 +159,7 @@ public void widgetSelected(SelectionEvent e) { MHandlerContainer container = (MHandlerContainer) getMaster().getValue(); int idx = container.getHandlers().indexOf(obj) - 1; if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -185,7 +186,7 @@ public void widgetSelected(SelectionEvent e) { MHandlerContainer container = (MHandlerContainer) getMaster().getValue(); int idx = container.getHandlers().indexOf(obj) + 1; if( idx < container.getHandlers().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -205,8 +206,8 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MHandler handler = MApplicationFactory.eINSTANCE.createHandler(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS, handler); + MHandler handler = MCommandsFactory.INSTANCE.createHandler(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, handler); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -224,7 +225,7 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { if( ! viewer.getSelection().isEmpty() ) { List handlers = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.HANDLER_CONTAINER__HANDLERS, handlers); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, handlers); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java index 965dc168a0..4b8082506f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -18,13 +18,15 @@ import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MMenu; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenu; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; @@ -47,10 +49,12 @@ public class VMenuEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private ModelEditor editor; private TableViewer viewer; + private EStructuralFeature feature; - public VMenuEditor(EditingDomain editingDomain, ModelEditor editor) { + public VMenuEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature feature) { super(editingDomain); this.editor = editor; + this.feature = feature; } @Override @@ -97,7 +101,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); viewer.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -130,8 +134,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MMenu handler = MApplicationFactory.eINSTANCE.createMenu(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.PART__MENUS, handler); + MMenu handler = MMenuFactory.INSTANCE.createMenu(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), feature, handler); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); @@ -149,7 +153,7 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { List windows = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.PART__MENUS, windows); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART__MENUS, windows); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java index 56599325fc..4387053f7b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; import java.util.List; @@ -8,11 +18,12 @@ import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MBindingTable; -import org.eclipse.e4.ui.model.application.MHandler; -import org.eclipse.e4.ui.model.application.MKeyBinding; +import org.eclipse.e4.ui.model.application.commands.MBindingTable; +import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.commands.MKeyBinding; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; @@ -101,7 +112,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, viewer.getTable().setHeaderVisible(true); { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.KEY_SEQUENCE__KEY_SEQUENCE); + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_SEQUENCE__KEY_SEQUENCE); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("KeySequence"); @@ -110,7 +121,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, } { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MApplicationPackage.Literals.KEY_BINDING__COMMAND, MApplicationPackage.Literals.COMMAND__COMMAND_NAME)); + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.KEY_BINDING__COMMAND, CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME)); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Command"); @@ -119,7 +130,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, } { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.APPLICATION_ELEMENT__ID); + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Id"); @@ -150,7 +161,7 @@ public void widgetSelected(SelectionEvent e) { MBindingTable container = (MBindingTable) getMaster().getValue(); int idx = container.getBindings().indexOf(obj) - 1; if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.MODEL_COMPONENT__BINDINGS, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__BINDINGS, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -177,7 +188,7 @@ public void widgetSelected(SelectionEvent e) { MBindingTable container = (MBindingTable) getMaster().getValue(); int idx = container.getBindings().indexOf(obj) + 1; if( idx < container.getBindings().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.MODEL_COMPONENT__BINDINGS, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__BINDINGS, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -197,9 +208,9 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MKeyBinding handler = MApplicationFactory.eINSTANCE.createKeyBinding(); + MKeyBinding handler = MCommandsFactory.INSTANCE.createKeyBinding(); System.err.println(getMaster().getValue()); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.MODEL_COMPONENT__BINDINGS, handler); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__BINDINGS, handler); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); @@ -217,7 +228,7 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { if( ! viewer.getSelection().isEmpty() ) { List keybinding = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.MODEL_COMPONENT__BINDINGS, keybinding); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__BINDINGS, keybinding); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java index 47fcb534a5..a7a67a9fbb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java @@ -18,11 +18,12 @@ import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MHandler; -import org.eclipse.e4.ui.model.application.MPartDescriptor; -import org.eclipse.e4.ui.model.application.MPartDescriptorContainer; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory; +import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; +import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptorContainer; +import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; @@ -109,7 +110,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, viewer.getTable().setHeaderVisible(true); { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL); + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Name"); @@ -118,7 +119,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, } { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.PART_DESCRIPTOR__CATEGORY); + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CATEGORY); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Category"); @@ -149,7 +150,7 @@ public void widgetSelected(SelectionEvent e) { MPartDescriptorContainer container = (MPartDescriptorContainer) getMaster().getValue(); int idx = container.getDescriptors().indexOf(obj) - 1; if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -176,7 +177,7 @@ public void widgetSelected(SelectionEvent e) { MPartDescriptorContainer container = (MPartDescriptorContainer) getMaster().getValue(); int idx = container.getDescriptors().indexOf(obj) + 1; if( idx < container.getDescriptors().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -196,8 +197,8 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MPartDescriptor command = MApplicationFactory.eINSTANCE.createPartDescriptor(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, command); + MPartDescriptor command = MBasicFactory.INSTANCE.createPartDescriptor(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, command); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -215,7 +216,7 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { if( ! viewer.getSelection().isEmpty() ) { List commands = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, commands); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, commands); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java similarity index 86% rename from bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java rename to bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index e7840fbdbc..f7d3baed80 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -18,15 +18,17 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; @@ -49,13 +51,13 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; -public class VControlEditor extends AbstractComponentEditor { +public class VWindowControlEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private ModelEditor editor; private TableViewer viewer; - public VControlEditor(EditingDomain editingDomain, ModelEditor editor) { + public VWindowControlEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); this.editor = editor; } @@ -112,7 +114,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, viewer.getControl().setLayoutData(gd); - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN); + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(getMaster())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -138,7 +140,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -165,7 +167,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if( idx < container.getChildren().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -189,12 +191,13 @@ public String getText(Object element) { } }); childrenDropDown.setInput(new EClass[] { - MApplicationPackage.Literals.PERSPECTIVE_STACK, - MApplicationPackage.Literals.PART_SASH_CONTAINER, - MApplicationPackage.Literals.PART_STACK, - MApplicationPackage.Literals.PART + AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, + BasicPackageImpl.Literals.PART_SASH_CONTAINER, + BasicPackageImpl.Literals.PART_STACK, + BasicPackageImpl.Literals.PART, + BasicPackageImpl.Literals.INPUT_PART }); - childrenDropDown.setSelection(new StructuredSelection(MApplicationPackage.Literals.PERSPECTIVE_STACK)); + childrenDropDown.setSelection(new StructuredSelection(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); @@ -204,9 +207,10 @@ public String getText(Object element) { public void widgetSelected(SelectionEvent e) { if( ! childrenDropDown.getSelection().isEmpty() ) { EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); - EObject eObject = MApplicationFactory.eINSTANCE.create(eClass); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + EObject eObject = EcoreUtil.create(eClass); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -226,7 +230,7 @@ public void widgetSelected(SelectionEvent e) { if( ! viewer.getSelection().isEmpty() ) { List elements = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, elements); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index 8dec90f559..ac1aedea96 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -18,20 +18,27 @@ import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MElementContainer; -import org.eclipse.e4.ui.model.application.MWindow; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; +import org.eclipse.e4.ui.model.application.ui.basic.MWindow; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; @@ -107,7 +114,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer.getTable().setHeaderVisible(true); { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.UI_LABEL__LABEL); + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Name"); @@ -116,7 +123,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__X); + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__X); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("X"); @@ -125,7 +132,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__Y); + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__Y); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Y"); @@ -134,7 +141,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__WIDTH); + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__WIDTH); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Width"); @@ -143,7 +150,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), MApplicationPackage.Literals.WINDOW__HEIGHT); + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__HEIGHT); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Height"); @@ -153,7 +160,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); + GridLayout gl = new GridLayout(2,false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -161,9 +168,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -174,7 +182,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -190,7 +198,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Down"); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -201,7 +209,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if( idx < container.getChildren().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -214,15 +222,30 @@ public void widgetSelected(SelectionEvent e) { } }); + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + EClass eclass = (EClass) element; + return eclass.getName(); + } + }); + childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.WINDOW, BasicPackageImpl.Literals.TRIMMED_WINDOW }); + childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.WINDOW)); + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Add ..."); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MWindow handler = MApplicationFactory.eINSTANCE.createWindow(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); + EObject handler = EcoreUtil.create(eClass); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, handler); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); @@ -234,14 +257,14 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Remove"); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { List windows = ((IStructuredSelection) viewer.getSelection()).toList(); MElementContainer container = (MElementContainer) getMaster().getValue(); - Command cmd = RemoveCommand.create(getEditingDomain(), container, MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, windows); + Command cmd = RemoveCommand.create(getEditingDomain(), container, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, windows); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); if( container.getChildren().size() > 0 ) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java index edb5656cd7..9097a8ab44 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -18,9 +18,9 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MApplicationPackage; -import org.eclipse.e4.ui.model.application.MWindowTrim; +import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; +import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.edit.command.AddCommand; @@ -118,8 +118,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MWindowTrim handler = MApplicationFactory.eINSTANCE.createWindowTrim(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + MTrimBar handler = MBasicFactory.INSTANCE.createTrimBar(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS, handler); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); @@ -137,7 +137,7 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { if( ! viewer.getSelection().isEmpty() ) { List trimElements = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MApplicationPackage.Literals.ELEMENT_CONTAINER__CHILDREN, trimElements); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS, trimElements); if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); } From 107aebbdac139fc0e711aeed3f6eb813685149eb Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 19 Apr 2010 13:44:57 +0000 Subject: [PATCH 0078/1286] [Bug 309616] - [UI][ModelEditor] No support for the new 'Addons' attribute in the editors --- .../e4/tools/emf/ui/internal/Messages.java | 14 +- .../tools/emf/ui/internal/Messages.properties | 7 +- .../emf/ui/internal/common/ModelEditor.java | 8 +- .../common/component/AddonsEditor.java | 119 ++++++++++ .../common/component/ApplicationEditor.java | 10 + .../component/virtual/VApplicationAddons.java | 213 ++++++++++++++++++ 6 files changed, 359 insertions(+), 12 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index d1602bed87..a0e5788cf6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -22,6 +22,7 @@ public class Messages { public static String ApplicationEditor_BindingTables; public static String ApplicationEditor_Commands; public static String ApplicationEditor_Windows; + public static String ApplicationEditor_Addons; public static String BindingTableEditor_Label; public static String BindingTableEditor_Description; @@ -293,16 +294,9 @@ public class Messages { public static String VBindingTableEditor_Add; public static String VBindingTableEditor_Remove; - - - - - - - - - - + public static String AddonsEditor_Id; + public static String AddonsEditor_ClassURI; + public static String AddonsEditor_Find; static { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 290dd336c7..025e972b3b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -16,6 +16,7 @@ ApplicationEditor_PartDescriptors=Part Descriptors ApplicationEditor_BindingTables=BindingTables ApplicationEditor_Commands=Commands ApplicationEditor_Windows=Windows +ApplicationEditor_Addons=Addons BindingTableEditor_Label=BindingTable BindingTableEditor_Description=BindingTable bla bla bla @@ -285,4 +286,8 @@ VBindingTableEditor_Id=Id VBindingTableEditor_Up=Up VBindingTableEditor_Down=Down VBindingTableEditor_Add=Add ... -VBindingTableEditor_Remove=Remove \ No newline at end of file +VBindingTableEditor_Remove=Remove + +AddonsEditor_Id=Id +AddonsEditor_ClassURI=Class URI +AddonsEditor_Find=Find ... \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index eef4517ecc..7c4c854e7f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -30,6 +30,7 @@ import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ShadowComposite; +import org.eclipse.e4.tools.emf.ui.internal.common.component.AddonsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ApplicationEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.BindingTableEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.DirectMenuItemEditor; @@ -57,6 +58,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.TrimBarEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.TrimmedWindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VApplicationAddons; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VBindingTableEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VCommandEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowControlEditor; @@ -110,6 +112,7 @@ public class ModelEditor { public static final int VIRTUAL_MODEL_COMP_BINDINGS = 9; public static final int VIRTUAL_PARTDESCRIPTOR_MENU = 10; public static final int VIRTUAL_TRIMMED_WINDOW_TRIMS = 11; + public static final int VIRTUAL_ADDONS = 12; private Map editorMap = new HashMap(); private AbstractComponentEditor[] virtualEditors; @@ -283,7 +286,8 @@ private void registerVirtualEditors() { new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.MODEL_COMPONENT__COMMANDS), new VModelComponentBindingEditor(modelProvider.getEditingDomain(), this), new VMenuEditor(modelProvider.getEditingDomain(), this, org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS), - new VWindowTrimEditor(modelProvider.getEditingDomain(), this) + new VWindowTrimEditor(modelProvider.getEditingDomain(), this), + new VApplicationAddons(modelProvider.getEditingDomain(), this) }; } @@ -295,6 +299,8 @@ private void registerDefaultEditors() { registerEditor(ApplicationPackageImpl.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain())); registerEditor(ApplicationPackageImpl.Literals.MODEL_COMPONENTS, new ModelComponentsEditor(modelProvider.getEditingDomain(),this)); registerEditor(ApplicationPackageImpl.Literals.MODEL_COMPONENT, new ModelComponentEditor(modelProvider.getEditingDomain())); + registerEditor(ApplicationPackageImpl.Literals.ADDON, new AddonsEditor(modelProvider.getEditingDomain(),project)); + registerEditor(CommandsPackageImpl.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(),modelProvider)); registerEditor(CommandsPackageImpl.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain(),modelProvider,project)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java new file mode 100644 index 0000000000..990de1fd77 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -0,0 +1,119 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; +import org.eclipse.e4.ui.model.application.MContribution; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class AddonsEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private IProject project; + + public AddonsEditor(EditingDomain editingDomain, IProject project) { + super(editingDomain); + this.project = project; + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "Addon"; + } + + @Override + public String getDetailLabel(Object element) { + MContribution contrib = (MContribution) element; + if( contrib.getContributionURI() != null && contrib.getContributionURI().trim().length() > 0 ) { + return contrib.getContributionURI().substring(contrib.getContributionURI().lastIndexOf('/')+1); + } + return null; + } + + @Override + public String getDescription(Object element) { + return "Addon Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context); + } + getMaster().setValue(object); + return composite; + } + + protected Composite createForm(Composite parent, EMFDataBindingContext context) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.AddonsEditor_Id); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.AddonsEditor_ClassURI); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster())); + + final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setText(Messages.AddonsEditor_Find); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue()); + dialog.open(); + } + }); + } + +// ControlFactory.createBindingsWidget(parent, this); + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return null; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index a63049b7ef..01dddf7515 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -50,6 +50,7 @@ public class ApplicationEditor extends AbstractComponentEditor { private IListProperty APPLICATION__COMMANDS = EMFProperties.list(ApplicationPackageImpl.Literals.APPLICATION__COMMANDS); private IListProperty PART_DESCRIPTOR_CONTAINER__DESCRIPTORS = EMFProperties.list(BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS); private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + private IListProperty APPLICATION__ADDONS = EMFProperties.list(ApplicationPackageImpl.Literals.APPLICATION__ADDONS); public ApplicationEditor(EditingDomain editingDomain) { super(editingDomain); @@ -114,6 +115,15 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) @Override public IObservableList getChildList(Object element) { WritableList list = new WritableList(); + list.add(new VirtualEntry( ModelEditor.VIRTUAL_ADDONS, APPLICATION__ADDONS, element, Messages.ApplicationEditor_Addons) { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.ApplicationEditor_Handlers) { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java new file mode 100644 index 0000000000..1dcc077c47 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java @@ -0,0 +1,213 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import java.util.List; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MAddon; +import org.eclipse.e4.ui.model.application.MApplication; +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.e4.ui.model.application.commands.MCommand; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsFactoryImpl; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VApplicationAddons extends AbstractComponentEditor { + private Composite composite; + private ModelEditor editor; + private TableViewer viewer; + private EMFDataBindingContext context; + + public VApplicationAddons(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "Addons"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Addons bla bla bla bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + VirtualEntry o = (VirtualEntry)object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Commands"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + viewer.setLabelProvider(new ComponentLabelProvider(editor)); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MApplication container = (MApplication) getMaster().getValue(); + int idx = container.getCommands().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__ADDONS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MApplication container = (MApplication) getMaster().getValue(); + int idx = container.getCommands().indexOf(obj) + 1; + if( idx < container.getCommands().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__ADDONS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MAddon command = MApplicationFactory.INSTANCE.createAddon(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__ADDONS, command); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(command); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List commands = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__ADDONS, commands); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + +} From b725f38c21ac81738ffcc199cd1bc152de56077d Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 19 Apr 2010 14:25:27 +0000 Subject: [PATCH 0079/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * added new icon for addons --- .../icons/full/modelelements/Addons.png | Bin 0 -> 859 bytes .../internal/common/component/AddonsEditor.java | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Addons.png diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Addons.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Addons.png new file mode 100644 index 0000000000000000000000000000000000000000..3262767cda95a217ac8d3fabf6c4bfe3514fd770 GIT binary patch literal 859 zcmV-h1El-)HU~Z@BQ7|ITsWqFPt%czwZJk^u%JZL0Ogu z7-JwwQn0tTclx3}?kvID+L{XidsxQ^&e&|W7P?hu`JbU6)Keq zD2hUaNxZkB72a$%4^2)^`UtC|A7te-nGAX1Xrjep5qO>_@7ffX%SGn`-ED7gLpU5( zk(@u5K{Og2Z)$29rKuELp-_NyIt_Job>MI~K&R7bgynLX>`sh~jA#lt3}_YQwqglZ ztJPR4mEiF3kO&v?|I7ONdO%xaZnyg`4MVH2u&{85WF^F8xkx0!oK7d7&*!07ENT-s zHZ~xYO7;1CzImGB_xm6GXq~MiVV0C|gzZGQ)-QC?rN*&h*fy7fxUu2>pgCsM)-Q?tMb$Vds z*E@*sEW?$R-d!Zlo`yI#H#gqa);3B?D6pBWXVBO67?`R6Qy3_qLZ+|_MxhlJx8`9r z{Xs@mdTouNQ0N7+J#TJqhNGh+O#w+J@OC~45~`3D2_z=L-&zrFU%dy%Qdzg0ic~cM z%s{~na19L&^isj*=4PpCtqL-e!E)J#V5X7%DWt(#}Pq3W$oGSy^Pc4j%jrk7_ z4xV5*S(C}slXQfB*Dx$m5ut)=uA6Vdoof#vmX1Pr{o_H2ueAT3P;2Ktrs3gX7h2gv zE62G1jK||?p|odbXLH|f%y4eoeRKHd`|tRw^&nXM?`u5!c)i}iTrM|2E9N*Z__gcJ lE2dmBR}@y4olxbIzJJd{=EC=vF*^VN002ovPDHLkV1lGDi4On( literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index 990de1fd77..83f5f00e0f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -1,5 +1,8 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import java.net.MalformedURLException; +import java.net.URL; + import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -28,6 +31,7 @@ public class AddonsEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private IProject project; + private Image image; public AddonsEditor(EditingDomain editingDomain, IProject project) { super(editingDomain); @@ -36,7 +40,17 @@ public AddonsEditor(EditingDomain editingDomain, IProject project) { @Override public Image getImage(Object element, Display display) { - return null; + if( image == null ) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Addons.png")); //$NON-NLS-1$ +// image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Addons.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; } @Override From 567ff032ee7dd36e7442e5b9d1d8a3b135a2b68a Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 19 Apr 2010 14:32:21 +0000 Subject: [PATCH 0080/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * added new icon for addons --- .../icons/full/modelelements/Application.png | Bin 0 -> 465 bytes .../icons/full/modelelements/ModelComponent.png | Bin 0 -> 591 bytes .../common/component/ApplicationEditor.java | 3 ++- .../common/component/ModelComponentEditor.java | 3 ++- 4 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Application.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ModelComponent.png diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Application.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Application.png new file mode 100644 index 0000000000000000000000000000000000000000..3bc0bd32fceb21d70368f7842a00a53d6369ba48 GIT binary patch literal 465 zcmV;?0WSWDP)zJNu3H-P zO&@UpeyZQXi7jKe-Hk?r-sue;aDce_XqkvXP+W#F_*ot`jB?BS93Uw71|U^ZjLH`yP%FO7U<6!nLCG} z$SDlWeEcNHZMNv|IbJ-M`( zKwWL~opzjJe^WpCmV9E;(0&ut2;4va_(#>M8)>9$R5viQnf(Nkh~VM$y>J(jqb$cj z+nL1Nm|mV)Gm|9MnHf*7Ja4OEAQz__^LRKOLEwqpiGV^^A*T=#&inGm-62Xs;dnSp zKj&H9T*boh2i)W+(n27l!C)>fq|L%VB1i ziC4p;NwV_}ZjW7$LRW#(_bKF#hp=!IqNO26Z*w2+LEwx{PVnZ&Sn}T;mtzb$;qA*nT@@+ zV5uQ@iXDTPoTbV#FRr~z04|PPh`wXTNoCm9*tG&?e3+fYl>K6+&3|Cc$KOpL`ER+_ dcRl5U#9zn6ZO}GF Date: Tue, 20 Apr 2010 20:10:15 +0000 Subject: [PATCH 0081/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * remove unneeded text --- .../emf/ui/internal/common/component/virtual/VWindowEditor.java | 1 - 1 file changed, 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index ac1aedea96..065e0bbb8b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -236,7 +236,6 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.WINDOW)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { From 67b33952339f41936f4cce53ebbe389c59e0a1a7 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 20 Apr 2010 20:51:41 +0000 Subject: [PATCH 0082/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * adding support for context menus * implemented main menu creation --- .../component/AbstractComponentEditor.java | 7 +++ .../e4/tools/emf/ui/internal/Messages.java | 2 + .../tools/emf/ui/internal/Messages.properties | 1 + .../emf/ui/internal/common/ModelEditor.java | 33 ++++++++++++ .../internal/common/component/MenuEditor.java | 52 ++++++++++++++++--- .../common/component/WindowEditor.java | 32 ++++++++++++ .../component/virtual/VApplicationAddons.java | 8 --- 7 files changed, 120 insertions(+), 15 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index c9a5e8dc88..0b0a6b8e95 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -13,7 +13,9 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; +import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -21,6 +23,7 @@ import org.eclipse.core.runtime.FileLocator; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; @@ -101,4 +104,8 @@ protected Image loadSharedImage(Display d, URL path) { public FeaturePath[] getLabelProperties() { return new FeaturePath[] {}; } + + public List getActions(Object element) { + return Collections.emptyList(); + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index a0e5788cf6..4a68831757 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -144,6 +144,7 @@ public class Messages { public static String MenuItemEditor_Tooltip; public static String MenuItemEditor_IconURI; public static String MenuItemEditor_Find; + public static String MenuEditor_MainMenu; public static String MenuSeparatorEditor_Label; public static String MenuSeparatorEditor_Id; @@ -299,6 +300,7 @@ public class Messages { public static String AddonsEditor_Find; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 025e972b3b..3aab827a7b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -130,6 +130,7 @@ MenuEditor_DirectMenuItem=Direct MenuItem MenuEditor_LabelLabel=Label MenuEditor_Tooltip=Tooltip MenuEditor_IconURI=Icon URI +MenuEditor_MainMenu=Main Menu MenuItemEditor_Id=Id MenuItemEditor_Type=Type diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 7c4c854e7f..ba9cf65bdd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -11,6 +11,7 @@ package org.eclipse.e4.tools.emf.ui.internal.common; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -77,6 +78,10 @@ import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider; import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor; import org.eclipse.jface.viewers.ISelectionChangedListener; @@ -222,6 +227,34 @@ public void selectionChanged(SelectionChangedEvent event) { form.setWeights(new int[] { 1, 2 }); viewer.setSelection(new StructuredSelection(modelProvider.getRoot())); + + MenuManager mgr = new MenuManager(); + mgr.setRemoveAllWhenShown(true); + mgr.addMenuListener(new IMenuListener() { + + public void menuAboutToShow(IMenuManager manager) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if( ! s.isEmpty() ) { + List actions; + if( s.getFirstElement() instanceof VirtualEntry ) { + actions = virtualEditors[((VirtualEntry)s.getFirstElement()).getId()].getActions(s.getFirstElement()); + } else { + EObject o = (EObject) s.getFirstElement(); + AbstractComponentEditor editor = editorMap.get(o.eClass()); + if( editor != null ) { + actions = editor.getActions(s.getFirstElement()); + } else { + actions = Collections.emptyList(); + } + } + + for( Action a : actions ) { + manager.add(a); + } + } + } + }); + viewer.getControl().setMenu(mgr.createContextMenu(viewer.getControl())); } private TreeViewer createTreeViewerArea(Composite parent) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 35f3aff47e..aae3288881 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -25,7 +25,9 @@ import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; @@ -35,6 +37,7 @@ import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; @@ -51,6 +54,7 @@ import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StackLayout; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -58,6 +62,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -70,6 +75,7 @@ public class MenuEditor extends AbstractComponentEditor { private ModelEditor editor; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + private StackLayout stackLayout; private class Struct { private final String label; @@ -102,11 +108,6 @@ public Image getImage(Object element, Display display) { return image; } - @Override - public String getLabel(Object element) { - return Messages.MenuEditor_Label; - } - @Override public String getDescription(Object element) { return Messages.MenuEditor_Description; @@ -116,13 +117,31 @@ public String getDescription(Object element) { public Composite getEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + + createForm(composite, context, getMaster(),false); + createForm(composite, context, getMaster(),true); + } + EObject o = (EObject) object; + Control topControl; + if( o.eContainer() instanceof MWindow ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); } + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean rootMenu) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); @@ -141,6 +160,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } // ------------------------------------------------------------ + if( ! rootMenu ) { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuEditor_LabelLabel); @@ -153,6 +173,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } // ------------------------------------------------------------ + if( ! rootMenu ) { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuEditor_Tooltip); @@ -165,6 +186,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } // ------------------------------------------------------------ + if( ! rootMenu ) { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuEditor_IconURI); @@ -341,8 +363,24 @@ public IObservableList getChildList(Object element) { return ELEMENT_CONTAINER__CHILDREN.observe(element); } + @Override + public String getLabel(Object element) { + MMenu menu = (MMenu) element; + if( menu.getParent() == null ) { + EObject o = (EObject) element; + if( o.eContainer() instanceof MWindow ) { + return Messages.MenuEditor_MainMenu; + } + } + return Messages.MenuEditor_Label; + } + @Override public String getDetailLabel(Object element) { + MMenu menu = (MMenu) element; + if( menu.getLabel() != null && menu.getLabel().trim().length() > 0 ) { + return menu.getLabel(); + } return null; } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index e2d17d25b3..252a1a797b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -12,6 +12,8 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; +import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; @@ -25,14 +27,20 @@ import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenu; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -56,8 +64,20 @@ public class WindowEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private IValueProperty WINDOW__MAIN_MENU = EMFProperties.value(BasicPackageImpl.Literals.WINDOW__MAIN_MENU); + private Action addMainMenu; + public WindowEditor(EditingDomain editingDomain) { super(editingDomain); + addMainMenu = new Action("Add Main Menu") { + @Override + public void run() { + MMenu menu = MMenuFactory.INSTANCE.createMenu(); + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__MAIN_MENU, menu); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + }; } @Override @@ -272,4 +292,16 @@ public FeaturePath[] getLabelProperties() { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; } + + @Override + public List getActions(Object element) { + List actions = new ArrayList(); + + MWindow window = (MWindow) element; + if( window.getMainMenu() == null ) { + actions.add(addMainMenu); + } + + return actions; + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java index 1dcc077c47..36dcf7ba58 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java @@ -5,22 +5,15 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MAddon; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsFactoryImpl; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; @@ -29,7 +22,6 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; From abf7dc10d0f167417169e806f89f0471fe69d631 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 21 Apr 2010 14:28:36 +0000 Subject: [PATCH 0083/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * minor problems found by findbugs --- .../emf/ui/internal/common/component/ControlFactory.java | 2 +- .../e4/tools/emf/ui/internal/common/component/MenuEditor.java | 2 +- .../ui/internal/common/component/ModelComponentEditor.java | 2 +- .../tools/emf/ui/internal/common/component/ToolBarEditor.java | 2 +- .../component/dialogs/AbstractCommandSelectionDialog.java | 4 ++-- .../common/component/dialogs/ContributionClassDialog.java | 4 ++-- .../common/component/virtual/VBindingTableEditor.java | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index b918e975c4..688533ee26 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -197,7 +197,7 @@ public void widgetSelected(SelectionEvent e) { b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - l = new Label(parent, SWT.NONE); + new Label(parent, SWT.NONE); final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); viewer.setLabelProvider(new LabelProvider() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index aae3288881..08ecef1684 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -77,7 +77,7 @@ public class MenuEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private StackLayout stackLayout; - private class Struct { + private static class Struct { private final String label; private final EClass eClass; private final boolean separator; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index 003c7e8c39..b0667831ad 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -148,7 +148,7 @@ private Composite createForm(Composite parent) { gd.horizontalSpan=2; t.setLayoutData(gd); - l = new Label(parent, SWT.NONE); + new Label(parent, SWT.NONE); ListViewer viewer = new ListViewer(parent); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 0574facaad..61c8f198ee 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -71,7 +71,7 @@ public class ToolBarEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private class Struct { + private static class Struct { private final String label; private final EClass eClass; private final boolean separator; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java index 87a3710792..d81e922808 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java @@ -75,7 +75,7 @@ protected Control createDialogArea(Composite parent) { Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - l = new Label(container, SWT.NONE); + new Label(container, SWT.NONE); viewer = new TableViewer(container); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(new LabelProviderImpl()); @@ -132,7 +132,7 @@ protected void okPressed() { protected abstract Command createStoreCommand( EditingDomain editingDomain, MCommand command); - private class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { + private static class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { public void update(final ViewerCell cell) { MCommand cmd = (MCommand) cell.getElement(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java index e0fd19c8ad..6406389b36 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -90,7 +90,7 @@ public void widgetDisposed(DisposeEvent e) { final Text t = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - l = new Label(container,SWT.NONE); + new Label(container,SWT.NONE); viewer = new TableViewer(container); GridData gd = new GridData(GridData.FILL_BOTH); @@ -173,7 +173,7 @@ private ClassContributionCollector getCollector() { return null; } - private class ContributionResultHandlerImpl implements ContributionResultHandler { + private static class ContributionResultHandlerImpl implements ContributionResultHandler { private boolean cancled = false; private IObservableList list; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index fd90c78309..072385c276 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -478,7 +478,7 @@ public IObservableList getChildList(Object element) { return null; } - private class ObservableFactoryImpl implements IObservableFactory { + private static class ObservableFactoryImpl implements IObservableFactory { private IEMFListProperty prop = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN); public IObservable createObservable(Object target) { @@ -489,7 +489,7 @@ public IObservable createObservable(Object target) { } } - private class TreeStructureAdvisorImpl extends TreeStructureAdvisor { + private static class TreeStructureAdvisorImpl extends TreeStructureAdvisor { } } From 04cce4137a103e59af8899cc517c34a826514a5d Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 21 Apr 2010 14:44:28 +0000 Subject: [PATCH 0084/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * some NLS stuff --- .../e4/tools/emf/ui/internal/Messages.java | 8 ++++++-- .../tools/emf/ui/internal/Messages.properties | 9 ++++++++- .../AbstractCommandSelectionDialog.java | 13 +++++++------ .../dialogs/ContributionClassDialog.java | 19 ++++++++++--------- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 4a68831757..3d09b37b90 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -13,7 +13,8 @@ import org.eclipse.osgi.util.NLS; public class Messages { - + public static String AbstractCommandSelectionDialog_Label_CommandId; + public static String ApplicationEditor_Label; public static String ApplicationEditor_Description; public static String ApplicationEditor_Id; @@ -299,7 +300,10 @@ public class Messages { public static String AddonsEditor_ClassURI; public static String AddonsEditor_Find; - + public static String ContributionClassDialog_DialogMessage; + public static String ContributionClassDialog_DialogTitle; + public static String ContributionClassDialog_Label_Classname; + public static String ContributionClassDialog_ShellTitle; static { NLS.initializeMessages(Messages.class.getName(), Messages.class); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 3aab827a7b..ebdb796cab 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -8,6 +8,8 @@ # * Contributors: # * Tom Schindl - initial API and implementation # ****************************************************************************** +AbstractCommandSelectionDialog_Label_CommandId=Command-Id + ApplicationEditor_Label=Application ApplicationEditor_Description=Application bla, bla, bla ApplicationEditor_Id=Id @@ -291,4 +293,9 @@ VBindingTableEditor_Remove=Remove AddonsEditor_Id=Id AddonsEditor_ClassURI=Class URI -AddonsEditor_Find=Find ... \ No newline at end of file +AddonsEditor_Find=Find ... + +ContributionClassDialog_DialogMessage=Enter the name of the contributing class +ContributionClassDialog_DialogTitle=Find Contribution Class +ContributionClassDialog_Label_Classname=Classname +ContributionClassDialog_ShellTitle=Find Contribution Class diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java index d81e922808..b178f7f71b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java @@ -14,6 +14,7 @@ import java.util.List; import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MModelComponent; @@ -70,7 +71,7 @@ protected Control createDialogArea(Composite parent) { container.setLayout(new GridLayout(2, false)); Label l = new Label(container, SWT.NONE); - l.setText("Command-Id"); + l.setText(Messages.AbstractCommandSelectionDialog_Label_CommandId); Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -142,10 +143,10 @@ public void update(final ViewerCell cell) { styledString.append(cmd.getCommandName()); } if( cmd.getDescription() != null ) { - styledString.append(" - " + cmd.getDescription(),StyledString.DECORATIONS_STYLER); + styledString.append(" - " + cmd.getDescription(),StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ } if( cmd.getElementId() != null ) { - styledString.append(" - " + cmd.getElementId(),StyledString.DECORATIONS_STYLER); + styledString.append(" - " + cmd.getElementId(),StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ } cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); @@ -157,17 +158,17 @@ public Image getImage(Object element) { public String getText(Object element) { MCommand command = (MCommand) element; - String s = ""; + String s = ""; //$NON-NLS-1$ if( command.getCommandName() != null ) { s += command.getCommandName(); } if( command.getDescription() != null ) { - s += " " + command.getDescription(); + s += " " + command.getDescription(); //$NON-NLS-1$ } if( command.getElementId() != null ) { - s += " " + command.getElementId(); + s += " " + command.getElementId(); //$NON-NLS-1$ } return s; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java index 6406389b36..175a546737 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -16,6 +16,7 @@ import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionData; import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionResultHandler; import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Filter; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -67,9 +68,9 @@ public ContributionClassDialog(Shell parentShell, IProject project, EditingDomai protected Control createDialogArea(Composite parent) { Composite comp = (Composite) super.createDialogArea(parent); - getShell().setText("Find Contribution Class"); - setTitle("Find Contribution Class"); - setMessage("Enter the name of the contributing class"); + getShell().setText(Messages.ContributionClassDialog_ShellTitle); + setTitle(Messages.ContributionClassDialog_DialogTitle); + setMessage(Messages.ContributionClassDialog_DialogMessage); getShell().addDisposeListener(new DisposeListener() { @@ -78,14 +79,14 @@ public void widgetDisposed(DisposeEvent e) { } }); - javaClassImage = new Image(getShell().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/class_obj.gif")); + javaClassImage = new Image(getShell().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/class_obj.gif")); //$NON-NLS-1$ Composite container = new Composite(comp, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); container.setLayout(new GridLayout(2,false)); Label l = new Label(container, SWT.NONE); - l.setText("Classname"); + l.setText(Messages.ContributionClassDialog_Label_Classname); final Text t = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -103,12 +104,12 @@ public void update(ViewerCell cell) { StyledString styledString = new StyledString(data.className, null); if( data.bundleName != null ) { - styledString.append(" - " + data.bundleName, StyledString.DECORATIONS_STYLER); + styledString.append(" - " + data.bundleName, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ } if( data.sourceType != null ) { - styledString.append(" - ", StyledString.DECORATIONS_STYLER); - styledString.append(data.sourceType + "", StyledString.COUNTER_STYLER); + styledString.append(" - ", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + styledString.append(data.sourceType + "", StyledString.COUNTER_STYLER); //$NON-NLS-1$ } if( data.iconPath == null ) { @@ -154,7 +155,7 @@ protected void okPressed() { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if( ! s.isEmpty() ) { ContributionData cd = (ContributionData) s.getFirstElement(); - String uri = "platform:/plugin/" + cd.bundleName + "/" + cd.className; + String uri = "platform:/plugin/" + cd.bundleName + "/" + cd.className; //$NON-NLS-1$ //$NON-NLS-2$ Command cmd = SetCommand.create(editingDomain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, uri); if( cmd.canExecute() ) { editingDomain.getCommandStack().execute(cmd); From ef4bac865d5405312872e610d87ddcfd8f0e2d45 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 22 Apr 2010 06:43:16 +0000 Subject: [PATCH 0085/1286] [Bug 309593] - [CSS] Think about theme management and css contribution --- .../.settings/org.eclipse.pde.core.prefs | 4 ++-- .../META-INF/MANIFEST.MF | 3 ++- .../build.properties | 3 ++- .../css/default.css | 22 +++++++++++++++++++ .../org.eclipse.e4.tools.emf.ui/plugin.xml | 11 ++++++++++ 5 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/css/default.css create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/plugin.xml diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.core.prefs index 81bd2f274f..497f55a69b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.core.prefs +++ b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.core.prefs @@ -1,4 +1,4 @@ -#Tue Mar 02 18:39:11 CET 2010 +#Sun Apr 18 16:26:38 CEST 2010 eclipse.preferences.version=1 -pluginProject.extensions=false +pluginProject.extensions=true resolve.requirebundle=false diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 9d7c30fb81..2a67a7c1ab 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -20,7 +20,8 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", com.ibm.icu;bundle-version="4.2.1", org.eclipse.core.resources;bundle-version="3.6.0", org.eclipse.e4.core.services;bundle-version="0.9.1", - org.eclipse.osgi;bundle-version="3.6.0" + org.eclipse.osgi;bundle-version="3.6.0", + org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0" Bundle-ActivationPolicy: lazy Import-Package: javax.inject;version="1.0.0", org.osgi.framework;version="1.5.0" diff --git a/bundles/org.eclipse.e4.tools.emf.ui/build.properties b/bundles/org.eclipse.e4.tools.emf.ui/build.properties index d72a1c5dd5..e462e083a9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/build.properties @@ -3,7 +3,8 @@ bin.includes = .,\ plugin.properties,\ icons/,\ about.html,\ - OSGI-INF/contributioncollector.xml + OSGI-INF/contributioncollector.xml,\ + plugin.xml output.. = bin/ jars.compile.order = . source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/css/default.css b/bundles/org.eclipse.e4.tools.emf.ui/css/default.css new file mode 100644 index 0000000000..751eb8fc18 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/css/default.css @@ -0,0 +1,22 @@ +.headerSectionContainer { + background-color: gradient #575757 #101010 100%; +} + +.sectionHeader { + font-weight: bold; + font-size: 15pt; + color: white; +} + +.subSectionHeader { + background-color: gradient #575757 #101010 100%; +} + + +.contentContainer { + background-color: #fff #fff #cccccc 20% 80%; +} + +.formContainer { + background-color: #fff; +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml b/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml new file mode 100644 index 0000000000..1b2fb64bfe --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml @@ -0,0 +1,11 @@ + + + + + + + + + From 78f2263393f8b04244ff5a92573e4597f15dc0ca Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 22 Apr 2010 06:44:19 +0000 Subject: [PATCH 0086/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixed findbugs warning From 6e1db650d5f29e51c784844d59198be89a4a4af1 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 22 Apr 2010 17:55:24 +0000 Subject: [PATCH 0087/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * remove wrong subtypes --- .../emf/ui/internal/common/component/PartStackEditor.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 8f6597fcf0..617eb83a32 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -27,6 +27,8 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUiFactory; +import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; @@ -272,8 +274,8 @@ public String getText(Object element) { } }); childrenDropDown.setInput(new EClass[] { - BasicPackageImpl.Literals.PART_SASH_CONTAINER, - BasicPackageImpl.Literals.PART_STACK, +// BasicPackageImpl.Literals.PART_SASH_CONTAINER, +// BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART }); From 78e4a92d11828b2151c020e797f939674768b8b1 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 29 Apr 2010 13:10:48 +0000 Subject: [PATCH 0088/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * use the new CSS-Theme-Features --- .../META-INF/MANIFEST.MF | 3 +- .../build.properties | 1 - .../css/default.css | 22 --------- .../emf/editor3x/E4WorkbenchModelEditor.java | 45 ++++++------------- .../PDEClassContributionProvider.java | 12 ++++- .../tools/emf/editor3x/XMIModelResource.java | 1 + 6 files changed, 27 insertions(+), 57 deletions(-) delete mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/css/default.css diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index dd63143407..6a47378ae0 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -17,6 +17,7 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.pde.core;bundle-version="3.6.0", org.eclipse.core.resources;bundle-version="3.6.0", org.eclipse.jdt.core;bundle-version="3.6.0", - org.eclipse.ui.ide;bundle-version="3.6.0" + org.eclipse.ui.ide;bundle-version="3.6.0", + org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0" Service-Component: OSGI-INF/pdecontributionprovider.xml Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties index b2760a07f1..0ba7cf565c 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties @@ -3,6 +3,5 @@ bin.includes = META-INF/,\ .,\ plugin.xml,\ icons/,\ - css/,\ OSGI-INF/pdecontributionprovider.xml source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/css/default.css b/bundles/org.eclipse.e4.tools.emf.editor3x/css/default.css deleted file mode 100644 index 751eb8fc18..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/css/default.css +++ /dev/null @@ -1,22 +0,0 @@ -.headerSectionContainer { - background-color: gradient #575757 #101010 100%; -} - -.sectionHeader { - font-weight: bold; - font-size: 15pt; - color: white; -} - -.subSectionHeader { - background-color: gradient #575757 #101010 100%; -} - - -.contentContainer { - background-color: #fff #fff #cccccc 20% 80%; -} - -.formContainer { - background-color: #fff; -} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java index f2ab75ca2e..562e917515 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java @@ -23,6 +23,8 @@ import org.eclipse.e4.ui.css.core.engine.CSSEngine; import org.eclipse.e4.ui.css.core.engine.CSSErrorHandler; import org.eclipse.e4.ui.css.swt.engine.CSSSWTEngineImpl; +import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; +import org.eclipse.e4.ui.css.swt.theme.IThemeManager; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.edit.ui.util.EditUIUtil; import org.eclipse.swt.SWT; @@ -35,6 +37,9 @@ import org.eclipse.ui.PartInitException; import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.part.EditorPart; +import org.osgi.framework.Bundle; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; @SuppressWarnings("restriction") public class E4WorkbenchModelEditor extends EditorPart { @@ -67,36 +72,6 @@ public void doSaveAs() { } - private void setupCss(Display display) { - CSSEngine engine = (CSSEngine) display - .getData("org.eclipse.e4.ui.css.core.engine"); - - if (engine == null) { - engine = new CSSSWTEngineImpl(display, true); - engine.setErrorHandler(new CSSErrorHandler() { - public void error(Exception e) { - e.printStackTrace(); - } - }); - display.setData("org.eclipse.e4.ui.css.core.engine", engine); - - try { - URL url = FileLocator.resolve(new URL(CSS_URI.toString())); - display.setData("org.eclipse.e4.ui.css.core.cssURL", url); //$NON-NLS-1$ - - InputStream stream = url.openStream(); - engine.parseStyleSheet(stream); - stream.close(); - } catch (MalformedURLException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - } - } - @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { @@ -122,7 +97,6 @@ public boolean isSaveAsAllowed() { @Override public void createPartControl(Composite parent) { - setupCss(parent.getDisplay()); Composite comp = new Composite(parent, SWT.NONE); comp.setBackground(comp.getDisplay().getSystemColor(SWT.COLOR_WHITE)); comp.setBackgroundMode(SWT.INHERIT_DEFAULT); @@ -142,6 +116,15 @@ public void createPartControl(Composite parent) { } makeActions(); + Bundle b = FrameworkUtil.getBundle(E4WorkbenchModelEditor.class); + if( b != null ) { + ServiceReference ref = b.getBundleContext().getServiceReference(IThemeManager.class.getName()); + if( ref != null ) { + IThemeManager mgr = (IThemeManager) b.getBundleContext().getService(ref); + IThemeEngine engine = mgr.getEngineForDisplay(parent.getDisplay()); + engine.applyStyles(parent, true); + } + } } private void makeActions() { diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java index 7a205c2883..24a2afdfb1 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java @@ -74,7 +74,7 @@ public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, // Accept search results from the JDT SearchEngine String cName = new String(simpleTypeName); String pName = new String(packageName); - String label = cName + " - " + pName; //$NON-NLS-1$ +// String label = cName + " - " + pName; //$NON-NLS-1$ String content = pName + "." + cName; //$NON-NLS-1$ // System.err.println("Found: " + label + " => " + pName + " => " + path); @@ -86,9 +86,10 @@ public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, IFile f = project.getFile("/META-INF/MANIFEST.MF"); if( f != null && f.exists() ) { + BufferedReader r = null; try { InputStream s = f.getContents(); - BufferedReader r = new BufferedReader(new InputStreamReader(s)); + r = new BufferedReader(new InputStreamReader(s)); String line; while( (line = r.readLine()) != null ) { if( line.startsWith("Bundle-SymbolicName:") ) { @@ -106,6 +107,13 @@ public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); + } finally { + try { + r.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java index 59b63ecf7c..deff0a449c 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java @@ -109,6 +109,7 @@ public IStatus save() { fireCommandStackChanged(); } catch (Exception e) { // TODO: handle exception + e.printStackTrace(); } return Status.OK_STATUS; From 751112156144929eed7f87add95cebe17b9361d1 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 29 Apr 2010 13:11:31 +0000 Subject: [PATCH 0089/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * extracting model change commands --- .../common/commands/AddAddonCommand.java | 30 ++++++++++++ .../common/commands/MoveAddonCommand.java | 20 ++++++++ .../common/commands/RemoveAddonCommand.java | 35 ++++++++++++++ .../common/component/AddonsEditor.java | 10 ++++ .../component/virtual/VApplicationAddons.java | 48 +++++++++++++------ 5 files changed, 128 insertions(+), 15 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java new file mode 100644 index 0000000000..27cf0d5164 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.commands; + +import org.eclipse.e4.ui.model.application.MAddon; +import org.eclipse.e4.ui.model.application.MApplication; +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.domain.EditingDomain; + +public class AddAddonCommand { + public void execute(EditingDomain editingDomain, MApplication parent) { + MAddon command = MApplicationFactory.INSTANCE.createAddon(); + Command cmd = AddCommand.create(editingDomain, parent, ApplicationPackageImpl.Literals.APPLICATION__ADDONS, command); + + if( cmd.canExecute() ) { + editingDomain.getCommandStack().execute(cmd); + } + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java new file mode 100644 index 0000000000..6c3f9889de --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java @@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.commands; + +import org.eclipse.e4.ui.model.application.MAddon; +import org.eclipse.emf.edit.domain.EditingDomain; + +public class MoveAddonCommand { + public void execute(EditingDomain editingDomain, MAddon addon, boolean up) { + + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java new file mode 100644 index 0000000000..1e71dfcb9e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.commands; + +import java.util.List; + +import org.eclipse.e4.ui.model.application.MAddon; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; + +public class RemoveAddonCommand { + public void execute(EditingDomain editingDomain, List addons) { + EObject parent = ((EObject)addons.get(0)).eContainer(); + for( MAddon a : addons ) { + if( parent != ((EObject)a).eContainer() ) { + throw new IllegalArgumentException("The addons all have to belong to the same parent container"); + } + } + Command cmd = RemoveCommand.create(editingDomain, parent, ApplicationPackageImpl.Literals.APPLICATION__ADDONS, addons); + if( cmd.canExecute() ) { + editingDomain.getCommandStack().execute(cmd); + } + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index 83f5f00e0f..77f150bd6e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; import java.net.MalformedURLException; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java index 36dcf7ba58..316d16e4d2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java @@ -1,5 +1,6 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -8,16 +9,17 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.emf.ui.internal.common.commands.AddAddonCommand; +import org.eclipse.e4.tools.emf.ui.internal.common.commands.RemoveAddonCommand; import org.eclipse.e4.ui.model.application.MAddon; import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; @@ -39,9 +41,21 @@ public class VApplicationAddons extends AbstractComponentEditor { private TableViewer viewer; private EMFDataBindingContext context; + private List actions = new ArrayList(); + + //FIXME We need to plug this stuff into the command frameworks + private AddAddonCommand addAddonCommand = new AddAddonCommand(); + private RemoveAddonCommand removeAddonCommand = new RemoveAddonCommand(); + public VApplicationAddons(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain); this.editor = editor; + actions.add(new Action("Add Addon") { + @Override + public void run() { + handleAddAddon(); + } + }); } @Override @@ -165,13 +179,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MAddon command = MApplicationFactory.INSTANCE.createAddon(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__ADDONS, command); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(command); - } + handleAddAddon(); } }); @@ -183,11 +191,7 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { if( ! viewer.getSelection().isEmpty() ) { - List commands = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__ADDONS, commands); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } + handleRemoveAddons(((IStructuredSelection)viewer.getSelection()).toList()); } } }); @@ -195,11 +199,25 @@ public void widgetSelected(SelectionEvent e) { return parent; } - + + private void handleAddAddon() { + addAddonCommand.execute(getEditingDomain(), (MApplication) getMaster().getValue()); + } + + private void handleRemoveAddons(List addons) { + removeAddonCommand.execute(getEditingDomain(), addons); + } + @Override public IObservableList getChildList(Object element) { // TODO Auto-generated method stub return null; } + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } From b58beb27076a264d8ef7100a4e1e37d855ebb590 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 7 May 2010 08:15:05 +0000 Subject: [PATCH 0090/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * refactored to directly use DI in 3.x --- .../META-INF/MANIFEST.MF | 7 +- .../OSGI-INF/contextfunction.xml | 8 + .../OSGI-INF/pdecontributionprovider.xml | 2 +- .../build.properties | 3 +- .../plugin.xml | 16 ++ .../emf/editor3x/E4WorkbenchModelEditor.java | 237 +++++++++--------- .../PDEClassContributionProvider.java | 12 +- .../emf/editor3x/XMIResourceFunction.java | 23 ++ .../editor3x/compat/E4CompatEditorPart.java | 108 ++++++++ .../compat/IEclipseContextServiceFactory.java | 70 ++++++ .../META-INF/MANIFEST.MF | 4 +- .../tools/emf/ui/common/XMIModelResource.java | 118 +++++++++ .../emf/ui/internal/common/ModelEditor.java | 31 ++- .../internal/wbm/ApplicationModelEditor.java | 8 +- 14 files changed, 505 insertions(+), 142 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/contextfunction.xml create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index 6a47378ae0..e3e5fd0b31 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -18,6 +18,9 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.core.resources;bundle-version="3.6.0", org.eclipse.jdt.core;bundle-version="3.6.0", org.eclipse.ui.ide;bundle-version="3.6.0", - org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0" -Service-Component: OSGI-INF/pdecontributionprovider.xml + org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0", + org.eclipse.e4.core.contexts;bundle-version="0.9.0", + org.eclipse.e4.core.di;bundle-version="0.9.0", + org.eclipse.e4.core.services;bundle-version="0.9.1" +Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/contextfunction.xml Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/contextfunction.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/contextfunction.xml new file mode 100644 index 0000000000..07c4270939 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/contextfunction.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml index dbd21aa8b9..ce78958efd 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml @@ -1,5 +1,5 @@ - + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties index 0ba7cf565c..30bd06c0cf 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties @@ -3,5 +3,6 @@ bin.includes = META-INF/,\ .,\ plugin.xml,\ icons/,\ - OSGI-INF/pdecontributionprovider.xml + OSGI-INF/pdecontributionprovider.xml,\ + OSGI-INF/contextfunction.xml source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml index 8a4c94ce26..2fa5805338 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml @@ -38,5 +38,21 @@ name="e4"> + + + + + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java index 562e917515..cfbeaef289 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java @@ -10,19 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.e4.tools.emf.editor3x.compat.E4CompatEditorPart; import org.eclipse.e4.tools.emf.ui.common.IModelResource.ModelListener; import org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor; -import org.eclipse.e4.ui.css.core.engine.CSSEngine; -import org.eclipse.e4.ui.css.core.engine.CSSErrorHandler; -import org.eclipse.e4.ui.css.swt.engine.CSSSWTEngineImpl; import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; import org.eclipse.e4.ui.css.swt.theme.IThemeManager; import org.eclipse.emf.common.util.URI; @@ -30,7 +21,6 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorSite; import org.eclipse.ui.IFileEditorInput; @@ -42,118 +32,121 @@ import org.osgi.framework.ServiceReference; @SuppressWarnings("restriction") -public class E4WorkbenchModelEditor extends EditorPart { - private XMIModelResource resource; - private ApplicationModelEditor editor; - private UndoAction undoAction; - private RedoAction redoAction; - - private static final String CSS_URI = "platform:/plugin/org.eclipse.e4.tools.emf.editor3x/css/default.css"; - - private ModelListener listener = new ModelListener() { - - public void dirtyChanged() { - firePropertyChange(PROP_DIRTY); - } - - public void commandStackChanged() { - // TODO Auto-generated method stub - - } - }; - - @Override - public void doSave(IProgressMonitor monitor) { - editor.save(); - } - - @Override - public void doSaveAs() { - - } - - @Override - public void init(IEditorSite site, IEditorInput input) - throws PartInitException { - setSite(site); - setInput(input); - - URI resourceURI = EditUIUtil.getURI(input); - if (resourceURI != null) { - resource = new XMIModelResource(resourceURI); - resource.addModelListener(listener); - } - } - - @Override - public boolean isDirty() { - return resource.isDirty(); - } - - @Override - public boolean isSaveAsAllowed() { - return false; - } - - @Override - public void createPartControl(Composite parent) { - Composite comp = new Composite(parent, SWT.NONE); - comp.setBackground(comp.getDisplay().getSystemColor(SWT.COLOR_WHITE)); - comp.setBackgroundMode(SWT.INHERIT_DEFAULT); - - FillLayout layout = new FillLayout(); - layout.marginWidth = 10; - layout.marginHeight = 10; - comp.setLayout(layout); - IFileEditorInput input = (IFileEditorInput)getEditorInput(); - editor = new ApplicationModelEditor(comp, resource, input.getFile().getProject()); - - try { - parent.setRedraw(false); - parent.reskin(SWT.ALL); - } finally { - parent.setRedraw(true); - } - - makeActions(); - Bundle b = FrameworkUtil.getBundle(E4WorkbenchModelEditor.class); - if( b != null ) { - ServiceReference ref = b.getBundleContext().getServiceReference(IThemeManager.class.getName()); - if( ref != null ) { - IThemeManager mgr = (IThemeManager) b.getBundleContext().getService(ref); - IThemeEngine engine = mgr.getEngineForDisplay(parent.getDisplay()); - engine.applyStyles(parent, true); - } - } - } - - private void makeActions() { - undoAction = new UndoAction(resource); - redoAction = new RedoAction(resource); - - getEditorSite().getActionBars().setGlobalActionHandler( - ActionFactory.UNDO.getId(), undoAction); - getEditorSite().getActionBars().setGlobalActionHandler( - ActionFactory.REDO.getId(), redoAction); - } - - @Override - public void dispose() { - if (undoAction != null) - undoAction.dispose(); - - if (redoAction != null) - redoAction.dispose(); - - if (listener != null && resource != null) - resource.removeModelListener(listener); - - super.dispose(); - } +public class E4WorkbenchModelEditor extends E4CompatEditorPart { - @Override - public void setFocus() { - editor.setFocus(); + public E4WorkbenchModelEditor() { + super("platform:/plugin/org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor"); } + +// private XMIModelResource resource; +// private ApplicationModelEditor editor; +// private UndoAction undoAction; +// private RedoAction redoAction; +// +// private ModelListener listener = new ModelListener() { +// +// public void dirtyChanged() { +// firePropertyChange(PROP_DIRTY); +// } +// +// public void commandStackChanged() { +// // TODO Auto-generated method stub +// +// } +// }; +// +// @Override +// public void doSave(IProgressMonitor monitor) { +// editor.doSave(monitor); +// } +// +// @Override +// public void doSaveAs() { +// +// } +// +// @Override +// public void init(IEditorSite site, IEditorInput input) +// throws PartInitException { +// setSite(site); +// setInput(input); +// +// URI resourceURI = EditUIUtil.getURI(input); +// if (resourceURI != null) { +// resource = new XMIModelResource(resourceURI); +// resource.addModelListener(listener); +// } +// } +// +// @Override +// public boolean isDirty() { +// return resource.isDirty(); +// } +// +// @Override +// public boolean isSaveAsAllowed() { +// return false; +// } +// +// @Override +// public void createPartControl(Composite parent) { +// Composite comp = new Composite(parent, SWT.NONE); +// comp.setBackground(comp.getDisplay().getSystemColor(SWT.COLOR_WHITE)); +// comp.setBackgroundMode(SWT.INHERIT_DEFAULT); +// +// FillLayout layout = new FillLayout(); +// layout.marginWidth = 10; +// layout.marginHeight = 10; +// comp.setLayout(layout); +// IFileEditorInput input = (IFileEditorInput)getEditorInput(); +// editor = new ApplicationModelEditor(comp, resource, input.getFile().getProject()); +// +// try { +// parent.setRedraw(false); +// parent.reskin(SWT.ALL); +// } finally { +// parent.setRedraw(true); +// } +// +// makeActions(); +// Bundle b = FrameworkUtil.getBundle(E4WorkbenchModelEditor.class); +// if( b != null ) { +// ServiceReference ref = b.getBundleContext().getServiceReference(IThemeManager.class.getName()); +// if( ref != null ) { +// IThemeManager mgr = (IThemeManager) b.getBundleContext().getService(ref); +// IThemeEngine engine = mgr.getEngineForDisplay(parent.getDisplay()); +// engine.applyStyles(parent, true); +// } +// } +// } +// +// private void makeActions() { +// undoAction = new UndoAction(resource); +// redoAction = new RedoAction(resource); +// +// getEditorSite().getActionBars().setGlobalActionHandler( +// ActionFactory.UNDO.getId(), undoAction); +// getEditorSite().getActionBars().setGlobalActionHandler( +// ActionFactory.REDO.getId(), redoAction); +// } +// +// @Override +// public void dispose() { +// if (undoAction != null) +// undoAction.dispose(); +// +// if (redoAction != null) +// redoAction.dispose(); +// +// if (listener != null && resource != null) +// resource.removeModelListener(listener); +// +// super.dispose(); +// } +// +// @Override +// public void setFocus() { +// editor.setFocus(); +// } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java index 24a2afdfb1..b137eb5b90 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java @@ -108,11 +108,13 @@ public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, // TODO Auto-generated catch block e.printStackTrace(); } finally { - try { - r.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if( r != null ) { + try { + r.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java new file mode 100644 index 0000000000..77a360960d --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java @@ -0,0 +1,23 @@ +package org.eclipse.e4.tools.emf.editor3x; + +import org.eclipse.e4.core.contexts.ContextFunction; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.tools.emf.ui.common.XMIModelResource; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.edit.ui.util.EditUIUtil; +import org.eclipse.ui.IEditorInput; + +public class XMIResourceFunction extends ContextFunction { + + @Override + public Object compute(IEclipseContext context, Object[] arguments) { + final IEditorInput input = context.get(IEditorInput.class); + if( input != null ) { + URI resourceURI = EditUIUtil.getURI(input); + return new XMIModelResource(resourceURI); + } + + return null; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java new file mode 100644 index 0000000000..b5f9d552fd --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java @@ -0,0 +1,108 @@ +package org.eclipse.e4.tools.emf.editor3x.compat; + +import org.eclipse.core.runtime.IExecutableExtension; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.core.services.contributions.IContributionFactory; +import org.eclipse.e4.tools.emf.editor3x.E4WorkbenchModelEditor; +import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; +import org.eclipse.e4.ui.css.swt.theme.IThemeManager; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.part.EditorPart; +import org.osgi.framework.Bundle; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; + +public class E4CompatEditorPart extends EditorPart implements IExecutableExtension { + private Object instance; + private String classUri; + + //TODO can we create a context as a top-level service? + private IEclipseContext context; + + public E4CompatEditorPart(String classUri) { + this.classUri = classUri; + } + + @Override + public void doSave(IProgressMonitor monitor) { + // TODO Auto-generated method stub + + } + + @Override + public void doSaveAs() { + // TODO Auto-generated method stub + + } + + @Override + public void init(IEditorSite site, IEditorInput input) + throws PartInitException { + setSite(site); + setInput(input); + + IEclipseContext parentContext = (IEclipseContext) getSite().getService(IEclipseContext.class); + System.err.println("The parent context: " + parentContext); + context = parentContext.createChild("EditPart('"+getPartName()+"')"); //$NON-NLS-1$ + context.declareModifiable(IEditorInput.class); + context.declareModifiable(EditorPart.class); + context.set(EditorPart.class,this); + context.set(IEditorInput.class, input); + } + + @Override + public boolean isDirty() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isSaveAsAllowed() { + // TODO Auto-generated method stub + return false; + } + + @Override + public void createPartControl(Composite parent) { + Composite comp = new Composite(parent, SWT.NONE); + comp.setBackgroundMode(SWT.INHERIT_DEFAULT); + + FillLayout layout = new FillLayout(); + layout.marginWidth = 10; + layout.marginHeight = 10; + comp.setLayout(layout); + + context.set(Composite.class.getName(), comp); + IContributionFactory factory = (IContributionFactory) context.get(IContributionFactory.class); + instance = factory.create(classUri, context); + + Bundle b = FrameworkUtil.getBundle(E4WorkbenchModelEditor.class); + if( b != null ) { + ServiceReference ref = b.getBundleContext().getServiceReference(IThemeManager.class.getName()); + if( ref != null ) { + IThemeManager mgr = (IThemeManager) b.getBundleContext().getService(ref); + IThemeEngine engine = mgr.getEngineForDisplay(parent.getDisplay()); + engine.applyStyles(parent, true); + } + } + } + + @Override + public void setFocus() { + // TODO Auto-generated method stub + + } + + @Override + public void dispose() { + context.dispose(); + super.dispose(); + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java new file mode 100644 index 0000000000..d3d9251455 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java @@ -0,0 +1,70 @@ +package org.eclipse.e4.tools.emf.editor3x.compat; + +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.RegistryFactory; +import org.eclipse.e4.core.contexts.EclipseContextFactory; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.core.services.contributions.IContributionFactory; +import org.eclipse.e4.workbench.modeling.ESelectionService; +import org.eclipse.e4.workbench.ui.IWorkbench; +import org.eclipse.e4.workbench.ui.internal.ReflectionContributionFactory; +import org.eclipse.ui.ISelectionService; +import org.eclipse.ui.IWorkbenchPartSite; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.internal.services.IWorkbenchLocationService; +import org.eclipse.ui.services.AbstractServiceFactory; +import org.eclipse.ui.services.IServiceLocator; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; + +public class IEclipseContextServiceFactory extends AbstractServiceFactory { + + public IEclipseContextServiceFactory() { + } + + @SuppressWarnings("restriction") + @Override + public Object create(Class serviceInterface, IServiceLocator parentLocator, + IServiceLocator locator) { + if( ! IEclipseContext.class.equals(serviceInterface) ) { + return null; + } + + IWorkbenchLocationService wls = (IWorkbenchLocationService) locator.getService(IWorkbenchLocationService.class); + final IWorkbenchWindow window = wls.getWorkbenchWindow(); + final IWorkbenchPartSite site = wls.getPartSite(); + + System.err.println("The locator: " + locator); + System.err.println(" Window: " + window); + System.err.println(" Site: " + site); + + + Object o = parentLocator.getService(serviceInterface); + + // This happens when we run in plain 3.x + // We need to create a parent service context + if( window == null && site == null ) { + Bundle bundle = FrameworkUtil.getBundle(IEclipseContextServiceFactory.class); + BundleContext bundleContext = bundle.getBundleContext(); + IEclipseContext serviceContext = EclipseContextFactory.getServiceContext(bundleContext); + + final IEclipseContext appContext = serviceContext.createChild("WorkbenchContext"); //$NON-NLS-1$ + IExtensionRegistry registry = RegistryFactory.getRegistry(); + ReflectionContributionFactory contributionFactory = new ReflectionContributionFactory(registry); + appContext.set(IContributionFactory.class.getName(),contributionFactory); + + return appContext; + } /*else if( o != null && site == null ) { + IEclipseContext windowContext = ((IEclipseContext)o).createChild("WindowContext("+window+")"); +// windowContext.declareModifiable(ESelectionService.class); +// //FIXME This is not correct we need to use DI :-) +// windowContext.set(ESelectionService.class, new E4CompatSelectionService(window)); + + return windowContext; + }*/ + + return o; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 2a67a7c1ab..ce71a25a67 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -21,7 +21,9 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.core.resources;bundle-version="3.6.0", org.eclipse.e4.core.services;bundle-version="0.9.1", org.eclipse.osgi;bundle-version="3.6.0", - org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0" + org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0", + org.eclipse.e4.core.di;bundle-version="0.9.0", + org.eclipse.e4.ui.workbench;bundle-version="0.9.1" Bundle-ActivationPolicy: lazy Import-Package: javax.inject;version="1.0.0", org.osgi.framework;version="1.5.0" diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java new file mode 100644 index 0000000000..95bbb4fc9d --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java @@ -0,0 +1,118 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.common; + +import java.util.ArrayList; +import java.util.EventObject; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.workbench.ui.internal.E4XMIResourceFactory; +import org.eclipse.emf.common.command.BasicCommandStack; +import org.eclipse.emf.common.command.CommandStackListener; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; + +@SuppressWarnings("restriction") +public class XMIModelResource implements IModelResource { + private EditingDomain editingDomain; + private Resource resource; + private List listeners = new ArrayList(); + private boolean dirty; + + + public XMIModelResource(URI uri) { + ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( + ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + ResourceSet resourceSet = new ResourceSetImpl(); + BasicCommandStack commandStack = new BasicCommandStack(); + commandStack.addCommandStackListener(new CommandStackListener() { + + public void commandStackChanged(EventObject event) { + dirty = true; + fireDirtyChanged(); + fireCommandStackChanged(); + } + }); + editingDomain = new AdapterFactoryEditingDomain(adapterFactory, + commandStack, resourceSet); + resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap() + .put(Resource.Factory.Registry.DEFAULT_EXTENSION, + new E4XMIResourceFactory()); + resource = resourceSet.getResource(uri, true); + } + + public IObservableList getRoot() { + WritableList list = new WritableList(); + list.add(resource.getContents().get(0)); + return list; + } + + public EditingDomain getEditingDomain() { + return editingDomain; + } + + public boolean isSaveable() { + return true; + } + + public void addModelListener(ModelListener listener) { + listeners.add(listener); + } + + public void removeModelListener(ModelListener listener) { + listeners.remove(listener); + } + + public boolean isDirty() { + return dirty && getEditingDomain().getCommandStack().canUndo(); + } + + private void fireDirtyChanged() { + for( ModelListener listener : listeners ) { + listener.dirtyChanged(); + } + } + + private void fireCommandStackChanged() { + for( ModelListener listener : listeners ) { + listener.commandStackChanged(); + } + } + + public IStatus save() { + Map map = new HashMap(); + try { + resource.save(map); + editingDomain.getCommandStack().flush(); + dirty = false; + fireDirtyChanged(); + fireCommandStackChanged(); + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + + return Status.OK_STATUS; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index ba9cf65bdd..9eb0780591 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -16,6 +16,8 @@ import java.util.List; import java.util.Map; +import javax.inject.Inject; + import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.map.IMapChangeListener; @@ -26,8 +28,8 @@ import org.eclipse.core.databinding.observable.set.SetChangeEvent; import org.eclipse.core.databinding.observable.set.WritableSet; import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ShadowComposite; @@ -74,6 +76,7 @@ import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.e4.workbench.modeling.ESelectionService; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.ecore.EClass; @@ -129,6 +132,7 @@ public class ModelEditor { private TreeViewer viewer; private IModelResource modelProvider; private IProject project; +// private ESelectionService selectionService; public ModelEditor(Composite composite, IModelResource modelProvider, IProject project) { this.modelProvider = modelProvider; @@ -221,6 +225,11 @@ public void selectionChanged(SelectionChangedEvent event) { Rectangle r = scrolling.getClientArea(); scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); + +// if( selectionService != null ) { +// selectionService.setSelection(s.getFirstElement()); +// } + } } }); @@ -257,6 +266,16 @@ public void menuAboutToShow(IMenuManager manager) { viewer.getControl().setMenu(mgr.createContextMenu(viewer.getControl())); } +// @Inject +// public void setSelectionService(ESelectionService selectionService) { +// this.selectionService = selectionService; +// if( viewer != null && ! viewer.getControl().isDisposed() ) { +// if( ! viewer.getSelection().isEmpty() ) { +// selectionService.setSelection(((IStructuredSelection)viewer.getSelection()).getFirstElement()); +// } +// } +// } + private TreeViewer createTreeViewerArea(Composite parent) { parent = new Composite(parent, SWT.NONE); parent.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ @@ -402,14 +421,12 @@ public AbstractComponentEditor getEditor(EClass eClass) { return editorMap.get(eClass); } - public IStatus save() { + public void doSave(@Optional IProgressMonitor monitor) { if (modelProvider.isSaveable()) { - return modelProvider.save(); + modelProvider.save(); } - - return Status.CANCEL_STATUS; } - + public void setFocus() { viewer.getControl().setFocus(); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java index 51ddad58d1..4104bbecd2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java @@ -10,16 +10,18 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.wbm; +import javax.inject.Inject; + import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.swt.widgets.Composite; public class ApplicationModelEditor extends ModelEditor { + @Inject public ApplicationModelEditor(Composite composite, - IModelResource modelProvider, IProject project) { + @Optional IModelResource modelProvider, @Optional IProject project) { super(composite, modelProvider, project); } - - } From c6c747155d19a16f513f923894de70ed4e73b3fa Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 7 May 2010 12:30:13 +0000 Subject: [PATCH 0091/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * no dependency on emf.ui which has an upper bound to 3.7.0 --- .../META-INF/MANIFEST.MF | 4 +- .../emf/editor3x/E4WorkbenchModelEditor.java | 1 - .../emf/editor3x/XMIResourceFunction.java | 2 +- .../e4/tools/emf/editor3x/emf/EditUIUtil.java | 87 +++++++++++++++++++ .../META-INF/MANIFEST.MF | 1 - 5 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/emf/EditUIUtil.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index e3e5fd0b31..f93cda5a54 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -7,7 +7,6 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.core.runtime;bundle-version="3.6.0", org.eclipse.emf.common;bundle-version="2.6.0", - org.eclipse.emf.edit.ui;bundle-version="2.6.0", org.eclipse.core.databinding.observable;bundle-version="1.3.0", org.eclipse.e4.tools.emf.ui;bundle-version="0.9.0", org.eclipse.e4.ui.workbench;bundle-version="0.9.1", @@ -21,6 +20,7 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0", org.eclipse.e4.core.contexts;bundle-version="0.9.0", org.eclipse.e4.core.di;bundle-version="0.9.0", - org.eclipse.e4.core.services;bundle-version="0.9.1" + org.eclipse.e4.core.services;bundle-version="0.9.1", + org.eclipse.emf.edit;bundle-version="2.6.0" Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/contextfunction.xml Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java index cfbeaef289..d8b8f5919c 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java @@ -17,7 +17,6 @@ import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; import org.eclipse.e4.ui.css.swt.theme.IThemeManager; import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.edit.ui.util.EditUIUtil; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java index 77a360960d..201d703644 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java @@ -2,9 +2,9 @@ import org.eclipse.e4.core.contexts.ContextFunction; import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.tools.emf.editor3x.emf.EditUIUtil; import org.eclipse.e4.tools.emf.ui.common.XMIModelResource; import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.edit.ui.util.EditUIUtil; import org.eclipse.ui.IEditorInput; public class XMIResourceFunction extends ContextFunction { diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/emf/EditUIUtil.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/emf/EditUIUtil.java new file mode 100644 index 0000000000..39074b0341 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/emf/EditUIUtil.java @@ -0,0 +1,87 @@ +package org.eclipse.e4.tools.emf.editor3x.emf; + +import java.lang.reflect.Method; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.common.util.URI; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IURIEditorInput; +import org.osgi.framework.Bundle; + +public class EditUIUtil { + static final Class FILE_CLASS; + static { + Class fileClass = null; + try { + fileClass = IFile.class; + } catch (Throwable exception) { + // Ignore any exceptions and assume the class isn't available. + } + FILE_CLASS = fileClass; + } + + static final Class FILE_REVISION_CLASS; + static final Method FILE_REVISION_GET_URI_METHOD; + static { + Class fileRevisionClass = null; + Method fileRevisionGetURIMethod = null; + Bundle bundle = Platform.getBundle("org.eclipse.team.core"); + if (bundle != null + && (bundle.getState() & (Bundle.ACTIVE | Bundle.STARTING | Bundle.RESOLVED)) != 0) { + try { + fileRevisionClass = bundle + .loadClass("org.eclipse.team.core.history.IFileRevision"); + fileRevisionGetURIMethod = fileRevisionClass + .getMethod("getURI"); + } catch (Throwable exeption) { + // Ignore any exceptions and assume the class isn't available. + } + } + FILE_REVISION_CLASS = fileRevisionClass; + FILE_REVISION_GET_URI_METHOD = fileRevisionGetURIMethod; + } + + static final Class URI_EDITOR_INPUT_CLASS; + static { + Class uriEditorInputClass = null; + try { + uriEditorInputClass = IURIEditorInput.class; + } catch (Throwable exception) { + // The class is not available. + } + URI_EDITOR_INPUT_CLASS = uriEditorInputClass; + } + + public static URI getURI(IEditorInput editorInput) { + + if (FILE_CLASS != null) { + IFile file = (IFile) editorInput.getAdapter(FILE_CLASS); + if (file != null) { + return URI.createPlatformResourceURI(file.getFullPath() + .toString(), true); + } + } + if (FILE_REVISION_CLASS != null) { + Object fileRevision = editorInput.getAdapter(FILE_REVISION_CLASS); + if (fileRevision != null) { + try { + return URI + .createURI(((java.net.URI) FILE_REVISION_GET_URI_METHOD + .invoke(fileRevision)).toString()); + } catch (Throwable exception) { + // TODO Log error + } + } + } + if (URI_EDITOR_INPUT_CLASS != null) { + if (editorInput instanceof IURIEditorInput) { + return URI.createURI( + ((IURIEditorInput) editorInput).getURI().toString()) + .trimFragment(); + } + } + + return null; + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index ce71a25a67..126b5f3432 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -15,7 +15,6 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.jface;bundle-version="3.6.0", org.eclipse.emf.edit;bundle-version="2.6.0", org.eclipse.equinox.common;bundle-version="3.6.0", - org.eclipse.e4.ui.model.workbench.edit;bundle-version="0.9.1", org.eclipse.emf.databinding.edit;bundle-version="1.2.0", com.ibm.icu;bundle-version="4.2.1", org.eclipse.core.resources;bundle-version="3.6.0", From ca0617a4572b729c282d9ee1245b9e3d265febde Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 7 May 2010 20:38:56 +0000 Subject: [PATCH 0092/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * add selection injection and delivering --- .../META-INF/MANIFEST.MF | 5 ++- .../OSGI-INF/selectionproviderfunction.xml | 8 ++++ ...ion.xml => xmiresourcecontextfunction.xml} | 0 .../build.properties | 3 +- .../plugin.xml | 7 --- .../editor3x/compat/E4CompatEditorPart.java | 43 +++++++++++++++++-- .../compat/IEclipseContextServiceFactory.java | 32 ++++++++++---- .../SelectionProviderContextFunction.java | 29 +++++++++++++ .../META-INF/MANIFEST.MF | 3 +- .../ui/common/ISelectionProviderService.java | 5 +++ .../emf/ui/internal/common/ModelEditor.java | 34 +++++++++------ 11 files changed, 133 insertions(+), 36 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/selectionproviderfunction.xml rename bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/{contextfunction.xml => xmiresourcecontextfunction.xml} (100%) create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ISelectionProviderService.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index f93cda5a54..69418fc9db 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -21,6 +21,7 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.core.contexts;bundle-version="0.9.0", org.eclipse.e4.core.di;bundle-version="0.9.0", org.eclipse.e4.core.services;bundle-version="0.9.1", - org.eclipse.emf.edit;bundle-version="2.6.0" -Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/contextfunction.xml + org.eclipse.emf.edit;bundle-version="2.6.0", + org.eclipse.e4.ui.services;bundle-version="0.9.1" +Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/xmiresourcecontextfunction.xml, OSGI-INF/selectionproviderfunction.xml Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/selectionproviderfunction.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/selectionproviderfunction.xml new file mode 100644 index 0000000000..73d6e010dd --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/selectionproviderfunction.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/contextfunction.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/xmiresourcecontextfunction.xml similarity index 100% rename from bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/contextfunction.xml rename to bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/xmiresourcecontextfunction.xml diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties index 30bd06c0cf..69419d0dd0 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties @@ -4,5 +4,6 @@ bin.includes = META-INF/,\ plugin.xml,\ icons/,\ OSGI-INF/pdecontributionprovider.xml,\ - OSGI-INF/contextfunction.xml + OSGI-INF/xmiresourcecontextfunction.xml,\ + OSGI-INF/selectionproviderfunction.xml source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml index 2fa5805338..3859e5668b 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml @@ -47,12 +47,5 @@ - - - - - diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java index b5f9d552fd..9368835102 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java @@ -2,17 +2,22 @@ import org.eclipse.core.runtime.IExecutableExtension; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.ListenerList; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.core.services.contributions.IContributionFactory; import org.eclipse.e4.tools.emf.editor3x.E4WorkbenchModelEditor; import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; import org.eclipse.e4.ui.css.swt.theme.IThemeManager; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.PartInitException; import org.eclipse.ui.part.EditorPart; import org.osgi.framework.Bundle; @@ -49,12 +54,15 @@ public void init(IEditorSite site, IEditorInput input) setInput(input); IEclipseContext parentContext = (IEclipseContext) getSite().getService(IEclipseContext.class); - System.err.println("The parent context: " + parentContext); context = parentContext.createChild("EditPart('"+getPartName()+"')"); //$NON-NLS-1$ context.declareModifiable(IEditorInput.class); context.declareModifiable(EditorPart.class); context.set(EditorPart.class,this); - context.set(IEditorInput.class, input); + context.set(IEditorInput.class, input); + + ISelectionProvider s = new SelectionProviderImpl(); + context.set(ISelectionProvider.class, s); + site.setSelectionProvider(s); } @Override @@ -103,6 +111,35 @@ public void setFocus() { @Override public void dispose() { context.dispose(); + context = null; super.dispose(); } + + private class SelectionProviderImpl implements ISelectionProvider { + private ISelection currentSelection = StructuredSelection.EMPTY; + + private ListenerList listeners = new ListenerList(); + + public void setSelection(ISelection selection) { + currentSelection = selection; + SelectionChangedEvent evt = new SelectionChangedEvent(this, selection); + + for( Object l : listeners.getListeners() ) { + ((ISelectionChangedListener)l).selectionChanged(evt); + } + } + + public void removeSelectionChangedListener( + ISelectionChangedListener listener) { + listeners.remove(listener); + } + + public ISelection getSelection() { + return currentSelection; + } + + public void addSelectionChangedListener(ISelectionChangedListener listener) { + listeners.add(listener); + } + } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java index d3d9251455..69dab9c382 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java @@ -5,10 +5,15 @@ import org.eclipse.e4.core.contexts.EclipseContextFactory; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.core.services.contributions.IContributionFactory; +import org.eclipse.e4.ui.services.IServiceConstants; import org.eclipse.e4.workbench.modeling.ESelectionService; import org.eclipse.e4.workbench.ui.IWorkbench; import org.eclipse.e4.workbench.ui.internal.ReflectionContributionFactory; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.ISelectionService; +import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPartSite; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.internal.services.IWorkbenchLocationService; @@ -55,16 +60,25 @@ public Object create(Class serviceInterface, IServiceLocator parentLocator, appContext.set(IContributionFactory.class.getName(),contributionFactory); return appContext; - } /*else if( o != null && site == null ) { - IEclipseContext windowContext = ((IEclipseContext)o).createChild("WindowContext("+window+")"); -// windowContext.declareModifiable(ESelectionService.class); -// //FIXME This is not correct we need to use DI :-) -// windowContext.set(ESelectionService.class, new E4CompatSelectionService(window)); - + } else if( o != null && site == null ) { + final IEclipseContext windowContext = ((IEclipseContext)o).createChild("WindowContext("+window+")"); + windowContext.set(ISelectionService.class, window.getSelectionService()); + window.getSelectionService().addSelectionListener(new ISelectionListener() { + + public void selectionChanged(IWorkbenchPart part, ISelection selection) { + if( ! selection.isEmpty() ) { + IStructuredSelection s = (IStructuredSelection) selection; + if( s.size() == 1 ) { + windowContext.set(IServiceConstants.SELECTION, s.getFirstElement()); + } else { + windowContext.set(IServiceConstants.SELECTION, s.toList()); + } + } + } + }); return windowContext; - }*/ + } return o; } - -} +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java new file mode 100644 index 0000000000..42b59ca15a --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java @@ -0,0 +1,29 @@ +package org.eclipse.e4.tools.emf.editor3x.compat; + +import java.util.List; + +import org.eclipse.e4.core.contexts.ContextFunction; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.tools.emf.ui.common.ISelectionProviderService; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.StructuredSelection; + +public class SelectionProviderContextFunction extends ContextFunction { + + @Override + public Object compute(final IEclipseContext context, Object[] arguments) { + return new ISelectionProviderService() { + + public void setSelection(Object selection) { + ISelectionProvider pv = context.get(ISelectionProvider.class); + + if( selection instanceof List ) { + pv.setSelection(new StructuredSelection((List)selection)); + } else { + pv.setSelection(new StructuredSelection(selection)); + } + + } + }; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 126b5f3432..4a3d1f26ce 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -22,7 +22,8 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.osgi;bundle-version="3.6.0", org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0", org.eclipse.e4.core.di;bundle-version="0.9.0", - org.eclipse.e4.ui.workbench;bundle-version="0.9.1" + org.eclipse.e4.ui.workbench;bundle-version="0.9.1", + org.eclipse.e4.ui.services;bundle-version="0.9.1" Bundle-ActivationPolicy: lazy Import-Package: javax.inject;version="1.0.0", org.osgi.framework;version="1.5.0" diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ISelectionProviderService.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ISelectionProviderService.java new file mode 100644 index 0000000000..3c1d3d5fcd --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ISelectionProviderService.java @@ -0,0 +1,5 @@ +package org.eclipse.e4.tools.emf.ui.common; + +public interface ISelectionProviderService { + public void setSelection(Object selection); +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 9eb0780591..cf8ddc1dcf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -17,6 +17,7 @@ import java.util.Map; import javax.inject.Inject; +import javax.inject.Named; import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -31,6 +32,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.common.ISelectionProviderService; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ShadowComposite; import org.eclipse.e4.tools.emf.ui.internal.common.component.AddonsEditor; @@ -76,6 +78,7 @@ import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.e4.ui.services.IServiceConstants; import org.eclipse.e4.workbench.modeling.ESelectionService; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; @@ -132,7 +135,7 @@ public class ModelEditor { private TreeViewer viewer; private IModelResource modelProvider; private IProject project; -// private ESelectionService selectionService; + private ISelectionProviderService selectionService; public ModelEditor(Composite composite, IModelResource modelProvider, IProject project) { this.modelProvider = modelProvider; @@ -226,9 +229,9 @@ public void selectionChanged(SelectionChangedEvent event) { Rectangle r = scrolling.getClientArea(); scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); -// if( selectionService != null ) { -// selectionService.setSelection(s.getFirstElement()); -// } + if( selectionService != null ) { + selectionService.setSelection(s.getFirstElement()); + } } } @@ -266,15 +269,20 @@ public void menuAboutToShow(IMenuManager manager) { viewer.getControl().setMenu(mgr.createContextMenu(viewer.getControl())); } -// @Inject -// public void setSelectionService(ESelectionService selectionService) { -// this.selectionService = selectionService; -// if( viewer != null && ! viewer.getControl().isDisposed() ) { -// if( ! viewer.getSelection().isEmpty() ) { -// selectionService.setSelection(((IStructuredSelection)viewer.getSelection()).getFirstElement()); -// } -// } -// } + @Inject @Optional + public void setSelectionService(ISelectionProviderService selectionService) { + this.selectionService = selectionService; + if( viewer != null && ! viewer.getControl().isDisposed() ) { + if( ! viewer.getSelection().isEmpty() ) { + selectionService.setSelection(((IStructuredSelection)viewer.getSelection()).getFirstElement()); + } + } + } + + @Inject + public void updateSelection(@Optional @Named(IServiceConstants.SELECTION) Object selection ) { + System.err.println("The selection: " + selection); + } private TreeViewer createTreeViewerArea(Composite parent) { parent = new Composite(parent, SWT.NONE); From a7964d9ab6f92f8a099331067bc14205026fb005 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 7 May 2010 21:21:06 +0000 Subject: [PATCH 0093/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * adding dirty lifecycle support --- .../emf/editor3x/XMIResourceFunction.java | 21 +++++++++++++++++-- .../editor3x/compat/E4CompatEditorPart.java | 13 ++++++++---- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java index 201d703644..518468e103 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java @@ -2,19 +2,36 @@ import org.eclipse.e4.core.contexts.ContextFunction; import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.tools.emf.editor3x.compat.E4CompatEditorPart; import org.eclipse.e4.tools.emf.editor3x.emf.EditUIUtil; import org.eclipse.e4.tools.emf.ui.common.XMIModelResource; +import org.eclipse.e4.tools.emf.ui.common.IModelResource.ModelListener; import org.eclipse.emf.common.util.URI; import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.part.EditorPart; public class XMIResourceFunction extends ContextFunction { @Override - public Object compute(IEclipseContext context, Object[] arguments) { + public Object compute(final IEclipseContext context, Object[] arguments) { final IEditorInput input = context.get(IEditorInput.class); + final E4CompatEditorPart part = (E4CompatEditorPart) context.get(EditorPart.class); + if( input != null ) { URI resourceURI = EditUIUtil.getURI(input); - return new XMIModelResource(resourceURI); + final XMIModelResource resource = new XMIModelResource(resourceURI); + resource.addModelListener(new ModelListener() { + + public void dirtyChanged() { + context.set(EditorPart.class.getName()+".dirty", resource.isDirty()); + part.firePropertyChange(EditorPart.PROP_DIRTY); + } + + public void commandStackChanged() { + + } + }); + return resource; } return null; diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java index 9368835102..440d7d2a07 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java @@ -37,8 +37,8 @@ public E4CompatEditorPart(String classUri) { @Override public void doSave(IProgressMonitor monitor) { - // TODO Auto-generated method stub - + IContributionFactory factory = (IContributionFactory) context.get(IContributionFactory.class); + factory.call(instance, null, "doSave", context, null); } @Override @@ -65,10 +65,15 @@ public void init(IEditorSite site, IEditorInput input) site.setSelectionProvider(s); } + @Override + public void firePropertyChange(int propertyId) { + super.firePropertyChange(propertyId); + } + @Override public boolean isDirty() { - // TODO Auto-generated method stub - return false; + Boolean b = (Boolean) context.get(EditorPart.class.getName()+".dirty"); + return b != null && b; } @Override From e457197d9b2baaf2d2bb08a184f3c292f66ee2ce Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 14 May 2010 13:05:19 +0000 Subject: [PATCH 0094/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixing support for e4-compat --- .../editor3x/compat/E4CompatEditorPart.java | 27 +++++++++++++++---- .../compat/IEclipseContextServiceFactory.java | 9 +++---- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java index 440d7d2a07..b17adaa42f 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java @@ -8,6 +8,7 @@ import org.eclipse.e4.tools.emf.editor3x.E4WorkbenchModelEditor; import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; import org.eclipse.e4.ui.css.swt.theme.IThemeManager; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; @@ -18,6 +19,9 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.ISelectionListener; +import org.eclipse.ui.ISelectionService; +import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.PartInitException; import org.eclipse.ui.part.EditorPart; import org.osgi.framework.Bundle; @@ -54,15 +58,21 @@ public void init(IEditorSite site, IEditorInput input) setInput(input); IEclipseContext parentContext = (IEclipseContext) getSite().getService(IEclipseContext.class); - context = parentContext.createChild("EditPart('"+getPartName()+"')"); //$NON-NLS-1$ + +// System.err.println("The context" + parentContext); + + // We are in e4 Compat-Mode + if( parentContext.get("org.eclipse.e4.workbench.ui.IPresentationEngine") != null ) { + MPart p = (MPart) getSite().getService(MPart.class); + context = p.getContext(); + } else { + context = parentContext.createChild("EditPart('"+getPartName()+"')"); //$NON-NLS-1$ + } + context.declareModifiable(IEditorInput.class); context.declareModifiable(EditorPart.class); context.set(EditorPart.class,this); context.set(IEditorInput.class, input); - - ISelectionProvider s = new SelectionProviderImpl(); - context.set(ISelectionProvider.class, s); - site.setSelectionProvider(s); } @Override @@ -84,6 +94,11 @@ public boolean isSaveAsAllowed() { @Override public void createPartControl(Composite parent) { + ISelectionProvider s = new SelectionProviderImpl(); + context.set(ISelectionProvider.class, s); + getSite().setSelectionProvider(s); + + Composite comp = new Composite(parent, SWT.NONE); comp.setBackgroundMode(SWT.INHERIT_DEFAULT); @@ -140,10 +155,12 @@ public void removeSelectionChangedListener( } public ISelection getSelection() { + System.err.println("Selection: " + currentSelection); return currentSelection; } public void addSelectionChangedListener(ISelectionChangedListener listener) { + System.err.println("Adding listener: " + listener); listeners.add(listener); } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java index 69dab9c382..8380681048 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java @@ -6,8 +6,6 @@ import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.core.services.contributions.IContributionFactory; import org.eclipse.e4.ui.services.IServiceConstants; -import org.eclipse.e4.workbench.modeling.ESelectionService; -import org.eclipse.e4.workbench.ui.IWorkbench; import org.eclipse.e4.workbench.ui.internal.ReflectionContributionFactory; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; @@ -40,10 +38,9 @@ public Object create(Class serviceInterface, IServiceLocator parentLocator, final IWorkbenchWindow window = wls.getWorkbenchWindow(); final IWorkbenchPartSite site = wls.getPartSite(); - System.err.println("The locator: " + locator); - System.err.println(" Window: " + window); - System.err.println(" Site: " + site); - +// System.err.println("The locator: " + locator); +// System.err.println(" Window: " + window); +// System.err.println(" Site: " + site); Object o = parentLocator.getService(serviceInterface); From e0dbdbc081c962ef2c08eed091b74ed57b30c906 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 14 May 2010 15:22:33 +0000 Subject: [PATCH 0095/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * remove unneeded selection injection --- .../e4/tools/emf/ui/internal/common/ModelEditor.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index cf8ddc1dcf..85adc0dfc9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -17,7 +17,6 @@ import java.util.Map; import javax.inject.Inject; -import javax.inject.Named; import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -78,8 +77,6 @@ import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.e4.ui.services.IServiceConstants; -import org.eclipse.e4.workbench.modeling.ESelectionService; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.ecore.EClass; @@ -279,10 +276,10 @@ public void setSelectionService(ISelectionProviderService selectionService) { } } - @Inject - public void updateSelection(@Optional @Named(IServiceConstants.SELECTION) Object selection ) { - System.err.println("The selection: " + selection); - } +// @Inject +// public void updateSelection(@Optional @Named(IServiceConstants.SELECTION) Object selection ) { +// System.err.println("The selection: " + selection); +// } private TreeViewer createTreeViewerArea(Composite parent) { parent = new Composite(parent, SWT.NONE); From b5e2a3df5b1a0d406a330e373a497fbb9d7022db Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 14 May 2010 17:29:00 +0000 Subject: [PATCH 0096/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixed problem of not passing IProject --- .../e4/tools/emf/editor3x/compat/E4CompatEditorPart.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java index b17adaa42f..ae098740c8 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java @@ -1,5 +1,6 @@ package org.eclipse.e4.tools.emf.editor3x.compat; +import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IExecutableExtension; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.ListenerList; @@ -19,6 +20,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.ISelectionService; import org.eclipse.ui.IWorkbenchPart; @@ -71,8 +73,15 @@ public void init(IEditorSite site, IEditorInput input) context.declareModifiable(IEditorInput.class); context.declareModifiable(EditorPart.class); + context.set(EditorPart.class,this); context.set(IEditorInput.class, input); + + if( input instanceof IFileEditorInput ) { + IFileEditorInput fInput = (IFileEditorInput)getEditorInput(); + context.set(IProject.class, fInput.getFile().getProject()); + } + } @Override From bc5d0c35f82c593dd6cc0ff6aa4e798edea8a79c Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 15 May 2010 09:47:49 +0000 Subject: [PATCH 0097/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * refactored to use a hashmap for registering virtual editors --- .../emf/ui/internal/common/ModelEditor.java | 62 ++++++++++--------- .../emf/ui/internal/common/VirtualEntry.java | 6 +- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 85adc0dfc9..6c1a85359b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -108,22 +108,22 @@ public class ModelEditor { private static final String CSS_CLASS_KEY = "org.eclipse.e4.ui.css.CssClassName"; //$NON-NLS-1$ - public static final int VIRTUAL_PART_MENU = 0; - public static final int VIRTUAL_PART = 1; - public static final int VIRTUAL_HANDLER = 2; - public static final int VIRTUAL_BINDING_TABLE = 3; - public static final int VIRTUAL_COMMAND = 4; - public static final int VIRTUAL_WINDOWS = 5; - public static final int VIRTUAL_WINDOW_CONTROLS = 6; - public static final int VIRTUAL_PART_DESCRIPTORS = 7; - public static final int VIRTUAL_MODEL_COMP_COMMANDS = 8; - public static final int VIRTUAL_MODEL_COMP_BINDINGS = 9; - public static final int VIRTUAL_PARTDESCRIPTOR_MENU = 10; - public static final int VIRTUAL_TRIMMED_WINDOW_TRIMS = 11; - public static final int VIRTUAL_ADDONS = 12; + public static final String VIRTUAL_PART_MENU = ModelEditor.class.getName() + ".VIRTUAL_PART_MENU"; //$NON-NLS-1$ + public static final String VIRTUAL_PART = ModelEditor.class.getName() + ".VIRTUAL_PART"; //$NON-NLS-1$ + public static final String VIRTUAL_HANDLER = ModelEditor.class.getName() + ".VIRTUAL_HANDLER"; //$NON-NLS-1$ + public static final String VIRTUAL_BINDING_TABLE = ModelEditor.class.getName() + ".VIRTUAL_BINDING_TABLE"; //$NON-NLS-1$ + public static final String VIRTUAL_COMMAND = ModelEditor.class.getName() + ".VIRTUAL_BINDING_TABLE"; //$NON-NLS-1$ + public static final String VIRTUAL_WINDOWS = ModelEditor.class.getName() + ".VIRTUAL_BINDING_TABLE"; //$NON-NLS-1$ + public static final String VIRTUAL_WINDOW_CONTROLS = ModelEditor.class.getName() + ".VIRTUAL_BINDING_TABLE"; //$NON-NLS-1$ + public static final String VIRTUAL_PART_DESCRIPTORS = ModelEditor.class.getName() + ".VIRTUAL_PART_DESCRIPTORS"; //$NON-NLS-1$ + public static final String VIRTUAL_MODEL_COMP_COMMANDS = ModelEditor.class.getName() + ".VIRTUAL_PART_DESCRIPTORS"; //$NON-NLS-1$ + public static final String VIRTUAL_MODEL_COMP_BINDINGS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_COMP_BINDINGS"; //$NON-NLS-1$ + public static final String VIRTUAL_PARTDESCRIPTOR_MENU = ModelEditor.class.getName() + ".VIRTUAL_MODEL_COMP_BINDINGS"; //$NON-NLS-1$ + public static final String VIRTUAL_TRIMMED_WINDOW_TRIMS = ModelEditor.class.getName() + ".VIRTUAL_TRIMMED_WINDOW_TRIMS"; //$NON-NLS-1$ + public static final String VIRTUAL_ADDONS = ModelEditor.class.getName() + ".VIRTUAL_TRIMMED_WINDOW_TRIMS"; //$NON-NLS-1$ private Map editorMap = new HashMap(); - private AbstractComponentEditor[] virtualEditors; + private Map virtualEditors = new HashMap(); private List labelFeaturePaths = new ArrayList(); // private List editors = new @@ -137,8 +137,12 @@ public class ModelEditor { public ModelEditor(Composite composite, IModelResource modelProvider, IProject project) { this.modelProvider = modelProvider; this.project = project; + registerDefaultEditors(); registerVirtualEditors(); + + + SashForm form = new SashForm(composite, SWT.HORIZONTAL); form.setBackground(form.getDisplay().getSystemColor(SWT.COLOR_WHITE)); @@ -212,7 +216,7 @@ public void selectionChanged(SelectionChangedEvent event) { } } else { VirtualEntry entry = (VirtualEntry) s.getFirstElement(); - AbstractComponentEditor editor = virtualEditors[entry.getId()]; + AbstractComponentEditor editor = virtualEditors.get(entry.getId()); if (editor != null) { textLabel.setText(editor.getLabel(entry)); iconLabel.setImage(editor.getImage(entry, iconLabel.getDisplay())); @@ -246,7 +250,7 @@ public void menuAboutToShow(IMenuManager manager) { if( ! s.isEmpty() ) { List actions; if( s.getFirstElement() instanceof VirtualEntry ) { - actions = virtualEditors[((VirtualEntry)s.getFirstElement()).getId()].getActions(s.getFirstElement()); + actions = virtualEditors.get(((VirtualEntry)s.getFirstElement()).getId()).getActions(s.getFirstElement()); } else { EObject o = (EObject) s.getFirstElement(); AbstractComponentEditor editor = editorMap.get(o.eClass()); @@ -332,20 +336,18 @@ public void handleMapChange(MapChangeEvent event) { } private void registerVirtualEditors() { - virtualEditors = new AbstractComponentEditor[] { new VMenuEditor(modelProvider.getEditingDomain(), this, BasicPackageImpl.Literals.PART__MENUS), // V-Menu - null, // V-Part - new VHandlerEditor(modelProvider.getEditingDomain(), this), - new VBindingTableEditor(modelProvider.getEditingDomain(), this), - new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.APPLICATION__COMMANDS), - new VWindowEditor(modelProvider.getEditingDomain(), this), - new VWindowControlEditor(modelProvider.getEditingDomain(), this), - new VPartDescriptor(modelProvider.getEditingDomain(), this), - new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.MODEL_COMPONENT__COMMANDS), - new VModelComponentBindingEditor(modelProvider.getEditingDomain(), this), - new VMenuEditor(modelProvider.getEditingDomain(), this, org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS), - new VWindowTrimEditor(modelProvider.getEditingDomain(), this), - new VApplicationAddons(modelProvider.getEditingDomain(), this) - }; + virtualEditors.put(VIRTUAL_PART_MENU, new VMenuEditor(modelProvider.getEditingDomain(), this, BasicPackageImpl.Literals.PART__MENUS)); + virtualEditors.put(VIRTUAL_HANDLER, new VHandlerEditor(modelProvider.getEditingDomain(), this)); + virtualEditors.put(VIRTUAL_BINDING_TABLE,new VBindingTableEditor(modelProvider.getEditingDomain(), this)); + virtualEditors.put(VIRTUAL_COMMAND,new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.APPLICATION__COMMANDS)); + virtualEditors.put(VIRTUAL_WINDOWS, new VWindowEditor(modelProvider.getEditingDomain(), this)); + virtualEditors.put(VIRTUAL_WINDOW_CONTROLS, new VWindowControlEditor(modelProvider.getEditingDomain(), this)); + virtualEditors.put(VIRTUAL_PART_DESCRIPTORS, new VPartDescriptor(modelProvider.getEditingDomain(), this)); + virtualEditors.put(VIRTUAL_MODEL_COMP_COMMANDS, new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.MODEL_COMPONENT__COMMANDS)); + virtualEditors.put(VIRTUAL_MODEL_COMP_BINDINGS, new VModelComponentBindingEditor(modelProvider.getEditingDomain(), this)); + virtualEditors.put(VIRTUAL_PARTDESCRIPTOR_MENU, new VMenuEditor(modelProvider.getEditingDomain(), this, org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS)); + virtualEditors.put(VIRTUAL_TRIMMED_WINDOW_TRIMS, new VWindowTrimEditor(modelProvider.getEditingDomain(), this)); + virtualEditors.put(VIRTUAL_ADDONS, new VApplicationAddons(modelProvider.getEditingDomain(), this)); } public void setSelection(Object element) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java index abd4625833..46279ef22b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java @@ -22,12 +22,12 @@ import org.eclipse.core.databinding.property.list.IListProperty; public abstract class VirtualEntry { - private int id; + private String id; private Object originalParent; private String label; private IObservableList list; - public VirtualEntry(int id, IListProperty property, Object originalParent, String label) { + public VirtualEntry(String id, IListProperty property, Object originalParent, String label) { this.id = id; this.originalParent = originalParent; this.label = label; @@ -68,7 +68,7 @@ public Object getOriginalParent() { return originalParent; } - public int getId() { + public String getId() { return id; } From 64030ec0821dde9ed7f6ed7d28c00ddaf17d49a4 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 15 May 2010 11:00:14 +0000 Subject: [PATCH 0098/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * started adding contributions --- .../META-INF/MANIFEST.MF | 4 +- .../org.eclipse.e4.tools.emf.ui/plugin.xml | 1 + .../org.eclipse.e4.tools.emf.ui.editors.exsd | 102 ++++++++++++++++++ .../emf/ui/common/IEditorDescriptor.java | 8 ++ .../emf/ui/internal/common/ModelEditor.java | 34 +++++- .../internal/wbm/ApplicationModelEditor.java | 5 +- 6 files changed, 149 insertions(+), 5 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorDescriptor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 4a3d1f26ce..073c16d827 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -23,7 +23,9 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0", org.eclipse.e4.core.di;bundle-version="0.9.0", org.eclipse.e4.ui.workbench;bundle-version="0.9.1", - org.eclipse.e4.ui.services;bundle-version="0.9.1" + org.eclipse.e4.ui.services;bundle-version="0.9.1", + org.eclipse.equinox.registry;bundle-version="3.5.0", + org.eclipse.e4.core.contexts;bundle-version="0.9.0" Bundle-ActivationPolicy: lazy Import-Package: javax.inject;version="1.0.0", org.osgi.framework;version="1.5.0" diff --git a/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml b/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml index 1b2fb64bfe..b3cd9703c8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml +++ b/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml @@ -1,6 +1,7 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorDescriptor.java new file mode 100644 index 0000000000..de57bc4ae2 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorDescriptor.java @@ -0,0 +1,8 @@ +package org.eclipse.e4.tools.emf.ui.common; + +import org.eclipse.emf.ecore.EClass; + +public interface IEditorDescriptor { + public EClass getEClass(); + public Class getEditorClass(); +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 6c1a85359b..3ae1ccddb7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -28,8 +28,17 @@ import org.eclipse.core.databinding.observable.set.SetChangeEvent; import org.eclipse.core.databinding.observable.set.WritableSet; import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.RegistryFactory; +import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.core.di.annotations.Optional; +import org.eclipse.e4.core.services.contributions.IContributionFactory; +import org.eclipse.e4.tools.emf.ui.common.IEditorDescriptor; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.ISelectionProviderService; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -81,6 +90,7 @@ import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; @@ -133,14 +143,16 @@ public class ModelEditor { private IModelResource modelProvider; private IProject project; private ISelectionProviderService selectionService; + private IEclipseContext context; - public ModelEditor(Composite composite, IModelResource modelProvider, IProject project) { + public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project) { this.modelProvider = modelProvider; this.project = project; + this.context = context; registerDefaultEditors(); registerVirtualEditors(); - + registerContributedEditors(); SashForm form = new SashForm(composite, SWT.HORIZONTAL); @@ -353,6 +365,24 @@ private void registerVirtualEditors() { public void setSelection(Object element) { viewer.setSelection(new StructuredSelection(element)); } + + private void registerContributedEditors() { + IExtensionRegistry registry = RegistryFactory.getRegistry(); + IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ + + for( IConfigurationElement el : extPoint.getConfigurationElements() ) { + try { + IEditorDescriptor desc = (IEditorDescriptor) el.createExecutableExtension("descriptorClass"); //$NON-NLS-1$ + EClass eClass = desc.getEClass(); + IContributionFactory fact = context.get(IContributionFactory.class); + AbstractComponentEditor editor = (AbstractComponentEditor) fact.create("platform:/plugin/"+el.getContributor().getName()+"/"+desc.getEditorClass().getName(), context); //$NON-NLS-1$ //$NON-NLS-2$ + registerEditor(eClass, editor); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } private void registerDefaultEditors() { registerEditor(ApplicationPackageImpl.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain())); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java index 4104bbecd2..fe83cd6563 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java @@ -13,6 +13,7 @@ import javax.inject.Inject; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; @@ -20,8 +21,8 @@ public class ApplicationModelEditor extends ModelEditor { @Inject - public ApplicationModelEditor(Composite composite, + public ApplicationModelEditor(Composite composite, IEclipseContext context, @Optional IModelResource modelProvider, @Optional IProject project) { - super(composite, modelProvider, project); + super(composite, context, modelProvider, project); } } From 86060cf31cd8084e46b9c9f4e4e825238ed9c2df Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 15 May 2010 12:03:40 +0000 Subject: [PATCH 0099/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixed ids --- .../META-INF/MANIFEST.MF | 1 + .../org.eclipse.e4.tools.emf.ui.editors.exsd | 23 +++++++ .../emf/ui/internal/common/ModelEditor.java | 65 +++++++++++++------ .../component/virtual/VPartDescriptor.java | 2 +- 4 files changed, 69 insertions(+), 22 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 073c16d827..ed036f7e4f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -31,6 +31,7 @@ Import-Package: javax.inject;version="1.0.0", org.osgi.framework;version="1.5.0" Export-Package: org.eclipse.e4.tools.emf.ui.common, org.eclipse.e4.tools.emf.ui.common.component, + org.eclipse.e4.tools.emf.ui.internal;x-internal:=true, org.eclipse.e4.tools.emf.ui.internal.common;x-internal:=true, org.eclipse.e4.tools.emf.ui.internal.common.component;x-internal:=true, org.eclipse.e4.tools.emf.ui.internal.wbm;x-friends:="org.eclipse.e4.tools.emf.editor" diff --git a/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd b/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd index aec2bebe99..352421fdf6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd +++ b/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd @@ -19,6 +19,7 @@ + @@ -62,6 +63,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 3ae1ccddb7..9f607398a3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -30,7 +30,6 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.IExtensionRegistry; import org.eclipse.core.runtime.IProgressMonitor; @@ -90,7 +89,6 @@ import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; @@ -122,15 +120,15 @@ public class ModelEditor { public static final String VIRTUAL_PART = ModelEditor.class.getName() + ".VIRTUAL_PART"; //$NON-NLS-1$ public static final String VIRTUAL_HANDLER = ModelEditor.class.getName() + ".VIRTUAL_HANDLER"; //$NON-NLS-1$ public static final String VIRTUAL_BINDING_TABLE = ModelEditor.class.getName() + ".VIRTUAL_BINDING_TABLE"; //$NON-NLS-1$ - public static final String VIRTUAL_COMMAND = ModelEditor.class.getName() + ".VIRTUAL_BINDING_TABLE"; //$NON-NLS-1$ - public static final String VIRTUAL_WINDOWS = ModelEditor.class.getName() + ".VIRTUAL_BINDING_TABLE"; //$NON-NLS-1$ - public static final String VIRTUAL_WINDOW_CONTROLS = ModelEditor.class.getName() + ".VIRTUAL_BINDING_TABLE"; //$NON-NLS-1$ + public static final String VIRTUAL_COMMAND = ModelEditor.class.getName() + ".VIRTUAL_COMMAND"; //$NON-NLS-1$ + public static final String VIRTUAL_WINDOWS = ModelEditor.class.getName() + ".VIRTUAL_WINDOWS"; //$NON-NLS-1$ + public static final String VIRTUAL_WINDOW_CONTROLS = ModelEditor.class.getName() + ".VIRTUAL_WINDOW_CONTROLS"; //$NON-NLS-1$ public static final String VIRTUAL_PART_DESCRIPTORS = ModelEditor.class.getName() + ".VIRTUAL_PART_DESCRIPTORS"; //$NON-NLS-1$ - public static final String VIRTUAL_MODEL_COMP_COMMANDS = ModelEditor.class.getName() + ".VIRTUAL_PART_DESCRIPTORS"; //$NON-NLS-1$ + public static final String VIRTUAL_MODEL_COMP_COMMANDS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_COMP_COMMANDS"; //$NON-NLS-1$ public static final String VIRTUAL_MODEL_COMP_BINDINGS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_COMP_BINDINGS"; //$NON-NLS-1$ - public static final String VIRTUAL_PARTDESCRIPTOR_MENU = ModelEditor.class.getName() + ".VIRTUAL_MODEL_COMP_BINDINGS"; //$NON-NLS-1$ + public static final String VIRTUAL_PARTDESCRIPTOR_MENU = ModelEditor.class.getName() + ".VIRTUAL_PARTDESCRIPTOR_MENU"; //$NON-NLS-1$ public static final String VIRTUAL_TRIMMED_WINDOW_TRIMS = ModelEditor.class.getName() + ".VIRTUAL_TRIMMED_WINDOW_TRIMS"; //$NON-NLS-1$ - public static final String VIRTUAL_ADDONS = ModelEditor.class.getName() + ".VIRTUAL_TRIMMED_WINDOW_TRIMS"; //$NON-NLS-1$ + public static final String VIRTUAL_ADDONS = ModelEditor.class.getName() + ".VIRTUAL_ADDONS"; //$NON-NLS-1$ private Map editorMap = new HashMap(); private Map virtualEditors = new HashMap(); @@ -152,8 +150,9 @@ public ModelEditor(Composite composite, IEclipseContext context, IModelResource registerDefaultEditors(); registerVirtualEditors(); - registerContributedEditors(); + registerContributedEditors(); + registerContributedVirtualEditors(); SashForm form = new SashForm(composite, SWT.HORIZONTAL); form.setBackground(form.getDisplay().getSystemColor(SWT.COLOR_WHITE)); @@ -346,22 +345,42 @@ public void handleMapChange(MapChangeEvent event) { return viewer; } + + private void registerContributedVirtualEditors() { + IExtensionRegistry registry = RegistryFactory.getRegistry(); + IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ + + for( IConfigurationElement el : extPoint.getConfigurationElements() ) { + if( ! "virtualeditor".equals(el.getName()) ) { + continue; + } + + IContributionFactory fact = context.get(IContributionFactory.class); + AbstractComponentEditor editor = (AbstractComponentEditor) fact.create("platform:/plugin/"+el.getContributor().getName()+"/"+el.getAttribute("class"), context); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + registerVirtualEditor(el.getAttribute("id"), editor); //$NON-NLS-1$ + } + } private void registerVirtualEditors() { - virtualEditors.put(VIRTUAL_PART_MENU, new VMenuEditor(modelProvider.getEditingDomain(), this, BasicPackageImpl.Literals.PART__MENUS)); - virtualEditors.put(VIRTUAL_HANDLER, new VHandlerEditor(modelProvider.getEditingDomain(), this)); - virtualEditors.put(VIRTUAL_BINDING_TABLE,new VBindingTableEditor(modelProvider.getEditingDomain(), this)); - virtualEditors.put(VIRTUAL_COMMAND,new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.APPLICATION__COMMANDS)); - virtualEditors.put(VIRTUAL_WINDOWS, new VWindowEditor(modelProvider.getEditingDomain(), this)); - virtualEditors.put(VIRTUAL_WINDOW_CONTROLS, new VWindowControlEditor(modelProvider.getEditingDomain(), this)); - virtualEditors.put(VIRTUAL_PART_DESCRIPTORS, new VPartDescriptor(modelProvider.getEditingDomain(), this)); - virtualEditors.put(VIRTUAL_MODEL_COMP_COMMANDS, new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.MODEL_COMPONENT__COMMANDS)); - virtualEditors.put(VIRTUAL_MODEL_COMP_BINDINGS, new VModelComponentBindingEditor(modelProvider.getEditingDomain(), this)); - virtualEditors.put(VIRTUAL_PARTDESCRIPTOR_MENU, new VMenuEditor(modelProvider.getEditingDomain(), this, org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS)); - virtualEditors.put(VIRTUAL_TRIMMED_WINDOW_TRIMS, new VWindowTrimEditor(modelProvider.getEditingDomain(), this)); - virtualEditors.put(VIRTUAL_ADDONS, new VApplicationAddons(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_PART_MENU, new VMenuEditor(modelProvider.getEditingDomain(), this, BasicPackageImpl.Literals.PART__MENUS)); + registerVirtualEditor(VIRTUAL_HANDLER, new VHandlerEditor(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_BINDING_TABLE,new VBindingTableEditor(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_COMMAND,new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.APPLICATION__COMMANDS)); + registerVirtualEditor(VIRTUAL_WINDOWS, new VWindowEditor(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_WINDOW_CONTROLS, new VWindowControlEditor(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_PART_DESCRIPTORS, new VPartDescriptor(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_MODEL_COMP_COMMANDS, new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.MODEL_COMPONENT__COMMANDS)); + registerVirtualEditor(VIRTUAL_MODEL_COMP_BINDINGS, new VModelComponentBindingEditor(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_PARTDESCRIPTOR_MENU, new VMenuEditor(modelProvider.getEditingDomain(), this, org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS)); + registerVirtualEditor(VIRTUAL_TRIMMED_WINDOW_TRIMS, new VWindowTrimEditor(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_ADDONS, new VApplicationAddons(modelProvider.getEditingDomain(), this)); } + private void registerVirtualEditor(String id, AbstractComponentEditor editor ) { +// System.err.println("Registering: " + id + " => " + editor); + virtualEditors.put(id, editor); + } + public void setSelection(Object element) { viewer.setSelection(new StructuredSelection(element)); } @@ -371,6 +390,10 @@ private void registerContributedEditors() { IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ for( IConfigurationElement el : extPoint.getConfigurationElements() ) { + if( ! "editor".equals(el.getName()) ) { + continue; + } + try { IEditorDescriptor desc = (IEditorDescriptor) el.createExecutableExtension("descriptorClass"); //$NON-NLS-1$ EClass eClass = desc.getEClass(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java index a7a67a9fbb..5e9b1b0105 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java @@ -98,7 +98,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); - l.setText("Commands"); + l.setText("Descriptors"); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); viewer = new TableViewer(parent); From e14d060904ccd007850a6031e5a21b0ca493e9d6 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 15 May 2010 12:56:51 +0000 Subject: [PATCH 0100/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * allow reusing editor stuff --- bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF | 1 + 1 file changed, 1 insertion(+) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index 69418fc9db..e419afd5cf 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -25,3 +25,4 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.ui.services;bundle-version="0.9.1" Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/xmiresourcecontextfunction.xml, OSGI-INF/selectionproviderfunction.xml Bundle-ActivationPolicy: lazy +Export-Package: org.eclipse.e4.tools.emf.editor3x.wizard;x-internal:=true From fc55b4e8fc82a9a99e142991fb12d0fb8d61f1ea Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 15 May 2010 12:57:24 +0000 Subject: [PATCH 0101/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixed problem with PartDescriptor not being an MContribution --- .../org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF | 1 + .../ui/internal/common/component/AddonsEditor.java | 2 +- .../common/component/DirectMenuItemEditor.java | 2 +- .../common/component/DirectToolItemEditor.java | 2 +- .../ui/internal/common/component/HandlerEditor.java | 2 +- .../common/component/PartDescriptorEditor.java | 3 ++- .../emf/ui/internal/common/component/PartEditor.java | 2 +- .../internal/common/component/ToolControlEditor.java | 2 +- .../component/dialogs/ContributionClassDialog.java | 12 +++++++----- 9 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index ed036f7e4f..17124bd75b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -34,5 +34,6 @@ Export-Package: org.eclipse.e4.tools.emf.ui.common, org.eclipse.e4.tools.emf.ui.internal;x-internal:=true, org.eclipse.e4.tools.emf.ui.internal.common;x-internal:=true, org.eclipse.e4.tools.emf.ui.internal.common.component;x-internal:=true, + org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;x-internal:=true, org.eclipse.e4.tools.emf.ui.internal.wbm;x-friends:="org.eclipse.e4.tools.emf.editor" Service-Component: OSGI-INF/contributioncollector.xml diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index 77f150bd6e..1d18d4543c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -124,7 +124,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue()); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); dialog.open(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index e5b37626c1..1e3c331d06 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -88,7 +88,7 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue()); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); dialog.open(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index fd096578bc..8783f4d2e6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -77,7 +77,7 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue()); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); dialog.open(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 5507efc4c8..f8fbf66691 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -145,7 +145,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue()); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); dialog.open(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 0e603ee683..01289815b2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -28,6 +28,7 @@ import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.descriptor.basic.util.BasicAdapterFactory; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; @@ -176,7 +177,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue()); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MPartDescriptor) getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CONTRIBUTION_URI); dialog.open(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 1bfedacb40..0ae6c6630b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -175,7 +175,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue()); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); dialog.open(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index 429fe92971..2c7bff92e3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -128,7 +128,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue()); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); dialog.open(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java index 175a546737..1dbe714f9d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -18,9 +18,9 @@ import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Filter; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -53,15 +53,17 @@ public class ContributionClassDialog extends TitleAreaDialog { private IProject project; private Image javaClassImage; - private MContribution contribution; + private MApplicationElement contribution; private EditingDomain editingDomain; private TableViewer viewer; + private EStructuralFeature feature; - public ContributionClassDialog(Shell parentShell, IProject project, EditingDomain editingDomain, MContribution contribution) { + public ContributionClassDialog(Shell parentShell, IProject project, EditingDomain editingDomain, MApplicationElement contribution, EStructuralFeature feature) { super(parentShell); this.project = project; this.contribution = contribution; this.editingDomain = editingDomain; + this.feature = feature; } @Override @@ -156,7 +158,7 @@ protected void okPressed() { if( ! s.isEmpty() ) { ContributionData cd = (ContributionData) s.getFirstElement(); String uri = "platform:/plugin/" + cd.bundleName + "/" + cd.className; //$NON-NLS-1$ //$NON-NLS-2$ - Command cmd = SetCommand.create(editingDomain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, uri); + Command cmd = SetCommand.create(editingDomain, contribution, feature, uri); if( cmd.canExecute() ) { editingDomain.getCommandStack().execute(cmd); super.okPressed(); From 10eb0d74f08c92daa0f561afb278aee0b98a51e8 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 15 May 2010 13:34:25 +0000 Subject: [PATCH 0102/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixed translation --- .../src/org/eclipse/e4/tools/emf/ui/internal/Messages.java | 5 ++++- .../org/eclipse/e4/tools/emf/ui/internal/Messages.properties | 1 + .../emf/ui/internal/common/component/PerspectiveEditor.java | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 3d09b37b90..3570f4e557 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -244,6 +244,7 @@ public class Messages { public static String PerspectiveEditor_Label; public static String PerspectiveEditor_Description; public static String PerspectiveEditor_Id; + public static String PerspectiveEditor_LabelLabel; public static String PerspectiveEditor_SelectedElement; public static String PerspectiveEditor_Tooltip; public static String PerspectiveEditor_IconURI; @@ -303,7 +304,9 @@ public class Messages { public static String ContributionClassDialog_DialogMessage; public static String ContributionClassDialog_DialogTitle; public static String ContributionClassDialog_Label_Classname; - public static String ContributionClassDialog_ShellTitle; + public static String ContributionClassDialog_ShellTitle; + + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index ebdb796cab..e1f3fa7cbd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -238,6 +238,7 @@ PartStackEditor_ContainerData=Container Data PerspectiveEditor_Label=Perspective PerspectiveEditor_Description=Perspective Bla Bla Bla PerspectiveEditor_Id=Id +PerspectiveEditor_LabelLabel=Label PerspectiveEditor_SelectedElement=Selected Element PerspectiveEditor_Label=Label PerspectiveEditor_Tooltip=Tooltip diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index c2b152b1bb..a583ad7c07 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -191,7 +191,7 @@ public void handleValueChange(ValueChangeEvent event) { // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PerspectiveEditor_Label); + l.setText(Messages.PerspectiveEditor_LabelLabel); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); From 32e11d4ef20c54245f2c240e1e3a307b1b0cc6eb Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 15 May 2010 14:44:54 +0000 Subject: [PATCH 0103/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixed with bundle name extraction --- .../e4/tools/emf/editor3x/PDEClassContributionProvider.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java index b137eb5b90..cf55a477d1 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java @@ -95,6 +95,9 @@ public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, if( line.startsWith("Bundle-SymbolicName:") ) { int start = line.indexOf(':'); int end = line.indexOf(';'); + if( end == -1 ) { + end = line.length(); + } ContributionData data = new ContributionData(line.substring(start+1,end).trim(), content, "Java", null); handler.result(data); break; From f1909d31866ef2832e45adb90f0618f17e27c125 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 15 May 2010 15:27:06 +0000 Subject: [PATCH 0104/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * adding support to contribute ui elements --- .../e4/tools/emf/ui/internal/Messages.java | 2 +- .../tools/emf/ui/internal/Messages.properties | 2 +- .../emf/ui/internal/common/ModelEditor.java | 4 +- .../component/ModelComponentEditor.java | 5 +- .../virtual/VModelComponentUIEditor.java | 265 ++++++++++++++++++ 5 files changed, 273 insertions(+), 5 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentUIEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 3570f4e557..32762c9cdd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -163,7 +163,7 @@ public class Messages { public static String ModelComponentEditor_KeyBindings; public static String ModelComponentEditor_Commands; public static String ModelComponentEditor_Menus; - public static String ModelComponentEditor_Parts; + public static String ModelComponentEditor_UiChildren; public static String ModelComponentEditor_PartDescriptors; public static String ModelComponentEditor_DetailParentId; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index e1f3fa7cbd..938e2ca60e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -158,7 +158,7 @@ ModelComponentEditor_BindingTables=BindingTables ModelComponentEditor_KeyBindings=KeyBindings ModelComponentEditor_Commands=Commands ModelComponentEditor_Menus=Menus -ModelComponentEditor_Parts=Parts +ModelComponentEditor_UiChildren=UI-Children ModelComponentEditor_PartDescriptors=PartDescriptors ModelComponentEditor_DetailParentId=parentId diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 9f607398a3..24e151b4c8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -73,6 +73,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VApplicationAddons; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VBindingTableEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VCommandEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelComponentUIEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowControlEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuEditor; @@ -117,7 +118,7 @@ public class ModelEditor { private static final String CSS_CLASS_KEY = "org.eclipse.e4.ui.css.CssClassName"; //$NON-NLS-1$ public static final String VIRTUAL_PART_MENU = ModelEditor.class.getName() + ".VIRTUAL_PART_MENU"; //$NON-NLS-1$ - public static final String VIRTUAL_PART = ModelEditor.class.getName() + ".VIRTUAL_PART"; //$NON-NLS-1$ + public static final String VIRTUAL_MODEL_COMPONENT_CHILDREN = ModelEditor.class.getName() + ".VIRTUAL_MODEL_COMPONENT_CHILDREN"; //$NON-NLS-1$ public static final String VIRTUAL_HANDLER = ModelEditor.class.getName() + ".VIRTUAL_HANDLER"; //$NON-NLS-1$ public static final String VIRTUAL_BINDING_TABLE = ModelEditor.class.getName() + ".VIRTUAL_BINDING_TABLE"; //$NON-NLS-1$ public static final String VIRTUAL_COMMAND = ModelEditor.class.getName() + ".VIRTUAL_COMMAND"; //$NON-NLS-1$ @@ -374,6 +375,7 @@ private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_PARTDESCRIPTOR_MENU, new VMenuEditor(modelProvider.getEditingDomain(), this, org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS)); registerVirtualEditor(VIRTUAL_TRIMMED_WINDOW_TRIMS, new VWindowTrimEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_ADDONS, new VApplicationAddons(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_MODEL_COMPONENT_CHILDREN, new VModelComponentUIEditor(modelProvider.getEditingDomain(), this)); } private void registerVirtualEditor(String id, AbstractComponentEditor editor ) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index b0667831ad..19b89c0a9c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -25,6 +25,7 @@ import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.emf.databinding.EMFDataBindingContext; @@ -231,11 +232,11 @@ protected boolean accepted(Object o) { } }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART, MODEL_COMPONENT__CHILDREN, element, Messages.ModelComponentEditor_Parts) { + list.add(new VirtualEntry( ModelEditor.VIRTUAL_MODEL_COMPONENT_CHILDREN, MODEL_COMPONENT__CHILDREN, element, Messages.ModelComponentEditor_UiChildren) { @Override protected boolean accepted(Object o) { - return o instanceof MPart; + return o instanceof MUIElement; } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentUIEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentUIEditor.java new file mode 100644 index 0000000000..0c3c40f7d5 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentUIEditor.java @@ -0,0 +1,265 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import java.util.List; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MModelComponent; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUIElement; +import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VModelComponentUIEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private ModelEditor editor; + private TableViewer viewer; + + public VModelComponentUIEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "UI-Children"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "UI-Children Bla Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + VirtualEntry o = (VirtualEntry)object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Children"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + + viewer = new TableViewer(parent); + viewer.setContentProvider(new ObservableListContentProvider()); + viewer.setLabelProvider(new ComponentLabelProvider(editor)); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(2,false); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MModelComponent container = (MModelComponent) getMaster().getValue(); + int idx = container.getDescriptors().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MModelComponent container = (MModelComponent) getMaster().getValue(); + int idx = container.getDescriptors().indexOf(obj) + 1; + if( idx < container.getDescriptors().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + EClass eclass = (EClass) element; + return eclass.getName(); + } + }); + childrenDropDown.setInput(new EClass[] { + // Basic + BasicPackageImpl.Literals.PART, + BasicPackageImpl.Literals.INPUT_PART, + BasicPackageImpl.Literals.PART_STACK, + BasicPackageImpl.Literals.PART_SASH_CONTAINER, + BasicPackageImpl.Literals.TRIM_BAR, + BasicPackageImpl.Literals.TRIM_ELEMENT, + BasicPackageImpl.Literals.WINDOW, + BasicPackageImpl.Literals.TRIMMED_WINDOW, + // Advanced + AdvancedPackageImpl.Literals.PERSPECTIVE, + AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, + // Menu + MenuPackageImpl.Literals.MENU_SEPARATOR, + MenuPackageImpl.Literals.MENU, + MenuPackageImpl.Literals.HANDLED_MENU_ITEM, + MenuPackageImpl.Literals.DIRECT_MENU_ITEM, + MenuPackageImpl.Literals.TOOL_BAR, + MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, + MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, + MenuPackageImpl.Literals.TOOL_CONTROL, + MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR + }); + childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART)); + + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); + MUIElement obj = (MUIElement) EcoreUtil.create(eClass); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__CHILDREN, obj); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(obj); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List commands = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__CHILDREN, commands); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } +} From f8a5bd248b02389c2ffe00379e97f4c71bc231cd Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 15 May 2010 19:37:23 +0000 Subject: [PATCH 0105/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * removed wrong contribution From 58f704a9ff773db1321d2d6f9ae61c79abc80d5b Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 15 May 2010 19:40:08 +0000 Subject: [PATCH 0106/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * started adding support for icon selection --- .../META-INF/MANIFEST.MF | 1 + .../internal/common/component/PartEditor.java | 13 +- .../AbstractCommandSelectionDialog.java | 2 +- .../component/dialogs/AbstractIconDialog.java | 300 ++++++++++++++++++ .../dialogs/PartIconDialogEditor.java | 30 ++ 5 files changed, 343 insertions(+), 3 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 17124bd75b..49455424fa 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -28,6 +28,7 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.e4.core.contexts;bundle-version="0.9.0" Bundle-ActivationPolicy: lazy Import-Package: javax.inject;version="1.0.0", + org.eclipse.core.runtime.jobs, org.osgi.framework;version="1.5.0" Export-Package: org.eclipse.e4.tools.emf.ui.common, org.eclipse.e4.tools.emf.ui.common.component, diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 0ae6c6630b..e118933576 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -24,6 +24,8 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.AbstractIconDialog; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartIconDialogEditor; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -155,9 +157,16 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.PartEditor_Find); + b.setText(Messages.PartEditor_Find); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + PartIconDialogEditor dialog = new PartIconDialogEditor(b.getShell(), project,getEditingDomain(),(MPart) getMaster().getValue()); + dialog.open(); + } + }); } // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java index b178f7f71b..de8ebadffe 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java @@ -80,7 +80,7 @@ protected Control createDialogArea(Composite parent) { viewer = new TableViewer(container); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(new LabelProviderImpl()); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); viewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java new file mode 100644 index 0000000000..1b978fcf30 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java @@ -0,0 +1,300 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceVisitor; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.e4.tools.emf.ui.internal.StringMatcher; +import org.eclipse.e4.ui.model.application.MApplicationElement; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public abstract class AbstractIconDialog extends TitleAreaDialog { + private TableViewer viewer; + private IProject project; + private MApplicationElement element; + private EStructuralFeature feature; + private EditingDomain editingDomain; + private Map icons = Collections.synchronizedMap(new HashMap()); + + public AbstractIconDialog(Shell parentShell, IProject project, EditingDomain editingDomain, MApplicationElement element, EStructuralFeature feature) { + super(parentShell); + this.editingDomain = editingDomain; + this.element = element; + this.feature = feature; + this.project = project; + } + + protected abstract String getShellTitle(); + + protected abstract String getDialogTitle(); + + protected abstract String getDialogMessage(); + + @Override + protected Control createDialogArea(Composite parent) { + Composite comp = (Composite) super.createDialogArea(parent); + + getShell().setText(getShellTitle()); + setTitle(getDialogTitle()); + setMessage(getDialogMessage()); + + Composite container = new Composite(comp, SWT.NONE); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + container.setLayout(new GridLayout(2, false)); + + Label l = new Label(container, SWT.NONE); + l.setText("IconName"); + + final Text t = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + new Label(container, SWT.NONE); + + viewer = new TableViewer(container); + GridData gd = new GridData(GridData.FILL_BOTH); + viewer.getControl().setLayoutData(gd); + viewer.setContentProvider(new ObservableListContentProvider()); + viewer.setLabelProvider(new StyledCellLabelProvider() { + @Override + public void update(ViewerCell cell) { + IFile file = (IFile) cell.getElement(); + StyledString styledString = new StyledString(file.getProjectRelativePath().toString(), null); + + Image img = icons.get(file); + if (img == null) { + InputStream in = null; + try { + in = file.getContents(); + img = new Image(cell.getControl().getDisplay(), in); + icons.put(file, img); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } finally { + if (in != null) { + try { + in.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + } + + String bundle = getBundle(file); + if( bundle != null ) { + styledString.append(" - " + bundle, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + } + + cell.setImage(img); + cell.setText(styledString.getString()); + cell.setStyleRanges(styledString.getStyleRanges()); + } + }); + + final WritableList list = new WritableList(); + viewer.setInput(list); + viewer.addDoubleClickListener(new IDoubleClickListener() { + + public void doubleClick(DoubleClickEvent event) { + okPressed(); + } + }); + + t.addModifyListener(new ModifyListener() { + private IconMatchCallback callback; + private Timer timer = new Timer(true); + private TimerTask task; + + public void modifyText(ModifyEvent e) { + if (callback != null) { + callback.cancel = true; + } + if (task != null) { + task.cancel(); + } + list.clear(); + + clearImages(); + + callback = new IconMatchCallback(list); + task = new SearchThread(callback, t.getText(), project); + timer.schedule(task, 500); + } + }); + + getShell().addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + clearImages(); + } + }); + + return comp; + } + + private void clearImages() { + for (Image img : icons.values()) { + img.dispose(); + } + icons.clear(); + } + + @Override + protected void okPressed() { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if( ! s.isEmpty() ) { + IFile file = (IFile) s.getFirstElement(); + String bundle = getBundle(file); + String uri = "platform:/plugin/"+bundle+"/"+file.getProjectRelativePath().toString(); + Command cmd = SetCommand.create(editingDomain, element, feature, uri); + if( cmd.canExecute() ) { + editingDomain.getCommandStack().execute(cmd); + super.okPressed(); + } + } + } + + private String getBundle(IFile file) { + IProject project = file.getProject(); + IFile f = project.getFile("/META-INF/MANIFEST.MF"); //$NON-NLS-1$ + + if (f != null && f.exists()) { + BufferedReader r = null; + try { + InputStream s = f.getContents(); + r = new BufferedReader(new InputStreamReader(s)); + String line; + while ((line = r.readLine()) != null) { + if (line.startsWith("Bundle-SymbolicName:")) { //$NON-NLS-1$ + int start = line.indexOf(':'); + int end = line.indexOf(';'); + if (end == -1) { + end = line.length(); + } + return line.substring(start + 1, end).trim(); + } + } + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } finally { + if (r != null) { + try { + r.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + } + return null; + } + + private class IconMatchCallback { + private volatile boolean cancel; + private IObservableList list; + + private IconMatchCallback(IObservableList list) { + this.list = list; + } + + public void match(final IFile file) { + if (!cancel) { + list.getRealm().exec(new Runnable() { + + public void run() { + list.add(file); + } + }); + } + } + } + + private static class SearchThread extends TimerTask { + private final IconMatchCallback callback; + private final IProject project; + private final StringMatcher matcherGif; + private final StringMatcher matcherJpg; + private final StringMatcher matcherPng; + + public SearchThread(IconMatchCallback callback, String pattern, IProject project) { + this.matcherGif = new StringMatcher("*" + pattern + "*.gif", true, false); //$NON-NLS-1$//$NON-NLS-2$ + this.matcherJpg = new StringMatcher("*" + pattern + "*.jpg", true, false); //$NON-NLS-1$//$NON-NLS-2$ + this.matcherPng = new StringMatcher("*" + pattern + "*.png", true, false); //$NON-NLS-1$//$NON-NLS-2$ + this.callback = callback; + this.project = project; + } + + @Override + public void run() { + try { + project.accept(new IResourceVisitor() { + + public boolean visit(IResource resource) throws CoreException { + if (callback.cancel) { + return false; + } + + if (resource.getType() == IResource.FOLDER || resource.getType() == IResource.PROJECT) { + return true; + } else if (resource.getType() == IResource.FILE && !resource.isLinked()) { + String path = resource.getProjectRelativePath().toString(); + if (matcherGif.match(path) || matcherPng.match(path) || matcherJpg.match(path)) { + callback.match((IFile) resource); + } + } + return false; + } + + }); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java new file mode 100644 index 0000000000..d2c0e3f8e1 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java @@ -0,0 +1,30 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.widgets.Shell; + +public class PartIconDialogEditor extends AbstractIconDialog { + + public PartIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MPart element) { + super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); + } + + @Override + protected String getShellTitle() { + return "Part Icon Search"; + } + + @Override + protected String getDialogTitle() { + return "Part Icon Search"; + } + + @Override + protected String getDialogMessage() { + return "Search for GIF, PNG and JPG icons in the current project"; + } + +} From a6c621d0b2aa8beac4223de22f4ff807265dc459 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 15 May 2010 20:08:06 +0000 Subject: [PATCH 0107/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * adding icon support to various elements --- .../emf/ui/internal/common/ModelEditor.java | 146 +++++++++--------- .../component/DirectMenuItemEditor.java | 4 +- .../component/DirectToolItemEditor.java | 4 +- .../component/HandledMenuItemEditor.java | 5 +- .../component/HandledToolItemEditor.java | 6 +- .../internal/common/component/MenuEditor.java | 15 +- .../common/component/MenuItemEditor.java | 18 ++- .../component/PartDescriptorEditor.java | 14 +- .../common/component/PerspectiveEditor.java | 17 +- .../common/component/ToolItemEditor.java | 19 ++- .../common/component/TrimmedWindowEditor.java | 5 +- .../common/component/WindowEditor.java | 20 ++- .../dialogs/MenuIconDialogEditor.java | 31 ++++ .../dialogs/MenuItemIconDialogEditor.java | 31 ++++ .../PartDescriptorIconDialogEditor.java | 31 ++++ .../dialogs/PerspectiveIconDialogEditor.java | 31 ++++ .../dialogs/ToolItemIconDialogEditor.java | 31 ++++ .../dialogs/WindowIconDialogEditor.java | 31 ++++ 18 files changed, 361 insertions(+), 98 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 24e151b4c8..48bc4b14eb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -116,7 +116,7 @@ public class ModelEditor { private static final String CSS_CLASS_KEY = "org.eclipse.e4.ui.css.CssClassName"; //$NON-NLS-1$ - + public static final String VIRTUAL_PART_MENU = ModelEditor.class.getName() + ".VIRTUAL_PART_MENU"; //$NON-NLS-1$ public static final String VIRTUAL_MODEL_COMPONENT_CHILDREN = ModelEditor.class.getName() + ".VIRTUAL_MODEL_COMPONENT_CHILDREN"; //$NON-NLS-1$ public static final String VIRTUAL_HANDLER = ModelEditor.class.getName() + ".VIRTUAL_HANDLER"; //$NON-NLS-1$ @@ -132,7 +132,7 @@ public class ModelEditor { public static final String VIRTUAL_ADDONS = ModelEditor.class.getName() + ".VIRTUAL_ADDONS"; //$NON-NLS-1$ private Map editorMap = new HashMap(); - private Map virtualEditors = new HashMap(); + private Map virtualEditors = new HashMap(); private List labelFeaturePaths = new ArrayList(); // private List editors = new @@ -148,13 +148,13 @@ public ModelEditor(Composite composite, IEclipseContext context, IModelResource this.modelProvider = modelProvider; this.project = project; this.context = context; - + registerDefaultEditors(); registerVirtualEditors(); - + registerContributedEditors(); registerContributedVirtualEditors(); - + SashForm form = new SashForm(composite, SWT.HORIZONTAL); form.setBackground(form.getDisplay().getSystemColor(SWT.COLOR_WHITE)); @@ -192,20 +192,20 @@ public ModelEditor(Composite composite, IEclipseContext context, IModelResource final ScrolledComposite scrolling = new ScrolledComposite(editingArea, SWT.H_SCROLL | SWT.V_SCROLL); scrolling.setBackgroundMode(SWT.INHERIT_DEFAULT); scrolling.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ - + final Composite contentContainer = new Composite(scrolling, SWT.NONE); contentContainer.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ scrolling.setExpandHorizontal(true); scrolling.setExpandVertical(true); scrolling.setContent(contentContainer); - + scrolling.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { Rectangle r = scrolling.getClientArea(); scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); } }); - + scrolling.setLayoutData(new GridData(GridData.FILL_BOTH)); final StackLayout layout = new StackLayout(); contentContainer.setLayout(layout); @@ -238,42 +238,42 @@ public void selectionChanged(SelectionChangedEvent event) { contentContainer.layout(true); } } - + Rectangle r = scrolling.getClientArea(); scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); - - if( selectionService != null ) { + + if (selectionService != null) { selectionService.setSelection(s.getFirstElement()); } - + } } }); form.setWeights(new int[] { 1, 2 }); viewer.setSelection(new StructuredSelection(modelProvider.getRoot())); - + MenuManager mgr = new MenuManager(); mgr.setRemoveAllWhenShown(true); mgr.addMenuListener(new IMenuListener() { - + public void menuAboutToShow(IMenuManager manager) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if( ! s.isEmpty() ) { + if (!s.isEmpty()) { List actions; - if( s.getFirstElement() instanceof VirtualEntry ) { - actions = virtualEditors.get(((VirtualEntry)s.getFirstElement()).getId()).getActions(s.getFirstElement()); + if (s.getFirstElement() instanceof VirtualEntry) { + actions = virtualEditors.get(((VirtualEntry) s.getFirstElement()).getId()).getActions(s.getFirstElement()); } else { EObject o = (EObject) s.getFirstElement(); AbstractComponentEditor editor = editorMap.get(o.eClass()); - if( editor != null ) { + if (editor != null) { actions = editor.getActions(s.getFirstElement()); } else { actions = Collections.emptyList(); } } - - for( Action a : actions ) { + + for (Action a : actions) { manager.add(a); } } @@ -282,26 +282,28 @@ public void menuAboutToShow(IMenuManager manager) { viewer.getControl().setMenu(mgr.createContextMenu(viewer.getControl())); } - @Inject @Optional + @Inject + @Optional public void setSelectionService(ISelectionProviderService selectionService) { this.selectionService = selectionService; - if( viewer != null && ! viewer.getControl().isDisposed() ) { - if( ! viewer.getSelection().isEmpty() ) { - selectionService.setSelection(((IStructuredSelection)viewer.getSelection()).getFirstElement()); + if (viewer != null && !viewer.getControl().isDisposed()) { + if (!viewer.getSelection().isEmpty()) { + selectionService.setSelection(((IStructuredSelection) viewer.getSelection()).getFirstElement()); } } } - -// @Inject -// public void updateSelection(@Optional @Named(IServiceConstants.SELECTION) Object selection ) { -// System.err.println("The selection: " + selection); -// } - + + // @Inject + // public void updateSelection(@Optional @Named(IServiceConstants.SELECTION) + // Object selection ) { + // System.err.println("The selection: " + selection); + // } + private TreeViewer createTreeViewerArea(Composite parent) { parent = new Composite(parent, SWT.NONE); parent.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ parent.setBackgroundMode(SWT.INHERIT_DEFAULT); - + FillLayout l = new FillLayout(); l.marginWidth = 5; parent.setLayout(l); @@ -346,18 +348,18 @@ public void handleMapChange(MapChangeEvent event) { return viewer; } - + private void registerContributedVirtualEditors() { IExtensionRegistry registry = RegistryFactory.getRegistry(); IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ - - for( IConfigurationElement el : extPoint.getConfigurationElements() ) { - if( ! "virtualeditor".equals(el.getName()) ) { + + for (IConfigurationElement el : extPoint.getConfigurationElements()) { + if (!"virtualeditor".equals(el.getName())) { continue; } - + IContributionFactory fact = context.get(IContributionFactory.class); - AbstractComponentEditor editor = (AbstractComponentEditor) fact.create("platform:/plugin/"+el.getContributor().getName()+"/"+el.getAttribute("class"), context); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + AbstractComponentEditor editor = (AbstractComponentEditor) fact.create("platform:/plugin/" + el.getContributor().getName() + "/" + el.getAttribute("class"), context); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ registerVirtualEditor(el.getAttribute("id"), editor); //$NON-NLS-1$ } } @@ -365,8 +367,8 @@ private void registerContributedVirtualEditors() { private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_PART_MENU, new VMenuEditor(modelProvider.getEditingDomain(), this, BasicPackageImpl.Literals.PART__MENUS)); registerVirtualEditor(VIRTUAL_HANDLER, new VHandlerEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_BINDING_TABLE,new VBindingTableEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_COMMAND,new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.APPLICATION__COMMANDS)); + registerVirtualEditor(VIRTUAL_BINDING_TABLE, new VBindingTableEditor(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_COMMAND, new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.APPLICATION__COMMANDS)); registerVirtualEditor(VIRTUAL_WINDOWS, new VWindowEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_WINDOW_CONTROLS, new VWindowControlEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_PART_DESCRIPTORS, new VPartDescriptor(modelProvider.getEditingDomain(), this)); @@ -378,29 +380,29 @@ private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_MODEL_COMPONENT_CHILDREN, new VModelComponentUIEditor(modelProvider.getEditingDomain(), this)); } - private void registerVirtualEditor(String id, AbstractComponentEditor editor ) { -// System.err.println("Registering: " + id + " => " + editor); + private void registerVirtualEditor(String id, AbstractComponentEditor editor) { + // System.err.println("Registering: " + id + " => " + editor); virtualEditors.put(id, editor); } - + public void setSelection(Object element) { viewer.setSelection(new StructuredSelection(element)); } - + private void registerContributedEditors() { IExtensionRegistry registry = RegistryFactory.getRegistry(); IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ - - for( IConfigurationElement el : extPoint.getConfigurationElements() ) { - if( ! "editor".equals(el.getName()) ) { + + for (IConfigurationElement el : extPoint.getConfigurationElements()) { + if (!"editor".equals(el.getName())) { continue; } - + try { IEditorDescriptor desc = (IEditorDescriptor) el.createExecutableExtension("descriptorClass"); //$NON-NLS-1$ EClass eClass = desc.getEClass(); IContributionFactory fact = context.get(IContributionFactory.class); - AbstractComponentEditor editor = (AbstractComponentEditor) fact.create("platform:/plugin/"+el.getContributor().getName()+"/"+desc.getEditorClass().getName(), context); //$NON-NLS-1$ //$NON-NLS-2$ + AbstractComponentEditor editor = (AbstractComponentEditor) fact.create("platform:/plugin/" + el.getContributor().getName() + "/" + desc.getEditorClass().getName(), context); //$NON-NLS-1$ //$NON-NLS-2$ registerEditor(eClass, editor); } catch (CoreException e) { // TODO Auto-generated catch block @@ -411,39 +413,38 @@ private void registerContributedEditors() { private void registerDefaultEditors() { registerEditor(ApplicationPackageImpl.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain())); - registerEditor(ApplicationPackageImpl.Literals.MODEL_COMPONENTS, new ModelComponentsEditor(modelProvider.getEditingDomain(),this)); + registerEditor(ApplicationPackageImpl.Literals.MODEL_COMPONENTS, new ModelComponentsEditor(modelProvider.getEditingDomain(), this)); registerEditor(ApplicationPackageImpl.Literals.MODEL_COMPONENT, new ModelComponentEditor(modelProvider.getEditingDomain())); - registerEditor(ApplicationPackageImpl.Literals.ADDON, new AddonsEditor(modelProvider.getEditingDomain(),project)); - - - registerEditor(CommandsPackageImpl.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(),modelProvider)); - registerEditor(CommandsPackageImpl.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain(),modelProvider,project)); + registerEditor(ApplicationPackageImpl.Literals.ADDON, new AddonsEditor(modelProvider.getEditingDomain(), project)); + + registerEditor(CommandsPackageImpl.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(), modelProvider)); + registerEditor(CommandsPackageImpl.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain(), modelProvider, project)); registerEditor(CommandsPackageImpl.Literals.COMMAND, new CommandEditor(modelProvider.getEditingDomain())); registerEditor(CommandsPackageImpl.Literals.BINDING_TABLE, new BindingTableEditor(modelProvider.getEditingDomain(), this)); - + registerEditor(MenuPackageImpl.Literals.TOOL_BAR, new ToolBarEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain(),project)); - registerEditor(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, new HandledToolItemEditor(modelProvider.getEditingDomain(),modelProvider)); + registerEditor(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain(), project)); + registerEditor(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, new HandledToolItemEditor(modelProvider.getEditingDomain(), project, modelProvider)); registerEditor(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, new ToolBarSeparatorEditor(modelProvider.getEditingDomain())); - registerEditor(MenuPackageImpl.Literals.TOOL_CONTROL, new ToolControlEditor(modelProvider.getEditingDomain(),project)); - - registerEditor(MenuPackageImpl.Literals.MENU, new MenuEditor(modelProvider.getEditingDomain(), this)); + registerEditor(MenuPackageImpl.Literals.TOOL_CONTROL, new ToolControlEditor(modelProvider.getEditingDomain(), project)); + + registerEditor(MenuPackageImpl.Literals.MENU, new MenuEditor(modelProvider.getEditingDomain(), project, this)); registerEditor(MenuPackageImpl.Literals.MENU_SEPARATOR, new MenuSeparatorEditor(modelProvider.getEditingDomain())); - registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), modelProvider)); + registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), project, modelProvider)); registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this, project)); - - registerEditor(BasicPackageImpl.Literals.PART, new PartEditor(modelProvider.getEditingDomain(),project)); - registerEditor(BasicPackageImpl.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain())); - registerEditor(BasicPackageImpl.Literals.TRIMMED_WINDOW, new TrimmedWindowEditor(modelProvider.getEditingDomain())); + + registerEditor(BasicPackageImpl.Literals.PART, new PartEditor(modelProvider.getEditingDomain(), project)); + registerEditor(BasicPackageImpl.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain(), project)); + registerEditor(BasicPackageImpl.Literals.TRIMMED_WINDOW, new TrimmedWindowEditor(modelProvider.getEditingDomain(), project)); registerEditor(BasicPackageImpl.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor(modelProvider.getEditingDomain(), this)); - registerEditor(BasicPackageImpl.Literals.PART_STACK, new PartStackEditor(modelProvider.getEditingDomain(),this)); + registerEditor(BasicPackageImpl.Literals.PART_STACK, new PartStackEditor(modelProvider.getEditingDomain(), this)); registerEditor(BasicPackageImpl.Literals.INPUT_PART, new InputPartEditor(modelProvider.getEditingDomain(), project)); registerEditor(BasicPackageImpl.Literals.TRIM_BAR, new TrimBarEditor(modelProvider.getEditingDomain(), this)); - - registerEditor(org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain(),project)); - - registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, new PerspectiveStackEditor(modelProvider.getEditingDomain(),this)); - registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE, new PerspectiveEditor(modelProvider.getEditingDomain(),this)); + + registerEditor(org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain(), project)); + + registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, new PerspectiveStackEditor(modelProvider.getEditingDomain(), this)); + registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE, new PerspectiveEditor(modelProvider.getEditingDomain(), project, this)); registerEditor(AdvancedPackageImpl.Literals.PLACEHOLDER, new PlaceholderEditor(modelProvider.getEditingDomain())); } @@ -488,12 +489,11 @@ public void doSave(@Optional IProgressMonitor monitor) { modelProvider.save(); } } - + public void setFocus() { viewer.getControl().setFocus(); } - private static class TreeStructureAdvisorImpl extends TreeStructureAdvisor { } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index 1e3c331d06..e9cff25710 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -38,11 +38,9 @@ public class DirectMenuItemEditor extends MenuItemEditor { private Image image; - private IProject project; public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain); - this.project = project; + super(editingDomain,project); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index 8783f4d2e6..af3d3c8d72 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -37,11 +37,9 @@ public class DirectToolItemEditor extends ToolItemEditor { private Image image; - private IProject project; public DirectToolItemEditor(EditingDomain editingDomain, IProject project) { - super(editingDomain); - this.project = project; + super(editingDomain,project); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index 1689160059..2fe314b100 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -14,6 +14,7 @@ import java.net.URL; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; @@ -65,8 +66,8 @@ public class HandledMenuItemEditor extends MenuItemEditor { private Image image; private IModelResource resource; - public HandledMenuItemEditor(EditingDomain editingDomain, IModelResource resource) { - super(editingDomain); + public HandledMenuItemEditor(EditingDomain editingDomain, IProject project, IModelResource resource) { + super(editingDomain,project); this.resource = resource; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index a442f71d2f..e8ed3a4305 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -14,12 +14,12 @@ import java.net.URL; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledToolItemCommandSelectionDialog; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -65,8 +65,8 @@ public class HandledToolItemEditor extends ToolItemEditor { private Image image; private IModelResource resource; - public HandledToolItemEditor(EditingDomain editingDomain, IModelResource resource) { - super(editingDomain); + public HandledToolItemEditor(EditingDomain editingDomain, IProject project, IModelResource resource) { + super(editingDomain, project); this.resource = resource; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 08ecef1684..326eba354c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -17,11 +17,13 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; @@ -73,6 +75,7 @@ public class MenuEditor extends AbstractComponentEditor { private Image image; private EMFDataBindingContext context; private ModelEditor editor; + private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private StackLayout stackLayout; @@ -89,9 +92,10 @@ public Struct(String label, EClass eClass, boolean separator) { } } - public MenuEditor(EditingDomain editingDomain, ModelEditor editor) { + public MenuEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { super(editingDomain); this.editor = editor; + this.project = project; } @Override @@ -195,9 +199,16 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText(Messages.MenuItemEditor_Find); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MenuIconDialogEditor dialog = new MenuIconDialogEditor(b.getShell(), project, getEditingDomain(),(MMenu) getMaster().getValue()); + dialog.open(); + } + }); } // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index d1a1b68890..d346f34ec2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -16,12 +16,15 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuItemIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.ItemType; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; @@ -33,6 +36,8 @@ import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -47,9 +52,11 @@ public abstract class MenuItemEditor extends AbstractComponentEditor { private Composite composite; private Image menuImage; private EMFDataBindingContext context; + protected IProject project; - public MenuItemEditor(EditingDomain editingDomain) { + public MenuItemEditor(EditingDomain editingDomain, IProject project) { super(editingDomain); + this.project = project; } @Override @@ -144,9 +151,16 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText(Messages.MenuItemEditor_Find); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MenuItemIconDialogEditor dialog = new MenuItemIconDialogEditor(b.getShell(), project, getEditingDomain(),(MMenuItem) getMaster().getValue()); + dialog.open(); + } + }); } createFormSubTypeForm(parent, context, master); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 01289815b2..0d46e20f3e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -24,6 +24,8 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartDescriptorIconDialogEditor; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; @@ -31,6 +33,7 @@ import org.eclipse.e4.ui.model.application.descriptor.basic.util.BasicAdapterFactory; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; @@ -157,9 +160,16 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.PartDescriptorEditor_Find); + b.setText(Messages.PartDescriptorEditor_Find); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + PartDescriptorIconDialogEditor dialog = new PartDescriptorIconDialogEditor(b.getShell(), project, getEditingDomain(),(MPartDescriptor) getMaster().getValue()); + dialog.open(); + } + }); } // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index a583ad7c07..8daad0ec50 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -21,14 +21,18 @@ import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartIconDialogEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PerspectiveIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; @@ -75,11 +79,13 @@ public class PerspectiveEditor extends AbstractComponentEditor { private Image image; private EMFDataBindingContext context; private ModelEditor editor; + private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - public PerspectiveEditor(EditingDomain editingDomain, ModelEditor editor) { + public PerspectiveEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { super(editingDomain); + this.project = project; this.editor = editor; } @@ -221,8 +227,15 @@ public void handleValueChange(ValueChangeEvent event) { t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.PerspectiveEditor_Find); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + PerspectiveIconDialogEditor dialog = new PerspectiveIconDialogEditor(b.getShell(), project,getEditingDomain(),(MPerspective) getMaster().getValue()); + dialog.open(); + } + }); } { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 9bf6c0103a..39d5364320 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -14,8 +14,12 @@ import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PerspectiveIconDialogEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ToolItemIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.ItemType; import org.eclipse.e4.ui.model.application.ui.menu.MToolItem; @@ -30,6 +34,8 @@ import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; @@ -40,9 +46,11 @@ public abstract class ToolItemEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; + protected IProject project; - public ToolItemEditor(EditingDomain editingDomain) { + public ToolItemEditor(EditingDomain editingDomain, IProject project) { super(editingDomain); + this.project = project; } @Override @@ -126,10 +134,17 @@ private void createFormSubTypeForm(Composite parent, EMFDataBindingContext conte t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText("Find ..."); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ToolItemIconDialogEditor dialog = new ToolItemIconDialogEditor(b.getShell(), project,getEditingDomain(),(MToolItem) getMaster().getValue()); + dialog.open(); + } + }); } // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java index aabc235345..4119793bab 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java @@ -2,6 +2,7 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; @@ -11,8 +12,8 @@ public class TrimmedWindowEditor extends WindowEditor { private IListProperty TRIMMED_WINDOW__TRIM_BARS = EMFProperties.list(BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS); - public TrimmedWindowEditor(EditingDomain editingDomain) { - super(editingDomain); + public TrimmedWindowEditor(EditingDomain editingDomain, IProject project) { + super(editingDomain,project); } public IObservableList getChildList(Object element) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 252a1a797b..0efb85904c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -22,9 +22,12 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ToolItemIconDialogEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.WindowIconDialogEditor; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; @@ -33,6 +36,7 @@ import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; +import org.eclipse.e4.ui.model.application.ui.menu.MToolItem; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; @@ -44,6 +48,8 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -58,6 +64,7 @@ public class WindowEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; + private IProject project; private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); private IListProperty WINDOW__WINDOWS = EMFProperties.list(BasicPackageImpl.Literals.WINDOW__WINDOWS); @@ -66,8 +73,9 @@ public class WindowEditor extends AbstractComponentEditor { private Action addMainMenu; - public WindowEditor(EditingDomain editingDomain) { + public WindowEditor(EditingDomain editingDomain, IProject project) { super(editingDomain); + this.project = project; addMainMenu = new Action("Add Main Menu") { @Override public void run() { @@ -214,10 +222,18 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText("Find ..."); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + WindowIconDialogEditor dialog = new WindowIconDialogEditor(b.getShell(), project,getEditingDomain(),(MWindow) getMaster().getValue()); + dialog.open(); + } + }); + } ControlFactory.createBindingsWidget(parent, this); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java new file mode 100644 index 0000000000..22a33c242f --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java @@ -0,0 +1,31 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenu; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.widgets.Shell; + +public class MenuIconDialogEditor extends AbstractIconDialog { + + public MenuIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MMenu element) { + super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); + } + + @Override + protected String getShellTitle() { + return "Menu Icon Search"; + } + + @Override + protected String getDialogTitle() { + return "Menu Icon Search"; + } + + @Override + protected String getDialogMessage() { + return "Search for GIF, PNG and JPG icons in the current project"; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java new file mode 100644 index 0000000000..74828a1774 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java @@ -0,0 +1,31 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.widgets.Shell; + +public class MenuItemIconDialogEditor extends AbstractIconDialog { + + public MenuItemIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MMenuItem element) { + super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); + } + + @Override + protected String getShellTitle() { + return "Menu Item Icon Search"; + } + + @Override + protected String getDialogTitle() { + return "Menu Item Icon Search"; + } + + @Override + protected String getDialogMessage() { + return "Search for GIF, PNG and JPG icons in the current project"; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java new file mode 100644 index 0000000000..4d7ede72e5 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java @@ -0,0 +1,31 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.widgets.Shell; + +public class PartDescriptorIconDialogEditor extends AbstractIconDialog { + + public PartDescriptorIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MPartDescriptor element) { + super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); + } + + @Override + protected String getShellTitle() { + return "Part Descriptor Icon Search"; + } + + @Override + protected String getDialogTitle() { + return "Part Descriptor Icon Search"; + } + + @Override + protected String getDialogMessage() { + return "Search for GIF, PNG and JPG icons in the current project"; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java new file mode 100644 index 0000000000..63758b8f92 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java @@ -0,0 +1,31 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.widgets.Shell; + +public class PerspectiveIconDialogEditor extends AbstractIconDialog { + + public PerspectiveIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MPerspective element) { + super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); + } + + @Override + protected String getShellTitle() { + return "Perspective Icon Search"; + } + + @Override + protected String getDialogTitle() { + return "Perspective Icon Search"; + } + + @Override + protected String getDialogMessage() { + return "Search for GIF, PNG and JPG icons in the current project"; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java new file mode 100644 index 0000000000..8387545768 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java @@ -0,0 +1,31 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MToolItem; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.widgets.Shell; + +public class ToolItemIconDialogEditor extends AbstractIconDialog { + + public ToolItemIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MToolItem element) { + super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); + } + + @Override + protected String getShellTitle() { + return "ToolItem Icon Search"; + } + + @Override + protected String getDialogTitle() { + return "ToolItem Icon Search"; + } + + @Override + protected String getDialogMessage() { + return "Search for GIF, PNG and JPG icons in the current project"; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java new file mode 100644 index 0000000000..babdf30384 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java @@ -0,0 +1,31 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; +import org.eclipse.e4.ui.model.application.ui.basic.MWindow; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.widgets.Shell; + +public class WindowIconDialogEditor extends AbstractIconDialog { + + public WindowIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MWindow element) { + super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); + } + + @Override + protected String getShellTitle() { + return "Menu Icon Search"; + } + + @Override + protected String getDialogTitle() { + return "Menu Icon Search"; + } + + @Override + protected String getDialogMessage() { + return "Search for GIF, PNG and JPG icons in the current project"; + } + +} From 6b929c1edebdc7c06d714328c7fd0c31e997d8b2 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 17 May 2010 16:03:25 +0000 Subject: [PATCH 0108/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * removed unneeded code --- .../emf/editor3x/E4WorkbenchModelEditor.java | 131 ------------------ 1 file changed, 131 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java index d8b8f5919c..e3a506d645 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java @@ -10,142 +10,11 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x; -import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.e4.tools.emf.editor3x.compat.E4CompatEditorPart; -import org.eclipse.e4.tools.emf.ui.common.IModelResource.ModelListener; -import org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor; -import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; -import org.eclipse.e4.ui.css.swt.theme.IThemeManager; -import org.eclipse.emf.common.util.URI; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.ActionFactory; -import org.eclipse.ui.part.EditorPart; -import org.osgi.framework.Bundle; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; -@SuppressWarnings("restriction") public class E4WorkbenchModelEditor extends E4CompatEditorPart { public E4WorkbenchModelEditor() { super("platform:/plugin/org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor"); } - -// private XMIModelResource resource; -// private ApplicationModelEditor editor; -// private UndoAction undoAction; -// private RedoAction redoAction; -// -// private ModelListener listener = new ModelListener() { -// -// public void dirtyChanged() { -// firePropertyChange(PROP_DIRTY); -// } -// -// public void commandStackChanged() { -// // TODO Auto-generated method stub -// -// } -// }; -// -// @Override -// public void doSave(IProgressMonitor monitor) { -// editor.doSave(monitor); -// } -// -// @Override -// public void doSaveAs() { -// -// } -// -// @Override -// public void init(IEditorSite site, IEditorInput input) -// throws PartInitException { -// setSite(site); -// setInput(input); -// -// URI resourceURI = EditUIUtil.getURI(input); -// if (resourceURI != null) { -// resource = new XMIModelResource(resourceURI); -// resource.addModelListener(listener); -// } -// } -// -// @Override -// public boolean isDirty() { -// return resource.isDirty(); -// } -// -// @Override -// public boolean isSaveAsAllowed() { -// return false; -// } -// -// @Override -// public void createPartControl(Composite parent) { -// Composite comp = new Composite(parent, SWT.NONE); -// comp.setBackground(comp.getDisplay().getSystemColor(SWT.COLOR_WHITE)); -// comp.setBackgroundMode(SWT.INHERIT_DEFAULT); -// -// FillLayout layout = new FillLayout(); -// layout.marginWidth = 10; -// layout.marginHeight = 10; -// comp.setLayout(layout); -// IFileEditorInput input = (IFileEditorInput)getEditorInput(); -// editor = new ApplicationModelEditor(comp, resource, input.getFile().getProject()); -// -// try { -// parent.setRedraw(false); -// parent.reskin(SWT.ALL); -// } finally { -// parent.setRedraw(true); -// } -// -// makeActions(); -// Bundle b = FrameworkUtil.getBundle(E4WorkbenchModelEditor.class); -// if( b != null ) { -// ServiceReference ref = b.getBundleContext().getServiceReference(IThemeManager.class.getName()); -// if( ref != null ) { -// IThemeManager mgr = (IThemeManager) b.getBundleContext().getService(ref); -// IThemeEngine engine = mgr.getEngineForDisplay(parent.getDisplay()); -// engine.applyStyles(parent, true); -// } -// } -// } -// -// private void makeActions() { -// undoAction = new UndoAction(resource); -// redoAction = new RedoAction(resource); -// -// getEditorSite().getActionBars().setGlobalActionHandler( -// ActionFactory.UNDO.getId(), undoAction); -// getEditorSite().getActionBars().setGlobalActionHandler( -// ActionFactory.REDO.getId(), redoAction); -// } -// -// @Override -// public void dispose() { -// if (undoAction != null) -// undoAction.dispose(); -// -// if (redoAction != null) -// redoAction.dispose(); -// -// if (listener != null && resource != null) -// resource.removeModelListener(listener); -// -// super.dispose(); -// } -// -// @Override -// public void setFocus() { -// editor.setFocus(); -// } - } From 69d174bf6589513f14843359e8229531c3d1987a Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 17 May 2010 16:10:16 +0000 Subject: [PATCH 0109/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * adding support for context variables --- .../e4/tools/emf/ui/internal/Messages.java | 2 +- .../tools/emf/ui/internal/Messages.properties | 1 + .../common/component/ControlFactory.java | 353 ++++++++++++------ .../internal/common/component/PartEditor.java | 1 + .../common/component/WindowEditor.java | 1 + 5 files changed, 243 insertions(+), 115 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 32762c9cdd..63842cab7b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -67,6 +67,7 @@ public class Messages { public static String ControlFactory_Tags; public static String ControlFactory_Key; public static String ControlFactory_Value; + public static String ControlFactory_ContextVariables; public static String DirectToolItemEditor_ClassURI; public static String DirectToolItemEditor_Find; @@ -305,7 +306,6 @@ public class Messages { public static String ContributionClassDialog_DialogTitle; public static String ContributionClassDialog_Label_Classname; public static String ContributionClassDialog_ShellTitle; - static { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 938e2ca60e..78ac0a1453 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -62,6 +62,7 @@ ControlFactory_Remove=Remove ControlFactory_Tags=Tags ControlFactory_Key=Key ControlFactory_Value=Value +ControlFactory_ContextVariables=Context Variables DirectToolItemEditor_ClassURI=Class URI DirectToolItemEditor_Find=Find ... diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 688533ee26..832c277f50 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -19,6 +19,7 @@ import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFListProperty; @@ -46,131 +47,255 @@ import org.eclipse.swt.widgets.Text; public class ControlFactory { - public static void createBindingsWidget(Composite parent, final AbstractComponentEditor editor) { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ControlFactory_BindingContexts); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { - handleAddText( editor, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, t); - } + public static void createVariablesWidget(Composite parent, final AbstractComponentEditor editor) { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.ControlFactory_ContextVariables); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + t.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { + handleAddText(editor, UiPackageImpl.Literals.CONTEXT__VARIABLES, t); } - }); - - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Add); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleAddText( editor, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, t); + } + }); + + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ControlFactory_Add); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + handleAddText(editor, UiPackageImpl.Literals.CONTEXT__VARIABLES, t); + } + }); + + new Label(parent, SWT.NONE); + + final TableViewer viewer = new TableViewer(parent); + viewer.setLabelProvider(new LabelProvider()); + viewer.setContentProvider(new ObservableListContentProvider()); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 150; + viewer.getControl().setLayoutData(gd); + + IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.CONTEXT__VARIABLES); + viewer.setInput(prop.observeDetail(editor.getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ControlFactory_Up); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MApplication container = (MApplication) editor.getMaster().getValue(); + int idx = container.getCommands().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), UiPackageImpl.Literals.CONTEXT__VARIABLES, obj, idx); + + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } } - }); - - new Label(parent, SWT.NONE); - - final TableViewer viewer = new TableViewer(parent); - viewer.setLabelProvider(new LabelProvider()); - viewer.setContentProvider(new ObservableListContentProvider()); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 150; - viewer.getControl().setLayoutData(gd); - - IEMFListProperty prop = EMFProperties.list(CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS); - viewer.setInput(prop.observeDetail(editor.getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; - buttonComp.setLayout(gl); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Up); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MApplication container = (MApplication) editor.getMaster().getValue(); - int idx = container.getCommands().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); - - if( cmd.canExecute() ) { - editor.getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ControlFactory_Down); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MApplication container = (MApplication) editor.getMaster().getValue(); + int idx = container.getCommands().indexOf(obj) + 1; + if (idx < container.getCommands().size()) { + Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), UiPackageImpl.Literals.CONTEXT__VARIABLES, obj, idx); + + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); } - } + } } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Down); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MApplication container = (MApplication) editor.getMaster().getValue(); - int idx = container.getCommands().indexOf(obj) + 1; - if( idx < container.getCommands().size() ) { - Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); - - if( cmd.canExecute() ) { - editor.getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ControlFactory_Remove); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + MApplication el = (MApplication) editor.getMaster().getValue(); + List ids = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(editor.getEditingDomain(), el, UiPackageImpl.Literals.CONTEXT__VARIABLES, ids); + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + if (el.getBindingContexts().size() > 0) { + viewer.setSelection(new StructuredSelection(el.getBindingContexts().get(0))); + } + } + } + } + }); + } + + public static void createBindingsWidget(Composite parent, final AbstractComponentEditor editor) { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.ControlFactory_BindingContexts); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + t.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { + handleAddText(editor, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, t); + } + } + }); + + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ControlFactory_Add); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + handleAddText(editor, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, t); + } + }); + + new Label(parent, SWT.NONE); + + final TableViewer viewer = new TableViewer(parent); + viewer.setLabelProvider(new LabelProvider()); + viewer.setContentProvider(new ObservableListContentProvider()); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 150; + viewer.getControl().setLayoutData(gd); + + IEMFListProperty prop = EMFProperties.list(CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS); + viewer.setInput(prop.observeDetail(editor.getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ControlFactory_Up); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MApplication container = (MApplication) editor.getMaster().getValue(); + int idx = container.getCommands().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); + + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); } - } + } } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Remove); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - MApplication el = (MApplication) editor.getMaster().getValue(); - List ids = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(editor.getEditingDomain(), el, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, ids); - if( cmd.canExecute() ) { - editor.getEditingDomain().getCommandStack().execute(cmd); - if( el.getBindingContexts().size() > 0 ) { - viewer.setSelection(new StructuredSelection(el.getBindingContexts().get(0))); + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ControlFactory_Down); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MApplication container = (MApplication) editor.getMaster().getValue(); + int idx = container.getCommands().indexOf(obj) + 1; + if (idx < container.getCommands().size()) { + Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); + + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); } } + } } - }); + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ControlFactory_Remove); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + MApplication el = (MApplication) editor.getMaster().getValue(); + List ids = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(editor.getEditingDomain(), el, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, ids); + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + if (el.getBindingContexts().size() > 0) { + viewer.setSelection(new StructuredSelection(el.getBindingContexts().get(0))); + } + } + } + } + }); } - - public static void createTagsWidget( Composite parent, final AbstractComponentEditor editor ) { + + public static void createTagsWidget(Composite parent, final AbstractComponentEditor editor) { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ControlFactory_Tags); l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); @@ -240,10 +365,10 @@ public String getText(Object element) { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if( ! s.isEmpty() ) { + if (!s.isEmpty()) { MApplicationElement appEl = (MApplicationElement) editor.getMaster().getValue(); Command cmd = RemoveCommand.create(editor.getEditingDomain(), appEl, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, s.toList()); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { editor.getEditingDomain().getCommandStack().execute(cmd); } } @@ -251,10 +376,10 @@ public void widgetSelected(SelectionEvent e) { }); } - private static void handleAddText( AbstractComponentEditor editor, EStructuralFeature feature, Text tagText) { + private static void handleAddText(AbstractComponentEditor editor, EStructuralFeature feature, Text tagText) { if (tagText.getText().trim().length() > 0) { String[] tags = tagText.getText().split(";"); //$NON-NLS-1$ - for( int i = 0; i < tags.length;i++ ) { + for (int i = 0; i < tags.length; i++) { tags[i] = tags[i].trim(); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index e118933576..4317138370 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -319,6 +319,7 @@ public String getText(Object element) { b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); } + ControlFactory.createVariablesWidget(parent, this); ControlFactory.createTagsWidget(parent, this); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 0efb85904c..479e9fb077 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -237,6 +237,7 @@ public void widgetSelected(SelectionEvent e) { } ControlFactory.createBindingsWidget(parent, this); + ControlFactory.createVariablesWidget(parent, this); ControlFactory.createTagsWidget(parent, this); return parent; From 1480acaa183c5e05074082fdd177c90a263e6f7d Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 18 May 2010 16:42:59 +0000 Subject: [PATCH 0110/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * reacted to upstream changes --- .../org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java | 2 +- .../emf/editor3x/compat/SelectionProviderContextFunction.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java index 518468e103..8ea8779aff 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java @@ -13,7 +13,7 @@ public class XMIResourceFunction extends ContextFunction { @Override - public Object compute(final IEclipseContext context, Object[] arguments) { + public Object compute(final IEclipseContext context) { final IEditorInput input = context.get(IEditorInput.class); final E4CompatEditorPart part = (E4CompatEditorPart) context.get(EditorPart.class); diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java index 42b59ca15a..b15003499d 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java @@ -11,7 +11,7 @@ public class SelectionProviderContextFunction extends ContextFunction { @Override - public Object compute(final IEclipseContext context, Object[] arguments) { + public Object compute(final IEclipseContext context) { return new ISelectionProviderService() { public void setSelection(Object selection) { From 4dc758983b699e76df39b104b6fb675eba95a87c Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 21 May 2010 14:26:37 +0000 Subject: [PATCH 0111/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * make the model resource none optional --- .../e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java index fe83cd6563..cb9a0bb56b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java @@ -22,7 +22,7 @@ public class ApplicationModelEditor extends ModelEditor { @Inject public ApplicationModelEditor(Composite composite, IEclipseContext context, - @Optional IModelResource modelProvider, @Optional IProject project) { + IModelResource modelProvider, @Optional IProject project) { super(composite, context, modelProvider, project); } } From 5345f9fed285da61ccab4781a66d20aee923adc7 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 21 May 2010 14:47:10 +0000 Subject: [PATCH 0112/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * remove unneeded menu element --- .../common/component/ModelComponentEditor.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index 19b89c0a9c..64225b3825 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -224,14 +224,14 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART_MENU, MODEL_COMPONENT__CHILDREN, element, Messages.ModelComponentEditor_Menus) { - - @Override - protected boolean accepted(Object o) { - return o instanceof MMenu; - } - - }); +// list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART_MENU, MODEL_COMPONENT__CHILDREN, element, Messages.ModelComponentEditor_Menus) { +// +// @Override +// protected boolean accepted(Object o) { +// return o instanceof MMenu; +// } +// +// }); list.add(new VirtualEntry( ModelEditor.VIRTUAL_MODEL_COMPONENT_CHILDREN, MODEL_COMPONENT__CHILDREN, element, Messages.ModelComponentEditor_UiChildren) { @Override From e2254a8dd69bfc1d4ea1c09b225f0020efcf2860 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 24 May 2010 08:47:34 +0000 Subject: [PATCH 0113/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * fixed build.properties --- bundles/org.eclipse.e4.tools.emf.ui/build.properties | 3 ++- .../emf/ui/internal/common/component/ApplicationEditor.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/build.properties b/bundles/org.eclipse.e4.tools.emf.ui/build.properties index e462e083a9..0ab8a4447f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/build.properties @@ -4,7 +4,8 @@ bin.includes = .,\ icons/,\ about.html,\ OSGI-INF/contributioncollector.xml,\ - plugin.xml + plugin.xml,\ + css/ output.. = bin/ jars.compile.order = . source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index b5eb34ffc8..bee39806a2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -108,6 +108,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } + ControlFactory.createVariablesWidget(parent, this); ControlFactory.createBindingsWidget(parent, this); return parent; From 85c0716692e9188b8898a7f22484ba6357ab4ab9 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 25 May 2010 15:47:56 +0000 Subject: [PATCH 0114/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * removed unneeded com.icu --- bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF | 1 - .../org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 49455424fa..d2a835ec48 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -16,7 +16,6 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.emf.edit;bundle-version="2.6.0", org.eclipse.equinox.common;bundle-version="3.6.0", org.eclipse.emf.databinding.edit;bundle-version="1.2.0", - com.ibm.icu;bundle-version="4.2.1", org.eclipse.core.resources;bundle-version="3.6.0", org.eclipse.e4.core.services;bundle-version="0.9.1", org.eclipse.osgi;bundle-version="3.6.0", diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java index 6fc7603db0..99c8b21a78 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal; +import java.text.BreakIterator; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -22,8 +23,6 @@ import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerFilter; -import com.ibm.icu.text.BreakIterator; - /** * A filter used in conjunction with FilteredTree. In order to * determine if a node should be filtered it uses the content and label provider From f65e3370fbf02fdda13be803c5e2567957890d7c Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 25 May 2010 15:48:31 +0000 Subject: [PATCH 0115/1286] [Bug 304584] - [Tooling] Implement Workbench-Model-Tooling * added elementId for command parameters --- .../e4/tools/emf/ui/internal/Messages.java | 3 ++ .../tools/emf/ui/internal/Messages.properties | 1 + .../common/component/CommandEditor.java | 40 +++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 63842cab7b..f879dfc8e4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -53,6 +53,7 @@ public class Messages { public static String CommandEditor_Down; public static String CommandEditor_Add; public static String CommandEditor_Remove; + public static String CommandEditor_ParameterId; public static String DirectMenuItemEditor_Label; public static String DirectMenuItemEditor_Description; @@ -306,6 +307,8 @@ public class Messages { public static String ContributionClassDialog_DialogTitle; public static String ContributionClassDialog_Label_Classname; public static String ContributionClassDialog_ShellTitle; + + static { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 78ac0a1453..4e9558a9be 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -48,6 +48,7 @@ CommandEditor_Up=Up CommandEditor_Down=Down CommandEditor_Add=Add ... CommandEditor_Remove=Remove +CommandEditor_ParameterId=Id DirectMenuItemEditor_Label=DirectMenuItem DirectMenuItemEditor_Description=DirectMenuItem bla bla bla diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index d22f35d85d..9f0ad33da6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -160,6 +160,46 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { gd.heightHint = 120; viewer.getControl().setLayoutData(gd); + { + IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText(Messages.CommandEditor_ParameterId); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + column.setEditingSupport(new EditingSupport(viewer) { + private TextCellEditor editor = new TextCellEditor(viewer.getTable()); + + @Override + protected void setValue(Object element, Object value) { + if( value.toString().trim().length() == 0 ) { + value = null; + } + + Command cmd = SetCommand.create(getEditingDomain(), element, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, value); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + @Override + protected Object getValue(Object element) { + MCommandParameter obj = (MCommandParameter) element; + return obj.getElementId() != null ? obj.getElementId() : ""; //$NON-NLS-1$ + } + + @Override + protected CellEditor getCellEditor(Object element) { + return editor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + } + { IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__NAME); From 34b925b1a894246747a3dc719c8473da40102b5e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 27 May 2010 15:47:10 +0000 Subject: [PATCH 0116/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling --- .../tools/emf/ui/internal/common/component/ToolBarEditor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 61c8f198ee..e2020e2757 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -93,7 +93,7 @@ public ToolBarEditor(EditingDomain editingDomain, ModelEditor editor) { public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Toolbar.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ToolBar.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); From 2dcf59f5856475a5fb6941ade9c93f2ebe0f78ca Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 2 Jun 2010 11:28:00 +0000 Subject: [PATCH 0117/1286] Bug 315362 - [Tooling] ClassCastException in WorkbenchModel Editor in 3.x host mode --- .../editor3x/compat/E4CompatEditorPart.java | 10 ++++++++ .../compat/IEclipseContextServiceFactory.java | 23 +++++++++++++++---- .../SelectionProviderContextFunction.java | 10 ++++++++ 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java index ae098740c8..ba0d738152 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x.compat; import org.eclipse.core.resources.IProject; diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java index 8380681048..875e826d93 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + * Simon Chemouil - bugfix 315362 + ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x.compat; import org.eclipse.core.runtime.IExtensionRegistry; @@ -64,11 +75,15 @@ public Object create(Class serviceInterface, IServiceLocator parentLocator, public void selectionChanged(IWorkbenchPart part, ISelection selection) { if( ! selection.isEmpty() ) { - IStructuredSelection s = (IStructuredSelection) selection; - if( s.size() == 1 ) { - windowContext.set(IServiceConstants.SELECTION, s.getFirstElement()); + if( ! (selection instanceof IStructuredSelection) ) { + windowContext.set(ISelection.class, selection); } else { - windowContext.set(IServiceConstants.SELECTION, s.toList()); + IStructuredSelection s = (IStructuredSelection) selection; + if( s.size() == 1 ) { + windowContext.set(IServiceConstants.SELECTION, s.getFirstElement()); + } else { + windowContext.set(IServiceConstants.SELECTION, s.toList()); + } } } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java index b15003499d..e908509eec 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x.compat; import java.util.List; From 28cc75bdc4cf7718a6570a6311a407501648451e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 3 Jun 2010 12:26:32 +0000 Subject: [PATCH 0118/1286] Bug 315362 - [Tooling] ClassCastException in WorkbenchModel Editor in 3.x host mode --- .../emf/editor3x/compat/IEclipseContextServiceFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java index 875e826d93..93f095a23f 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java @@ -7,7 +7,7 @@ * * Contributors: * Tom Schindl - initial API and implementation - * Simon Chemouil - bugfix 315362 + * ARTAL Technologies - bugfix 315362 ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x.compat; From 019151f7b7e5dc90ea9587bf89ef7d6694c15b1b Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 3 Jun 2010 16:13:16 +0000 Subject: [PATCH 0119/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * factoring compat stuff --- .../org.eclipse.e4.tools.compat/.classpath | 7 + bundles/org.eclipse.e4.tools.compat/.project | 33 +++ .../.settings/org.eclipse.jdt.core.prefs | 8 + .../META-INF/MANIFEST.MF | 16 ++ .../OSGI-INF/selectionproviderfunction.xml | 8 + .../build.properties | 6 + .../org.eclipse.e4.tools.compat/plugin.xml | 13 + .../internal/ContextServiceFactory.java | 94 +++++++ .../internal/DirtyProviderFunction.java | 34 +++ .../ReflectionContributionFactory.java | 253 ++++++++++++++++++ .../SelectionProviderContextFunction.java | 39 +++ .../e4/tools/compat/internal/Util.java | 26 ++ .../e4/tools/compat/parts/DIEditorPart.java | 171 ++++++++++++ .../compat/parts/DISaveableViewPart.java | 42 +++ .../e4/tools/compat/parts/DIViewPart.java | 30 +++ .../org.eclipse.e4.tools.services/.classpath | 7 + .../org.eclipse.e4.tools.services/.project | 28 ++ .../.settings/org.eclipse.jdt.core.prefs | 8 + .../META-INF/MANIFEST.MF | 7 + .../build.properties | 4 + .../tools/services/IDirtyProviderService.java | 5 + .../services/ISelectionProviderService.java | 5 + 22 files changed, 844 insertions(+) create mode 100644 bundles/org.eclipse.e4.tools.compat/.classpath create mode 100644 bundles/org.eclipse.e4.tools.compat/.project create mode 100644 bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.jdt.core.prefs create mode 100644 bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF create mode 100644 bundles/org.eclipse.e4.tools.compat/OSGI-INF/selectionproviderfunction.xml create mode 100644 bundles/org.eclipse.e4.tools.compat/build.properties create mode 100644 bundles/org.eclipse.e4.tools.compat/plugin.xml create mode 100644 bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java create mode 100644 bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DirtyProviderFunction.java create mode 100644 bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java create mode 100644 bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/SelectionProviderContextFunction.java create mode 100644 bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/Util.java create mode 100644 bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java create mode 100644 bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java create mode 100644 bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java create mode 100644 bundles/org.eclipse.e4.tools.services/.classpath create mode 100644 bundles/org.eclipse.e4.tools.services/.project create mode 100644 bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.core.prefs create mode 100644 bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF create mode 100644 bundles/org.eclipse.e4.tools.services/build.properties create mode 100644 bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IDirtyProviderService.java create mode 100644 bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/ISelectionProviderService.java diff --git a/bundles/org.eclipse.e4.tools.compat/.classpath b/bundles/org.eclipse.e4.tools.compat/.classpath new file mode 100644 index 0000000000..64c5e31b7a --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.compat/.project b/bundles/org.eclipse.e4.tools.compat/.project new file mode 100644 index 0000000000..e5e9a15272 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/.project @@ -0,0 +1,33 @@ + + + org.eclipse.e4.tools.compat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.pde.ds.core.builder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..4fe427185e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Mon May 31 09:52:05 CEST 2010 +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/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..6e43c8a7ae --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Compat +Bundle-SymbolicName: org.eclipse.e4.tools.compat;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", + org.eclipse.core.runtime;bundle-version="3.6.0", + org.eclipse.e4.core.contexts;bundle-version="0.9.0", + org.eclipse.e4.core.services;bundle-version="0.9.1", + org.eclipse.e4.ui.services;bundle-version="0.9.1", + org.eclipse.e4.core.di;bundle-version="0.9.0", + org.eclipse.e4.tools.services;bundle-version="1.0.0", + org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0" +Service-Component: OSGI-INF/selectionproviderfunction.xml +Export-Package: org.eclipse.e4.tools.compat.parts diff --git a/bundles/org.eclipse.e4.tools.compat/OSGI-INF/selectionproviderfunction.xml b/bundles/org.eclipse.e4.tools.compat/OSGI-INF/selectionproviderfunction.xml new file mode 100644 index 0000000000..8790308750 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/OSGI-INF/selectionproviderfunction.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/build.properties b/bundles/org.eclipse.e4.tools.compat/build.properties new file mode 100644 index 0000000000..4975ca25a1 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/build.properties @@ -0,0 +1,6 @@ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + OSGI-INF/selectionproviderfunction.xml +source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.compat/plugin.xml b/bundles/org.eclipse.e4.tools.compat/plugin.xml new file mode 100644 index 0000000000..a839686368 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/plugin.xml @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java new file mode 100644 index 0000000000..480448e405 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java @@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.compat.internal; + +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.RegistryFactory; +import org.eclipse.e4.core.contexts.EclipseContextFactory; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.core.services.contributions.IContributionFactory; +import org.eclipse.e4.ui.services.IServiceConstants; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.ISelectionListener; +import org.eclipse.ui.ISelectionService; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchPartSite; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.internal.services.IWorkbenchLocationService; +import org.eclipse.ui.services.AbstractServiceFactory; +import org.eclipse.ui.services.IServiceLocator; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; + +@SuppressWarnings("restriction") +public class ContextServiceFactory extends AbstractServiceFactory { + + @Override + public Object create(Class serviceInterface, IServiceLocator parentLocator, + IServiceLocator locator) { + if( ! IEclipseContext.class.equals(serviceInterface) ) { + return null; + } + + + IWorkbenchLocationService wls = (IWorkbenchLocationService) locator.getService(IWorkbenchLocationService.class); + final IWorkbenchWindow window = wls.getWorkbenchWindow(); + final IWorkbenchPartSite site = wls.getPartSite(); + +// System.err.println("The locator: " + locator); +// System.err.println(" Window: " + window); +// System.err.println(" Site: " + site); + + Object o = parentLocator.getService(serviceInterface); + + // This happens when we run in plain 3.x + // We need to create a parent service context + if( window == null && site == null ) { + Bundle bundle = FrameworkUtil.getBundle(ContextServiceFactory.class); + BundleContext bundleContext = bundle.getBundleContext(); + IEclipseContext serviceContext = EclipseContextFactory.getServiceContext(bundleContext); + + final IEclipseContext appContext = serviceContext.createChild("WorkbenchContext"); //$NON-NLS-1$ + IExtensionRegistry registry = RegistryFactory.getRegistry(); + ReflectionContributionFactory contributionFactory = new ReflectionContributionFactory(registry); + appContext.set(IContributionFactory.class.getName(),contributionFactory); + + return appContext; + } else if( o != null && site == null ) { + final IEclipseContext windowContext = ((IEclipseContext)o).createChild("WindowContext("+window+")"); + windowContext.set(ISelectionService.class, window.getSelectionService()); + windowContext.declareModifiable(IServiceConstants.SELECTION); + + window.getSelectionService().addSelectionListener(new ISelectionListener() { + + public void selectionChanged(IWorkbenchPart part, ISelection selection) { + if( ! selection.isEmpty() ) { + if( selection instanceof IStructuredSelection ) { + IStructuredSelection s = (IStructuredSelection) selection; + if( s.size() == 1 ) { + windowContext.set(IServiceConstants.SELECTION, s.getFirstElement()); + } else { + windowContext.set(IServiceConstants.SELECTION, s.toList()); + } + } else { + windowContext.set(IServiceConstants.SELECTION, selection); + } + } + } + }); + return windowContext; + } + + return o; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DirtyProviderFunction.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DirtyProviderFunction.java new file mode 100644 index 0000000000..88d82f130c --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DirtyProviderFunction.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.compat.internal; + +import org.eclipse.e4.core.contexts.ContextFunction; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.tools.compat.parts.DIEditorPart; +import org.eclipse.e4.tools.services.IDirtyProviderService; +import org.eclipse.ui.part.EditorPart; + +public class DirtyProviderFunction extends ContextFunction { + + @Override + public Object compute(IEclipseContext context) { + DIEditorPart part = (DIEditorPart) context.get(EditorPart.class); + return new IDirtyProviderService() { + + public void setDirtyState(boolean dirtyState) { + // TODO Auto-generated method stub + + } + + }; + } + +} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java new file mode 100644 index 0000000000..3ac6b2d03a --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java @@ -0,0 +1,253 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.compat.internal; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.InvalidRegistryObjectException; +import org.eclipse.e4.core.contexts.ContextInjectionFactory; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.core.di.InjectionException; +import org.eclipse.e4.core.services.contributions.IContributionFactory; +import org.eclipse.e4.core.services.contributions.IContributionFactorySpi; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; +import org.osgi.service.packageadmin.PackageAdmin; + +/** + * Create the contribution factory. + */ +public class ReflectionContributionFactory implements IContributionFactory { + + private IExtensionRegistry registry; + private Map languages; + + static class URI { + private String[] segments; + + URI(String[] segments) { + this.segments = segments; + } + + public static URI createURI(String uriString) { + return new URI(uriString.split("/")); + } + + public int segmentCount() { + return segments.length; + } + + public String segment(int i) { + return segments[i]; + } + } + + /** + * Create a reflection factory. + * + * @param registry + * to read languages. + */ + public ReflectionContributionFactory(IExtensionRegistry registry) { + this.registry = registry; + processLanguages(); + } + + public Object call(Object object, String uriString, String methodName, IEclipseContext context, + Object defaultValue) { + if (uriString != null) { + URI uri = URI.createURI(uriString); + if (uri.segmentCount() > 3) { + String prefix = uri.segment(2); + IContributionFactorySpi factory = (IContributionFactorySpi) languages.get(prefix); + return factory.call(object, methodName, context, defaultValue); + } + } + + Method targetMethod = null; + + Method[] methods = object.getClass().getMethods(); + + // Optimization: if there's only one method, use it. + if (methods.length == 1) { + targetMethod = methods[0]; + } else { + ArrayList toSort = new ArrayList(); + + for (int i = 0; i < methods.length; i++) { + Method method = methods[i]; + + // Filter out non-public constructors + if ((method.getModifiers() & Modifier.PUBLIC) != 0 + && method.getName().equals(methodName)) { + toSort.add(method); + } + } + + // Sort the methods by descending number of method + // arguments + Collections.sort(toSort, new Comparator() { + /* + * (non-Javadoc) + * + * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) + */ + public int compare(Method m1, Method m2) { + int l1 = m1.getParameterTypes().length; + int l2 = m2.getParameterTypes().length; + + return l1 - l2; + } + }); + + // Find the first satisfiable method + for (Iterator iter = toSort.iterator(); iter.hasNext() && targetMethod == null;) { + Method next = iter.next(); + + boolean satisfiable = true; + + Class[] params = next.getParameterTypes(); + for (int i = 0; i < params.length && satisfiable; i++) { + Class clazz = params[i]; + + if (!context.containsKey(clazz.getName()) + && !IEclipseContext.class.equals(clazz)) { + satisfiable = false; + } + } + + if (satisfiable) { + targetMethod = next; + } + } + } + + if (targetMethod == null) { + if (defaultValue != null) { + return defaultValue; + } + throw new RuntimeException( + "could not find satisfiable method " + methodName + " in class " + object.getClass()); //$NON-NLS-1$//$NON-NLS-2$ + } + + Class[] paramKeys = targetMethod.getParameterTypes(); + + try { +// Activator.trace(Policy.DEBUG_CMDS, "calling: " + methodName, null); //$NON-NLS-1$ + Object[] params = new Object[paramKeys.length]; + for (int i = 0; i < params.length; i++) { + if (IEclipseContext.class.equals(paramKeys[i])) { + params[i] = context; + } else { + params[i] = context.get(paramKeys[i].getName()); + } + } + + return targetMethod.invoke(object, params); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + public Object create(String uriString, IEclipseContext context) { + if (uriString == null) { + return null; + } + URI uri = URI.createURI(uriString); + Bundle bundle = getBundle(uri); + Object contribution; + if (bundle != null) { + contribution = createFromBundle(bundle, context, uri); + } else { + contribution = null; +// Activator.log(LogService.LOG_ERROR, "Unable to retrive the bundle from the URI: " //$NON-NLS-1$ +// + uriString); + } + return contribution; + } + + protected Object createFromBundle(Bundle bundle, IEclipseContext context, URI uri) { + Object contribution; + if (uri.segmentCount() > 3) { + String prefix = uri.segment(2); + IContributionFactorySpi factory = (IContributionFactorySpi) languages.get(prefix); + StringBuffer resource = new StringBuffer(uri.segment(3)); + for (int i = 4; i < uri.segmentCount(); i++) { + resource.append('/'); + resource.append(uri.segment(i)); + } + contribution = factory.create(bundle, resource.toString(), context); + } else { + String clazz = uri.segment(2); + try { + Class targetClass = bundle.loadClass(clazz); + contribution = ContextInjectionFactory.make(targetClass, context); + if (contribution == null) { + String message = "Unable to load class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ + + bundle.getBundleId() + "'"; //$NON-NLS-1$ +// Activator.log(LogService.LOG_ERROR, message, new Exception()); + } + } catch (ClassNotFoundException e) { + contribution = null; + String message = "Unable to load class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ + + bundle.getBundleId() + "'"; //$NON-NLS-1$ +// Activator.log(LogService.LOG_ERROR, message, e); + } catch (InjectionException e) { + contribution = null; + String message = "Unable to create class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ + + bundle.getBundleId() + "'"; //$NON-NLS-1$ +// Activator.log(LogService.LOG_ERROR, message, e); + } + } + return contribution; + } + + protected void processLanguages() { + languages = new HashMap(); + String extId = "org.eclipse.e4.languages"; //$NON-NLS-1$ + IConfigurationElement[] languageElements = registry.getConfigurationElementsFor(extId); + for (int i = 0; i < languageElements.length; i++) { + IConfigurationElement languageElement = languageElements[i]; + try { + languages.put(languageElement.getAttribute("name"), //$NON-NLS-1$ + languageElement.createExecutableExtension("contributionFactory")); //$NON-NLS-1$ + } catch (InvalidRegistryObjectException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + protected Bundle getBundle(URI platformURI) { + return Util.getBundle(platformURI.segment(1)); + } + + public Bundle getBundle(String uriString) { + URI uri = URI.createURI(uriString); + return getBundle(uri); + } + +} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/SelectionProviderContextFunction.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/SelectionProviderContextFunction.java new file mode 100644 index 0000000000..901627cd04 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/SelectionProviderContextFunction.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.compat.internal; + +import java.util.List; + +import org.eclipse.e4.core.contexts.ContextFunction; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.tools.services.ISelectionProviderService; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.StructuredSelection; + + +public class SelectionProviderContextFunction extends ContextFunction { + + @Override + public Object compute(final IEclipseContext context) { + return new ISelectionProviderService() { + public void setSelection(Object selection) { + ISelectionProvider pv = context.get(ISelectionProvider.class); + + if( selection instanceof List ) { + pv.setSelection(new StructuredSelection((List)selection)); + } else { + pv.setSelection(new StructuredSelection(selection)); + } + + } + }; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/Util.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/Util.java new file mode 100644 index 0000000000..567fcc2b2f --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/Util.java @@ -0,0 +1,26 @@ +package org.eclipse.e4.tools.compat.internal; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; +import org.osgi.service.packageadmin.PackageAdmin; + +public class Util { + public static Bundle getBundle(String bundleName) { + Bundle bundle = FrameworkUtil.getBundle(Util.class); + BundleContext ctx = bundle.getBundleContext(); + ServiceReference ref = bundle.getBundleContext().getServiceReference(PackageAdmin.class.getName()); + PackageAdmin bundleAdmin = (PackageAdmin) ctx.getService(ref); + Bundle[] bundles = bundleAdmin.getBundles(bundleName, null); + if (bundles == null) + return null; + // Return the first bundle that is not installed or uninstalled + for (int i = 0; i < bundles.length; i++) { + if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) { + return bundles[i]; + } + } + return null; + } +} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java new file mode 100644 index 0000000000..a154d288e7 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java @@ -0,0 +1,171 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.compat.parts; + +import java.lang.reflect.Method; + +import org.eclipse.core.runtime.ListenerList; +import org.eclipse.e4.core.contexts.ContextInjectionFactory; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.tools.compat.internal.Util; +import org.eclipse.e4.ui.services.IStylingEngine; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.part.EditorPart; + +public abstract class DIEditorPart extends EditorPart { + private IEclipseContext context; + private C component; + private Class clazz; + private boolean dirtyState; + + public DIEditorPart(Class clazz) { + this.clazz = clazz; + } + +//FIXME once @Persist is out of ui.workbench +// @Override +// public void doSave(IProgressMonitor monitor) { +// // TODO Auto-generated method stub +// +// } +// +// @Override +// public void doSaveAs() { +// // TODO Auto-generated method stub +// } + + @Override + public void init(IEditorSite site, IEditorInput input) + throws PartInitException { + setSite(site); + setInput(input); + + IEclipseContext parentContext = (IEclipseContext) getSite().getService(IEclipseContext.class); + + // Check if running in 4.x + if( parentContext.get("org.eclipse.e4.workbench.ui.IPresentationEngine") != null ) { + // Hack to get the MPart-Context + try { + Class clazz = Util.getBundle("org.eclipse.e4.ui.model").loadClass("org.eclipse.e4.ui.model.application.ui.basic.MPart"); + Object instance = getSite().getService(clazz); + Method m = clazz.getMethod("getContext", new Class[0]); + context = (IEclipseContext) m.invoke(instance); + } catch (Exception e) { + throw new PartInitException("Could not create context",e); + } + } else { + context = parentContext.createChild("EditPart('"+getPartName()+"')"); //$NON-NLS-1$ + } + + context.declareModifiable(IEditorInput.class); + context.declareModifiable(EditorPart.class); + + context.set(EditorPart.class,this); + context.set(IEditorInput.class, input); + } + + +// +// @Override +// public boolean isSaveAsAllowed() { +// // TODO Auto-generated method stub +// return false; +// } + + @Override + public void createPartControl(Composite parent) { + ISelectionProvider s = new SelectionProviderImpl(); + context.set(ISelectionProvider.class, s); + getSite().setSelectionProvider(s); + + IStylingEngine styleEngine = context.get(IStylingEngine.class); + Composite comp = new Composite(parent, SWT.NONE); + comp.setBackgroundMode(SWT.INHERIT_DEFAULT); + + FillLayout layout = new FillLayout(); + layout.marginWidth = 10; + layout.marginHeight = 10; + comp.setLayout(layout); + + context.set(Composite.class.getName(), comp); + component = ContextInjectionFactory.make(clazz, context); + + styleEngine.setClassname(comp, getSite().getId()); + } + + public C getComponent() { + return component; + } + + public void setDirtyState(boolean dirtyState) { + if( dirtyState != this.dirtyState ) { + this.dirtyState = dirtyState; + firePropertyChange(PROP_DIRTY); + } + } + + @Override + public boolean isDirty() { + return dirtyState; + } + +//FIXME Once we have an @Focus we can implement it +// @Override +// public void setFocus() { +// // TODO Auto-generated method stub +// +// } + + @Override + public void dispose() { + context.dispose(); + context = null; + super.dispose(); + } + + private class SelectionProviderImpl implements ISelectionProvider { + private ISelection currentSelection = StructuredSelection.EMPTY; + + private ListenerList listeners = new ListenerList(); + + public void setSelection(ISelection selection) { + currentSelection = selection; + SelectionChangedEvent evt = new SelectionChangedEvent(this, selection); + + for( Object l : listeners.getListeners() ) { + ((ISelectionChangedListener)l).selectionChanged(evt); + } + } + + public void removeSelectionChangedListener( + ISelectionChangedListener listener) { + listeners.remove(listener); + } + + public ISelection getSelection() { + return currentSelection; + } + + public void addSelectionChangedListener(ISelectionChangedListener listener) { + listeners.add(listener); + } + } +} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java new file mode 100644 index 0000000000..a55efc86f8 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.compat.parts; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.ui.ISaveablePart; + +public class DISaveableViewPart extends DIViewPart implements ISaveablePart { + + public void doSave(IProgressMonitor monitor) { + // TODO Auto-generated method stub + + } + + public void doSaveAs() { + // TODO Auto-generated method stub + + } + + public boolean isDirty() { + // TODO Auto-generated method stub + return false; + } + + public boolean isSaveAsAllowed() { + // TODO Auto-generated method stub + return false; + } + + public boolean isSaveOnCloseNeeded() { + // TODO Auto-generated method stub + return false; + } +} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java new file mode 100644 index 0000000000..876f05dbcd --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.compat.parts; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.part.ViewPart; + +public class DIViewPart extends ViewPart { + + @Override + public void createPartControl(Composite parent) { + // TODO Auto-generated method stub + + } + + @Override + public void setFocus() { + // TODO Auto-generated method stub + + } + +} diff --git a/bundles/org.eclipse.e4.tools.services/.classpath b/bundles/org.eclipse.e4.tools.services/.classpath new file mode 100644 index 0000000000..64c5e31b7a --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.services/.project b/bundles/org.eclipse.e4.tools.services/.project new file mode 100644 index 0000000000..15c52ba19e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/.project @@ -0,0 +1,28 @@ + + + org.eclipse.e4.tools.services + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..199694e6da --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Wed Jun 02 16:01:21 CEST 2010 +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/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..664eaddc1e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Services +Bundle-SymbolicName: org.eclipse.e4.tools.services +Bundle-Version: 1.0.0.qualifier +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: org.eclipse.e4.tools.services diff --git a/bundles/org.eclipse.e4.tools.services/build.properties b/bundles/org.eclipse.e4.tools.services/build.properties new file mode 100644 index 0000000000..34d2e4d2da --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IDirtyProviderService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IDirtyProviderService.java new file mode 100644 index 0000000000..52dc193634 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IDirtyProviderService.java @@ -0,0 +1,5 @@ +package org.eclipse.e4.tools.services; + +public interface IDirtyProviderService { + public void setDirtyState(boolean dirtyState); +} diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/ISelectionProviderService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/ISelectionProviderService.java new file mode 100644 index 0000000000..e90d0f60bd --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/ISelectionProviderService.java @@ -0,0 +1,5 @@ +package org.eclipse.e4.tools.services; + +public interface ISelectionProviderService { + public void setSelection(Object selection); +} From f29d1abc4d2f9a9a8318d0091b09d4f6f46b7009 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 3 Jun 2010 16:26:30 +0000 Subject: [PATCH 0120/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * edit propagation --- .../org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF | 3 ++- .../OSGI-INF/dirtyproviderfunction.xml | 8 ++++++++ bundles/org.eclipse.e4.tools.compat/build.properties | 3 ++- .../tools/compat/internal/DirtyProviderFunction.java | 10 ++++++---- .../eclipse/e4/tools/compat/parts/DIEditorPart.java | 2 +- 5 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.compat/OSGI-INF/dirtyproviderfunction.xml diff --git a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF index 6e43c8a7ae..356b567cb4 100644 --- a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF @@ -12,5 +12,6 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.core.di;bundle-version="0.9.0", org.eclipse.e4.tools.services;bundle-version="1.0.0", org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0" -Service-Component: OSGI-INF/selectionproviderfunction.xml +Service-Component: OSGI-INF/selectionproviderfunction.xml, OSGI-INF/dirtyproviderfunction.xml Export-Package: org.eclipse.e4.tools.compat.parts +Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.e4.tools.compat/OSGI-INF/dirtyproviderfunction.xml b/bundles/org.eclipse.e4.tools.compat/OSGI-INF/dirtyproviderfunction.xml new file mode 100644 index 0000000000..7927e5092b --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/OSGI-INF/dirtyproviderfunction.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/build.properties b/bundles/org.eclipse.e4.tools.compat/build.properties index 4975ca25a1..e56d72ba99 100644 --- a/bundles/org.eclipse.e4.tools.compat/build.properties +++ b/bundles/org.eclipse.e4.tools.compat/build.properties @@ -2,5 +2,6 @@ output.. = bin/ bin.includes = META-INF/,\ .,\ plugin.xml,\ - OSGI-INF/selectionproviderfunction.xml + OSGI-INF/selectionproviderfunction.xml,\ + OSGI-INF/dirtyproviderfunction.xml source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DirtyProviderFunction.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DirtyProviderFunction.java index 88d82f130c..0a459f2ac5 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DirtyProviderFunction.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DirtyProviderFunction.java @@ -20,14 +20,16 @@ public class DirtyProviderFunction extends ContextFunction { @Override public Object compute(IEclipseContext context) { - DIEditorPart part = (DIEditorPart) context.get(EditorPart.class); + final DIEditorPart part = (DIEditorPart) context.get(EditorPart.class); + if( part == null ) { + return null; + } + return new IDirtyProviderService() { public void setDirtyState(boolean dirtyState) { - // TODO Auto-generated method stub - + part.setDirtyState(dirtyState); } - }; } diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java index a154d288e7..2549071c69 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java @@ -64,7 +64,7 @@ public void init(IEditorSite site, IEditorInput input) if( parentContext.get("org.eclipse.e4.workbench.ui.IPresentationEngine") != null ) { // Hack to get the MPart-Context try { - Class clazz = Util.getBundle("org.eclipse.e4.ui.model").loadClass("org.eclipse.e4.ui.model.application.ui.basic.MPart"); + Class clazz = Util.getBundle("org.eclipse.e4.ui.model.workbench").loadClass("org.eclipse.e4.ui.model.application.ui.basic.MPart"); Object instance = getSite().getService(clazz); Method m = clazz.getMethod("getContext", new Class[0]); context = (IEclipseContext) m.invoke(instance); From c80b325a088c3f78ebcf3037bbc75a95a3f417d0 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 3 Jun 2010 16:34:33 +0000 Subject: [PATCH 0121/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed DS problem --- .../OSGI-INF/dirtyproviderfunction.xml | 4 ++-- .../OSGI-INF/selectionproviderfunction.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.compat/OSGI-INF/dirtyproviderfunction.xml b/bundles/org.eclipse.e4.tools.compat/OSGI-INF/dirtyproviderfunction.xml index 7927e5092b..997082069c 100644 --- a/bundles/org.eclipse.e4.tools.compat/OSGI-INF/dirtyproviderfunction.xml +++ b/bundles/org.eclipse.e4.tools.compat/OSGI-INF/dirtyproviderfunction.xml @@ -1,8 +1,8 @@ - + - \ No newline at end of file + diff --git a/bundles/org.eclipse.e4.tools.compat/OSGI-INF/selectionproviderfunction.xml b/bundles/org.eclipse.e4.tools.compat/OSGI-INF/selectionproviderfunction.xml index 8790308750..15b8531d18 100644 --- a/bundles/org.eclipse.e4.tools.compat/OSGI-INF/selectionproviderfunction.xml +++ b/bundles/org.eclipse.e4.tools.compat/OSGI-INF/selectionproviderfunction.xml @@ -1,8 +1,8 @@ - + - \ No newline at end of file + From ea53a6a1712b7c3a30387616d0e7c9fbb85c4ee4 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 3 Jun 2010 16:38:13 +0000 Subject: [PATCH 0122/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * adding new compat bundles --- .../org.eclipse.e4.core.tools.feature/feature.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/features/org.eclipse.e4.core.tools.feature/feature.xml b/features/org.eclipse.e4.core.tools.feature/feature.xml index b542dc7298..0f880b4302 100644 --- a/features/org.eclipse.e4.core.tools.feature/feature.xml +++ b/features/org.eclipse.e4.core.tools.feature/feature.xml @@ -31,4 +31,18 @@ version="0.0.0" unpack="false"/> + + + + From 993ecf59704bfbd7ef3b1881d5a354b5be8ebf49 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 3 Jun 2010 17:08:12 +0000 Subject: [PATCH 0123/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * setting up styling engine --- .../internal/ContextServiceFactory.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java index 480448e405..fa33b02037 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java @@ -15,9 +15,14 @@ import org.eclipse.e4.core.contexts.EclipseContextFactory; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.core.services.contributions.IContributionFactory; +import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; +import org.eclipse.e4.ui.css.swt.theme.IThemeManager; import org.eclipse.e4.ui.services.IServiceConstants; +import org.eclipse.e4.ui.services.IStylingEngine; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Widget; import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.ISelectionService; import org.eclipse.ui.IWorkbenchPart; @@ -63,6 +68,27 @@ public Object create(Class serviceInterface, IServiceLocator parentLocator, ReflectionContributionFactory contributionFactory = new ReflectionContributionFactory(registry); appContext.set(IContributionFactory.class.getName(),contributionFactory); + IThemeManager manager = serviceContext.get(IThemeManager.class); + final IThemeEngine engine = manager.getEngineForDisplay(Display.getCurrent()); + + appContext.set(IStylingEngine.class, new IStylingEngine() { + + public void setClassname(Object widget, String classname) { + ((Widget) widget).setData( + "org.eclipse.e4.ui.css.CssClassName", classname); //$NON-NLS-1$ + engine.applyStyles((Widget) widget, true); + } + + public void setId(Object widget, String id) { + ((Widget) widget).setData("org.eclipse.e4.ui.css.id", id); //$NON-NLS-1$ + engine.applyStyles((Widget) widget, true); + } + + public void style(Object widget) { + engine.applyStyles((Widget) widget, true); + } + }); + return appContext; } else if( o != null && site == null ) { final IEclipseContext windowContext = ((IEclipseContext)o).createChild("WindowContext("+window+")"); From 325d42a3bd7368f18fa5f2548c30a7f39baf6a3c Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 3 Jun 2010 17:24:43 +0000 Subject: [PATCH 0124/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * using new compat implementation --- .../e4/tools/compat/parts/DIEditorPart.java | 2 +- .../META-INF/MANIFEST.MF | 6 +- .../OSGI-INF/selectionproviderfunction.xml | 8 - .../plugin.xml | 9 - .../emf/editor3x/E4WorkbenchModelEditor.java | 29 ++- .../emf/editor3x/XMIResourceFunction.java | 8 +- .../editor3x/compat/E4CompatEditorPart.java | 186 ------------------ .../compat/IEclipseContextServiceFactory.java | 96 --------- .../SelectionProviderContextFunction.java | 39 ---- .../css/default.css | 5 + 10 files changed, 39 insertions(+), 349 deletions(-) delete mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/selectionproviderfunction.xml delete mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java delete mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java delete mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java index 2549071c69..3f2580cb43 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java @@ -108,7 +108,7 @@ public void createPartControl(Composite parent) { context.set(Composite.class.getName(), comp); component = ContextInjectionFactory.make(clazz, context); - styleEngine.setClassname(comp, getSite().getId()); + styleEngine.setClassname(comp, getClass().getSimpleName()); } public C getComponent() { diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index e419afd5cf..db0beef847 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -22,7 +22,9 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.core.di;bundle-version="0.9.0", org.eclipse.e4.core.services;bundle-version="0.9.1", org.eclipse.emf.edit;bundle-version="2.6.0", - org.eclipse.e4.ui.services;bundle-version="0.9.1" -Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/xmiresourcecontextfunction.xml, OSGI-INF/selectionproviderfunction.xml + org.eclipse.e4.ui.services;bundle-version="0.9.1", + org.eclipse.e4.tools.compat;bundle-version="1.0.0", + org.eclipse.e4.tools.services;bundle-version="1.0.0" +Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/xmiresourcecontextfunction.xml Bundle-ActivationPolicy: lazy Export-Package: org.eclipse.e4.tools.emf.editor3x.wizard;x-internal:=true diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/selectionproviderfunction.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/selectionproviderfunction.xml deleted file mode 100644 index 73d6e010dd..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/selectionproviderfunction.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml index 3859e5668b..8a4c94ce26 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml @@ -38,14 +38,5 @@ name="e4"> - - - - - - diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java index e3a506d645..ec9134aeab 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java @@ -10,11 +10,34 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x; -import org.eclipse.e4.tools.emf.editor3x.compat.E4CompatEditorPart; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.e4.tools.compat.parts.DIEditorPart; +import org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor; -public class E4WorkbenchModelEditor extends E4CompatEditorPart { +@SuppressWarnings("restriction") +public class E4WorkbenchModelEditor extends DIEditorPart { public E4WorkbenchModelEditor() { - super("platform:/plugin/org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor"); + super(ApplicationModelEditor.class); + } + + @Override + public void doSave(IProgressMonitor monitor) { + getComponent().doSave(monitor); + } + + @Override + public void doSaveAs() { + + } + + @Override + public boolean isSaveAsAllowed() { + return false; + } + + @Override + public void setFocus() { + getComponent().setFocus(); } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java index 8ea8779aff..b8e737b8ca 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java @@ -2,20 +2,19 @@ import org.eclipse.e4.core.contexts.ContextFunction; import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.editor3x.compat.E4CompatEditorPart; import org.eclipse.e4.tools.emf.editor3x.emf.EditUIUtil; import org.eclipse.e4.tools.emf.ui.common.XMIModelResource; import org.eclipse.e4.tools.emf.ui.common.IModelResource.ModelListener; +import org.eclipse.e4.tools.services.IDirtyProviderService; import org.eclipse.emf.common.util.URI; import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.part.EditorPart; public class XMIResourceFunction extends ContextFunction { @Override public Object compute(final IEclipseContext context) { final IEditorInput input = context.get(IEditorInput.class); - final E4CompatEditorPart part = (E4CompatEditorPart) context.get(EditorPart.class); + final IDirtyProviderService dirtyProvider = context.get(IDirtyProviderService.class); if( input != null ) { URI resourceURI = EditUIUtil.getURI(input); @@ -23,8 +22,7 @@ public Object compute(final IEclipseContext context) { resource.addModelListener(new ModelListener() { public void dirtyChanged() { - context.set(EditorPart.class.getName()+".dirty", resource.isDirty()); - part.firePropertyChange(EditorPart.PROP_DIRTY); + dirtyProvider.setDirtyState(resource.isDirty()); } public void commandStackChanged() { diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java deleted file mode 100644 index ba0d738152..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java +++ /dev/null @@ -1,186 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x.compat; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IExecutableExtension; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.ListenerList; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.services.contributions.IContributionFactory; -import org.eclipse.e4.tools.emf.editor3x.E4WorkbenchModelEditor; -import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; -import org.eclipse.e4.ui.css.swt.theme.IThemeManager; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.ISelectionListener; -import org.eclipse.ui.ISelectionService; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.part.EditorPart; -import org.osgi.framework.Bundle; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; - -public class E4CompatEditorPart extends EditorPart implements IExecutableExtension { - private Object instance; - private String classUri; - - //TODO can we create a context as a top-level service? - private IEclipseContext context; - - public E4CompatEditorPart(String classUri) { - this.classUri = classUri; - } - - @Override - public void doSave(IProgressMonitor monitor) { - IContributionFactory factory = (IContributionFactory) context.get(IContributionFactory.class); - factory.call(instance, null, "doSave", context, null); - } - - @Override - public void doSaveAs() { - // TODO Auto-generated method stub - - } - - @Override - public void init(IEditorSite site, IEditorInput input) - throws PartInitException { - setSite(site); - setInput(input); - - IEclipseContext parentContext = (IEclipseContext) getSite().getService(IEclipseContext.class); - -// System.err.println("The context" + parentContext); - - // We are in e4 Compat-Mode - if( parentContext.get("org.eclipse.e4.workbench.ui.IPresentationEngine") != null ) { - MPart p = (MPart) getSite().getService(MPart.class); - context = p.getContext(); - } else { - context = parentContext.createChild("EditPart('"+getPartName()+"')"); //$NON-NLS-1$ - } - - context.declareModifiable(IEditorInput.class); - context.declareModifiable(EditorPart.class); - - context.set(EditorPart.class,this); - context.set(IEditorInput.class, input); - - if( input instanceof IFileEditorInput ) { - IFileEditorInput fInput = (IFileEditorInput)getEditorInput(); - context.set(IProject.class, fInput.getFile().getProject()); - } - - } - - @Override - public void firePropertyChange(int propertyId) { - super.firePropertyChange(propertyId); - } - - @Override - public boolean isDirty() { - Boolean b = (Boolean) context.get(EditorPart.class.getName()+".dirty"); - return b != null && b; - } - - @Override - public boolean isSaveAsAllowed() { - // TODO Auto-generated method stub - return false; - } - - @Override - public void createPartControl(Composite parent) { - ISelectionProvider s = new SelectionProviderImpl(); - context.set(ISelectionProvider.class, s); - getSite().setSelectionProvider(s); - - - Composite comp = new Composite(parent, SWT.NONE); - comp.setBackgroundMode(SWT.INHERIT_DEFAULT); - - FillLayout layout = new FillLayout(); - layout.marginWidth = 10; - layout.marginHeight = 10; - comp.setLayout(layout); - - context.set(Composite.class.getName(), comp); - IContributionFactory factory = (IContributionFactory) context.get(IContributionFactory.class); - instance = factory.create(classUri, context); - - Bundle b = FrameworkUtil.getBundle(E4WorkbenchModelEditor.class); - if( b != null ) { - ServiceReference ref = b.getBundleContext().getServiceReference(IThemeManager.class.getName()); - if( ref != null ) { - IThemeManager mgr = (IThemeManager) b.getBundleContext().getService(ref); - IThemeEngine engine = mgr.getEngineForDisplay(parent.getDisplay()); - engine.applyStyles(parent, true); - } - } - } - - @Override - public void setFocus() { - // TODO Auto-generated method stub - - } - - @Override - public void dispose() { - context.dispose(); - context = null; - super.dispose(); - } - - private class SelectionProviderImpl implements ISelectionProvider { - private ISelection currentSelection = StructuredSelection.EMPTY; - - private ListenerList listeners = new ListenerList(); - - public void setSelection(ISelection selection) { - currentSelection = selection; - SelectionChangedEvent evt = new SelectionChangedEvent(this, selection); - - for( Object l : listeners.getListeners() ) { - ((ISelectionChangedListener)l).selectionChanged(evt); - } - } - - public void removeSelectionChangedListener( - ISelectionChangedListener listener) { - listeners.remove(listener); - } - - public ISelection getSelection() { - System.err.println("Selection: " + currentSelection); - return currentSelection; - } - - public void addSelectionChangedListener(ISelectionChangedListener listener) { - System.err.println("Adding listener: " + listener); - listeners.add(listener); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java deleted file mode 100644 index 93f095a23f..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - * ARTAL Technologies - bugfix 315362 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x.compat; - -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.RegistryFactory; -import org.eclipse.e4.core.contexts.EclipseContextFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.services.contributions.IContributionFactory; -import org.eclipse.e4.ui.services.IServiceConstants; -import org.eclipse.e4.workbench.ui.internal.ReflectionContributionFactory; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.ISelectionListener; -import org.eclipse.ui.ISelectionService; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchPartSite; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.internal.services.IWorkbenchLocationService; -import org.eclipse.ui.services.AbstractServiceFactory; -import org.eclipse.ui.services.IServiceLocator; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; - -public class IEclipseContextServiceFactory extends AbstractServiceFactory { - - public IEclipseContextServiceFactory() { - } - - @SuppressWarnings("restriction") - @Override - public Object create(Class serviceInterface, IServiceLocator parentLocator, - IServiceLocator locator) { - if( ! IEclipseContext.class.equals(serviceInterface) ) { - return null; - } - - IWorkbenchLocationService wls = (IWorkbenchLocationService) locator.getService(IWorkbenchLocationService.class); - final IWorkbenchWindow window = wls.getWorkbenchWindow(); - final IWorkbenchPartSite site = wls.getPartSite(); - -// System.err.println("The locator: " + locator); -// System.err.println(" Window: " + window); -// System.err.println(" Site: " + site); - - Object o = parentLocator.getService(serviceInterface); - - // This happens when we run in plain 3.x - // We need to create a parent service context - if( window == null && site == null ) { - Bundle bundle = FrameworkUtil.getBundle(IEclipseContextServiceFactory.class); - BundleContext bundleContext = bundle.getBundleContext(); - IEclipseContext serviceContext = EclipseContextFactory.getServiceContext(bundleContext); - - final IEclipseContext appContext = serviceContext.createChild("WorkbenchContext"); //$NON-NLS-1$ - IExtensionRegistry registry = RegistryFactory.getRegistry(); - ReflectionContributionFactory contributionFactory = new ReflectionContributionFactory(registry); - appContext.set(IContributionFactory.class.getName(),contributionFactory); - - return appContext; - } else if( o != null && site == null ) { - final IEclipseContext windowContext = ((IEclipseContext)o).createChild("WindowContext("+window+")"); - windowContext.set(ISelectionService.class, window.getSelectionService()); - window.getSelectionService().addSelectionListener(new ISelectionListener() { - - public void selectionChanged(IWorkbenchPart part, ISelection selection) { - if( ! selection.isEmpty() ) { - if( ! (selection instanceof IStructuredSelection) ) { - windowContext.set(ISelection.class, selection); - } else { - IStructuredSelection s = (IStructuredSelection) selection; - if( s.size() == 1 ) { - windowContext.set(IServiceConstants.SELECTION, s.getFirstElement()); - } else { - windowContext.set(IServiceConstants.SELECTION, s.toList()); - } - } - } - } - }); - return windowContext; - } - - return o; - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java deleted file mode 100644 index e908509eec..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x.compat; - -import java.util.List; - -import org.eclipse.e4.core.contexts.ContextFunction; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.ISelectionProviderService; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.StructuredSelection; - -public class SelectionProviderContextFunction extends ContextFunction { - - @Override - public Object compute(final IEclipseContext context) { - return new ISelectionProviderService() { - - public void setSelection(Object selection) { - ISelectionProvider pv = context.get(ISelectionProvider.class); - - if( selection instanceof List ) { - pv.setSelection(new StructuredSelection((List)selection)); - } else { - pv.setSelection(new StructuredSelection(selection)); - } - - } - }; - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/css/default.css b/bundles/org.eclipse.e4.tools.emf.ui/css/default.css index 751eb8fc18..2117aec750 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/css/default.css +++ b/bundles/org.eclipse.e4.tools.emf.ui/css/default.css @@ -19,4 +19,9 @@ .formContainer { background-color: #fff; +} + +/* SingleSourcing Container */ +.E4WorkbenchModelEditor { + background-color: #fff; } \ No newline at end of file From 0e566b8c5d47bbfd85c779f0a9e5b7e9a27dd433 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 3 Jun 2010 17:52:09 +0000 Subject: [PATCH 0125/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * slight changes to dirty propagation --- .../META-INF/MANIFEST.MF | 2 +- .../OSGI-INF/dirtyproviderfunction.xml | 8 - .../build.properties | 3 +- .../internal/ContextServiceFactory.java | 11 +- .../internal/DirtyProviderFunction.java | 36 --- .../ReflectionContributionFactory.java | 253 ------------------ .../e4/tools/compat/parts/DIEditorPart.java | 5 +- 7 files changed, 10 insertions(+), 308 deletions(-) delete mode 100644 bundles/org.eclipse.e4.tools.compat/OSGI-INF/dirtyproviderfunction.xml delete mode 100644 bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DirtyProviderFunction.java delete mode 100644 bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java diff --git a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF index 356b567cb4..448e0f8abe 100644 --- a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF @@ -12,6 +12,6 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.core.di;bundle-version="0.9.0", org.eclipse.e4.tools.services;bundle-version="1.0.0", org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0" -Service-Component: OSGI-INF/selectionproviderfunction.xml, OSGI-INF/dirtyproviderfunction.xml +Service-Component: OSGI-INF/selectionproviderfunction.xml Export-Package: org.eclipse.e4.tools.compat.parts Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.e4.tools.compat/OSGI-INF/dirtyproviderfunction.xml b/bundles/org.eclipse.e4.tools.compat/OSGI-INF/dirtyproviderfunction.xml deleted file mode 100644 index 997082069c..0000000000 --- a/bundles/org.eclipse.e4.tools.compat/OSGI-INF/dirtyproviderfunction.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/bundles/org.eclipse.e4.tools.compat/build.properties b/bundles/org.eclipse.e4.tools.compat/build.properties index e56d72ba99..4975ca25a1 100644 --- a/bundles/org.eclipse.e4.tools.compat/build.properties +++ b/bundles/org.eclipse.e4.tools.compat/build.properties @@ -2,6 +2,5 @@ output.. = bin/ bin.includes = META-INF/,\ .,\ plugin.xml,\ - OSGI-INF/selectionproviderfunction.xml,\ - OSGI-INF/dirtyproviderfunction.xml + OSGI-INF/selectionproviderfunction.xml source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java index fa33b02037..68dce242d9 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java @@ -10,11 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.compat.internal; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.RegistryFactory; import org.eclipse.e4.core.contexts.EclipseContextFactory; import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.services.contributions.IContributionFactory; import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; import org.eclipse.e4.ui.css.swt.theme.IThemeManager; import org.eclipse.e4.ui.services.IServiceConstants; @@ -39,7 +36,7 @@ public class ContextServiceFactory extends AbstractServiceFactory { @Override - public Object create(Class serviceInterface, IServiceLocator parentLocator, + public Object create(@SuppressWarnings("rawtypes") Class serviceInterface, IServiceLocator parentLocator, IServiceLocator locator) { if( ! IEclipseContext.class.equals(serviceInterface) ) { return null; @@ -64,9 +61,9 @@ public Object create(Class serviceInterface, IServiceLocator parentLocator, IEclipseContext serviceContext = EclipseContextFactory.getServiceContext(bundleContext); final IEclipseContext appContext = serviceContext.createChild("WorkbenchContext"); //$NON-NLS-1$ - IExtensionRegistry registry = RegistryFactory.getRegistry(); - ReflectionContributionFactory contributionFactory = new ReflectionContributionFactory(registry); - appContext.set(IContributionFactory.class.getName(),contributionFactory); +// IExtensionRegistry registry = RegistryFactory.getRegistry(); +// ReflectionContributionFactory contributionFactory = new ReflectionContributionFactory(registry); +// appContext.set(IContributionFactory.class.getName(),contributionFactory); IThemeManager manager = serviceContext.get(IThemeManager.class); final IThemeEngine engine = manager.getEngineForDisplay(Display.getCurrent()); diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DirtyProviderFunction.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DirtyProviderFunction.java deleted file mode 100644 index 0a459f2ac5..0000000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DirtyProviderFunction.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.compat.internal; - -import org.eclipse.e4.core.contexts.ContextFunction; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.compat.parts.DIEditorPart; -import org.eclipse.e4.tools.services.IDirtyProviderService; -import org.eclipse.ui.part.EditorPart; - -public class DirtyProviderFunction extends ContextFunction { - - @Override - public Object compute(IEclipseContext context) { - final DIEditorPart part = (DIEditorPart) context.get(EditorPart.class); - if( part == null ) { - return null; - } - - return new IDirtyProviderService() { - - public void setDirtyState(boolean dirtyState) { - part.setDirtyState(dirtyState); - } - }; - } - -} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java deleted file mode 100644 index 3ac6b2d03a..0000000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java +++ /dev/null @@ -1,253 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.compat.internal; - -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.InvalidRegistryObjectException; -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.InjectionException; -import org.eclipse.e4.core.services.contributions.IContributionFactory; -import org.eclipse.e4.core.services.contributions.IContributionFactorySpi; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; -import org.osgi.service.packageadmin.PackageAdmin; - -/** - * Create the contribution factory. - */ -public class ReflectionContributionFactory implements IContributionFactory { - - private IExtensionRegistry registry; - private Map languages; - - static class URI { - private String[] segments; - - URI(String[] segments) { - this.segments = segments; - } - - public static URI createURI(String uriString) { - return new URI(uriString.split("/")); - } - - public int segmentCount() { - return segments.length; - } - - public String segment(int i) { - return segments[i]; - } - } - - /** - * Create a reflection factory. - * - * @param registry - * to read languages. - */ - public ReflectionContributionFactory(IExtensionRegistry registry) { - this.registry = registry; - processLanguages(); - } - - public Object call(Object object, String uriString, String methodName, IEclipseContext context, - Object defaultValue) { - if (uriString != null) { - URI uri = URI.createURI(uriString); - if (uri.segmentCount() > 3) { - String prefix = uri.segment(2); - IContributionFactorySpi factory = (IContributionFactorySpi) languages.get(prefix); - return factory.call(object, methodName, context, defaultValue); - } - } - - Method targetMethod = null; - - Method[] methods = object.getClass().getMethods(); - - // Optimization: if there's only one method, use it. - if (methods.length == 1) { - targetMethod = methods[0]; - } else { - ArrayList toSort = new ArrayList(); - - for (int i = 0; i < methods.length; i++) { - Method method = methods[i]; - - // Filter out non-public constructors - if ((method.getModifiers() & Modifier.PUBLIC) != 0 - && method.getName().equals(methodName)) { - toSort.add(method); - } - } - - // Sort the methods by descending number of method - // arguments - Collections.sort(toSort, new Comparator() { - /* - * (non-Javadoc) - * - * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) - */ - public int compare(Method m1, Method m2) { - int l1 = m1.getParameterTypes().length; - int l2 = m2.getParameterTypes().length; - - return l1 - l2; - } - }); - - // Find the first satisfiable method - for (Iterator iter = toSort.iterator(); iter.hasNext() && targetMethod == null;) { - Method next = iter.next(); - - boolean satisfiable = true; - - Class[] params = next.getParameterTypes(); - for (int i = 0; i < params.length && satisfiable; i++) { - Class clazz = params[i]; - - if (!context.containsKey(clazz.getName()) - && !IEclipseContext.class.equals(clazz)) { - satisfiable = false; - } - } - - if (satisfiable) { - targetMethod = next; - } - } - } - - if (targetMethod == null) { - if (defaultValue != null) { - return defaultValue; - } - throw new RuntimeException( - "could not find satisfiable method " + methodName + " in class " + object.getClass()); //$NON-NLS-1$//$NON-NLS-2$ - } - - Class[] paramKeys = targetMethod.getParameterTypes(); - - try { -// Activator.trace(Policy.DEBUG_CMDS, "calling: " + methodName, null); //$NON-NLS-1$ - Object[] params = new Object[paramKeys.length]; - for (int i = 0; i < params.length; i++) { - if (IEclipseContext.class.equals(paramKeys[i])) { - params[i] = context; - } else { - params[i] = context.get(paramKeys[i].getName()); - } - } - - return targetMethod.invoke(object, params); - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - - public Object create(String uriString, IEclipseContext context) { - if (uriString == null) { - return null; - } - URI uri = URI.createURI(uriString); - Bundle bundle = getBundle(uri); - Object contribution; - if (bundle != null) { - contribution = createFromBundle(bundle, context, uri); - } else { - contribution = null; -// Activator.log(LogService.LOG_ERROR, "Unable to retrive the bundle from the URI: " //$NON-NLS-1$ -// + uriString); - } - return contribution; - } - - protected Object createFromBundle(Bundle bundle, IEclipseContext context, URI uri) { - Object contribution; - if (uri.segmentCount() > 3) { - String prefix = uri.segment(2); - IContributionFactorySpi factory = (IContributionFactorySpi) languages.get(prefix); - StringBuffer resource = new StringBuffer(uri.segment(3)); - for (int i = 4; i < uri.segmentCount(); i++) { - resource.append('/'); - resource.append(uri.segment(i)); - } - contribution = factory.create(bundle, resource.toString(), context); - } else { - String clazz = uri.segment(2); - try { - Class targetClass = bundle.loadClass(clazz); - contribution = ContextInjectionFactory.make(targetClass, context); - if (contribution == null) { - String message = "Unable to load class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ - + bundle.getBundleId() + "'"; //$NON-NLS-1$ -// Activator.log(LogService.LOG_ERROR, message, new Exception()); - } - } catch (ClassNotFoundException e) { - contribution = null; - String message = "Unable to load class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ - + bundle.getBundleId() + "'"; //$NON-NLS-1$ -// Activator.log(LogService.LOG_ERROR, message, e); - } catch (InjectionException e) { - contribution = null; - String message = "Unable to create class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ - + bundle.getBundleId() + "'"; //$NON-NLS-1$ -// Activator.log(LogService.LOG_ERROR, message, e); - } - } - return contribution; - } - - protected void processLanguages() { - languages = new HashMap(); - String extId = "org.eclipse.e4.languages"; //$NON-NLS-1$ - IConfigurationElement[] languageElements = registry.getConfigurationElementsFor(extId); - for (int i = 0; i < languageElements.length; i++) { - IConfigurationElement languageElement = languageElements[i]; - try { - languages.put(languageElement.getAttribute("name"), //$NON-NLS-1$ - languageElement.createExecutableExtension("contributionFactory")); //$NON-NLS-1$ - } catch (InvalidRegistryObjectException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - protected Bundle getBundle(URI platformURI) { - return Util.getBundle(platformURI.segment(1)); - } - - public Bundle getBundle(String uriString) { - URI uri = URI.createURI(uriString); - return getBundle(uri); - } - -} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java index 3f2580cb43..0556588db0 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java @@ -16,6 +16,7 @@ import org.eclipse.e4.core.contexts.ContextInjectionFactory; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.tools.compat.internal.Util; +import org.eclipse.e4.tools.services.IDirtyProviderService; import org.eclipse.e4.ui.services.IStylingEngine; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; @@ -30,7 +31,7 @@ import org.eclipse.ui.PartInitException; import org.eclipse.ui.part.EditorPart; -public abstract class DIEditorPart extends EditorPart { +public abstract class DIEditorPart extends EditorPart implements IDirtyProviderService { private IEclipseContext context; private C component; private Class clazz; @@ -77,8 +78,10 @@ public void init(IEditorSite site, IEditorInput input) context.declareModifiable(IEditorInput.class); context.declareModifiable(EditorPart.class); + context.declareModifiable(IDirtyProviderService.class); context.set(EditorPart.class,this); + context.set(IDirtyProviderService.class,this); context.set(IEditorInput.class, input); } From b5b3edb5a87060ba1e475ca0db6d1ebe78e1966b Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 3 Jun 2010 18:34:06 +0000 Subject: [PATCH 0126/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * implemented ViewPart Injection Container --- .../internal/ContextServiceFactory.java | 3 +- .../e4/tools/compat/internal/PartHelper.java | 103 ++++++++++++++++++ .../e4/tools/compat/parts/DIEditorPart.java | 82 +------------- .../compat/parts/DISaveableViewPart.java | 62 +++++++---- .../e4/tools/compat/parts/DIViewPart.java | 40 +++++-- 5 files changed, 183 insertions(+), 107 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java index 68dce242d9..0492c6cb28 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java @@ -67,6 +67,7 @@ public Object create(@SuppressWarnings("rawtypes") Class serviceInterface, IServ IThemeManager manager = serviceContext.get(IThemeManager.class); final IThemeEngine engine = manager.getEngineForDisplay(Display.getCurrent()); + appContext.set(IStylingEngine.class, engine); appContext.set(IStylingEngine.class, new IStylingEngine() { @@ -90,8 +91,8 @@ public void style(Object widget) { } else if( o != null && site == null ) { final IEclipseContext windowContext = ((IEclipseContext)o).createChild("WindowContext("+window+")"); windowContext.set(ISelectionService.class, window.getSelectionService()); - windowContext.declareModifiable(IServiceConstants.SELECTION); + windowContext.declareModifiable(IServiceConstants.SELECTION); window.getSelectionService().addSelectionListener(new ISelectionListener() { public void selectionChanged(IWorkbenchPart part, ISelection selection) { diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java new file mode 100644 index 0000000000..58484ff459 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.compat.internal; + +import java.lang.reflect.Method; + +import org.eclipse.core.runtime.ListenerList; +import org.eclipse.e4.core.contexts.ContextInjectionFactory; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.ui.services.IStylingEngine; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IWorkbenchPartSite; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.part.WorkbenchPart; + +public class PartHelper { + public static IEclipseContext createPartContext(WorkbenchPart part) throws PartInitException { + IWorkbenchPartSite site = part.getSite(); + IEclipseContext parentContext = (IEclipseContext) site.getService(IEclipseContext.class); + + // Check if running in 4.x + if( parentContext.get("org.eclipse.e4.workbench.ui.IPresentationEngine") != null ) { + // Hack to get the MPart-Context + try { + Class clazz = Util.getBundle("org.eclipse.e4.ui.model.workbench").loadClass("org.eclipse.e4.ui.model.application.ui.basic.MPart"); + Object instance = site.getService(clazz); + Method m = clazz.getMethod("getContext", new Class[0]); + return (IEclipseContext) m.invoke(instance); + } catch (Exception e) { + throw new PartInitException("Could not create context",e); + } + } else { + return parentContext.createChild("EditPart('"+part.getPartName()+"')"); //$NON-NLS-1$ + } + + } + + public static C creatComponent(Composite parent, IEclipseContext context, Class clazz, WorkbenchPart part) { + ISelectionProvider s = new SelectionProviderImpl(); + context.set(ISelectionProvider.class, s); + part.getSite().setSelectionProvider(s); + + IStylingEngine styleEngine = context.get(IStylingEngine.class); + Composite comp = new Composite(parent, SWT.NONE); + comp.setBackgroundMode(SWT.INHERIT_DEFAULT); + + //FIXME This should be read from the CSS + FillLayout layout = new FillLayout(); + layout.marginWidth = 10; + layout.marginHeight = 10; + comp.setLayout(layout); + + context.set(Composite.class.getName(), comp); + C component = ContextInjectionFactory.make(clazz, context); + + styleEngine.setClassname(comp, part.getClass().getSimpleName()); + + return component; + } + + static class SelectionProviderImpl implements ISelectionProvider { + private ISelection currentSelection = StructuredSelection.EMPTY; + + private ListenerList listeners = new ListenerList(); + + public void setSelection(ISelection selection) { + currentSelection = selection; + SelectionChangedEvent evt = new SelectionChangedEvent(this, selection); + + for( Object l : listeners.getListeners() ) { + ((ISelectionChangedListener)l).selectionChanged(evt); + } + } + + public void removeSelectionChangedListener( + ISelectionChangedListener listener) { + listeners.remove(listener); + } + + public ISelection getSelection() { + return currentSelection; + } + + public void addSelectionChangedListener(ISelectionChangedListener listener) { + listeners.add(listener); + } + } +} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java index 0556588db0..751b20a177 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java @@ -10,23 +10,13 @@ ******************************************************************************/ package org.eclipse.e4.tools.compat.parts; -import java.lang.reflect.Method; -import org.eclipse.core.runtime.ListenerList; -import org.eclipse.e4.core.contexts.ContextInjectionFactory; import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.compat.internal.Util; +import org.eclipse.e4.tools.compat.internal.PartHelper; import org.eclipse.e4.tools.services.IDirtyProviderService; -import org.eclipse.e4.ui.services.IStylingEngine; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorSite; import org.eclipse.ui.PartInitException; import org.eclipse.ui.part.EditorPart; @@ -59,28 +49,12 @@ public void init(IEditorSite site, IEditorInput input) setSite(site); setInput(input); - IEclipseContext parentContext = (IEclipseContext) getSite().getService(IEclipseContext.class); - - // Check if running in 4.x - if( parentContext.get("org.eclipse.e4.workbench.ui.IPresentationEngine") != null ) { - // Hack to get the MPart-Context - try { - Class clazz = Util.getBundle("org.eclipse.e4.ui.model.workbench").loadClass("org.eclipse.e4.ui.model.application.ui.basic.MPart"); - Object instance = getSite().getService(clazz); - Method m = clazz.getMethod("getContext", new Class[0]); - context = (IEclipseContext) m.invoke(instance); - } catch (Exception e) { - throw new PartInitException("Could not create context",e); - } - } else { - context = parentContext.createChild("EditPart('"+getPartName()+"')"); //$NON-NLS-1$ - } - + context = PartHelper.createPartContext(this); context.declareModifiable(IEditorInput.class); - context.declareModifiable(EditorPart.class); + context.declareModifiable(IEditorPart.class); context.declareModifiable(IDirtyProviderService.class); - context.set(EditorPart.class,this); + context.set(IEditorPart.class,this); context.set(IDirtyProviderService.class,this); context.set(IEditorInput.class, input); } @@ -95,23 +69,7 @@ public void init(IEditorSite site, IEditorInput input) @Override public void createPartControl(Composite parent) { - ISelectionProvider s = new SelectionProviderImpl(); - context.set(ISelectionProvider.class, s); - getSite().setSelectionProvider(s); - - IStylingEngine styleEngine = context.get(IStylingEngine.class); - Composite comp = new Composite(parent, SWT.NONE); - comp.setBackgroundMode(SWT.INHERIT_DEFAULT); - - FillLayout layout = new FillLayout(); - layout.marginWidth = 10; - layout.marginHeight = 10; - comp.setLayout(layout); - - context.set(Composite.class.getName(), comp); - component = ContextInjectionFactory.make(clazz, context); - - styleEngine.setClassname(comp, getClass().getSimpleName()); + component = PartHelper.creatComponent(parent, context, clazz, this); } public C getComponent() { @@ -143,32 +101,4 @@ public void dispose() { context = null; super.dispose(); } - - private class SelectionProviderImpl implements ISelectionProvider { - private ISelection currentSelection = StructuredSelection.EMPTY; - - private ListenerList listeners = new ListenerList(); - - public void setSelection(ISelection selection) { - currentSelection = selection; - SelectionChangedEvent evt = new SelectionChangedEvent(this, selection); - - for( Object l : listeners.getListeners() ) { - ((ISelectionChangedListener)l).selectionChanged(evt); - } - } - - public void removeSelectionChangedListener( - ISelectionChangedListener listener) { - listeners.remove(listener); - } - - public ISelection getSelection() { - return currentSelection; - } - - public void addSelectionChangedListener(ISelectionChangedListener listener) { - listeners.add(listener); - } - } } diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java index a55efc86f8..6aa27be73c 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java @@ -10,33 +10,53 @@ ******************************************************************************/ package org.eclipse.e4.tools.compat.parts; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.ui.ISaveablePart; +import org.eclipse.e4.tools.services.IDirtyProviderService; +import org.eclipse.ui.ISaveablePart2; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.PartInitException; -public class DISaveableViewPart extends DIViewPart implements ISaveablePart { - - public void doSave(IProgressMonitor monitor) { - // TODO Auto-generated method stub - +public abstract class DISaveableViewPart extends DIViewPart implements ISaveablePart2, IDirtyProviderService { + private boolean dirtyState; + + public DISaveableViewPart(Class clazz) { + super(clazz); } + +// public void doSave(IProgressMonitor monitor) { +// // TODO Auto-generated method stub +// +// } +// +// public void doSaveAs() { +// // TODO Auto-generated method stub +// +// } - public void doSaveAs() { - // TODO Auto-generated method stub - + public void setDirtyState(boolean dirtyState) { + if( dirtyState != this.dirtyState ) { + this.dirtyState = dirtyState; + firePropertyChange(PROP_DIRTY); + } } - + public boolean isDirty() { - // TODO Auto-generated method stub - return false; + return dirtyState; } - public boolean isSaveAsAllowed() { - // TODO Auto-generated method stub - return false; + public void init(IViewSite site) throws PartInitException { + super.init(site); + + getContext().declareModifiable(IDirtyProviderService.class); + getContext().set(IDirtyProviderService.class, this); } - - public boolean isSaveOnCloseNeeded() { - // TODO Auto-generated method stub - return false; - } + +// public boolean isSaveAsAllowed() { +// // TODO Auto-generated method stub +// return false; +// } +// +// public boolean isSaveOnCloseNeeded() { +// // TODO Auto-generated method stub +// return false; +// } } diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java index 876f05dbcd..ac5fe13281 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java @@ -10,21 +10,43 @@ ******************************************************************************/ package org.eclipse.e4.tools.compat.parts; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.tools.compat.internal.PartHelper; import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.PartInitException; import org.eclipse.ui.part.ViewPart; -public class DIViewPart extends ViewPart { - +public abstract class DIViewPart extends ViewPart { + private IEclipseContext context; + private Class clazz; + private C component; + + public DIViewPart(Class clazz) { + this.clazz = clazz; + } + @Override - public void createPartControl(Composite parent) { - // TODO Auto-generated method stub + public void init(IViewSite site) throws PartInitException { + super.init(site); + context = PartHelper.createPartContext(this); + context.declareModifiable(IViewPart.class); + + context.set(IViewPart.class, this); } - + @Override - public void setFocus() { - // TODO Auto-generated method stub - + public void createPartControl(Composite parent) { + component = PartHelper.creatComponent(parent, context, clazz, this); } -} + protected IEclipseContext getContext() { + return context; + } + + public C getComponent() { + return component; + } +} \ No newline at end of file From b5a64a4a12ebc0733f08ecd5d132bdb52ddc9cc2 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 3 Jun 2010 22:32:15 +0000 Subject: [PATCH 0127/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * implementing @Persist --- .../META-INF/MANIFEST.MF | 3 +- .../e4/tools/compat/parts/DIEditorPart.java | 37 ++++++++--------- .../compat/parts/DISaveableViewPart.java | 40 +++++++++---------- .../emf/editor3x/E4WorkbenchModelEditor.java | 16 -------- .../META-INF/MANIFEST.MF | 3 +- .../emf/ui/internal/common/ModelEditor.java | 2 + 6 files changed, 44 insertions(+), 57 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF index 448e0f8abe..518b39dbc4 100644 --- a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF @@ -11,7 +11,8 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.ui.services;bundle-version="0.9.1", org.eclipse.e4.core.di;bundle-version="0.9.0", org.eclipse.e4.tools.services;bundle-version="1.0.0", - org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0" + org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0", + org.eclipse.e4.ui.di;bundle-version="0.9.0" Service-Component: OSGI-INF/selectionproviderfunction.xml Export-Package: org.eclipse.e4.tools.compat.parts Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java index 751b20a177..cd805dd0ce 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java @@ -11,9 +11,12 @@ package org.eclipse.e4.tools.compat.parts; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.e4.core.contexts.ContextInjectionFactory; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.tools.compat.internal.PartHelper; import org.eclipse.e4.tools.services.IDirtyProviderService; +import org.eclipse.e4.ui.di.Persist; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; @@ -31,17 +34,22 @@ public DIEditorPart(Class clazz) { this.clazz = clazz; } -//FIXME once @Persist is out of ui.workbench -// @Override -// public void doSave(IProgressMonitor monitor) { -// // TODO Auto-generated method stub -// -// } -// -// @Override -// public void doSaveAs() { -// // TODO Auto-generated method stub -// } + @Override + public void doSave(IProgressMonitor monitor) { + IEclipseContext saveContext = context.createChild(); + ContextInjectionFactory.invoke(component, Persist.class, saveContext); + saveContext.dispose(); + } + + @Override + public void doSaveAs() { + + } + + @Override + public boolean isSaveAsAllowed() { + return false; + } @Override public void init(IEditorSite site, IEditorInput input) @@ -60,13 +68,6 @@ public void init(IEditorSite site, IEditorInput input) } -// -// @Override -// public boolean isSaveAsAllowed() { -// // TODO Auto-generated method stub -// return false; -// } - @Override public void createPartControl(Composite parent) { component = PartHelper.creatComponent(parent, context, clazz, this); diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java index 6aa27be73c..b9cb94eb4c 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java @@ -10,7 +10,11 @@ ******************************************************************************/ package org.eclipse.e4.tools.compat.parts; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.e4.core.contexts.ContextInjectionFactory; +import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.tools.services.IDirtyProviderService; +import org.eclipse.e4.ui.di.Persist; import org.eclipse.ui.ISaveablePart2; import org.eclipse.ui.IViewSite; import org.eclipse.ui.PartInitException; @@ -22,15 +26,19 @@ public DISaveableViewPart(Class clazz) { super(clazz); } -// public void doSave(IProgressMonitor monitor) { -// // TODO Auto-generated method stub -// -// } -// -// public void doSaveAs() { -// // TODO Auto-generated method stub -// -// } + public void doSave(IProgressMonitor monitor) { + IEclipseContext saveContext = getContext().createChild(); + ContextInjectionFactory.invoke(getComponent(), Persist.class, saveContext); + saveContext.dispose(); + } + + public void doSaveAs() { + + } + + public boolean isSaveAsAllowed() { + return false; + } public void setDirtyState(boolean dirtyState) { if( dirtyState != this.dirtyState ) { @@ -48,15 +56,5 @@ public void init(IViewSite site) throws PartInitException { getContext().declareModifiable(IDirtyProviderService.class); getContext().set(IDirtyProviderService.class, this); - } - -// public boolean isSaveAsAllowed() { -// // TODO Auto-generated method stub -// return false; -// } -// -// public boolean isSaveOnCloseNeeded() { -// // TODO Auto-generated method stub -// return false; -// } -} + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java index ec9134aeab..a9544e07fe 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java @@ -10,7 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x; -import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.e4.tools.compat.parts.DIEditorPart; import org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor; @@ -21,21 +20,6 @@ public E4WorkbenchModelEditor() { super(ApplicationModelEditor.class); } - @Override - public void doSave(IProgressMonitor monitor) { - getComponent().doSave(monitor); - } - - @Override - public void doSaveAs() { - - } - - @Override - public boolean isSaveAsAllowed() { - return false; - } - @Override public void setFocus() { getComponent().setFocus(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index d2a835ec48..b8003bef0b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -24,7 +24,8 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.e4.ui.workbench;bundle-version="0.9.1", org.eclipse.e4.ui.services;bundle-version="0.9.1", org.eclipse.equinox.registry;bundle-version="3.5.0", - org.eclipse.e4.core.contexts;bundle-version="0.9.0" + org.eclipse.e4.core.contexts;bundle-version="0.9.0", + org.eclipse.e4.ui.di;bundle-version="0.9.0" Bundle-ActivationPolicy: lazy Import-Package: javax.inject;version="1.0.0", org.eclipse.core.runtime.jobs, diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 48bc4b14eb..ab8bcd29c9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -81,6 +81,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor; +import org.eclipse.e4.ui.di.Persist; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; @@ -484,6 +485,7 @@ public AbstractComponentEditor getEditor(EClass eClass) { return editorMap.get(eClass); } + @Persist public void doSave(@Optional IProgressMonitor monitor) { if (modelProvider.isSaveable()) { modelProvider.save(); From a9f9f3c3551ed2acb6ebd44ccf82022c7aefeefc Mon Sep 17 00:00:00 2001 From: John Arthorne Date: Fri, 4 Jun 2010 20:22:09 +0000 Subject: [PATCH 0128/1286] Bug 315463 - API package name cleanup --- .../.settings/org.eclipse.jdt.ui.prefs | 6 +++++- .../e4/tools/emf/ui/common/IModelResource.java | 1 - .../e4/tools/emf/ui/common/XMIModelResource.java | 7 +------ .../component/AbstractComponentEditor.java | 3 --- .../internal/ObservableColumnLabelProvider.java | 1 - .../e4/tools/emf/ui/internal/PatternFilter.java | 1 - .../common/ClassContributionCollector.java | 1 - .../emf/ui/internal/common/ModelEditor.java | 16 ++++++---------- .../emf/ui/internal/common/VirtualEntry.java | 1 - .../common/commands/AddAddonCommand.java | 2 -- .../common/commands/MoveAddonCommand.java | 1 - .../common/commands/RemoveAddonCommand.java | 3 --- .../internal/common/component/AddonsEditor.java | 4 ---- .../common/component/ApplicationEditor.java | 5 ----- .../common/component/BindingTableEditor.java | 11 ----------- .../internal/common/component/CommandEditor.java | 9 --------- .../common/component/ControlFactory.java | 8 -------- .../common/component/DirectMenuItemEditor.java | 4 ---- .../common/component/DirectToolItemEditor.java | 4 ---- .../common/component/HandledMenuItemEditor.java | 11 ----------- .../common/component/HandledToolItemEditor.java | 10 ---------- .../internal/common/component/HandlerEditor.java | 5 ----- .../common/component/InputPartEditor.java | 3 --- .../common/component/KeyBindingEditor.java | 8 -------- .../ui/internal/common/component/MenuEditor.java | 10 ---------- .../common/component/MenuItemEditor.java | 5 ----- .../common/component/MenuSeparatorEditor.java | 4 ---- .../common/component/ModelComponentEditor.java | 8 -------- .../common/component/ModelComponentsEditor.java | 7 ------- .../common/component/PartDescriptorEditor.java | 12 ------------ .../ui/internal/common/component/PartEditor.java | 9 --------- .../component/PartSashContainerEditor.java | 12 ------------ .../common/component/PartStackEditor.java | 13 ------------- .../common/component/PerspectiveEditor.java | 14 -------------- .../common/component/PerspectiveStackEditor.java | 11 ----------- .../common/component/PlaceholderEditor.java | 4 ---- .../internal/common/component/ToolBarEditor.java | 10 ---------- .../common/component/ToolBarSeparatorEditor.java | 4 ---- .../common/component/ToolControlEditor.java | 5 ----- .../common/component/ToolItemEditor.java | 6 ------ .../internal/common/component/TrimBarEditor.java | 10 ---------- .../common/component/TrimmedWindowEditor.java | 2 -- .../internal/common/component/WindowEditor.java | 10 ---------- .../dialogs/AbstractCommandSelectionDialog.java | 2 -- .../component/dialogs/AbstractIconDialog.java | 3 --- .../dialogs/ContributionClassDialog.java | 2 -- .../HandledMenuItemCommandSelectionDialog.java | 2 -- .../HandledToolItemCommandSelectionDialog.java | 2 -- .../dialogs/HandlerCommandSelectionDialog.java | 2 -- .../KeyBindingCommandSelectionDialog.java | 2 -- .../component/dialogs/MenuIconDialogEditor.java | 2 -- .../dialogs/MenuItemIconDialogEditor.java | 2 -- .../dialogs/PartDescriptorIconDialogEditor.java | 2 -- .../component/dialogs/PartIconDialogEditor.java | 1 - .../dialogs/PerspectiveIconDialogEditor.java | 2 -- .../dialogs/ToolItemIconDialogEditor.java | 2 -- .../dialogs/WindowIconDialogEditor.java | 2 -- .../component/virtual/VApplicationAddons.java | 5 ----- .../component/virtual/VBindingTableEditor.java | 10 ---------- .../common/component/virtual/VCommandEditor.java | 8 -------- .../common/component/virtual/VHandlerEditor.java | 9 --------- .../common/component/virtual/VMenuEditor.java | 7 ------- .../virtual/VModelComponentBindingEditor.java | 9 --------- .../virtual/VModelComponentUIEditor.java | 12 ------------ .../component/virtual/VPartDescriptor.java | 8 -------- .../component/virtual/VWindowControlEditor.java | 8 -------- .../common/component/virtual/VWindowEditor.java | 9 --------- .../component/virtual/VWindowTrimEditor.java | 5 ----- .../ui/internal/wbm/ApplicationModelEditor.java | 1 - 69 files changed, 12 insertions(+), 388 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs index 87e3873ea0..5b21ea9bc2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs +++ b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs @@ -1,4 +1,8 @@ -#Sun Mar 07 11:22:19 CET 2010 +#Fri Jun 04 16:11:07 EDT 2010 eclipse.preferences.version=1 formatter_profile=_custom formatter_settings_version=11 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=; +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java index 4c5d0acaa3..9e0003b037 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java @@ -12,7 +12,6 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.edit.domain.EditingDomain; public interface IModelResource { public IObservableList getRoot(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java index 95bbb4fc9d..0a943b1b8b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java @@ -15,22 +15,17 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.workbench.ui.internal.E4XMIResourceFactory; +import org.eclipse.e4.ui.internal.workbench.E4XMIResourceFactory; import org.eclipse.emf.common.command.BasicCommandStack; import org.eclipse.emf.common.command.CommandStackListener; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; @SuppressWarnings("restriction") public class XMIModelResource implements IModelResource { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index 0b0a6b8e95..893a4367e2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -17,12 +17,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.runtime.FileLocator; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java index c1207886cc..f5bdd1fe23 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java @@ -11,7 +11,6 @@ package org.eclipse.e4.tools.emf.ui.internal; import java.util.Set; - import org.eclipse.core.databinding.observable.map.IMapChangeListener; import org.eclipse.core.databinding.observable.map.IObservableMap; import org.eclipse.core.databinding.observable.map.MapChangeEvent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java index 99c8b21a78..fbba0c0945 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java @@ -15,7 +15,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - import org.eclipse.jface.viewers.AbstractTreeViewer; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ITreeContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java index f7b4a5a109..b642e95558 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java @@ -12,7 +12,6 @@ import java.util.concurrent.CopyOnWriteArrayList; - import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider; import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionResultHandler; import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Filter; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index ab8bcd29c9..4c6fdf3631 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -15,9 +15,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - import javax.inject.Inject; - import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.map.IMapChangeListener; @@ -45,14 +43,14 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.AddonsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ApplicationEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.BindingTableEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.DirectMenuItemEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.HandledMenuItemEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.InputPartEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.KeyBindingEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.CommandEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.DirectMenuItemEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.DirectToolItemEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.HandledMenuItemEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.HandledToolItemEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.HandlerEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.InputPartEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.KeyBindingEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuSeparatorEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ModelComponentEditor; @@ -73,12 +71,12 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VApplicationAddons; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VBindingTableEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VCommandEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelComponentUIEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowControlEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelComponentBindingEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelComponentUIEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowControlEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor; import org.eclipse.e4.ui.di.Persist; @@ -87,8 +85,6 @@ import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.action.Action; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java index 46279ef22b..024e032b85 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java @@ -12,7 +12,6 @@ import java.util.ArrayList; import java.util.List; - import org.eclipse.core.databinding.observable.Diffs; import org.eclipse.core.databinding.observable.list.IListChangeListener; import org.eclipse.core.databinding.observable.list.IObservableList; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java index 27cf0d5164..ecc7a1d24d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java @@ -15,8 +15,6 @@ import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.domain.EditingDomain; public class AddAddonCommand { public void execute(EditingDomain editingDomain, MApplication parent) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java index 6c3f9889de..1dab6fefee 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java @@ -11,7 +11,6 @@ package org.eclipse.e4.tools.emf.ui.internal.common.commands; import org.eclipse.e4.ui.model.application.MAddon; -import org.eclipse.emf.edit.domain.EditingDomain; public class MoveAddonCommand { public void execute(EditingDomain editingDomain, MAddon addon, boolean up) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java index 1e71dfcb9e..8c36a3bd3e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java @@ -11,13 +11,10 @@ package org.eclipse.e4.tools.emf.ui.internal.common.commands; import java.util.List; - import org.eclipse.e4.ui.model.application.MAddon; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; public class RemoveAddonCommand { public void execute(EditingDomain editingDomain, List addons) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index 1d18d4543c..ed15c2df62 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -20,9 +19,6 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index bee39806a2..9b9fc0d48c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.property.list.IListProperty; @@ -24,10 +23,6 @@ import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index a7506e0d97..e17103f8d6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -13,7 +13,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.List; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -27,16 +26,6 @@ import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 9f0ad33da6..02d75d4a85 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; @@ -23,14 +22,6 @@ import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFValueProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 832c277f50..f79e5015d9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -12,7 +12,6 @@ import java.util.Arrays; import java.util.List; - import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.MApplication; @@ -21,14 +20,7 @@ import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.LabelProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index e9cff25710..e1f0bc53d5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; - import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.internal.Messages; @@ -20,9 +19,6 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index af3d3c8d72..a09837c22f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -12,16 +12,12 @@ import java.net.MalformedURLException; import java.net.URL; - import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index 2fe314b100..ad735e3ab5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; - import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.IModelResource; @@ -20,22 +19,12 @@ import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledMenuItemCommandSelectionDialog; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFValueProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index e8ed3a4305..19d78755e0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; - import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.IModelResource; @@ -26,15 +25,6 @@ import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFValueProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index f8fbf66691..66e84e3059 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.IModelResource; @@ -24,10 +23,6 @@ import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java index c81967a887..31bef61c35 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java @@ -14,9 +14,6 @@ import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 8ec5723aa9..a249b808d5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.IModelResource; @@ -26,13 +25,6 @@ import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerSupport; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 326eba354c..b6e94ed4a0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -13,7 +13,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.List; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; @@ -33,18 +32,9 @@ import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index d346f34ec2..66d209eba7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -26,10 +25,6 @@ import org.eclipse.e4.ui.model.application.ui.menu.ItemType; import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerProperties; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index 2f2af5925a..62b6ffa94c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -12,15 +12,11 @@ import java.net.MalformedURLException; import java.net.URL; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index 64225b3825..28bf9aa889 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.property.list.IListProperty; @@ -26,13 +25,6 @@ import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.viewers.ListViewer; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java index a081f2848a..c8726dea73 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java @@ -13,7 +13,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.List; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -25,12 +24,6 @@ import org.eclipse.e4.ui.model.application.MModelComponents; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 0d46e20f3e..1db9b287d5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -13,7 +13,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.Map.Entry; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IObservableValue; @@ -24,23 +23,12 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartDescriptorIconDialogEditor; -import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.descriptor.basic.util.BasicAdapterFactory; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 4317138370..d18713d594 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -13,7 +13,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.Map.Entry; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IObservableValue; @@ -24,7 +23,6 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.AbstractIconDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartIconDialogEditor; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; @@ -32,13 +30,6 @@ import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 5ba46b78cf..6818a47670 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -13,7 +13,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.List; - import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; @@ -31,20 +30,9 @@ import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 617eb83a32..c25d3a5888 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -13,7 +13,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.List; - import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; @@ -27,24 +26,12 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.MUiFactory; -import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 8daad0ec50..bc9a801347 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -13,7 +13,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.List; - import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; @@ -26,30 +25,17 @@ import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartIconDialogEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PerspectiveIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 276555f986..5200c4dcd5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -13,7 +13,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.List; - import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; @@ -31,16 +30,6 @@ import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 690708f0b1..2fe9df0951 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -20,10 +19,7 @@ import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index e2020e2757..3800bff2d7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -13,7 +13,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.List; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; @@ -29,17 +28,8 @@ import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index 2ef4e6cd72..15a124bd1a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -12,15 +12,11 @@ import java.net.MalformedURLException; import java.net.URL; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index 2c7bff92e3..0a03f37632 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -13,7 +13,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.Map.Entry; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; @@ -22,10 +21,6 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 39d5364320..9846a8bba3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -16,18 +16,12 @@ import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PerspectiveIconDialogEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ToolItemIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.ItemType; import org.eclipse.e4.ui.model.application.ui.menu.MToolItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerProperties; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index 033eafa103..d0ab346b97 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -13,7 +13,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.List; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -29,15 +28,6 @@ import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java index 4119793bab..529b6a68cd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java @@ -6,8 +6,6 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.edit.domain.EditingDomain; public class TrimmedWindowEditor extends WindowEditor { private IListProperty TRIMMED_WINDOW__TRIM_BARS = EMFProperties.list(BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 479e9fb077..b5bce8d2ae 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -14,7 +14,6 @@ import java.net.URL; import java.util.ArrayList; import java.util.List; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IValueChangeListener; @@ -26,24 +25,15 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ToolItemIconDialogEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.WindowIconDialogEditor; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.e4.ui.model.application.ui.menu.MToolItem; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java index de8ebadffe..c81212cb1b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java @@ -12,7 +12,6 @@ import java.util.ArrayList; import java.util.List; - import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; @@ -21,7 +20,6 @@ import org.eclipse.e4.ui.model.application.MModelComponents; import org.eclipse.e4.ui.model.application.commands.MCommand; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.dialogs.TitleAreaDialog; import org.eclipse.jface.viewers.AbstractTreeViewer; import org.eclipse.jface.viewers.ArrayContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java index 1b978fcf30..6f6aea3faf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java @@ -9,7 +9,6 @@ import java.util.Map; import java.util.Timer; import java.util.TimerTask; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.resources.IFile; @@ -21,8 +20,6 @@ import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.dialogs.TitleAreaDialog; import org.eclipse.jface.viewers.DoubleClickEvent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java index 1dbe714f9d..850fcb8293 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -21,8 +21,6 @@ import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.dialogs.TitleAreaDialog; import org.eclipse.jface.viewers.DoubleClickEvent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java index 39f72ebd90..2399ab8754 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java @@ -15,8 +15,6 @@ import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class HandledMenuItemCommandSelectionDialog extends AbstractCommandSelectionDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java index 8f9b0345d5..19bfac1ed2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java @@ -15,8 +15,6 @@ import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class HandledToolItemCommandSelectionDialog extends AbstractCommandSelectionDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java index ace3d85758..d2d337fb20 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java @@ -15,8 +15,6 @@ import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class HandlerCommandSelectionDialog extends AbstractCommandSelectionDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java index bda337ad84..5b56af5e2e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java @@ -15,8 +15,6 @@ import org.eclipse.e4.ui.model.application.commands.MKeyBinding; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class KeyBindingCommandSelectionDialog extends AbstractCommandSelectionDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java index 22a33c242f..e6597629ba 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java @@ -1,10 +1,8 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class MenuIconDialogEditor extends AbstractIconDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java index 74828a1774..c175ba652d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java @@ -1,10 +1,8 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class MenuItemIconDialogEditor extends AbstractIconDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java index 4d7ede72e5..b085f38889 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java @@ -2,9 +2,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class PartDescriptorIconDialogEditor extends AbstractIconDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java index d2c0e3f8e1..b767630d25 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java @@ -3,7 +3,6 @@ import org.eclipse.core.resources.IProject; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class PartIconDialogEditor extends AbstractIconDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java index 63758b8f92..677ffc5665 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java @@ -2,9 +2,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class PerspectiveIconDialogEditor extends AbstractIconDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java index 8387545768..45c8bd4daa 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java @@ -1,10 +1,8 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MToolItem; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class ToolItemIconDialogEditor extends AbstractIconDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java index babdf30384..b04560aa0c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java @@ -1,10 +1,8 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class WindowIconDialogEditor extends AbstractIconDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java index 316d16e4d2..baca981d14 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java @@ -2,7 +2,6 @@ import java.util.ArrayList; import java.util.List; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -15,10 +14,6 @@ import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index 072385c276..778f31c45b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -12,7 +12,6 @@ import java.util.ArrayList; import java.util.List; - import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; @@ -35,16 +34,7 @@ import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.command.CompoundCommand; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider; import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index 91ee4b8eba..f865eb3bee 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -11,7 +11,6 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; import java.util.List; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -25,14 +24,7 @@ import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index a522ebfb42..cb97b728d0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -11,7 +11,6 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; import java.util.List; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -24,14 +23,6 @@ import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java index 4b8082506f..821fa864c2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -11,7 +11,6 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; import java.util.List; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -23,13 +22,7 @@ import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableViewer; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java index 4387053f7b..06f0433d79 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java @@ -11,7 +11,6 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; import java.util.List; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -25,14 +24,6 @@ import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentUIEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentUIEditor.java index 0c3c40f7d5..fecd1842c3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentUIEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentUIEditor.java @@ -11,32 +11,21 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; import java.util.List; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MModelComponent; -import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; @@ -44,7 +33,6 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java index 5e9b1b0105..a9404ab5e1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java @@ -11,7 +11,6 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; import java.util.List; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -25,13 +24,6 @@ import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index f7d3baed80..68ec3066a9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -11,7 +11,6 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; import java.util.List; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -23,16 +22,9 @@ import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index 065e0bbb8b..240e2e0a27 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -11,7 +11,6 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; import java.util.List; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -19,21 +18,13 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java index 9097a8ab44..c5c6d4ad80 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -11,7 +11,6 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; import java.util.List; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -22,10 +21,6 @@ import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableViewer; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java index cb9a0bb56b..d72d0ad05d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java @@ -11,7 +11,6 @@ package org.eclipse.e4.tools.emf.ui.internal.wbm; import javax.inject.Inject; - import org.eclipse.core.resources.IProject; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.core.di.annotations.Optional; From 9eb31cd8bf673f1197ba211e151324b5455db678 Mon Sep 17 00:00:00 2001 From: Paul Webster Date: Sun, 6 Jun 2010 12:59:19 +0000 Subject: [PATCH 0129/1286] Bug 315463 - API package name cleanup Changes to compile in my workspace --- .../tools/emf/editor3x/XMIModelResource.java | 2 +- .../emf/editor3x/XMIResourceFunction.java | 2 +- .../wizard/BaseApplicationModelWizard.java | 36 ++++++++++--------- .../emf/editor3x/wizard/NewModelFilePage.java | 1 + .../tools/emf/ui/common/IModelResource.java | 1 + .../tools/emf/ui/common/XMIModelResource.java | 3 ++ .../component/AbstractComponentEditor.java | 2 ++ .../emf/ui/internal/common/ModelEditor.java | 2 ++ .../common/commands/AddAddonCommand.java | 2 ++ .../common/commands/MoveAddonCommand.java | 1 + .../common/commands/RemoveAddonCommand.java | 2 ++ .../common/component/AddonsEditor.java | 3 ++ .../common/component/ApplicationEditor.java | 4 +++ .../common/component/BindingTableEditor.java | 10 ++++++ .../common/component/CommandEditor.java | 8 +++++ .../common/component/ControlFactory.java | 7 ++++ .../component/DirectMenuItemEditor.java | 3 ++ .../component/DirectToolItemEditor.java | 3 ++ .../component/HandledMenuItemEditor.java | 9 +++++ .../component/HandledToolItemEditor.java | 9 +++++ .../common/component/HandlerEditor.java | 4 +++ .../common/component/InputPartEditor.java | 3 ++ .../common/component/KeyBindingEditor.java | 7 ++++ .../internal/common/component/MenuEditor.java | 9 +++++ .../common/component/MenuItemEditor.java | 4 +++ .../common/component/MenuSeparatorEditor.java | 3 ++ .../component/ModelComponentEditor.java | 5 +++ .../component/ModelComponentsEditor.java | 6 ++++ .../component/PartDescriptorEditor.java | 7 ++++ .../internal/common/component/PartEditor.java | 7 ++++ .../component/PartSashContainerEditor.java | 11 ++++++ .../common/component/PartStackEditor.java | 10 ++++++ .../common/component/PerspectiveEditor.java | 11 ++++++ .../component/PerspectiveStackEditor.java | 10 ++++++ .../common/component/PlaceholderEditor.java | 3 ++ .../common/component/ToolBarEditor.java | 9 +++++ .../component/ToolBarSeparatorEditor.java | 3 ++ .../common/component/ToolControlEditor.java | 4 +++ .../common/component/ToolItemEditor.java | 4 +++ .../common/component/TrimBarEditor.java | 9 +++++ .../common/component/TrimmedWindowEditor.java | 2 ++ .../common/component/WindowEditor.java | 6 ++++ .../AbstractCommandSelectionDialog.java | 1 + .../component/dialogs/AbstractIconDialog.java | 2 ++ .../dialogs/ContributionClassDialog.java | 2 ++ ...HandledMenuItemCommandSelectionDialog.java | 2 ++ ...HandledToolItemCommandSelectionDialog.java | 2 ++ .../HandlerCommandSelectionDialog.java | 2 ++ .../KeyBindingCommandSelectionDialog.java | 2 ++ .../dialogs/MenuIconDialogEditor.java | 1 + .../dialogs/MenuItemIconDialogEditor.java | 1 + .../PartDescriptorIconDialogEditor.java | 1 + .../dialogs/PartIconDialogEditor.java | 1 + .../dialogs/PerspectiveIconDialogEditor.java | 1 + .../dialogs/ToolItemIconDialogEditor.java | 1 + .../dialogs/WindowIconDialogEditor.java | 1 + .../component/virtual/VApplicationAddons.java | 3 ++ .../virtual/VBindingTableEditor.java | 9 +++++ .../component/virtual/VCommandEditor.java | 7 ++++ .../component/virtual/VHandlerEditor.java | 8 +++++ .../common/component/virtual/VMenuEditor.java | 6 ++++ .../virtual/VModelComponentBindingEditor.java | 8 +++++ .../virtual/VModelComponentUIEditor.java | 5 +++ .../component/virtual/VPartDescriptor.java | 7 ++++ .../virtual/VWindowControlEditor.java | 7 ++++ .../component/virtual/VWindowEditor.java | 7 ++++ .../component/virtual/VWindowTrimEditor.java | 4 +++ 67 files changed, 319 insertions(+), 19 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java index deff0a449c..a19ed76ddb 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java @@ -21,7 +21,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.workbench.ui.internal.E4XMIResourceFactory; +import org.eclipse.e4.ui.internal.workbench.E4XMIResourceFactory; import org.eclipse.emf.common.command.BasicCommandStack; import org.eclipse.emf.common.command.CommandStackListener; import org.eclipse.emf.common.util.URI; diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java index b8e737b8ca..2b64fcb824 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java @@ -3,8 +3,8 @@ import org.eclipse.e4.core.contexts.ContextFunction; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.tools.emf.editor3x.emf.EditUIUtil; -import org.eclipse.e4.tools.emf.ui.common.XMIModelResource; import org.eclipse.e4.tools.emf.ui.common.IModelResource.ModelListener; +import org.eclipse.e4.tools.emf.ui.common.XMIModelResource; import org.eclipse.e4.tools.services.IDirtyProviderService; import org.eclipse.emf.common.util.URI; import org.eclipse.ui.IEditorInput; diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/BaseApplicationModelWizard.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/BaseApplicationModelWizard.java index b8bc38accd..27d175bfab 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/BaseApplicationModelWizard.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/BaseApplicationModelWizard.java @@ -10,34 +10,36 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x.wizard; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; +import java.util.HashMap; +import java.util.Map; + import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.*; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; - -import org.eclipse.ui.*; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWizard; +import org.eclipse.ui.PartInitException; import org.eclipse.ui.actions.WorkspaceModifyOperation; import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.part.ISetSelectionTarget; diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewModelFilePage.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewModelFilePage.java index 2f60c2d8d7..90154bad5a 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewModelFilePage.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewModelFilePage.java @@ -14,6 +14,7 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.Path; +import org.eclipse.jface.dialogs.IDialogPage; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.WizardPage; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java index 9e0003b037..4c5d0acaa3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java @@ -12,6 +12,7 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.runtime.IStatus; +import org.eclipse.emf.edit.domain.EditingDomain; public interface IModelResource { public IObservableList getRoot(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java index 0a943b1b8b..aa8bae4b27 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java @@ -26,6 +26,9 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; @SuppressWarnings("restriction") public class XMIModelResource implements IModelResource { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index 893a4367e2..feb758061f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -20,6 +20,8 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.runtime.FileLocator; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 4c6fdf3631..66e891bbb4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -85,6 +85,8 @@ import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.action.Action; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java index ecc7a1d24d..27cf0d5164 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java @@ -15,6 +15,8 @@ import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.domain.EditingDomain; public class AddAddonCommand { public void execute(EditingDomain editingDomain, MApplication parent) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java index 1dab6fefee..6c3f9889de 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java @@ -11,6 +11,7 @@ package org.eclipse.e4.tools.emf.ui.internal.common.commands; import org.eclipse.e4.ui.model.application.MAddon; +import org.eclipse.emf.edit.domain.EditingDomain; public class MoveAddonCommand { public void execute(EditingDomain editingDomain, MAddon addon, boolean up) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java index 8c36a3bd3e..fed166cee0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java @@ -15,6 +15,8 @@ import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; public class RemoveAddonCommand { public void execute(EditingDomain editingDomain, List addons) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index ed15c2df62..16d87a9c49 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -19,6 +19,9 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 9b9fc0d48c..1963b3ea76 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -23,6 +23,10 @@ import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index e17103f8d6..f7a962be86 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -26,6 +26,16 @@ import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 02d75d4a85..c7f4bc3132 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -22,6 +22,14 @@ import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFValueProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index f79e5015d9..5a612571ad 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -20,7 +20,14 @@ import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.LabelProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index e1f0bc53d5..00d1935f3f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -19,6 +19,9 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index a09837c22f..1fe284e840 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -18,6 +18,9 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index ad735e3ab5..1b96a69451 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -25,6 +25,15 @@ import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFValueProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index 19d78755e0..bdc0808588 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -25,6 +25,15 @@ import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFValueProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 66e84e3059..0ed2eac203 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -23,6 +23,10 @@ import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java index 31bef61c35..c81967a887 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java @@ -14,6 +14,9 @@ import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index a249b808d5..5fbdb5ee35 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -25,6 +25,13 @@ import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerSupport; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index b6e94ed4a0..383d8aab20 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -32,9 +32,18 @@ import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 66d209eba7..0d97e1f193 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -25,6 +25,10 @@ import org.eclipse.e4.ui.model.application.ui.menu.ItemType; import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerProperties; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index 62b6ffa94c..c8b160bcbd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -17,6 +17,9 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index 28bf9aa889..a874f540fd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -25,6 +25,11 @@ import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.viewers.ListViewer; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java index c8726dea73..576d71561f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java @@ -24,6 +24,12 @@ import org.eclipse.e4.ui.model.application.MModelComponents; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 1db9b287d5..2b4e6b921c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -29,6 +29,13 @@ import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index d18713d594..a154bc9fef 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -30,6 +30,13 @@ import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 6818a47670..53c8881a22 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -30,9 +30,20 @@ import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index c25d3a5888..be87172d3f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -29,9 +29,19 @@ import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index bc9a801347..7d54cd9b47 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -33,9 +33,20 @@ import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 5200c4dcd5..45d3e9163e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -30,6 +30,16 @@ import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 2fe9df0951..bcc3323159 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -19,7 +19,10 @@ import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 3800bff2d7..4bd21de456 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -28,8 +28,17 @@ import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index 15a124bd1a..effe2e31fd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -17,6 +17,9 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index 0a03f37632..21ddb8c23d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -21,6 +21,10 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 9846a8bba3..6d2e67ddcc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -22,6 +22,10 @@ import org.eclipse.e4.ui.model.application.ui.menu.ItemType; import org.eclipse.e4.ui.model.application.ui.menu.MToolItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerProperties; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index d0ab346b97..717cf6940d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -28,6 +28,15 @@ import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java index 529b6a68cd..4119793bab 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java @@ -6,6 +6,8 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.edit.domain.EditingDomain; public class TrimmedWindowEditor extends WindowEditor { private IListProperty TRIMMED_WINDOW__TRIM_BARS = EMFProperties.list(BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index b5bce8d2ae..2b9ae57de7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -34,6 +34,12 @@ import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java index c81212cb1b..71e5701360 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java @@ -20,6 +20,7 @@ import org.eclipse.e4.ui.model.application.MModelComponents; import org.eclipse.e4.ui.model.application.commands.MCommand; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.dialogs.TitleAreaDialog; import org.eclipse.jface.viewers.AbstractTreeViewer; import org.eclipse.jface.viewers.ArrayContentProvider; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java index 6f6aea3faf..a054c2c764 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java @@ -20,6 +20,8 @@ import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.dialogs.TitleAreaDialog; import org.eclipse.jface.viewers.DoubleClickEvent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java index 850fcb8293..1dbe714f9d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -21,6 +21,8 @@ import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.dialogs.TitleAreaDialog; import org.eclipse.jface.viewers.DoubleClickEvent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java index 2399ab8754..39f72ebd90 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java @@ -15,6 +15,8 @@ import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class HandledMenuItemCommandSelectionDialog extends AbstractCommandSelectionDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java index 19bfac1ed2..8f9b0345d5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java @@ -15,6 +15,8 @@ import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class HandledToolItemCommandSelectionDialog extends AbstractCommandSelectionDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java index d2d337fb20..ace3d85758 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java @@ -15,6 +15,8 @@ import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class HandlerCommandSelectionDialog extends AbstractCommandSelectionDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java index 5b56af5e2e..bda337ad84 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java @@ -15,6 +15,8 @@ import org.eclipse.e4.ui.model.application.commands.MKeyBinding; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class KeyBindingCommandSelectionDialog extends AbstractCommandSelectionDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java index e6597629ba..704470cc14 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java @@ -3,6 +3,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenu; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class MenuIconDialogEditor extends AbstractIconDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java index c175ba652d..b35362f402 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java @@ -3,6 +3,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class MenuItemIconDialogEditor extends AbstractIconDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java index b085f38889..165cb83a7f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java @@ -3,6 +3,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class PartDescriptorIconDialogEditor extends AbstractIconDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java index b767630d25..d2c0e3f8e1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java @@ -3,6 +3,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class PartIconDialogEditor extends AbstractIconDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java index 677ffc5665..fecfb28384 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java @@ -3,6 +3,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class PerspectiveIconDialogEditor extends AbstractIconDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java index 45c8bd4daa..d11e1b3188 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java @@ -3,6 +3,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MToolItem; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class ToolItemIconDialogEditor extends AbstractIconDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java index b04560aa0c..af108df53d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java @@ -3,6 +3,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; public class WindowIconDialogEditor extends AbstractIconDialog { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java index baca981d14..bbc39d63e8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java @@ -14,6 +14,9 @@ import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index 778f31c45b..e2e59a00e1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -34,7 +34,16 @@ import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.command.CompoundCommand; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider; import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index f865eb3bee..277414fc32 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -24,7 +24,14 @@ import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index cb97b728d0..9a6646f54c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -23,6 +23,14 @@ import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java index 821fa864c2..ef947589a8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -22,7 +22,13 @@ import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableViewer; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java index 06f0433d79..188ba6bd91 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java @@ -24,6 +24,14 @@ import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentUIEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentUIEditor.java index fecd1842c3..ed061886f2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentUIEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentUIEditor.java @@ -24,8 +24,13 @@ import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java index a9404ab5e1..455c857ae8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java @@ -24,6 +24,13 @@ import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index 68ec3066a9..ac3be06810 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -22,9 +22,16 @@ import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index 240e2e0a27..416b90ede2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -22,9 +22,16 @@ import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java index c5c6d4ad80..50b959eee8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -21,6 +21,10 @@ import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableViewer; From 45fcc9c218986eba576fe1a2ff18aeb7fabe5cdc Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 8 Jun 2010 18:44:55 +0000 Subject: [PATCH 0130/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * auto-support extended models by search for possible super-type-editors --- .../emf/ui/internal/common/ModelEditor.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 66e891bbb4..cfec8245a4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -216,7 +216,7 @@ public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection s = (IStructuredSelection) event.getSelection(); if (s.getFirstElement() instanceof EObject) { EObject obj = (EObject) s.getFirstElement(); - AbstractComponentEditor editor = editorMap.get(obj.eClass()); + AbstractComponentEditor editor = getEditor(obj.eClass()); if (editor != null) { textLabel.setText(editor.getLabel(obj)); iconLabel.setImage(editor.getImage(obj, iconLabel.getDisplay())); @@ -264,7 +264,7 @@ public void menuAboutToShow(IMenuManager manager) { actions = virtualEditors.get(((VirtualEntry) s.getFirstElement()).getId()).getActions(s.getFirstElement()); } else { EObject o = (EObject) s.getFirstElement(); - AbstractComponentEditor editor = editorMap.get(o.eClass()); + AbstractComponentEditor editor = getEditor(o.eClass()); if (editor != null) { actions = editor.getActions(s.getFirstElement()); } else { @@ -480,7 +480,16 @@ private boolean equalsPaths(FeaturePath p1, FeaturePath p2) { } public AbstractComponentEditor getEditor(EClass eClass) { - return editorMap.get(eClass); + AbstractComponentEditor editor = editorMap.get(eClass); + if( editor == null ) { + for( EClass cl : eClass.getESuperTypes() ) { + editor = getEditor(cl); + if( editor != null ) { + return editor; + } + } + } + return editor; } @Persist @@ -506,7 +515,7 @@ public IObservable createObservable(Object target) { } else if (target instanceof VirtualEntry) { return ((VirtualEntry) target).getList(); } else { - AbstractComponentEditor editor = editorMap.get(((EObject) target).eClass()); + AbstractComponentEditor editor = getEditor(((EObject) target).eClass()); if (editor != null) { return editor.getChildList(target); } From 5e47c16b6339908cedb2de67bebd618c35f9c06b Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 8 Jun 2010 18:56:50 +0000 Subject: [PATCH 0131/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed problem with variables removing/moving --- .../common/component/ControlFactory.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 5a612571ad..ab46f1a698 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.ui.model.application.ui.MContext; + import java.util.Arrays; import java.util.List; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -105,8 +107,8 @@ public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (s.size() == 1) { Object obj = s.getFirstElement(); - MApplication container = (MApplication) editor.getMaster().getValue(); - int idx = container.getCommands().indexOf(obj) - 1; + MContext container = (MContext) editor.getMaster().getValue(); + int idx = container.getVariables().indexOf(obj) - 1; if (idx >= 0) { Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), UiPackageImpl.Literals.CONTEXT__VARIABLES, obj, idx); @@ -132,9 +134,9 @@ public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (s.size() == 1) { Object obj = s.getFirstElement(); - MApplication container = (MApplication) editor.getMaster().getValue(); - int idx = container.getCommands().indexOf(obj) + 1; - if (idx < container.getCommands().size()) { + MContext container = (MApplication) editor.getMaster().getValue(); + int idx = container.getVariables().indexOf(obj) + 1; + if (idx < container.getVariables().size()) { Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), UiPackageImpl.Literals.CONTEXT__VARIABLES, obj, idx); if (cmd.canExecute()) { @@ -156,13 +158,13 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { - MApplication el = (MApplication) editor.getMaster().getValue(); + MContext el = (MContext) editor.getMaster().getValue(); List ids = ((IStructuredSelection) viewer.getSelection()).toList(); Command cmd = RemoveCommand.create(editor.getEditingDomain(), el, UiPackageImpl.Literals.CONTEXT__VARIABLES, ids); if (cmd.canExecute()) { editor.getEditingDomain().getCommandStack().execute(cmd); - if (el.getBindingContexts().size() > 0) { - viewer.setSelection(new StructuredSelection(el.getBindingContexts().get(0))); + if (el.getVariables().size() > 0) { + viewer.setSelection(new StructuredSelection(el.getVariables().get(0))); } } } From 2a2dee5ae562068beae06b8c914f22bd12865bbc Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 8 Jun 2010 19:00:37 +0000 Subject: [PATCH 0132/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed problem with binding contexts removing/moving --- .../internal/common/component/ControlFactory.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index ab46f1a698..62bdbd56c0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.ui.model.application.commands.MBindings; + import org.eclipse.e4.ui.model.application.ui.MContext; import java.util.Arrays; @@ -231,8 +233,8 @@ public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (s.size() == 1) { Object obj = s.getFirstElement(); - MApplication container = (MApplication) editor.getMaster().getValue(); - int idx = container.getCommands().indexOf(obj) - 1; + MBindings container = (MBindings) editor.getMaster().getValue(); + int idx = container.getBindingContexts().indexOf(obj) - 1; if (idx >= 0) { Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); @@ -258,9 +260,9 @@ public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (s.size() == 1) { Object obj = s.getFirstElement(); - MApplication container = (MApplication) editor.getMaster().getValue(); - int idx = container.getCommands().indexOf(obj) + 1; - if (idx < container.getCommands().size()) { + MBindings container = (MBindings) editor.getMaster().getValue(); + int idx = container.getBindingContexts().indexOf(obj) + 1; + if (idx < container.getBindingContexts().size()) { Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); if (cmd.canExecute()) { @@ -282,7 +284,7 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { - MApplication el = (MApplication) editor.getMaster().getValue(); + MBindings el = (MBindings) editor.getMaster().getValue(); List ids = ((IStructuredSelection) viewer.getSelection()).toList(); Command cmd = RemoveCommand.create(editor.getEditingDomain(), el, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, ids); if (cmd.canExecute()) { From 8a49dee2a562a0907e7ce2ac2146d00da6930b59 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 8 Jun 2010 20:04:36 +0000 Subject: [PATCH 0133/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * using new Focus-Annotation Support --- .../eclipse/e4/tools/compat/parts/DIEditorPart.java | 11 +++++------ .../eclipse/e4/tools/compat/parts/DIViewPart.java | 12 ++++++++++++ .../tools/emf/editor3x/E4WorkbenchModelEditor.java | 5 ----- .../e4/tools/emf/ui/internal/common/ModelEditor.java | 3 +++ 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java index cd805dd0ce..dc711b9e3c 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java @@ -16,6 +16,7 @@ import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.tools.compat.internal.PartHelper; import org.eclipse.e4.tools.services.IDirtyProviderService; +import org.eclipse.e4.ui.di.Focus; import org.eclipse.e4.ui.di.Persist; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IEditorInput; @@ -89,12 +90,10 @@ public boolean isDirty() { return dirtyState; } -//FIXME Once we have an @Focus we can implement it -// @Override -// public void setFocus() { -// // TODO Auto-generated method stub -// -// } + @Override + public void setFocus() { + ContextInjectionFactory.invoke(component, Focus.class, context); + } @Override public void dispose() { diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java index ac5fe13281..46a29f69af 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java @@ -10,8 +10,11 @@ ******************************************************************************/ package org.eclipse.e4.tools.compat.parts; +import org.eclipse.e4.core.contexts.ContextInjectionFactory; import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.core.di.InjectionException; import org.eclipse.e4.tools.compat.internal.PartHelper; +import org.eclipse.e4.ui.di.Focus; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IViewPart; import org.eclipse.ui.IViewSite; @@ -49,4 +52,13 @@ protected IEclipseContext getContext() { public C getComponent() { return component; } + + @Override + public void setFocus() { + try { + ContextInjectionFactory.invoke(component, Focus.class, context); + } catch (InjectionException e) { + // TODO: handle exception + } + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java index a9544e07fe..3484bed566 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java @@ -19,9 +19,4 @@ public class E4WorkbenchModelEditor extends DIEditorPart public E4WorkbenchModelEditor() { super(ApplicationModelEditor.class); } - - @Override - public void setFocus() { - getComponent().setFocus(); - } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index cfec8245a4..d46780efa4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; +import org.eclipse.e4.ui.di.Focus; + import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -499,6 +501,7 @@ public void doSave(@Optional IProgressMonitor monitor) { } } + @Focus public void setFocus() { viewer.getControl().setFocus(); } From f74bf4b91384149d497241b4fb640fcafacd4ce3 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 8 Jun 2010 20:35:46 +0000 Subject: [PATCH 0134/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed nls stuff --- .../eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index d46780efa4..60a674dadb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -355,7 +355,7 @@ private void registerContributedVirtualEditors() { IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ for (IConfigurationElement el : extPoint.getConfigurationElements()) { - if (!"virtualeditor".equals(el.getName())) { + if (!"virtualeditor".equals(el.getName())) { //$NON-NLS-1$ continue; } @@ -382,7 +382,6 @@ private void registerVirtualEditors() { } private void registerVirtualEditor(String id, AbstractComponentEditor editor) { - // System.err.println("Registering: " + id + " => " + editor); virtualEditors.put(id, editor); } @@ -395,7 +394,7 @@ private void registerContributedEditors() { IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ for (IConfigurationElement el : extPoint.getConfigurationElements()) { - if (!"editor".equals(el.getName())) { + if (!"editor".equals(el.getName())) { //$NON-NLS-1$ continue; } From 0cab18532288dd4f090aa4f12a896650300de0b8 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 8 Jun 2010 21:30:52 +0000 Subject: [PATCH 0135/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * setting new context function --- .../tools/compat/internal/ContextServiceFactory.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java index 0492c6cb28..7e557ec867 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java @@ -67,7 +67,7 @@ public Object create(@SuppressWarnings("rawtypes") Class serviceInterface, IServ IThemeManager manager = serviceContext.get(IThemeManager.class); final IThemeEngine engine = manager.getEngineForDisplay(Display.getCurrent()); - appContext.set(IStylingEngine.class, engine); + appContext.set(IThemeEngine.class, engine); appContext.set(IStylingEngine.class, new IStylingEngine() { @@ -92,7 +92,7 @@ public void style(Object widget) { final IEclipseContext windowContext = ((IEclipseContext)o).createChild("WindowContext("+window+")"); windowContext.set(ISelectionService.class, window.getSelectionService()); - windowContext.declareModifiable(IServiceConstants.SELECTION); + windowContext.declareModifiable(IServiceConstants.ACTIVE_SELECTION); window.getSelectionService().addSelectionListener(new ISelectionListener() { public void selectionChanged(IWorkbenchPart part, ISelection selection) { @@ -100,12 +100,12 @@ public void selectionChanged(IWorkbenchPart part, ISelection selection) { if( selection instanceof IStructuredSelection ) { IStructuredSelection s = (IStructuredSelection) selection; if( s.size() == 1 ) { - windowContext.set(IServiceConstants.SELECTION, s.getFirstElement()); + windowContext.set(IServiceConstants.ACTIVE_SELECTION, s.getFirstElement()); } else { - windowContext.set(IServiceConstants.SELECTION, s.toList()); + windowContext.set(IServiceConstants.ACTIVE_SELECTION, s.toList()); } } else { - windowContext.set(IServiceConstants.SELECTION, selection); + windowContext.set(IServiceConstants.ACTIVE_SELECTION, selection); } } } From c77276c5febdc29cfe4a60c71c7c0bd1ab1d2c88 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 9 Jun 2010 18:42:38 +0000 Subject: [PATCH 0136/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * adding support for menu contributions --- .../e4/tools/emf/ui/internal/Messages.java | 18 +- .../tools/emf/ui/internal/Messages.properties | 16 + .../emf/ui/internal/common/ModelEditor.java | 10 +- .../component/MenuContributionEditor.java | 348 ++++++++++++++++++ .../component/ModelComponentEditor.java | 12 + .../virtual/VMenuContributionsEditor.java | 254 +++++++++++++ 6 files changed, 654 insertions(+), 4 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index f879dfc8e4..a4099d53a6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -168,6 +168,7 @@ public class Messages { public static String ModelComponentEditor_UiChildren; public static String ModelComponentEditor_PartDescriptors; public static String ModelComponentEditor_DetailParentId; + public static String ModelComponentEditor_MenuContributions; public static String ModelComponentsEditor_Label; public static String ModelComponentsEditor_Description; @@ -308,9 +309,20 @@ public class Messages { public static String ContributionClassDialog_Label_Classname; public static String ContributionClassDialog_ShellTitle; - - - + public static String MenuContributionEditor_Id; + public static String MenuContributionEditor_MenuItems; + public static String MenuContributionEditor_MenuItemType; + public static String MenuContributionEditor_MenuItemItemType; + public static String MenuContributionEditor_Up; + public static String MenuContributionEditor_Down; + public static String MenuContributionEditor_HandledMenuItem; + public static String MenuContributionEditor_Separator; + public static String MenuContributionEditor_Menu; + public static String MenuContributionEditor_DirectMenuItem; + public static String MenuContributionEditor_Remove; + public static String MenuContributionEditor_ParentId; + public static String MenuContributionEditor_Position; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 4e9558a9be..1a1f55175d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -163,6 +163,7 @@ ModelComponentEditor_Menus=Menus ModelComponentEditor_UiChildren=UI-Children ModelComponentEditor_PartDescriptors=PartDescriptors ModelComponentEditor_DetailParentId=parentId +ModelComponentEditor_MenuContributions=MenuContributions ModelComponentsEditor_Label=Model Components ModelComponentsEditor_Description=Some bla bla bla bla @@ -302,3 +303,18 @@ ContributionClassDialog_DialogMessage=Enter the name of the contributing class ContributionClassDialog_DialogTitle=Find Contribution Class ContributionClassDialog_Label_Classname=Classname ContributionClassDialog_ShellTitle=Find Contribution Class + +MenuContributionEditor_Id=Id +MenuContributionEditor_MenuItems=Menu Items +MenuContributionEditor_MenuItemType=Type +MenuContributionEditor_MenuItemItemType=Item Type +MenuContributionEditor_Up=Up +MenuContributionEditor_Down=Down +MenuContributionEditor_HandledMenuItem=Handled MenuItem +MenuContributionEditor_Separator=Separator +MenuContributionEditor_Menu=Menu +MenuContributionEditor_DirectMenuItem=Direct MenuItem +MenuContributionEditor_Remove=Remove +MenuContributionEditor_ParentId=Parent-Id +MenuContributionEditor_Position=Position + diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 60a674dadb..619dc49749 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -10,6 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; +import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuContributionEditor; + +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuContributionsEditor; + import org.eclipse.e4.ui.di.Focus; import java.util.ArrayList; @@ -131,6 +135,8 @@ public class ModelEditor { public static final String VIRTUAL_PARTDESCRIPTOR_MENU = ModelEditor.class.getName() + ".VIRTUAL_PARTDESCRIPTOR_MENU"; //$NON-NLS-1$ public static final String VIRTUAL_TRIMMED_WINDOW_TRIMS = ModelEditor.class.getName() + ".VIRTUAL_TRIMMED_WINDOW_TRIMS"; //$NON-NLS-1$ public static final String VIRTUAL_ADDONS = ModelEditor.class.getName() + ".VIRTUAL_ADDONS"; //$NON-NLS-1$ + public static final String VIRTUAL_MENU_CONTRIBUTIONS = ModelEditor.class.getName() + ".VIRTUAL_MENU_CONTRIBUTIONS"; //$NON-NLS-1$ + private Map editorMap = new HashMap(); private Map virtualEditors = new HashMap(); @@ -379,6 +385,7 @@ private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_TRIMMED_WINDOW_TRIMS, new VWindowTrimEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_ADDONS, new VApplicationAddons(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_MODEL_COMPONENT_CHILDREN, new VModelComponentUIEditor(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_MENU_CONTRIBUTIONS, new VMenuContributionsEditor(modelProvider.getEditingDomain(), this)); } private void registerVirtualEditor(String id, AbstractComponentEditor editor) { @@ -432,7 +439,8 @@ private void registerDefaultEditors() { registerEditor(MenuPackageImpl.Literals.MENU_SEPARATOR, new MenuSeparatorEditor(modelProvider.getEditingDomain())); registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), project, modelProvider)); registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this, project)); - + registerEditor(MenuPackageImpl.Literals.MENU_CONTRIBUTION, new MenuContributionEditor(modelProvider.getEditingDomain(),project, this)); + registerEditor(BasicPackageImpl.Literals.PART, new PartEditor(modelProvider.getEditingDomain(), project)); registerEditor(BasicPackageImpl.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain(), project)); registerEditor(BasicPackageImpl.Literals.TRIMMED_WINDOW, new TrimmedWindowEditor(modelProvider.getEditingDomain(), project)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java new file mode 100644 index 0000000000..b9b52b084b --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -0,0 +1,348 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.emf.databinding.EMFProperties; + +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + +import java.util.List; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenu; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +import org.eclipse.swt.SWT; + +import org.eclipse.core.databinding.observable.value.WritableValue; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.emf.databinding.EMFDataBindingContext; + +import org.eclipse.emf.edit.domain.EditingDomain; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; + +public class MenuContributionEditor extends AbstractComponentEditor { + private Composite composite; + private Image image; + private EMFDataBindingContext context; + private ModelEditor editor; + private IProject project; + + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + + private static class Struct { + private final String label; + private final EClass eClass; + private final boolean separator; + + public Struct(String label, EClass eClass, boolean separator) { + this.label = label; + this.eClass = eClass; + this.separator = separator; + } + } + + public MenuContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + this.project = project; + } + + @Override + public Image getImage(Object element, Display display) { + if( image == null ) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/MenuContribution.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "Menu Contribution"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Menu Contribution Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context2, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.MenuContributionEditor_Id); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.MenuContributionEditor_ParentId); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__PARENT_ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.MenuContributionEditor_Position); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__POSITION_IN_PARENT).observeDetail(getMaster())); + } + + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.MenuContributionEditor_MenuItems); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final TableViewer viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + + { + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText(Messages.MenuContributionEditor_MenuItemType); + column.getColumn().setWidth(300); + column.setLabelProvider(new ComponentLabelProvider(editor)); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText(Messages.MenuContributionEditor_MenuItemItemType); + column.getColumn().setWidth(100); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + viewer.setInput(prop.observeDetail(master)); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.MenuContributionEditor_Up); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.MenuContributionEditor_Down); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if (idx < container.getChildren().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + Struct struct = (Struct) element; + return struct.label; + } + }); + + Struct defaultStruct = new Struct(Messages.MenuContributionEditor_HandledMenuItem, MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false); + childrenDropDown.setInput(new Struct[] { new Struct(Messages.MenuContributionEditor_Separator, MenuPackageImpl.Literals.MENU_SEPARATOR, true), new Struct(Messages.MenuContributionEditor_Menu, MenuPackageImpl.Literals.MENU, false), defaultStruct, new Struct(Messages.MenuContributionEditor_DirectMenuItem, MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false) }); + childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!childrenDropDown.getSelection().isEmpty()) { + Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); + EClass eClass = struct.eClass; + MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + if (!struct.separator) { + editor.setSelection(eObject); + } + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.MenuContributionEditor_Remove); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + ControlFactory.createTagsWidget(parent, this); + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return ELEMENT_CONTAINER__CHILDREN.observe(element); + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java index a874f540fd..ba2b27ad4a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; + import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -55,6 +57,7 @@ public class ModelComponentEditor extends AbstractComponentEditor { private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES); private IListProperty MODEL_COMPONENT__COMMANDS = EMFProperties.list(ApplicationPackageImpl.Literals.MODEL_COMPONENT__COMMANDS); private IListProperty MODEL_COMPONENT__BINDINGS = EMFProperties.list(ApplicationPackageImpl.Literals.MODEL_COMPONENT__BINDINGS); + private IListProperty MENU_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS); public ModelComponentEditor(EditingDomain editingDomain) { super(editingDomain); @@ -246,6 +249,15 @@ protected boolean accepted(Object o) { }); + list.add(new VirtualEntry( ModelEditor.VIRTUAL_MENU_CONTRIBUTIONS, MENU_CONTRIBUTIONS, element, Messages.ModelComponentEditor_MenuContributions) { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + return list; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java new file mode 100644 index 0000000000..2db0267278 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java @@ -0,0 +1,254 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; + +import org.eclipse.e4.ui.model.application.ui.menu.MMenuContributions; + +import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution; + +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; + +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; + +import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory; +import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; +import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptorContainer; +import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VMenuContributionsEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private ModelEditor editor; + private TableViewer viewer; + + public VMenuContributionsEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "Menu Contributions"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Menu Contributions Bla Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + VirtualEntry o = (VirtualEntry)object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Menu Contributions"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Id"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__PARENT_ID); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("ParentId"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__POSITION_IN_PARENT); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Position"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MMenuContributions container = (MMenuContributions) getMaster().getValue(); + int idx = container.getMenuContributions().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MMenuContributions container = (MMenuContributions) getMaster().getValue(); + int idx = container.getMenuContributions().indexOf(obj) + 1; + if( idx < container.getMenuContributions().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MMenuContribution command = MMenuFactory.INSTANCE.createMenuContribution(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, command); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(command); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List commands = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, commands); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } +} From 49f9e63f5347f43482c80e02bd7de4295470891d Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 9 Jun 2010 23:03:04 +0000 Subject: [PATCH 0137/1286] Bug 316396 - [Tooling] ModelEditor gives error NPE --- .../META-INF/MANIFEST.MF | 2 +- .../OSGI-INF/projectfunction.xml | 8 ++++++++ .../build.properties | 3 ++- .../emf/editor3x/EditorProjectFunction.java | 16 ++++++++++++++++ .../ui/internal/wbm/ApplicationModelEditor.java | 6 ++++-- 5 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/projectfunction.xml create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index db0beef847..e69d0595b5 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -25,6 +25,6 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.ui.services;bundle-version="0.9.1", org.eclipse.e4.tools.compat;bundle-version="1.0.0", org.eclipse.e4.tools.services;bundle-version="1.0.0" -Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/xmiresourcecontextfunction.xml +Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/xmiresourcecontextfunction.xml, OSGI-INF/projectfunction.xml Bundle-ActivationPolicy: lazy Export-Package: org.eclipse.e4.tools.emf.editor3x.wizard;x-internal:=true diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/projectfunction.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/projectfunction.xml new file mode 100644 index 0000000000..ed7571e82b --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/projectfunction.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties index 69419d0dd0..2bc1498b59 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties @@ -5,5 +5,6 @@ bin.includes = META-INF/,\ icons/,\ OSGI-INF/pdecontributionprovider.xml,\ OSGI-INF/xmiresourcecontextfunction.xml,\ - OSGI-INF/selectionproviderfunction.xml + OSGI-INF/selectionproviderfunction.xml,\ + OSGI-INF/projectfunction.xml source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java new file mode 100644 index 0000000000..0544e40d45 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java @@ -0,0 +1,16 @@ +package org.eclipse.e4.tools.emf.editor3x; + +import org.eclipse.e4.core.contexts.ContextFunction; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IFileEditorInput; + +public class EditorProjectFunction extends ContextFunction { + + @Override + public Object compute(IEclipseContext context) { + final IEditorInput input = context.get(IEditorInput.class); + return ((IFileEditorInput)input).getFile().getProject(); + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java index d72d0ad05d..c406dfc689 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.wbm; +import javax.inject.Named; + import javax.inject.Inject; import org.eclipse.core.resources.IProject; import org.eclipse.e4.core.contexts.IEclipseContext; @@ -21,7 +23,7 @@ public class ApplicationModelEditor extends ModelEditor { @Inject public ApplicationModelEditor(Composite composite, IEclipseContext context, - IModelResource modelProvider, @Optional IProject project) { + IModelResource modelProvider, @Named("org.eclipse.e4.tools.emf.ui.editorproject") @Optional IProject project) { super(composite, context, modelProvider, project); } -} +} From c88b1719840d8ab94a594306f1a33bd6d0a06ef2 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 12 Jun 2010 19:56:12 +0000 Subject: [PATCH 0138/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * started adding support for new fragment contributions --- .../build.properties | 5 +- .../plugin.xml | 2 +- .../wizard/NewContributionModelWizard.java | 6 +- .../e4/tools/emf/ui/internal/Messages.java | 18 + .../tools/emf/ui/internal/Messages.properties | 17 + .../emf/ui/internal/common/ModelEditor.java | 9 + .../component/ModelFragmentsEditor.java | 231 ++++++++++++ .../common/component/StringModelFragment.java | 332 ++++++++++++++++++ 8 files changed, 612 insertions(+), 8 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties index 2bc1498b59..4f0aef779f 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties @@ -3,8 +3,5 @@ bin.includes = META-INF/,\ .,\ plugin.xml,\ icons/,\ - OSGI-INF/pdecontributionprovider.xml,\ - OSGI-INF/xmiresourcecontextfunction.xml,\ - OSGI-INF/selectionproviderfunction.xml,\ - OSGI-INF/projectfunction.xml + OSGI-INF/ source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml index 8a4c94ce26..dc050c9576 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml @@ -31,7 +31,7 @@ hasPages="true" icon="icons/full/obj16/plugin.png" id="org.eclipse.e4.tools.emf.editor3x.newmodelcontribution" - name="New Contribution Model"> + name="New Model Fragment"> - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.e4.ui.model.fragment.MFragmentFactory; + + +import org.eclipse.e4.ui.model.fragment.MModelFragment; + +import org.eclipse.e4.ui.model.fragment.MModelFragments; + +import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class ModelFragmentsEditor extends AbstractComponentEditor { + + private IListProperty MODEL_FRAGMENTS__FRAGMENTS = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS); + + private Composite composite; + private Image image; + private ModelEditor editor; + + public ModelFragmentsEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ModelFragments.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } + + @Override + public String getLabel(Object element) { + return Messages.ModelFragmentsEditor_Label; + } + + @Override + public String getDescription(Object element) { + return Messages.ModelFragmentsEditor_Description; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + composite = createForm(parent); + } + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.ModelFragmentsEditor_ModelFragments); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final TableViewer viewer = new TableViewer(parent); + viewer.setContentProvider(new ObservableListContentProvider()); + viewer.setLabelProvider(new ComponentLabelProvider(editor)); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + + IEMFListProperty prop = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS); + viewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelFragmentsEditor_Up); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MModelFragments container = (MModelFragments) getMaster().getValue(); + int idx = container.getFragments().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelFragmentsEditor_Down); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MModelFragments container = (MModelFragments) getMaster().getValue(); + int idx = container.getFragments().indexOf(obj) + 1; + if (idx < container.getFragments().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelFragmentsEditor_Add); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MModelFragment component = MFragmentFactory.INSTANCE.createStringModelFragment(); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, component); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(component); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelFragmentsEditor_Remove); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List elements = ((IStructuredSelection) viewer.getSelection()).toList(); + + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, elements); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return MODEL_FRAGMENTS__FRAGMENTS.observe(element); + } + + @Override + public String getDetailLabel(Object element) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java new file mode 100644 index 0000000000..5540040ca2 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -0,0 +1,332 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.emf.ecore.EPackage; + +import java.util.ArrayList; + +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; + +import org.eclipse.emf.ecore.EClassifier; + +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; + +import org.eclipse.e4.ui.model.fragment.MModelFragment; + +import java.util.List; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.widgets.Button; + +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.TableViewer; + +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridLayout; + +import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; + +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.emf.databinding.EMFProperties; + +import org.eclipse.e4.tools.emf.ui.internal.Messages; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.emf.databinding.EMFDataBindingContext; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +import org.eclipse.emf.edit.domain.EditingDomain; + +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; + +public class StringModelFragment extends AbstractComponentEditor { + private Composite composite; + private Image image; + private EMFDataBindingContext context; + private ModelEditor editor; + + private IListProperty MODEL_FRAGMENT__ELEMENTS = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS); + + public StringModelFragment(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/StringModelFragment.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } + + @Override + public String getLabel(Object element) { + return Messages.StringModelFragment_Label; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return Messages.StringModelFragment_Description; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + composite = createForm(parent); + } + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.StringModelFragment_ParentId); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__PARENT_ELEMENT_ID).observeDetail(getMaster())); + } + + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.StringModelFragment_Featurename); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__FEATURENAME).observeDetail(getMaster())); + } + + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.StringModelFragment_PositionInList); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__POSITION_IN_LIST).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.StringModelFragment_Elements); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final TableViewer viewer = new TableViewer(parent); + viewer.setContentProvider(new ObservableListContentProvider()); + viewer.setLabelProvider(new ComponentLabelProvider(editor)); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + + IEMFListProperty prop = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS); + viewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.StringModelFragment_Up); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MModelFragment container = (MModelFragment) getMaster().getValue(); + int idx = container.getElements().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.StringModelFragment_Down); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MModelFragment container = (MModelFragment) getMaster().getValue(); + int idx = container.getElements().indexOf(obj) + 1; + if (idx < container.getElements().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + EClass eclass = (EClass) element; + return eclass.getName(); + } + }); + + List list = new ArrayList(); + addClasses(ApplicationPackageImpl.eINSTANCE, list); + + childrenDropDown.setInput(list); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); + EObject eObject = EcoreUtil.create(eClass); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(eObject); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.StringModelFragment_Remove); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List elements = ((IStructuredSelection) viewer.getSelection()).toList(); + + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS, elements); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + return parent; + } + + public void addClasses(EPackage ePackage, List list) { + for (EClassifier c : ePackage.getEClassifiers()) { + if (c instanceof EClass) { + EClass eclass = (EClass) c; + if ( eclass != ApplicationPackageImpl.Literals.APPLICATION && !eclass.isAbstract() && !eclass.isInterface() && eclass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT)) { + list.add(eclass); + } + } + } + + for (EPackage eSubPackage : ePackage.getESubpackages()) { + addClasses(eSubPackage, list); + } + } + + public void dispose() { + if (image != null) { + image.dispose(); + image = null; + } + + if (composite != null) { + composite.dispose(); + composite = null; + } + + if (context != null) { + context.dispose(); + context = null; + } + } + + @Override + public IObservableList getChildList(Object element) { + return MODEL_FRAGMENT__ELEMENTS.observe(element); + } + +} From 81830e4b547eea5e8a7f6550e88b5eac7c0a46cf Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 12 Jun 2010 21:26:14 +0000 Subject: [PATCH 0139/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * started adding support for new fragment contributions --- .../org.eclipse.e4.tools.emf.ui.editors.exsd | 20 ++- .../tools/emf/ui/common/IEditorFeature.java | 20 +++ .../tools/emf/ui/internal/Messages.properties | 2 +- .../emf/ui/internal/common/ModelEditor.java | 36 +++++ .../common/component/ControlFactory.java | 125 ++++++++++++++++++ .../common/component/StringModelFragment.java | 22 +-- .../AbstractCommandSelectionDialog.java | 27 ++-- 7 files changed, 230 insertions(+), 22 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd b/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd index 352421fdf6..57b8c96b0d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd +++ b/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd @@ -18,8 +18,9 @@ - - + + + @@ -85,6 +86,21 @@ + + + + + + + + + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java new file mode 100644 index 0000000000..cf0411f955 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java @@ -0,0 +1,20 @@ +package org.eclipse.e4.tools.emf.ui.common; + +import org.eclipse.emf.ecore.EStructuralFeature; + +import java.util.List; + +import org.eclipse.emf.ecore.EClass; + +public interface IEditorFeature { + public class FeatureClass { + public final String label; + public final EClass eClass; + + public FeatureClass(String label, EClass eClass) { + this.label = label; + this.eClass = eClass; + } + } + public List getFeatureClasses(EClass eClass, EStructuralFeature feature); +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 63f06f3f37..10a35c0bc4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -323,7 +323,7 @@ ModelFragmentsEditor_Up=Up ModelFragmentsEditor_Down=Down ModelFragmentsEditor_Add=Add ModelFragmentsEditor_Remove=Remove -ModelFragmentsEditor_Label=Label +ModelFragmentsEditor_Label=Model Fragments ModelFragmentsEditor_Description=Description StringModelFragment_Label=String Model Fragment diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 0668cc2396..09e4fda2b5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -10,6 +10,12 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; +import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; + +import org.eclipse.emf.ecore.EStructuralFeature; + +import org.eclipse.e4.tools.emf.ui.common.IEditorFeature; + import org.eclipse.e4.tools.emf.ui.internal.common.component.StringModelFragment; import org.eclipse.e4.tools.emf.ui.internal.common.component.ModelFragmentsEditor; @@ -147,6 +153,7 @@ public class ModelEditor { private Map editorMap = new HashMap(); private Map virtualEditors = new HashMap(); private List labelFeaturePaths = new ArrayList(); + private List editorFeatures = new ArrayList(); // private List editors = new // ArrayList(); @@ -167,6 +174,7 @@ public ModelEditor(Composite composite, IEclipseContext context, IModelResource registerContributedEditors(); registerContributedVirtualEditors(); + loadEditorFeatures(); SashForm form = new SashForm(composite, SWT.HORIZONTAL); form.setBackground(form.getDisplay().getSystemColor(SWT.COLOR_WHITE)); @@ -295,6 +303,34 @@ public void menuAboutToShow(IMenuManager manager) { viewer.getControl().setMenu(mgr.createContextMenu(viewer.getControl())); } + private void loadEditorFeatures() { + IExtensionRegistry registry = RegistryFactory.getRegistry(); + IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ + + for (IConfigurationElement el : extPoint.getConfigurationElements()) { + if (!"editorfeature".equals(el.getName())) { //$NON-NLS-1$ + continue; + } + + try { + editorFeatures.add((IEditorFeature) el.createExecutableExtension("class")); //$NON-NLS-1$ + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + public List getFeatureClasses(EClass eClass, EStructuralFeature feature) { + List list = new ArrayList(); + + for( IEditorFeature f : editorFeatures ) { + list.addAll(f.getFeatureClasses(eClass, feature)); + } + + return list; + } + @Inject @Optional public void setSelectionService(ISelectionProviderService selectionService) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 62bdbd56c0..6a2c7b608a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -50,6 +50,131 @@ import org.eclipse.swt.widgets.Text; public class ControlFactory { + public static void createStringListWidget(Composite parent, final AbstractComponentEditor editor, String label, final EStructuralFeature feature) { + Label l = new Label(parent, SWT.NONE); + l.setText(label); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + t.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { + handleAddText(editor, UiPackageImpl.Literals.CONTEXT__VARIABLES, t); + } + } + }); + + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ControlFactory_Add); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + handleAddText(editor, feature, t); + } + }); + + new Label(parent, SWT.NONE); + + final TableViewer viewer = new TableViewer(parent); + viewer.setLabelProvider(new LabelProvider()); + viewer.setContentProvider(new ObservableListContentProvider()); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 150; + viewer.getControl().setLayoutData(gd); + + IEMFListProperty prop = EMFProperties.list(feature); + viewer.setInput(prop.observeDetail(editor.getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ControlFactory_Up); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MContext container = (MContext) editor.getMaster().getValue(); + int idx = container.getVariables().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), feature, obj, idx); + + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ControlFactory_Down); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MContext container = (MApplication) editor.getMaster().getValue(); + int idx = container.getVariables().indexOf(obj) + 1; + if (idx < container.getVariables().size()) { + Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), feature, obj, idx); + + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ControlFactory_Remove); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + MContext el = (MContext) editor.getMaster().getValue(); + List ids = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(editor.getEditingDomain(), el, feature, ids); + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + if (el.getVariables().size() > 0) { + viewer.setSelection(new StructuredSelection(el.getVariables().get(0))); + } + } + } + } + }); + } + + public static void createVariablesWidget(Composite parent, final AbstractComponentEditor editor) { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ControlFactory_ContextVariables); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index 5540040ca2..95ad8e81a5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -1,5 +1,7 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; + import org.eclipse.emf.ecore.EPackage; import java.util.ArrayList; @@ -242,15 +244,17 @@ public void widgetSelected(SelectionEvent e) { childrenDropDown.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { - EClass eclass = (EClass) element; - return eclass.getName(); + FeatureClass eclass = (FeatureClass) element; + return eclass.label; } }); - List list = new ArrayList(); + List list = new ArrayList(); addClasses(ApplicationPackageImpl.eINSTANCE, list); + list.addAll(editor.getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS)); childrenDropDown.setInput(list); + childrenDropDown.setSelection(new StructuredSelection(list.get(0))); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); @@ -258,7 +262,7 @@ public String getText(Object element) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); + EClass eClass = ((FeatureClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement()).eClass; EObject eObject = EcoreUtil.create(eClass); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS, eObject); @@ -291,17 +295,17 @@ public void widgetSelected(SelectionEvent e) { return parent; } - - public void addClasses(EPackage ePackage, List list) { + + public void addClasses(EPackage ePackage, List list) { for (EClassifier c : ePackage.getEClassifiers()) { if (c instanceof EClass) { EClass eclass = (EClass) c; - if ( eclass != ApplicationPackageImpl.Literals.APPLICATION && !eclass.isAbstract() && !eclass.isInterface() && eclass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT)) { - list.add(eclass); + if (eclass != ApplicationPackageImpl.Literals.APPLICATION && !eclass.isAbstract() && !eclass.isInterface() && eclass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT)) { + list.add(new FeatureClass(eclass.getName(), eclass)); } } } - + for (EPackage eSubPackage : ePackage.getESubpackages()) { addClasses(eSubPackage, list); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java index 71e5701360..397cfb157c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java @@ -10,6 +10,16 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; + +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.emf.common.util.TreeIterator; + +import org.eclipse.emf.ecore.util.EcoreUtil; + +import org.eclipse.e4.ui.model.fragment.MModelFragments; + import java.util.ArrayList; import java.util.List; import org.eclipse.e4.tools.emf.ui.common.IModelResource; @@ -87,19 +97,16 @@ public void doubleClick(DoubleClickEvent event) { } }); - if( resource.getRoot().get(0) instanceof MApplication ) { - MApplication app = (MApplication) resource.getRoot().get(0); - viewer.setInput(app.getCommands()); - } else { - MModelComponents components = (MModelComponents)resource.getRoot().get(0); - List commands = new ArrayList(); - for( MModelComponent comp : components.getComponents() ) { - commands.addAll(comp.getCommands()); + List commands = new ArrayList(); + TreeIterator it = EcoreUtil.getAllContents((EObject)resource.getRoot().get(0), true); + while( it.hasNext() ) { + EObject o = it.next(); + if( o.eClass() == CommandsPackageImpl.Literals.COMMAND ) { + commands.add(o); } - viewer.setInput(commands); } + viewer.setInput(commands); - final PatternFilter filter = new PatternFilter() { @Override protected boolean isParentMatch(Viewer viewer, Object element) { From 2ecca1c2dd8d3e86136bb9fddf457e723868db42 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 14 Jun 2010 20:18:35 +0000 Subject: [PATCH 0140/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling --- .../full/modelelements/ModelFragments.png | Bin 0 -> 591 bytes .../modelelements/StringModelFragment.png | Bin 0 -> 746 bytes .../icons/full/obj16/EPackage.gif | Bin 0 -> 207 bytes .../icons/full/obj16/field_public_obj.gif | Bin 0 -> 124 bytes .../icons/full/wizban/fieldrefact_wiz.png | Bin 0 -> 8469 bytes .../e4/tools/emf/ui/internal/Messages.java | 6 + .../tools/emf/ui/internal/Messages.properties | 6 + .../component/ModelFragmentsEditor.java | 2 +- .../common/component/StringModelFragment.java | 41 +- .../dialogs/FeatureSelectionDialog.java | 441 ++++++++++++++++++ 10 files changed, 490 insertions(+), 6 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ModelFragments.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/StringModelFragment.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/EPackage.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_public_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/fieldrefact_wiz.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ModelFragments.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ModelFragments.png new file mode 100644 index 0000000000000000000000000000000000000000..6187b15aec001b7080b51a5f944f07591f26cc15 GIT binary patch literal 591 zcmV-V0eEcNHZMNv|IbJ-M`( zKwWL~opzjJe^WpCmV9E;(0&ut2;4va_(#>M8)>9$R5viQnf(Nkh~VM$y>J(jqb$cj z+nL1Nm|mV)Gm|9MnHf*7Ja4OEAQz__^LRKOLEwqpiGV^^A*T=#&inGm-62Xs;dnSp zKj&H9T*boh2i)W+(n27l!C)>fq|L%VB1i ziC4p;NwV_}ZjW7$LRW#(_bKF#hp=!IqNO26Z*w2+LEwx{PVnZ&Sn}T;mtzb$;qA*nT@@+ zV5uQ@iXDTPoTbV#FRr~z04|PPh`wXTNoCm9*tG&?e3+fYl>K6+&3|Cc$KOpL`ER+_ dcRl5U#9zn6ZO}GFR5;6} zlS^n^1r&zAJIS<_JZ9PwM^mj%n&~t%YBgvRrPZy_kfqR-WMN#1f*Td23l&14xKMCm za3$hOD2Nb2A!@B)Qqwd=6KqpDCTSj%CLuF(bMJX{5zv&R*?2Yw4*VbI@t?rm`9D#= zQ}KhbcPGrWsA{gN-+k2manJn#iS6Qd4qz1Xjd^m-xjZf5V;e=HCauFQ?Eim0k;LPQws{c``d9jGZs8*-Q%=8j{5 zn&A$GmO@HhaW~edhnf89jMp_jNo8r6Ae?!16QGK^VQ$Q>-(n?PL0m9*5R+#7fp{m%kuR< z*%L%GH9th-!NaLws}J7#@pUh>6qqQFp=OvXkJ}wyYwaZ6_A(oDUsEdwEKF8e4MP&O zYW|)ph$!lcs3ImDj?45ve4O-=(}c616D04DY;1z4#HZDNct<8j+`LX-b*<18HuD2tz{_Em;*{{R1EgF6t%ugl;*a@gHDF}E(tZWF=JmCF-N!@Xx chR7VYa}C7>MLhQ!z8~0lY2CXYo*WF;0D@FSb^rhX literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_public_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_public_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..d4cb4254d92bcafa0341fc69e353c8cafe6944fe GIT binary patch literal 124 zcmZ?wbhEHb6krfw*v!Bn(B^A0Bg183N$uYG6Hly@>kKN~SlYRx@jn002S=1^@s6A3-Z300009a7bBm000XU z000XU0RWnu7ytkYO=&|zP*7-ZbZ>KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-ePrx>>xFPTiH1=E+A$W$=bG8>s^ zm=Bn5Rah$aDtr}@$`X}2l~$F0mFKEdRdZE8)p@E5RI61Ft6o-prbbn>P~)iy)E2AN zsU20jsWz_8Qg>31P|s0cqrPALg8E|(vWA65poU1JRAaZs8I2(p#xiB`SVGovRs-uS zYnV-9TeA7=Om+qP8+I>yOjAR1s%ETak!GFdam@h^# z)@rS0t$wXH+Irf)+G6c;?H29p+V6F6oj{!|o%K3xI`?%6x;DB|x`n#ibhIR?(H}Q3Gzd138Ei2)WAMz7W9Vy`X}HnwgyEn!VS)>mv$8&{hQn>w4zwy3R}t;BYlZQm5)6pty=DfLrs+A-|>>;~;Q z_F?uV_HFjh9n2gO9o9Q^JA86v({H5aB!kjoO6 zc9$1ZZKsN-Zl8L~mE{`ly3)1N^`o1+o7}D0ZPeY&J;i;i`%NyJ8_8Y6J?}yE@b_5a zam?eLr<8@mESk|3$_SkmS{wQ>%qC18))9_|&j{ZT zes8AvOzF(F2#DZEY>2oYX&IRp`F#{ADl)1r>QS^)ba8a|EY_^#S^HO&t^Rgqwv=MZThqqEWH8 zxJo>d=ABlR_Bh=;eM9Tw|Ih34~oTE|= zX_mAr*D$vzw@+p(E0Yc6dFE}(8oqt`+R{gE3x4zjX+Sb3_cYE^= zgB=w+-tUy`ytONMS8KgRef4hA?t0j zufM;t32jm~jUGrkaOInTZ`zyfns>EuS}G30LFK_G-==(f<51|K&cocp&EJ`SxAh3? zNO>#LI=^+SEu(FqJ)ynt=!~PC9bO$rzPJB=?=j6w@a-(u02P7 zaQ)#(uUl{HW%tYNS3ItC^iAtK(eKlL`f9+{bJzISE?u8_z3;~C8@FyI-5j_jy7l;W z_U#vU3hqqYU3!mrul&B+{ptt$59)uk{;_4iZQ%G|z+lhASr6|H35TBkl>gI*;nGLU zN7W-nBaM%pA0HbH8olyl&XeJ%vZoWz%6?Y=dFykl=imL}`%BMQ{Mhgd`HRoLu6e2R za__6DuR6yg#~-}Tc|Gx_{H@O0eebyMy5GmWADJlpK>kqk(fVV@r_fLLKIeS?{4e)} z^ZO;zpECde00d`2O+f$vv5tKEQIh}w03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(` z>RI+y?e7jKeZ#YO-C7BWdhK~#9!?3;OzT-SA&0Xh>#SKf(SVv<^3a;Wq^DjB|_dg$%v3z`uaN_)*n1JY(&U7A?ci?#7V{p!AkFa z$HMyK$464mkrt6az#x)CByq97c}Kze+*e1n6A~hl6Tv72BBT+?0_swK|Biw6r++h+ zb0TR4S_FvIlvfa_%e=;Q59`mL7)v=JRuUkwgi-=I1xl{qTGuVCFMM-65FsxjzLFRc zF{m7h^wQ_vv9P{)V8S?&ya>tjU?`<10)fcYUHiI%^}oI~kr5%QKriE=@U)^J4o}{~ z^{)$9UphGHchwXCoTnU5E6O5Q=AW)hSbz1@WX1_uh0=1K7gFFUrOG1mmO=ek!}{`f zr?hjF1PNAh)+#o=vJ;fZwfUbvmax9^%v90|1*H~Zrt>|yrxayzs4HLdt|M6cpPkMN zWR%E?7!-I)UmG8FRj~H#J5U5Z3hV*y0g9!3ntHQMC$s>kfv14K*uQu8Q*Q^Pzy1ES zc0x(y&6j=!p4O`Du91&g;rf?^^f2%%gKNvh^=nFOSe+-I@-a#w2<=E1nXYqgvc~D5 zDQdIL)4->%CA24gQ1L}5i->jtPC%Rxp9|tZz$itJ2+GaB=Hk~Ee_wKR%YV1sqjax- zMX>hlJFpA*e7U!<>!uxp?C8%inDfa822azys1Q1+bu6QEA?Id8h9+vf`s!KQtz)l@RmdQ2Y}TDb#VRm!Qy*&tl`cz847_$5JD@2 zQTzcqPH0AsMkItlC~&;eW~A2Q#OuRU#w$+&Kf8bL?wP9r^>@$B)qwie^D{*tb4jPGRbKrAEmV4i=N`|m>o4BEwU?h>o5rYEeoDno z!P5$@7Imq+&y7shn3|qtc%n+BGRw?Vjq;`eyj1d`J^Kzke7PU!;GwF1@`agRSf0{d zX&9~2T3`BoZ;ON9v+uw|CX@dB_FK2|(2f%8(jLB!K}F6HSw-XoD?;RiXO4_==+q>K z&rDIurwM$6>gGWN7@L~KOC^b#tr=j`rOffE7puDK$o&O#lSPwSYK964v{I$m%(&3Z zu8kQg5j+v`0Cm26A2EHs+|r-H(=gMqq_m0?LBtodA{-g2@P%(5Lp+ZSgFQU>!S$@l z1tg6|E3i(ehmKmua&oxB>!-$x)0MeHd-fgp)%|;Se`O_5-+8GTuXvy@6-O$CF-jHX zTE+*0a)R%icp~^Bc;|~rEp_UWNE{lxWji0;R-j}cp&;jLf+eQ+SI?f{yRVJ&t{v;x zF<546Il-!wA)ytDcqStUkw7zY49|s}sdg9|ukqUJ=V;6|zp#Jr?oTiM5YN0^^F=7T zZfLORycgBz{nD47KE_Mus@(ij+qq*f&-PM4 z-q#ofkrizBCarU{Lr0_INNUBFauQLXQwdHUAAV@hz5~nyd-iY)>P`IT!mvSUXQTI? zyOml@PANd^_sV@SizEV)fybJy19ZaZp*{N!%>4R?@BH^7QWm*5C;%(-0AdnKLBfy7rN>c9XmxsN zwo{9smO!I>p4jy%^pAcQCSLf^1FP)XuTDMqYgfJ9vE7+DUF$$-35+6g(5W~1&f#+m z?%K{>8}h788+;Xq3}1TYBzNAhipUC~bwt(?b|0PYu{K?2B81*eYiTw^iW>)L)lWS9 zm(L#l&L{8Q`F((F3cr|Z7g9kdr&TBE#0wkkV0LUeF+Ec!v`*Ag0KR9LZal@q|NB3& zwQnu|;Uj-UyOWBoQ!Oe>Ev)7Wa)TuLcaqJnrgHpyH}B4WdG9x?AKQ0Tup%e4tT0lK zP}bsUg>}NA7fzE{yPBPAvaCvZgjQ&ZBW<7)TJGM_zYx*SF9K2b7&7L!Z3;=Ts_aW1UZ>`EB+-`dhr`?w@1lyYAx2gI`?mP4gzm1?D&p z%%?N_A_hlVw<&jyeR55(_1Sanjbm2^%R0`@g#?~vqGi!ak(!tyDizsKOrTH<)!LMN zO+9oN6)VeioumLiJT}TiwMpb;!5qgbbt0z;U3>@Gq~V^`6AYdH9Dn?+@7=Kbz4!6U z_dP(6NFk!IXhJbW&d`j6SB@S^{o)sYmtT7SVQw0{mA#KX!h7$2keheB2i*lTU76*? z8@3xm36T}jsep1JO+K3z-p% zE$$r1(1;u(jgbCYooG!Ty=kAxX2eWA#LxI7J&RH-C~F?p4~~vve2+vjpdDFSk)tk# zQg4oq6CCh~pHjT?>VIaaG0nrj@NZ~zI-D3DVyZUBT&sfB$X7(x@#^Ub>frz>Kf@-g zC7IIS+1{T0{EL+o*}xEW|GpUsP3xFwM1;P=*C1l(xaGs;1VFi5!WfM)2G^-l zsb3+i{d;$RVb8t;zi^YQ-}6RA$89D+wQXrzVJ>oXY@B_F1X@<;gv*uXh_@*7A%vB9 z6YlGX(`UcNrVSgZHRm`ve1@r+X=;@krDSI2{hM$5{>I+TuP1zy9iBP6>-(=ix8rQ( zRMKPyQF=9DtBLV_W^2TO>6s#Q8q)+YI0<% zMLF$rrrO4e#7YY_VHgoPS%|GpjZ~w+;Z1&!yNf*t@WW7KFg_Fh-M3`52>7S}orWDM%)hq|=#r!u6FaYu?%4(i|Rp z+!(W~;5iPBHF)sGGL0zCDum857di@|C0vX<=|qmPW`qtRS~lJhw5_8#?*J9dRIA*+ z?KTdN-O5b8{S6UGJ4bd^F&vy}KmNC5}~?mi9NvS;6chu7HpBPW~r z;`5^o`f>q7)ixccXlq3(j0n5RieXtMo0iCr;tWK0>(jC^tT2jbHkxeM@BmMKufhAb z4t!IDTs~uS%KO&8{q09Td)LjkzK=@F^7P;S4N)j0eS;E%b_OE`gTcozK60FOs|Nr$ zb8do{j#Y3Dwya;phJhYZNq>13;=J>PjH~f**P?E?fA8+k?%8*s_!F(_BZtR*w)UoI z+PGNZX+<%#be5zRJCS29v_zr90oFkzLNl}slm{6aK1bN;;I#+Hdfr!W-?V1JIT-An zy?eMiwYeEuo_q0!bUG2zUE5kp5h_JpE3}G}kwz)BRvbR{BK^fOtI7p-?dZW6Lpte` z2)qkHEm7Hdc|WXEZyi<_*nix!@4%j&+19S%n#KoaBf%)49a>&FIku2Wo|$V>4;-CH z7FNZu+2QYBoaCXKAL8K4f5MKno0yo;vk%<7<-Y)Et^CLZc6I;I1Ohy4d)1accZvzQ4aXok}u1 zIY%Rvq`GD;zwyND-Aywf85+jNh7PR5O;u6jQ;c|;=WDlf|NHL1%v5I!$^Or5DCcLL z2%b^7vFXgw*~Zq9tiP3vx0nl`PtKhkefBrEZ~MRw&P%(@Cq}K)E1KF$W_MvmInKCT zGgw`xf3F@LJ-Bh8ueg4FiBqS>s3y|{=@c#zV3opJhiQkni7BYg;n|4d>KvQ4tUOP@i4&BrBYDLrLeY$(Q1jB7PnmU zrt2Bqg|rxqUQAhux1;4~c(SdX@HG*h`0r01-g$Ox>Vt2D_O2xb7NwOk`BZRdOF8@8 z$9C^}ZoclfP~Fwa*IFfBx$*VTIm0($SZ5{m5QBVpa0-w2W=PM$- zvZQ$FStmv3#4IgkT~JMqRdv}TajUyRD7>*uUsZLQif7K zO(q@SdFIW{@a=##I^D@RA-PihNJLT&a+fkK6PF@=Cszt9R#qzMQ!1n}W**eyP0NxA zN+x`g^NGKUd?+U%N|}U@ce!=LOOCNhClDda%CnObxGc4JMrE(Gn(QR@StuwMGV~NP zS8aAHg%16t%;2_uY0Hw>?) zX})AB2uhod(mGO}pHkW=QObgj;)jY9%5}3gOF<=-Qd+K%)`GH7OjKqWo2)JNR?Me| zoM5fcQ_9d=&XVxG%bWEjnXZYX$rc7LOi1~?kai| z7JOFs1B8)XwhB67AwwEPjw_i95lDG@Q=r10B{wI6YKu~Ji>`#|(9=ebi&BBo+SkS< z#2H^i0&(JtbAgEXp6BP3F*!tx#NVn?S}RW(lj~ONq?@9N04q)qu|7_mpbSL5LPws_ zfx-j|Wfj;soLs1&U1mjE(Z4EB|El~o>j`lJ9&9vGC(ey1-4vy2C^O+iPj#FgpKh4r z-u5l)n?Q4=iyS|F&htG#XN*4>MbVrMqf`_{X>n2zCp}RoO4=w&iE|!Hx`P*Hb+JEP zP|B*nH)zvQ+O)LNZKX|9p*vdXmeaZwIn{Bf=z=CPB_?vBFBU7kHCTcY$si7;R7aGW zcFGL3B{)`V>l0@t_3>(h#zl=fmn(?YCLKjl1Eo4j>8ADriG7-lv~|95&KKuA=bRD2 zL!6$MnJDGrt^j4V@jPv`aaxC6w{T z|MQ6_-j*h{(Wz;+75hY#o)P08@8BPw?Rc+@*7V7d3X{&obAC}+i9|9dB2F8xAp+J) z-U(GFQeB8^WPZ~tdVU`#OB%)E#~R_WXaZq#YQqYZyEBmOZwUsG%f>}J8t;N zXX~wIPJ!P|g<~ruo)SNjxTw%Nu5nWcdatrm0)ofb>WI^7tqUKelt`k+Qq^u%ft_3KiP~LT< zs%5ZR9h(9YvFWL|{Eda{O;ro9I-%1FRlF98x?WYas4PWEpa*qrz60YKl~7z?sshlF zbxB~&wE_j;Utt#X$4Ob6uI0C?e60edl)fHe{oerq111Z&v0Gfi00000NkvXXu0mjf DEpD2w literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 6ccea790b0..a1f393c1b8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -340,6 +340,12 @@ public class Messages { public static String StringModelFragment_Down; public static String StringModelFragment_Remove; public static String StringModelFragment_Elements; + public static String StringModelFragment_Find; + + public static String FeatureSelectionDialog_Filter; + public static String FeatureSelectionDialog_ShellTitle; + public static String FeatureSelectionDialog_DialogTitle; + public static String FeatureSelectionDialog_DialogMessage; static { NLS.initializeMessages(Messages.class.getName(), Messages.class); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 10a35c0bc4..65a125e299 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -335,3 +335,9 @@ StringModelFragment_Up=Up StringModelFragment_Down=Down StringModelFragment_Remove=Remove StringModelFragment_Elements=Elements +StringModelFragment_Find=Find ... + +FeatureSelectionDialog_Filter=Filter +FeatureSelectionDialog_ShellTitle=Find Featurename +FeatureSelectionDialog_DialogTitle=Featurename +FeatureSelectionDialog_DialogMessage=Find the name of the feature you want to contribute to \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java index ca11efa5ad..a141bb10c4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java @@ -67,7 +67,7 @@ public ModelFragmentsEditor(EditingDomain editingDomain, ModelEditor editor) { public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ModelFragments.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ModelFragments.png")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index 95ad8e81a5..080cb16451 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -1,5 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.ui.model.fragment.MStringModelFragment; + +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FeatureSelectionDialog; + import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; import org.eclipse.emf.ecore.EPackage; @@ -10,12 +24,9 @@ import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; - import org.eclipse.e4.ui.model.fragment.MModelFragment; import java.util.List; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; @@ -87,7 +98,7 @@ public StringModelFragment(EditingDomain editingDomain, ModelEditor editor) { public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/StringModelFragment.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/StringModelFragment.png")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -141,11 +152,31 @@ private Composite createForm(Composite parent) { Label l = new Label(parent, SWT.NONE); l.setText(Messages.StringModelFragment_Featurename); - Text t = new Text(parent, SWT.BORDER); + Composite comp = new Composite(parent, SWT.NONE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; + comp.setLayoutData(gd); + GridLayout gl = new GridLayout(2,false); + gl.marginWidth=gl.marginHeight=0; + gl.verticalSpacing=0; + gl.marginLeft=gl.marginBottom=gl.marginRight=gl.marginTop=0; + comp.setLayout(gl); + + Text t = new Text(comp, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__FEATURENAME).observeDetail(getMaster())); + + final Button button = new Button(comp, SWT.PUSH | SWT.FLAT); + button.setText(Messages.StringModelFragment_Find); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FeatureSelectionDialog dialog = new FeatureSelectionDialog(button.getShell(),getEditingDomain(),(MStringModelFragment) getMaster().getValue()); + dialog.open(); + } + }); + } { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java new file mode 100644 index 0000000000..0b4908554f --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java @@ -0,0 +1,441 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import java.text.BreakIterator; +import java.util.ArrayList; +import java.util.List; +import java.util.Map.Entry; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.StringMatcher; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.fragment.MStringModelFragment; +import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; +import org.eclipse.e4.ui.model.internal.ModelUtils; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.jface.viewers.ViewerComparator; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +@SuppressWarnings("restriction") +public class FeatureSelectionDialog extends TitleAreaDialog { + private TreeViewer viewer; + private MStringModelFragment fragment; + private EditingDomain editingDomain; + + public FeatureSelectionDialog(Shell parentShell, EditingDomain editingDomain, MStringModelFragment fragment) { + super(parentShell); + this.fragment = fragment; + this.editingDomain = editingDomain; + } + + @Override + protected Control createDialogArea(Composite parent) { + getShell().setText(Messages.FeatureSelectionDialog_ShellTitle); + setTitle(Messages.FeatureSelectionDialog_DialogTitle); + setMessage(Messages.FeatureSelectionDialog_DialogMessage); + + + Composite composite = (Composite) super.createDialogArea(parent); + + final Image packageImage = new Image(getShell().getDisplay(),getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/EPackage.gif")); //$NON-NLS-1$ + final Image classImage = new Image(getShell().getDisplay(),getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/class_obj.gif")); //$NON-NLS-1$ + final Image featureImage = new Image(getShell().getDisplay(),getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/field_public_obj.gif")); //$NON-NLS-1$ + final Image newTitleImage = new Image(getShell().getDisplay(),getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/fieldrefact_wiz.png")); //$NON-NLS-1$ + + setTitleImage(newTitleImage); + + composite.addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + packageImage.dispose(); + classImage.dispose(); + featureImage.dispose(); + newTitleImage.dispose(); + } + }); + + + Composite container = new Composite(composite, SWT.NONE); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + container.setLayout(new GridLayout(2, false)); + + Label l = new Label(container, SWT.NONE); + l.setText(Messages.FeatureSelectionDialog_Filter); + + final Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); + searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + new Label(container, SWT.NONE); + viewer = new TreeViewer(container); + GridData gd = new GridData(GridData.FILL_BOTH); + gd.heightHint=200; + viewer.getControl().setLayoutData(gd); + viewer.setContentProvider(new ContentProviderImpl()); + viewer.setLabelProvider(new LabelProviderImpl(packageImage,classImage,featureImage)); + viewer.addDoubleClickListener(new IDoubleClickListener() { + + public void doubleClick(DoubleClickEvent event) { + okPressed(); + } + }); + viewer.setComparator(new ViewerComparator() { + @Override + public int compare(Viewer viewer, Object e1, Object e2) { + if( e1.getClass() == InternalPackage.class ) { + return ((InternalPackage)e1).ePackage.getNsURI().compareTo(((InternalPackage)e2).ePackage.getNsURI()); + } else if( e1.getClass() == InternalClass.class ) { + return ((InternalClass)e1).eClass.getName().compareTo(((InternalClass)e2).eClass.getName()); + } else if( e1.getClass() == InternalFeature.class ) { + return ((InternalFeature)e1).feature.getName().compareTo(((InternalFeature)e2).feature.getName()); + } + return super.compare(viewer, e1, e2); + } + }); + + final ViewerFilterImpl filter = new ViewerFilterImpl(); + + viewer.addFilter(filter); + searchText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + filter.setPattern(searchText.getText()); + viewer.refresh(); + } + }); + + + viewer.setInput(loadPackages()); + + return composite; + } + + @Override + protected void okPressed() { + IStructuredSelection sel = (IStructuredSelection) viewer.getSelection(); + if( ! sel.isEmpty() && sel.getFirstElement().getClass() == InternalFeature.class ) { + InternalFeature f = (InternalFeature) sel.getFirstElement(); + Command cmd = SetCommand.create(editingDomain, fragment, FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__FEATURENAME, f.feature.getName()); + + if( cmd.canExecute() ) { + editingDomain.getCommandStack().execute(cmd); + super.okPressed(); + } + } + } + + private static List loadPackages() { + List packs = new ArrayList(); + + for( Entry regEntry : EPackage.Registry.INSTANCE.entrySet() ) { + if( regEntry.getValue() instanceof EPackage ) { + EPackage ePackage = (EPackage) regEntry.getValue(); + InternalPackage iePackage = new InternalPackage(ePackage); + boolean found = false; + for( EClassifier cl : ePackage.getEClassifiers() ) { + if( cl instanceof EClass ) { + EClass eClass = (EClass) cl; + if( eClass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT) ) { + if( ! eClass.isInterface() && ! eClass.isAbstract() ) { + found = true; + InternalClass ieClass = new InternalClass(iePackage, eClass); + iePackage.classes.add(ieClass); + for( EReference f : eClass.getEAllReferences() ) { + ieClass.features.add(new InternalFeature(ieClass, f)); + } + } + } + } + } + if( found ) { + packs.add(iePackage); + } + } + } + + return packs; + } + + static class ContentProviderImpl implements ITreeContentProvider { + + public void dispose() { + + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + + } + + public Object[] getElements(Object inputElement) { + return ((List)inputElement).toArray(); + } + + public Object[] getChildren(Object parentElement) { + if( parentElement.getClass() == InternalPackage.class ) { + return ((InternalPackage)parentElement).classes.toArray(); + } else if( parentElement.getClass() == InternalClass.class ) { + return ((InternalClass)parentElement).features.toArray(); + } + return new Object[0]; + } + + public Object getParent(Object element) { + if( element.getClass() == InternalFeature.class ) { + return ((InternalFeature)element).clazz; + } else if( element.getClass() == InternalClass.class ) { + return ((InternalClass)element).pack; + } + return null; + } + + public boolean hasChildren(Object element) { + return getChildren(element).length > 0; + } + + } + + static class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { + private final Image packageImage; + private final Image classImage; + private final Image featureImage; + + public LabelProviderImpl(Image packageImage, Image classImage, Image featureImage) { + this.packageImage = packageImage; + this.classImage = classImage; + this.featureImage = featureImage; + } + + public void update(final ViewerCell cell) { + if( cell.getElement().getClass() == InternalPackage.class ) { + InternalPackage o = (InternalPackage) cell.getElement(); + StyledString styledString = new StyledString(o.ePackage.getName()); + styledString.append( " - " + o.ePackage.getNsURI(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + cell.setText(styledString.getString()); + cell.setStyleRanges(styledString.getStyleRanges()); + cell.setImage(packageImage); + } else if( cell.getElement().getClass() == InternalClass.class ) { + InternalClass o = (InternalClass) cell.getElement(); + cell.setText(o.eClass.getName()); + cell.setImage(classImage); + } else { + InternalFeature o = (InternalFeature) cell.getElement(); + StyledString styledString = new StyledString(o.feature.getName()); + + EClassifier type = ModelUtils.getTypeArgument(o.clazz.eClass, o.feature.getEGenericType()); + if( o.feature.isMany() ) { + styledString.append(" : List<" + type.getName()+ ">", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + styledString.append(" : " + type.getName(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + } + + cell.setText(styledString.getString()); + cell.setStyleRanges(styledString.getStyleRanges()); + cell.setImage(featureImage); + } + } + + public Image getImage(Object element) { + return null; + } + + public String getText(Object element) { + if( element.getClass() == InternalPackage.class ) { + InternalPackage o = (InternalPackage) element; + return o.ePackage.getName(); + } else if( element.getClass() == InternalClass.class ) { + InternalClass o = (InternalClass) element; + return o.eClass.getName(); + } else { + InternalFeature o = (InternalFeature) element; + return o.feature.getName(); + } + } + } + + static class ViewerFilterImpl extends ViewerFilter { + private StringMatcher matcher; + + @Override + public boolean select(Viewer viewer, Object parentElement, Object element) { + + if( element.getClass() == InternalPackage.class ) { + ILabelProvider pv = (ILabelProvider) ((StructuredViewer)viewer).getLabelProvider(); + for( InternalClass c : ((InternalPackage)element).classes ) { + if( match(pv.getText(c)) ) { + return true; + } + } + return false; + } else if( element.getClass() == InternalPackage.class ) { + ILabelProvider pv = (ILabelProvider) ((StructuredViewer)viewer).getLabelProvider(); + return match(pv.getText(element)); + } + + return true; + } + + protected boolean wordMatches(String text) { + if (text == null) { + return false; + } + + //If the whole text matches we are all set + if(match(text)) { + return true; + } + + // Otherwise check if any of the words of the text matches + String[] words = getWords(text); + for (int i = 0; i < words.length; i++) { + String word = words[i]; + if (match(word)) { + return true; + } + } + + return false; + } + + /** + * Answers whether the given String matches the pattern. + * + * @param string the String to test + * + * @return whether the string matches the pattern + */ + private boolean match(String string) { + if (matcher == null) { + return true; + } + return matcher.match(string); + } + + /** + * The pattern string for which this filter should select + * elements in the viewer. + * + * @param patternString + */ + public void setPattern(String patternString) { + + if (patternString == null || patternString.equals("")) { //$NON-NLS-1$ + matcher = null; + } else { + String pattern = patternString + "*"; //$NON-NLS-1$ +// if (includeLeadingWildcard) { +// pattern = "*" + pattern; //$NON-NLS-1$ +// } + matcher = new StringMatcher(pattern, true, false); + } + } + + /** + * Take the given filter text and break it down into words using a + * BreakIterator. + * + * @param text + * @return an array of words + */ + private String[] getWords(String text){ + List words = new ArrayList(); + // Break the text up into words, separating based on whitespace and + // common punctuation. + // Previously used String.split(..., "\\W"), where "\W" is a regular + // expression (see the Javadoc for class Pattern). + // Need to avoid both String.split and regular expressions, in order to + // compile against JCL Foundation (bug 80053). + // Also need to do this in an NL-sensitive way. The use of BreakIterator + // was suggested in bug 90579. + BreakIterator iter = BreakIterator.getWordInstance(); + iter.setText(text); + int i = iter.first(); + while (i != java.text.BreakIterator.DONE && i < text.length()) { + int j = iter.following(i); + if (j == java.text.BreakIterator.DONE) { + j = text.length(); + } + // match the word + if (Character.isLetterOrDigit(text.charAt(i))) { + String word = text.substring(i, j); + words.add(word); + } + i = j; + } + return (String[]) words.toArray(new String[words.size()]); + } + } + + static class InternalPackage { + final EPackage ePackage; + List classes = new ArrayList(); + + public InternalPackage(EPackage ePackage) { + this.ePackage = ePackage; + } + + @Override + public String toString() { + return ePackage.toString(); + } + } + + static class InternalClass { + final InternalPackage pack; + final EClass eClass; + List features = new ArrayList(); + + public InternalClass(InternalPackage pack, EClass eClass) { + this.eClass = eClass; + this.pack = pack; + } + } + + static class InternalFeature { + final InternalClass clazz; + final EStructuralFeature feature; + + public InternalFeature(InternalClass clazz, EStructuralFeature feature) { + this.clazz = clazz; + this.feature = feature; + } + + } +} From 56804140f0619951101a18f5945d29ba33b990f3 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 15 Jun 2010 16:46:26 +0000 Subject: [PATCH 0141/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling --- .../META-INF/MANIFEST.MF | 3 +- .../internal/ContextServiceFactory.java | 9 +- .../ReflectionContributionFactory.java | 260 ++++++++++++++++++ .../compat/internal/WorkbenchLogger.java | 143 ++++++++++ 4 files changed, 411 insertions(+), 4 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java create mode 100644 bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/WorkbenchLogger.java diff --git a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF index 518b39dbc4..4225c5064e 100644 --- a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF @@ -12,7 +12,8 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.core.di;bundle-version="0.9.0", org.eclipse.e4.tools.services;bundle-version="1.0.0", org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0", - org.eclipse.e4.ui.di;bundle-version="0.9.0" + org.eclipse.e4.ui.di;bundle-version="0.9.0", + javax.inject;bundle-version="1.0.0" Service-Component: OSGI-INF/selectionproviderfunction.xml Export-Package: org.eclipse.e4.tools.compat.parts Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java index 7e557ec867..e6d3ef7682 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java @@ -10,8 +10,11 @@ ******************************************************************************/ package org.eclipse.e4.tools.compat.internal; +import org.eclipse.e4.core.contexts.ContextInjectionFactory; import org.eclipse.e4.core.contexts.EclipseContextFactory; import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.core.services.contributions.IContributionFactory; +import org.eclipse.e4.core.services.log.Logger; import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; import org.eclipse.e4.ui.css.swt.theme.IThemeManager; import org.eclipse.e4.ui.services.IServiceConstants; @@ -61,9 +64,9 @@ public Object create(@SuppressWarnings("rawtypes") Class serviceInterface, IServ IEclipseContext serviceContext = EclipseContextFactory.getServiceContext(bundleContext); final IEclipseContext appContext = serviceContext.createChild("WorkbenchContext"); //$NON-NLS-1$ -// IExtensionRegistry registry = RegistryFactory.getRegistry(); -// ReflectionContributionFactory contributionFactory = new ReflectionContributionFactory(registry); -// appContext.set(IContributionFactory.class.getName(),contributionFactory); + appContext.set(Logger.class, new WorkbenchLogger()); + IContributionFactory contributionFactory = ContextInjectionFactory.make(ReflectionContributionFactory.class, appContext); + appContext.set(IContributionFactory.class.getName(),contributionFactory); IThemeManager manager = serviceContext.get(IThemeManager.class); final IThemeEngine engine = manager.getEngineForDisplay(Display.getCurrent()); diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java new file mode 100644 index 0000000000..1dce9b056a --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java @@ -0,0 +1,260 @@ +package org.eclipse.e4.tools.compat.internal; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import javax.inject.Inject; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.InvalidRegistryObjectException; +import org.eclipse.e4.core.contexts.ContextInjectionFactory; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.core.di.InjectionException; +import org.eclipse.e4.core.services.contributions.IContributionFactory; +import org.eclipse.e4.core.services.contributions.IContributionFactorySpi; +import org.eclipse.e4.core.services.log.Logger; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; +import org.osgi.service.packageadmin.PackageAdmin; + +/** + * Create the contribution factory. + */ +public class ReflectionContributionFactory implements IContributionFactory { + + private IExtensionRegistry registry; + private Map languages; + + @Inject + private PackageAdmin packageAdmin; + + @Inject + private Logger logger; + + /** + * Create a reflection factory. + * + * @param registry + * to read languages. + */ + @Inject + public ReflectionContributionFactory(IExtensionRegistry registry) { + this.registry = registry; + processLanguages(); + } + + public Object call(Object object, String uriString, String methodName, IEclipseContext context, + Object defaultValue) { + if (uriString != null) { + URI uri = new URI(uriString); + if (uri.segments.length > 3) { + String prefix = uri.segments[2]; + IContributionFactorySpi factory = (IContributionFactorySpi) languages.get(prefix); + return factory.call(object, methodName, context, defaultValue); + } + } + + Method targetMethod = null; + + Method[] methods = object.getClass().getMethods(); + + // Optimization: if there's only one method, use it. + if (methods.length == 1) { + targetMethod = methods[0]; + } else { + ArrayList toSort = new ArrayList(); + + for (int i = 0; i < methods.length; i++) { + Method method = methods[i]; + + // Filter out non-public constructors + if ((method.getModifiers() & Modifier.PUBLIC) != 0 + && method.getName().equals(methodName)) { + toSort.add(method); + } + } + + // Sort the methods by descending number of method + // arguments + Collections.sort(toSort, new Comparator() { + /* + * (non-Javadoc) + * + * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) + */ + public int compare(Method m1, Method m2) { + int l1 = m1.getParameterTypes().length; + int l2 = m2.getParameterTypes().length; + + return l1 - l2; + } + }); + + // Find the first satisfiable method + for (Iterator iter = toSort.iterator(); iter.hasNext() && targetMethod == null;) { + Method next = iter.next(); + + boolean satisfiable = true; + + Class[] params = next.getParameterTypes(); + for (int i = 0; i < params.length && satisfiable; i++) { + Class clazz = params[i]; + + if (!context.containsKey(clazz.getName()) + && !IEclipseContext.class.equals(clazz)) { + satisfiable = false; + } + } + + if (satisfiable) { + targetMethod = next; + } + } + } + + if (targetMethod == null) { + if (defaultValue != null) { + return defaultValue; + } + throw new RuntimeException( + "could not find satisfiable method " + methodName + " in class " + object.getClass()); //$NON-NLS-1$//$NON-NLS-2$ + } + + Class[] paramKeys = targetMethod.getParameterTypes(); + + try { + logger.debug("calling: " + methodName); + Object[] params = new Object[paramKeys.length]; + for (int i = 0; i < params.length; i++) { + if (IEclipseContext.class.equals(paramKeys[i])) { + params[i] = context; + } else { + params[i] = context.get(paramKeys[i].getName()); + } + } + + return targetMethod.invoke(object, params); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + public Object create(String uriString, IEclipseContext context) { + if (uriString == null) { + return null; + } + URI uri = new URI(uriString); + Bundle bundle = getBundle(uri); + Object contribution; + if (bundle != null) { + contribution = createFromBundle(bundle, context, uri); + } else { + contribution = null; + logger.error("Unable to retrive the bundle from the URI: "+ uriString); + } + return contribution; + } + + protected Object createFromBundle(Bundle bundle, IEclipseContext context, URI uri) { + Object contribution; + if (uri.segments.length > 3) { + String prefix = uri.segments[2]; + IContributionFactorySpi factory = (IContributionFactorySpi) languages.get(prefix); + StringBuffer resource = new StringBuffer(uri.segments[3]); + for (int i = 4; i < uri.segments.length; i++) { + resource.append('/'); + resource.append(uri.segments[i]); + } + contribution = factory.create(bundle, resource.toString(), context); + } else { + String clazz = uri.segments[2]; + try { + Class targetClass = bundle.loadClass(clazz); + contribution = ContextInjectionFactory.make(targetClass, context); + if (contribution == null) { + String message = "Unable to load class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ + + bundle.getBundleId() + "'"; //$NON-NLS-1$ + logger.error(message); + } + } catch (ClassNotFoundException e) { + contribution = null; + String message = "Unable to load class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ + + bundle.getBundleId() + "'"; //$NON-NLS-1$ + logger.error(message); + } catch (InjectionException e) { + contribution = null; + String message = "Unable to create class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ + + bundle.getBundleId() + "'"; //$NON-NLS-1$ + logger.error(message); + } + } + return contribution; + } + + protected void processLanguages() { + languages = new HashMap(); + String extId = "org.eclipse.e4.languages"; //$NON-NLS-1$ + IConfigurationElement[] languageElements = registry.getConfigurationElementsFor(extId); + for (int i = 0; i < languageElements.length; i++) { + IConfigurationElement languageElement = languageElements[i]; + try { + languages.put(languageElement.getAttribute("name"), //$NON-NLS-1$ + languageElement.createExecutableExtension("contributionFactory")); //$NON-NLS-1$ + } catch (InvalidRegistryObjectException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + protected Bundle getBundle(URI platformURI) { + return getBundleForName(platformURI.segments[1]); + } + + public Bundle getBundle(String uriString) { + return getBundle(new URI(uriString)); + } + + public Bundle getBundleForName(String bundlename) { + if( packageAdmin == null ) { + Bundle bundle = FrameworkUtil.getBundle(getClass()); + BundleContext context = bundle.getBundleContext(); + ServiceReference reference = context.getServiceReference(PackageAdmin.class.getName()); + packageAdmin = (PackageAdmin) context.getService(reference); + } + + Bundle[] bundles = packageAdmin.getBundles(bundlename, null); + if (bundles == null) + return null; + // Return the first bundle that is not installed or uninstalled + for (int i = 0; i < bundles.length; i++) { + if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) { + return bundles[i]; + } + } + return null; + } + + static class URI { + String[] segments; + String uri; + + private URI(String uriString) { + segments = uriString.substring(uriString.indexOf('/')+1).split("/"); + } + } +} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/WorkbenchLogger.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/WorkbenchLogger.java new file mode 100644 index 0000000000..d5e64d8a36 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/WorkbenchLogger.java @@ -0,0 +1,143 @@ +package org.eclipse.e4.tools.compat.internal; + +import java.util.ArrayList; +import javax.inject.Inject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.e4.core.services.log.Logger; +import org.eclipse.osgi.framework.log.FrameworkLog; +import org.eclipse.osgi.framework.log.FrameworkLogEntry; +import org.eclipse.osgi.service.debug.DebugOptions; +import org.eclipse.osgi.service.debug.DebugTrace; +import org.osgi.framework.Bundle; +import org.osgi.framework.FrameworkUtil; + +/** + * The workbench implementation of the logger service. + */ +public final class WorkbenchLogger extends Logger { + protected DebugTrace trace; + protected FrameworkLog log; + private Bundle bundle = FrameworkUtil.getBundle(WorkbenchLogger.class); + + /** + * Creates a new workbench logger + */ + public WorkbenchLogger() { + super(); + } + + public void debug(Throwable t) { + debug(t, null); + } + + public void debug(Throwable t, String message) { + trace(t, message); + } + + public void error(Throwable t, String message) { + log(new Status(IStatus.ERROR, bundle.getSymbolicName(), + message, t)); + } + + /** + * Copied from PlatformLogWriter in core runtime. + */ + private static FrameworkLogEntry getLog(IStatus status) { + Throwable t = status.getException(); + ArrayList childlist = new ArrayList(); + + int stackCode = t instanceof CoreException ? 1 : 0; + // ensure a substatus inside a CoreException is properly logged + if (stackCode == 1) { + IStatus coreStatus = ((CoreException) t).getStatus(); + if (coreStatus != null) { + childlist.add(getLog(coreStatus)); + } + } + + if (status.isMultiStatus()) { + IStatus[] children = status.getChildren(); + for (int i = 0; i < children.length; i++) { + childlist.add(getLog(children[i])); + } + } + + FrameworkLogEntry[] children = (FrameworkLogEntry[]) (childlist.size() == 0 ? null + : childlist.toArray(new FrameworkLogEntry[childlist.size()])); + + return new FrameworkLogEntry(status.getPlugin(), status.getSeverity(), status.getCode(), + status.getMessage(), stackCode, t, children); + } + + public void info(Throwable t, String message) { + log(new Status(IStatus.INFO, bundle.getSymbolicName(), message, + t)); + } + + public boolean isDebugEnabled() { + return false; + } + + public boolean isErrorEnabled() { + return true; + } + + public boolean isInfoEnabled() { + return true; + } + + public boolean isTraceEnabled() { + return false; + } + + public boolean isWarnEnabled() { + return true; + } + + private void log(IStatus status) { + if (log != null) { + log.log(getLog(status)); + } else { + System.out.println(status.getMessage()); + if (status.getException() != null) + status.getException().printStackTrace(); + } + } + + /** + * Sets the debug options service for this logger. + * + * @param options + * The debug options to be used by this logger + */ + @Inject + public void setDebugOptions(DebugOptions options) { + if (options != null) { + this.trace = options.newDebugTrace(bundle.getSymbolicName(), WorkbenchLogger.class); + } + } + + /** + * @param log + */ + @Inject + public void setFrameworkLog(FrameworkLog log) { + this.log = log; + } + + public void trace(Throwable t, String message) { + if (trace != null) { + trace.trace(null, message, t); + } else { + System.out.println(message); + t.printStackTrace(); + } + } + + public void warn(Throwable t, String message) { + log(new Status(IStatus.WARNING, bundle.getSymbolicName(), + message, t)); + } +} \ No newline at end of file From f22b6a1039c7ab1818fd51d51d33f829d72ce8b5 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 15 Jun 2010 17:40:27 +0000 Subject: [PATCH 0142/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling --- .../common/component/StringModelFragment.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index 080cb16451..e6c929a377 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -10,6 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.jface.viewers.ViewerComparator; + import org.eclipse.e4.ui.model.fragment.MStringModelFragment; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FeatureSelectionDialog; @@ -279,13 +283,21 @@ public String getText(Object element) { return eclass.label; } }); + childrenDropDown.setComparator(new ViewerComparator() { + @Override + public int compare(Viewer viewer, Object e1, Object e2) { + FeatureClass eClass1 = (FeatureClass) e1; + FeatureClass eClass2 = (FeatureClass) e2; + return eClass1.label.compareTo(eClass2.label); + } + }); List list = new ArrayList(); addClasses(ApplicationPackageImpl.eINSTANCE, list); list.addAll(editor.getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS)); - + childrenDropDown.setInput(list); - childrenDropDown.setSelection(new StructuredSelection(list.get(0))); + childrenDropDown.getCombo().select(0); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); From ef9ed07e7bb254100706313e5d21ff15632e01ce Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 15 Jun 2010 21:08:11 +0000 Subject: [PATCH 0143/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling From f70086c51800828eb8950d465ce454425c972b7c Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 16 Jun 2010 13:05:38 +0000 Subject: [PATCH 0144/1286] Bug 315098 - Support open-ended set of structural features in model components * removing old system --- .../emf/ui/internal/common/ModelEditor.java | 15 +- .../component/ModelComponentEditor.java | 279 ------------------ .../component/ModelComponentsEditor.java | 226 -------------- .../AbstractCommandSelectionDialog.java | 2 - .../virtual/VModelComponentBindingEditor.java | 247 ---------------- .../virtual/VModelComponentUIEditor.java | 258 ---------------- 6 files changed, 3 insertions(+), 1024 deletions(-) delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentUIEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 09e4fda2b5..661158062f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -71,8 +71,6 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.KeyBindingEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuSeparatorEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ModelComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ModelComponentsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PartDescriptorEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PartEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PartSashContainerEditor; @@ -91,8 +89,6 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VCommandEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelComponentBindingEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelComponentUIEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowControlEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor; @@ -135,15 +131,15 @@ public class ModelEditor { private static final String CSS_CLASS_KEY = "org.eclipse.e4.ui.css.CssClassName"; //$NON-NLS-1$ public static final String VIRTUAL_PART_MENU = ModelEditor.class.getName() + ".VIRTUAL_PART_MENU"; //$NON-NLS-1$ - public static final String VIRTUAL_MODEL_COMPONENT_CHILDREN = ModelEditor.class.getName() + ".VIRTUAL_MODEL_COMPONENT_CHILDREN"; //$NON-NLS-1$ +// public static final String VIRTUAL_MODEL_COMPONENT_CHILDREN = ModelEditor.class.getName() + ".VIRTUAL_MODEL_COMPONENT_CHILDREN"; //$NON-NLS-1$ public static final String VIRTUAL_HANDLER = ModelEditor.class.getName() + ".VIRTUAL_HANDLER"; //$NON-NLS-1$ public static final String VIRTUAL_BINDING_TABLE = ModelEditor.class.getName() + ".VIRTUAL_BINDING_TABLE"; //$NON-NLS-1$ public static final String VIRTUAL_COMMAND = ModelEditor.class.getName() + ".VIRTUAL_COMMAND"; //$NON-NLS-1$ public static final String VIRTUAL_WINDOWS = ModelEditor.class.getName() + ".VIRTUAL_WINDOWS"; //$NON-NLS-1$ public static final String VIRTUAL_WINDOW_CONTROLS = ModelEditor.class.getName() + ".VIRTUAL_WINDOW_CONTROLS"; //$NON-NLS-1$ public static final String VIRTUAL_PART_DESCRIPTORS = ModelEditor.class.getName() + ".VIRTUAL_PART_DESCRIPTORS"; //$NON-NLS-1$ - public static final String VIRTUAL_MODEL_COMP_COMMANDS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_COMP_COMMANDS"; //$NON-NLS-1$ - public static final String VIRTUAL_MODEL_COMP_BINDINGS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_COMP_BINDINGS"; //$NON-NLS-1$ +// public static final String VIRTUAL_MODEL_COMP_COMMANDS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_COMP_COMMANDS"; //$NON-NLS-1$ +// public static final String VIRTUAL_MODEL_COMP_BINDINGS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_COMP_BINDINGS"; //$NON-NLS-1$ public static final String VIRTUAL_PARTDESCRIPTOR_MENU = ModelEditor.class.getName() + ".VIRTUAL_PARTDESCRIPTOR_MENU"; //$NON-NLS-1$ public static final String VIRTUAL_TRIMMED_WINDOW_TRIMS = ModelEditor.class.getName() + ".VIRTUAL_TRIMMED_WINDOW_TRIMS"; //$NON-NLS-1$ public static final String VIRTUAL_ADDONS = ModelEditor.class.getName() + ".VIRTUAL_ADDONS"; //$NON-NLS-1$ @@ -421,12 +417,9 @@ private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_WINDOWS, new VWindowEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_WINDOW_CONTROLS, new VWindowControlEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_PART_DESCRIPTORS, new VPartDescriptor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_MODEL_COMP_COMMANDS, new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.MODEL_COMPONENT__COMMANDS)); - registerVirtualEditor(VIRTUAL_MODEL_COMP_BINDINGS, new VModelComponentBindingEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_PARTDESCRIPTOR_MENU, new VMenuEditor(modelProvider.getEditingDomain(), this, org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS)); registerVirtualEditor(VIRTUAL_TRIMMED_WINDOW_TRIMS, new VWindowTrimEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_ADDONS, new VApplicationAddons(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_MODEL_COMPONENT_CHILDREN, new VModelComponentUIEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_MENU_CONTRIBUTIONS, new VMenuContributionsEditor(modelProvider.getEditingDomain(), this)); } @@ -462,8 +455,6 @@ private void registerContributedEditors() { private void registerDefaultEditors() { registerEditor(ApplicationPackageImpl.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain())); - registerEditor(ApplicationPackageImpl.Literals.MODEL_COMPONENTS, new ModelComponentsEditor(modelProvider.getEditingDomain(), this)); - registerEditor(ApplicationPackageImpl.Literals.MODEL_COMPONENT, new ModelComponentEditor(modelProvider.getEditingDomain())); registerEditor(ApplicationPackageImpl.Literals.ADDON, new AddonsEditor(modelProvider.getEditingDomain(), project)); registerEditor(CommandsPackageImpl.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(), modelProvider)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java deleted file mode 100644 index ba2b27ad4a..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentEditor.java +++ /dev/null @@ -1,279 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; - -import java.net.MalformedURLException; -import java.net.URL; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MModelComponent; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; -import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class ModelComponentEditor extends AbstractComponentEditor { - - private Composite composite; - private Image image; - private EMFDataBindingContext context; - - private IListProperty MODEL_COMPONENT__CHILDREN = EMFProperties.list( ApplicationPackageImpl.Literals.MODEL_COMPONENT__CHILDREN); - private IListProperty PART_DESCRIPTOR_CONTAINER__DESCRIPTORS = EMFProperties.list( BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS); - private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); - private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES); - private IListProperty MODEL_COMPONENT__COMMANDS = EMFProperties.list(ApplicationPackageImpl.Literals.MODEL_COMPONENT__COMMANDS); - private IListProperty MODEL_COMPONENT__BINDINGS = EMFProperties.list(ApplicationPackageImpl.Literals.MODEL_COMPONENT__BINDINGS); - private IListProperty MENU_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS); - - public ModelComponentEditor(EditingDomain editingDomain) { - super(editingDomain); - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { - context = new EMFDataBindingContext(); - composite = createForm(parent); - } - getMaster().setValue(object); - return composite; - } - - public void dispose() { - if( image != null ) { - image.dispose(); - image = null; - } - - if( composite != null ) { - composite.dispose(); - composite = null; - } - - if( context != null ) { - context.dispose(); - context = null; - } - } - - private Composite createForm(Composite parent) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelComponentEditor_Id); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - - // ------------------------------------------------------------ - - l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelComponentEditor_ParentId); - - t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__PARENT_ID).observeDetail(getMaster())); - - Button b = new Button(parent, SWT.PUSH|SWT.FLAT); - b.setText(Messages.ModelComponentEditor_Find); - - // ------------------------------------------------------------ - - l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelComponentEditor_PositionInParent); - - t = new Text(parent, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__POSITION_IN_PARENT).observeDetail(getMaster())); - - // ------------------------------------------------------------ - - l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelComponentEditor_Processor); - - t = new Text(parent, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__PROCESSOR).observeDetail(getMaster())); - - // ------------------------------------------------------------ - - l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelComponentEditor_Tags); - - t = new Text(parent, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - t.setLayoutData(gd); - - new Label(parent, SWT.NONE); - ListViewer viewer = new ListViewer(parent); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - gd.heightHint = 130; - viewer.getList().setLayoutData(gd); - - return parent; - } - - @Override - public Image getImage(Object element, Display display) { - if( image == null ) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ModelComponent.png")); //$NON-NLS-1$ -// image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ModelComponent.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.ModelComponentEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.ModelComponentEditor_Description; - } - - @Override - public IObservableList getChildList(Object element) { - WritableList list = new WritableList(); - - list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.ModelComponentEditor_Handlers) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING_TABLE, BINDING_CONTAINER__BINDINGS, element, Messages.ModelComponentEditor_BindingTables) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry( ModelEditor.VIRTUAL_MODEL_COMP_BINDINGS, MODEL_COMPONENT__BINDINGS, element, Messages.ModelComponentEditor_KeyBindings) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - - list.add(new VirtualEntry( ModelEditor.VIRTUAL_MODEL_COMP_COMMANDS, MODEL_COMPONENT__COMMANDS, element, Messages.ModelComponentEditor_Commands) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - -// list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART_MENU, MODEL_COMPONENT__CHILDREN, element, Messages.ModelComponentEditor_Menus) { -// -// @Override -// protected boolean accepted(Object o) { -// return o instanceof MMenu; -// } -// -// }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_MODEL_COMPONENT_CHILDREN, MODEL_COMPONENT__CHILDREN, element, Messages.ModelComponentEditor_UiChildren) { - - @Override - protected boolean accepted(Object o) { - return o instanceof MUIElement; - } - - }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART_DESCRIPTORS, PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, element, Messages.ModelComponentEditor_PartDescriptors) { - - @Override - protected boolean accepted(Object o) { - return o instanceof MPartDescriptor; - } - - }); - - list.add(new VirtualEntry( ModelEditor.VIRTUAL_MENU_CONTRIBUTIONS, MENU_CONTRIBUTIONS, element, Messages.ModelComponentEditor_MenuContributions) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - return list; - } - - @Override - public String getDetailLabel(Object element) { - MModelComponent o = (MModelComponent) element; - if( o.getParentID() != null ) { - return Messages.ModelComponentEditor_DetailParentId + ": " + o.getParentID(); //$NON-NLS-1$ - } - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { - FeaturePath.fromList(ApplicationPackageImpl.Literals.MODEL_COMPONENT__PARENT_ID) - }; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java deleted file mode 100644 index 576d71561f..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelComponentsEditor.java +++ /dev/null @@ -1,226 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.MModelComponent; -import org.eclipse.e4.ui.model.application.MModelComponents; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class ModelComponentsEditor extends AbstractComponentEditor { - - private IListProperty MODEL_COMPONENTS__COMPONENTS = EMFProperties.list(ApplicationPackageImpl.Literals.MODEL_COMPONENTS__COMPONENTS); - - private Composite composite; - private Image image; - private ModelEditor editor; - - public ModelComponentsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ModelComponents.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.ModelComponentsEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.ModelComponentsEditor_Description; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - composite = createForm(parent); - } - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelComponentsEditor_ModelContributions); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - final TableViewer viewer = new TableViewer(parent); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(editor)); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - - IEMFListProperty prop = EMFProperties.list(ApplicationPackageImpl.Literals.MODEL_COMPONENTS__COMPONENTS); - viewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelComponentsEditor_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MModelComponents container = (MModelComponents) getMaster().getValue(); - int idx = container.getComponents().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENTS__COMPONENTS, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelComponentsEditor_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MModelComponents container = (MModelComponents) getMaster().getValue(); - int idx = container.getComponents().indexOf(obj) + 1; - if (idx < container.getComponents().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENTS__COMPONENTS, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelComponentsEditor_Add); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MModelComponent component = MApplicationFactory.INSTANCE.createModelComponent(); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENTS__COMPONENTS, component); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(component); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelComponentsEditor_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List elements = ((IStructuredSelection) viewer.getSelection()).toList(); - - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENTS__COMPONENTS, elements); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return MODEL_COMPONENTS__COMPONENTS.observe(element); - } - - @Override - public String getDetailLabel(Object element) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java index 397cfb157c..1f84e7aaa7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java @@ -26,8 +26,6 @@ import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MModelComponent; -import org.eclipse.e4.ui.model.application.MModelComponents; import org.eclipse.e4.ui.model.application.commands.MCommand; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.edit.domain.EditingDomain; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java deleted file mode 100644 index 188ba6bd91..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentBindingEditor.java +++ /dev/null @@ -1,247 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.commands.MBindingTable; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.commands.MKeyBinding; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class VModelComponentBindingEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private ModelEditor editor; - private TableViewer viewer; - - public VModelComponentBindingEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return "Commands"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "Commands Bla Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { - context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); - } - VirtualEntry o = (VirtualEntry)object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Keybindings"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_SEQUENCE__KEY_SEQUENCE); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("KeySequence"); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.KEY_BINDING__COMMAND, CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME)); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Command"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Id"); - column.getColumn().setWidth(170); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MBindingTable container = (MBindingTable) getMaster().getValue(); - int idx = container.getBindings().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__BINDINGS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MBindingTable container = (MBindingTable) getMaster().getValue(); - int idx = container.getBindings().indexOf(obj) + 1; - if( idx < container.getBindings().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__BINDINGS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MKeyBinding handler = MCommandsFactory.INSTANCE.createKeyBinding(); - System.err.println(getMaster().getValue()); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__BINDINGS, handler); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List keybinding = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__BINDINGS, keybinding); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentUIEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentUIEditor.java deleted file mode 100644 index ed061886f2..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelComponentUIEditor.java +++ /dev/null @@ -1,258 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MModelComponent; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class VModelComponentUIEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private ModelEditor editor; - private TableViewer viewer; - - public VModelComponentUIEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return "UI-Children"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "UI-Children Bla Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { - context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); - } - VirtualEntry o = (VirtualEntry)object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Children"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - - viewer = new TableViewer(parent); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(editor)); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(2,false); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MModelComponent container = (MModelComponent) getMaster().getValue(); - int idx = container.getDescriptors().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MModelComponent container = (MModelComponent) getMaster().getValue(); - int idx = container.getDescriptors().indexOf(obj) + 1; - if( idx < container.getDescriptors().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - EClass eclass = (EClass) element; - return eclass.getName(); - } - }); - childrenDropDown.setInput(new EClass[] { - // Basic - BasicPackageImpl.Literals.PART, - BasicPackageImpl.Literals.INPUT_PART, - BasicPackageImpl.Literals.PART_STACK, - BasicPackageImpl.Literals.PART_SASH_CONTAINER, - BasicPackageImpl.Literals.TRIM_BAR, - BasicPackageImpl.Literals.TRIM_ELEMENT, - BasicPackageImpl.Literals.WINDOW, - BasicPackageImpl.Literals.TRIMMED_WINDOW, - // Advanced - AdvancedPackageImpl.Literals.PERSPECTIVE, - AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, - // Menu - MenuPackageImpl.Literals.MENU_SEPARATOR, - MenuPackageImpl.Literals.MENU, - MenuPackageImpl.Literals.HANDLED_MENU_ITEM, - MenuPackageImpl.Literals.DIRECT_MENU_ITEM, - MenuPackageImpl.Literals.TOOL_BAR, - MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, - MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, - MenuPackageImpl.Literals.TOOL_CONTROL, - MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR - }); - childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART)); - - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); - MUIElement obj = (MUIElement) EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__CHILDREN, obj); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(obj); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List commands = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.MODEL_COMPONENT__CHILDREN, commands); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } -} From 3cc4919df9cafa6ccb9411a0b819afa057252ab1 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 21 Jun 2010 12:03:51 +0000 Subject: [PATCH 0145/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * make use of new contribution system From ddf7f44aaa5493ebd566794c09f0600b32c4e898 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 21 Jun 2010 15:01:24 +0000 Subject: [PATCH 0146/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * adding support for shared-elements --- .../.settings/org.eclipse.jdt.core.prefs | 9 +- .../emf/ui/internal/common/ModelEditor.java | 7 +- .../common/component/WindowEditor.java | 8 + .../virtual/VWindowSharedElementsEditor.java | 253 ++++++++++++++++++ 4 files changed, 272 insertions(+), 5 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs index 47b9e1b0ba..118f2dfe61 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,12 @@ -#Sun Apr 11 23:33:47 CEST 2010 +#Mon Jun 21 15:26:11 CEST 2010 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.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore @@ -11,7 +15,7 @@ org.eclipse.jdt.core.compiler.problem.deadCode=warning org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -45,6 +49,7 @@ org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 661158062f..56b641c444 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowSharedElementsEditor; + import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; import org.eclipse.emf.ecore.EStructuralFeature; @@ -131,19 +133,17 @@ public class ModelEditor { private static final String CSS_CLASS_KEY = "org.eclipse.e4.ui.css.CssClassName"; //$NON-NLS-1$ public static final String VIRTUAL_PART_MENU = ModelEditor.class.getName() + ".VIRTUAL_PART_MENU"; //$NON-NLS-1$ -// public static final String VIRTUAL_MODEL_COMPONENT_CHILDREN = ModelEditor.class.getName() + ".VIRTUAL_MODEL_COMPONENT_CHILDREN"; //$NON-NLS-1$ public static final String VIRTUAL_HANDLER = ModelEditor.class.getName() + ".VIRTUAL_HANDLER"; //$NON-NLS-1$ public static final String VIRTUAL_BINDING_TABLE = ModelEditor.class.getName() + ".VIRTUAL_BINDING_TABLE"; //$NON-NLS-1$ public static final String VIRTUAL_COMMAND = ModelEditor.class.getName() + ".VIRTUAL_COMMAND"; //$NON-NLS-1$ public static final String VIRTUAL_WINDOWS = ModelEditor.class.getName() + ".VIRTUAL_WINDOWS"; //$NON-NLS-1$ public static final String VIRTUAL_WINDOW_CONTROLS = ModelEditor.class.getName() + ".VIRTUAL_WINDOW_CONTROLS"; //$NON-NLS-1$ public static final String VIRTUAL_PART_DESCRIPTORS = ModelEditor.class.getName() + ".VIRTUAL_PART_DESCRIPTORS"; //$NON-NLS-1$ -// public static final String VIRTUAL_MODEL_COMP_COMMANDS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_COMP_COMMANDS"; //$NON-NLS-1$ -// public static final String VIRTUAL_MODEL_COMP_BINDINGS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_COMP_BINDINGS"; //$NON-NLS-1$ public static final String VIRTUAL_PARTDESCRIPTOR_MENU = ModelEditor.class.getName() + ".VIRTUAL_PARTDESCRIPTOR_MENU"; //$NON-NLS-1$ public static final String VIRTUAL_TRIMMED_WINDOW_TRIMS = ModelEditor.class.getName() + ".VIRTUAL_TRIMMED_WINDOW_TRIMS"; //$NON-NLS-1$ public static final String VIRTUAL_ADDONS = ModelEditor.class.getName() + ".VIRTUAL_ADDONS"; //$NON-NLS-1$ public static final String VIRTUAL_MENU_CONTRIBUTIONS = ModelEditor.class.getName() + ".VIRTUAL_MENU_CONTRIBUTIONS"; //$NON-NLS-1$ + public static final String VIRTUAL_WINDOW_SHARED_ELEMENTS = ModelEditor.class.getName() + ".VIRTUAL_WINDOW_SHARED_ELEMENTS"; //$NON-NLS-1$ private Map editorMap = new HashMap(); @@ -421,6 +421,7 @@ private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_TRIMMED_WINDOW_TRIMS, new VWindowTrimEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_ADDONS, new VApplicationAddons(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_MENU_CONTRIBUTIONS, new VMenuContributionsEditor(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_WINDOW_SHARED_ELEMENTS, new VWindowSharedElementsEditor(modelProvider.getEditingDomain(), this)); } private void registerVirtualEditor(String id, AbstractComponentEditor editor) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 2b9ae57de7..254dc19754 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -65,7 +65,9 @@ public class WindowEditor extends AbstractComponentEditor { private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); private IListProperty WINDOW__WINDOWS = EMFProperties.list(BasicPackageImpl.Literals.WINDOW__WINDOWS); private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + private IListProperty SHARED_ELEMENTS = EMFProperties.list(BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS); private IValueProperty WINDOW__MAIN_MENU = EMFProperties.value(BasicPackageImpl.Literals.WINDOW__MAIN_MENU); + private Action addMainMenu; @@ -269,6 +271,12 @@ protected boolean accepted(Object o) { }); + list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOW_SHARED_ELEMENTS, SHARED_ELEMENTS, element, "Shared Elements" ) { + protected boolean accepted(Object o) { + return true; + } + }); + MWindow window = (MWindow) element; if( window.getMainMenu() != null ) { list.add(0,window.getMainMenu()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java new file mode 100644 index 0000000000..6cfe2aa514 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java @@ -0,0 +1,253 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import java.util.List; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Label; + +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; + +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.jface.viewers.TableViewer; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +import org.eclipse.emf.edit.domain.EditingDomain; + +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; + +public class VWindowSharedElementsEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private ModelEditor editor; + private TableViewer viewer; + + public VWindowSharedElementsEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "Shared Elements"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Shared Elements Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + VirtualEntry o = (VirtualEntry)object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Controls"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + viewer.setLabelProvider(new ComponentLabelProvider(editor)); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + + + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS); + viewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(2,false); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if( idx < container.getChildren().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + EClass eclass = (EClass) element; + return eclass.getName(); + } + }); + childrenDropDown.setInput(new EClass[] { + BasicPackageImpl.Literals.PART_SASH_CONTAINER, + BasicPackageImpl.Literals.PART, + BasicPackageImpl.Literals.INPUT_PART + }); + childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! childrenDropDown.getSelection().isEmpty() ) { + EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); + + EObject eObject = EcoreUtil.create(eClass); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, eObject); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(eObject); + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List elements = ((IStructuredSelection)viewer.getSelection()).toList(); + + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, elements); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + +} From d11ac47dede9d21efb6ecb770838cd9a020d0055 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 21 Jun 2010 15:14:52 +0000 Subject: [PATCH 0147/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * adding placeholder support --- .../internal/common/component/PartSashContainerEditor.java | 5 ++++- .../emf/ui/internal/common/component/PartStackEditor.java | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 53c8881a22..6199416884 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; + import java.net.MalformedURLException; import java.net.URL; import java.util.List; @@ -315,7 +317,8 @@ public String getText(Object element) { BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, - BasicPackageImpl.Literals.INPUT_PART + BasicPackageImpl.Literals.INPUT_PART, + AdvancedPackageImpl.Literals.PLACEHOLDER }); childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index be87172d3f..53463c6c13 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; + import java.net.MalformedURLException; import java.net.URL; import java.util.List; @@ -271,10 +273,9 @@ public String getText(Object element) { } }); childrenDropDown.setInput(new EClass[] { -// BasicPackageImpl.Literals.PART_SASH_CONTAINER, -// BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, - BasicPackageImpl.Literals.INPUT_PART + BasicPackageImpl.Literals.INPUT_PART, + AdvancedPackageImpl.Literals.PLACEHOLDER }); childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); From 742e03b188101be7ac56e08ec23e59342f4d9abd Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 21 Jun 2010 16:29:53 +0000 Subject: [PATCH 0148/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * adding placeholder support --- .../full/modelelements/ModelComponent.png | Bin 591 -> 0 bytes .../icons/full/wizban/import_wiz.png | Bin 0 -> 6650 bytes .../e4/tools/emf/ui/internal/Messages.java | 2 + .../tools/emf/ui/internal/Messages.properties | 2 + .../emf/ui/internal/common/ModelEditor.java | 2 +- .../common/component/PlaceholderEditor.java | 33 ++- .../dialogs/SharedElementsDialog.java | 230 ++++++++++++++++++ 7 files changed, 265 insertions(+), 4 deletions(-) delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ModelComponent.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/import_wiz.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ModelComponent.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ModelComponent.png deleted file mode 100644 index 6187b15aec001b7080b51a5f944f07591f26cc15..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 591 zcmV-V0eEcNHZMNv|IbJ-M`( zKwWL~opzjJe^WpCmV9E;(0&ut2;4va_(#>M8)>9$R5viQnf(Nkh~VM$y>J(jqb$cj z+nL1Nm|mV)Gm|9MnHf*7Ja4OEAQz__^LRKOLEwqpiGV^^A*T=#&inGm-62Xs;dnSp zKj&H9T*boh2i)W+(n27l!C)>fq|L%VB1i ziC4p;NwV_}ZjW7$LRW#(_bKF#hp=!IqNO26Z*w2+LEwx{PVnZ&Sn}T;mtzb$;qA*nT@@+ zV5uQ@iXDTPoTbV#FRr~z04|PPh`wXTNoCm9*tG&?e3+fYl>K6+&3|Cc$KOpL`ER+_ dcRl5U#9zn6ZO}GF002S=1^@s6A3-Z300009a7bBm000XU z000XU0RWnu7ytkYO=&|zP*7-ZbZ>KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-ePrx>>xFPTiH1=E+A$W$=bG8>s^ zm=Bn5Rah$aDtr}@$`X}2l~$F0mFKEdRdZE8)p@E5RI61Ft6o-prbbn>P~)iy)E2AN zsU20jsWz_8Qg>31P|s0cqrPALg8E|(vWA65poU1JRAaZs8I2(p#xiB`SVGovRs-uS zYnV-9TeA7=Om+qP8+I>yOjAR1s%ETak!GFdam@h^# z)@rS0t$wXH+Irf)+G6c;?H29p+V6F6oj{!|o%K3xI`?%6x;DB|x`n#ibhIR?(H}Q3Gzd138Ei2)WAMz7W9Vy`X}HnwgyEn!VS)>mv$8&{hQn>w4zwy3R}t;BYlZQm5)6pty=DfLrs+A-|>>;~;Q z_F?uV_HFjh9n2gO9o9Q^JA86v({H5aB!kjoO6 zc9$1ZZKsN-Zl8L~mE{`ly3)1N^`o1+o7}D0ZPeY&J;i;i`%NyJ8_8Y6J?}yE@b_5a zam?eLr<8@mESk|3$_SkmS{wQ>%qC18))9_|&j{ZT zes8AvOzF(F2#DZEY>2oYX&IRp`F#{ADl)1r>QS^)ba8a|EY_^#S^HO&t^Rgqwv=MZThqqEWH8 zxJo>d=ABlR_Bh=;eM9Tw|Ih34~oTE|= zX_mAr*D$vzw@+p(E0Yc6dFE}(8oqt`+R{gE3x4zjX+Sb3_cYE^= zgB=w+-tUy`ytONMS8KgRef4hA?t0j zufM;t32jm~jUGrkaOInTZ`zyfns>EuS}G30LFK_G-==(f<51|K&cocp&EJ`SxAh3? zNO>#LI=^+SEu(FqJ)ynt=!~PC9bO$rzPJB=?=j6w@a-(u02P7 zaQ)#(uUl{HW%tYNS3ItC^iAtK(eKlL`f9+{bJzISE?u8_z3;~C8@FyI-5j_jy7l;W z_U#vU3hqqYU3!mrul&B+{ptt$59)uk{;_4iZQ%G|z+lhASr6|H35TBkl>gI*;nGLU zN7W-nBaM%pA0HbH8olyl&XeJ%vZoWz%6?Y=dFykl=imL}`%BMQ{Mhgd`HRoLu6e2R za__6DuR6yg#~-}Tc|Gx_{H@O0eebyMy5GmWADJlpK>kqk(fVV@r_fLLKIeS?{4e)} z^ZO;zpECde00d`2O+f$vv5tKEQIh}w03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(` z>RI+y?e7jKeZ#YO-C4;M*9K~#9!>|1S&9o2b$-ZOLOe(dhu4`UXL0fR|HN@ckT z?GMtlB&sSEsX?Nx)JU|YQq@-dlcGrdl?bE$sFYTUP%5>eO+!;EQIVE_C@O`-BmrcI zV;h5wiNEizy02kRT(J?oL^QKF>EGL=0_1WVof zu?6d!&yAH;Q6U)+@Idx~EMDrFj}=(|^ujr#M3H142~PwdQ32TtKvsJGV*}QcFOK&q zSrNdH01`G;1qkFa+t~16ee0$1vJwfC05G9YnLwWa!YgQN!-DnH%jW|URgwi^0umCS z`XH#}Kl|8%_4F$jJSD3nN?l-x2nGNI$z(e30K|d8fSJD24 z0P8<@Uo50-3IL#sIld7LkyoZq8xpK%U%S|&M6W;$yHrR3UqpsTt{SM1G+6)r;|ZgR zL4v_jVl9d34Jjey+Wh8660GmNK2cJlU!)x~bt}0qf*~s8%6;Aj0_*uVCaVN`gj^B^ z0emrQqfsAOu>NPyq)}p!T;BBy;2R@Dx<(q+y_vOWB)0BhlE1rNK)v+VQ~{99f~Bhg zsYZF8Cqod(di7(~%xZ=4AJ&`kztvmuS(2k7^43~*@PFT)DiavEq(}?I6AY|}>8%

    t- z8F~OPITwE6{B&#j(D8GaoUQ-Llixe|1W9kT9eees(*po{Rvc|3Rk=pmd)1mHQgi_D z3%8XH`JVsa)V!^~b?`K(_Mu(>{N}%0ZM(bo&zSG;o4x^9Skhf;^NduCS^2&Xjlhdk z;?M2u-!srx`PG?*zO(Oe4a0-MBac1##<#Dut=A6B7yv^86jtoGLEstmtusDCqM*vM zDl2Q^4MqB*Fa6fdCrYK#{a>J}g5O9Doo9w2LfMULzyM|YE>yPej)B7)73m4On0 z=NTDTQ&8mm{}A8Nd1B>&=nA-WwiO0!n}+lz?jI-1lS?NnaIE63G!z zW!EwLo{PSB3UQ7F>sU}_!6|$tK`u(f^KsldDEU9vm5YsCRXMn0V@McvHyb!)W$&S~Hrf<^bQ z0G3$~upavSjx)dg*)3o6gYtp>?~h=3Ab8~2?@yit3OkdyvY75=03`rL?Ehd6wefHz zK`&mZppy`%C|S#X>o};&UUK>1cHJZRrM54AZpX;){Q8y${h)GS|NA4jIAsT(|Ix)1 zqzo`0fWiI`E}%9(huM&DPM7Ye!1F!nzuezn7|wJc4r7O6*gFCMIC17Q#wRBb`xQ(~*U@UW z(2DG0pgidnSw8S2;Kh!8vE?QuD&YFO*ODXkl_z#TA|l(IDvSWuDx%oJsY0D5N9`O{ z`P4Ii`}?Q5!h>yqcQP}(X6WG`|LYK@XQuJMuicK`o+{?*Eu5*1fC~@&%Lte-m&wO_om=vDWNgO6hy>h?h69A`>yRT-+s&1aZ;Cd0J?-j zSV7?ZWk%|chpHFvcWw)e0IG^=&nRl=1hex?W+1NtIMp={k0s6f017A<1N`OheFp#j z(t7}k=qs0SX2ydR!N^Drvvcz(7JP&`W{E(2PpSkkc7E#KiRrmNzg!kfOijIW`z>3? z*FBLYiGkiC9)93L9lxiU+fo07<;M=NMl2;RnlE`29&(;J3qsQUHAZ-kUJr zh%i3y5ELzDrxd48oq@9sRH7AH?ARXNbKqETDDb5hfR`WXXaD|>5_6C?yCCVgwThQt zKZ1KV`kp&#j8s$!5}xmSZLzkhsn-;UNFq=IoEe)# zvuUqwiN>iSwhn*?rw-OB>diXln}l@=BZ8T^W-_=WmM@K%_WqN@=Wu+qg>$VcLPi)l zc^n7c-j8N|9ye{h89_0CF$S&3qTu_#RPc4LD#Tj$T1C-_cp0JUjTp1@A&f|8H-ZZn z8(7aW&5~e+k;Qx?gfZtZGrtMV(4yc^!83$&{n?}dECufMG zr$%w&@Da>TO#)P?I*gne!SI%w;2RHNXkm=(a1MRev8?QJLS5$9-m`(e)?hhR_+Aao z@H1$|ie_k0Z}!8vNrbV5NtWugwQH%-j4i%e@Z+cVyf==cwK@Fs=tb<^cNi06XW;oh zjPXG#=n{{5=JW^(+wVXaSqRKFr>rdZ+F@kT3}g7lpj`6PffFc~4{Fy9EOm-A7lxoL zz}gm~*g-@vHCx2g+zh;w_L(#22J3@bqk8--esH{2d-LLSbl<`EYk2qFpP}Fs!#5^n zazfIuBVm_1MObg36pXdWCoyp zF2H-oF95bqe@uE_CQ}_X5|=_6Lceq`H*=0*{}b>uI!oPXPX5k^Lm%HDOpiPdwHVo zNzci1-a*v}O1{zk&JREMo8M8@?rJBLyQ8=v8D1}*R+U7+73B>{b3&6FHiY5Sc4ZZlMs5?e(}2?7$ftZCL`)67`4q8W-{fzTHV zKJMJQ2|GTyB{xc3Fw*T4$-QPS`E8rEbZ%wZW9HhBC7#KyiG0PAZBukkp{W@beGK`= z#S8k?K5q{!l@cq_iWT#OG$Uu~lg+~UxyWmDua{c}ENw4yY6AwKrxIX#wwX|$%%bqL zEX(#B9!VIJlujhgBTZ_`**Qd#=hCPBuB};CJKiwx zWzbJaL0QP~)OxK_S_JE=5=YKVPd5FL3ys3X*onLRN~sbA7XX%-W9Cu7g=W~%0JcL7 z@qDe?yiB{yy z*lg&JjMszF`Pej5M}K8yAX}b;tO@FBMf3Xz;s?VXOfb7qV^;K+d1Zf8dc6@ zv+yMgKo^)_3Y>GAhCM*RlT8M!W?csm6KE=BMk%wAGb8obJ3ZM7Y7-5AB399roR7bp zm&vs2?1ecrTOo{?1f;BEigdOoyG~w$$&3t)XVOxRf#;dTlstiF3`79uQbD#!wZPh> z%pzjondCmt2)x|2KoD7nR^-r%EyBnmjFamywhMw%&tT9bi@Gf#O(hzRW;|A@HLZ7I zCM=wqXawU8Yr@M-vo6W3mwtQ%jaJmj?vaaYT%v8+C}(=ZG}1RF**%j2WdM_&C&_xk z1nV+kPWW#m|4af_b|i_&I)rgDH5XZjDAx3tlzHmS)&fULNW)QTv6@qnGbiTa!tse# zFft$d4R?jf=pwN8zVS}+t55GOI3=EXelNPcd46)P`}1{PrFcb~5}~7vIhqrZddC{p zKRy)(CugFIb@wD{UNg9agjB25*@g?wwVXFP7YAo&qrz0=#Oe}# zTh)v-0L;{F3B;gwig#62mNhTRX&os`C$gDc=4N|I!uL$Yh*Xpcmn{X#ua(N4;iZ-l zC7FeG{nkoLj@Erfdahy9`c!)waR^tr$W;LGjg<96WTI=jFhm6XNdB|8DxlKUFXi=I z$bVhIs<&JZAf+@qSrt$Mi04Te8)RDmRx@-SfL?&BW>m&1*&wW1idh3l7GkU#sB{I) zhGEqLuv(ET11Kh@C#(L)!bW3N8>}c+Banf$VAMusRfk!EK?0i~Yx5r%-;<(XW3dVV zjCEQ9aPwLLm1g`EY{1O`xMMB list = new ArrayList(); + for( MWindow m : ((MApplication)resource.getRoot().get(0)).getChildren() ) { + list.addAll(filter(m.getSharedElements())); + } + viewer.setInput(list); + } else if( resource.getRoot().get(0) instanceof MModelFragments ) { + List list = new ArrayList(); + for( MModelFragment f : ((MModelFragments)resource.getRoot().get(0)).getFragments() ) { + if( f instanceof MStringModelFragment ) { + if( ((MStringModelFragment)f).getFeaturename().equals("sharedElements") ) { //$NON-NLS-1$ + list.addAll(filter(f.getElements())); + } + } + } + viewer.setInput(list); + } + + final PatternFilter filter = new PatternFilter() { + @Override + protected boolean isParentMatch(Viewer viewer, Object element) { + return viewer instanceof AbstractTreeViewer && super.isParentMatch(viewer, element); + } + }; + viewer.addFilter(filter); + + searchText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + filter.setPattern(((Text) e.widget).getText()); + viewer.refresh(); + } + }); + + return comp; + } + + @Override + protected void okPressed() { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + Command cmd = SetCommand.create(resource.getEditingDomain(), placeholder, AdvancedPackageImpl.Literals.PLACEHOLDER__REF, s.getFirstElement()); + if( cmd.canExecute() ) { + resource.getEditingDomain().getCommandStack().execute(cmd); + super.okPressed(); + } + } + } + + private static List filter(List o) { + List rv = new ArrayList(); + for( T i : o ) { + if( i instanceof MPart || i instanceof MPartSashContainer ) { + rv.add(i); + } + } + return rv; + } + + private class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { + public void update(final ViewerCell cell) { + EObject o = (EObject) cell.getElement(); + + StyledString string = new StyledString(getTypename(o)); + + if( o instanceof MUILabel ) { + string.append(" - " + ((MUILabel)o).getLabel(), StyledString.DECORATIONS_STYLER); + } + + MApplicationElement el = (MApplicationElement) o; + string.append(" - " + el.getElementId(), StyledString.DECORATIONS_STYLER); + + cell.setText(string.getString()); + cell.setStyleRanges(string.getStyleRanges()); + cell.setImage(getImage(o)); + } + + public String getText(Object element) { + EObject o = (EObject) element; + MApplicationElement el = (MApplicationElement) o; + + if( el instanceof MUILabel ) { + MUILabel label = (MUILabel) el; + return getTypename(o) + " - " + el.getElementId() + " - " + label.getLabel(); + } else { + return getTypename(o) + " - " + el.getElementId() + " - "; + } + } + + private String getTypename(EObject o) { + AbstractComponentEditor editor = SharedElementsDialog.this.editor.getEditor((o).eClass()); + if( editor != null ) { + return editor.getLabel(o); + } else { + return o.eClass().getName(); + } + } + + public Image getImage(Object element) { + AbstractComponentEditor editor = SharedElementsDialog.this.editor.getEditor(((EObject)element).eClass()); + if( editor != null ) { + return editor.getImage(element, getShell().getDisplay()); + } + return null; + } + } +} From 7d9b8837a505b2767c77edcbbbce5d34b49eaf2e Mon Sep 17 00:00:00 2001 From: Paul Webster Date: Tue, 22 Jun 2010 19:05:29 +0000 Subject: [PATCH 0149/1286] Bug 317494 - Add org.eclipse.e4.tools.emf.liveeditor adding to tools feature --- features/org.eclipse.e4.core.tools.feature/feature.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/features/org.eclipse.e4.core.tools.feature/feature.xml b/features/org.eclipse.e4.core.tools.feature/feature.xml index 0f880b4302..0106e2cb24 100644 --- a/features/org.eclipse.e4.core.tools.feature/feature.xml +++ b/features/org.eclipse.e4.core.tools.feature/feature.xml @@ -45,4 +45,11 @@ version="0.0.0" unpack="false"/> + + From f0b3b7f53bf8e61867f2aaf74a08bce97371aedc Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 23 Jun 2010 14:40:26 +0000 Subject: [PATCH 0150/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * making images local to bundle and not crossloading them (plan is to have nicer .png-icons) --- .../icons/full/modelelements/Command.gif | Bin 0 -> 495 bytes .../icons/full/modelelements/DirectMenuItem.gif | Bin 0 -> 587 bytes .../icons/full/modelelements/DirectToolItem.gif | Bin 0 -> 227 bytes .../icons/full/modelelements/HandledMenuItem.gif | Bin 0 -> 587 bytes .../icons/full/modelelements/HandledToolItem.gif | Bin 0 -> 561 bytes .../icons/full/modelelements/Handler.gif | Bin 0 -> 379 bytes .../icons/full/modelelements/KeyBinding.gif | Bin 0 -> 321 bytes .../icons/full/modelelements/Menu.gif | Bin 0 -> 607 bytes .../icons/full/modelelements/MenuContribution.gif | Bin 0 -> 129 bytes .../icons/full/modelelements/MenuItem.gif | Bin 0 -> 348 bytes .../icons/full/modelelements/MenuSeparator.gif | Bin 0 -> 352 bytes .../icons/full/modelelements/Part.gif | Bin 0 -> 342 bytes .../icons/full/modelelements/PartDescriptor.gif | Bin 0 -> 361 bytes .../full/modelelements/PartSashContainer.gif | Bin 0 -> 378 bytes .../modelelements/PartSashContainer_vertical.gif | Bin 0 -> 347 bytes .../icons/full/modelelements/PartStack.gif | Bin 0 -> 607 bytes .../icons/full/modelelements/Perspective.gif | Bin 0 -> 953 bytes .../icons/full/modelelements/PerspectiveStack.gif | Bin 0 -> 570 bytes .../icons/full/modelelements/Placeholder.gif | Bin 0 -> 145 bytes .../icons/full/modelelements/ToolBar.gif | Bin 0 -> 607 bytes .../icons/full/modelelements/ToolBarSeparator.gif | Bin 0 -> 608 bytes .../icons/full/modelelements/ToolControl.gif | Bin 0 -> 377 bytes .../icons/full/modelelements/Window.gif | Bin 0 -> 358 bytes .../icons/full/modelelements/WindowTrim.gif | Bin 0 -> 358 bytes .../internal/common/component/AddonsEditor.java | 1 - .../common/component/ApplicationEditor.java | 1 - .../common/component/BindingTableEditor.java | 1 - .../internal/common/component/CommandEditor.java | 2 +- .../common/component/DirectMenuItemEditor.java | 2 +- .../common/component/DirectToolItemEditor.java | 2 +- .../common/component/HandledMenuItemEditor.java | 2 +- .../common/component/HandledToolItemEditor.java | 2 +- .../internal/common/component/HandlerEditor.java | 2 +- .../common/component/KeyBindingEditor.java | 2 +- .../common/component/MenuContributionEditor.java | 2 +- .../ui/internal/common/component/MenuEditor.java | 2 +- .../internal/common/component/MenuItemEditor.java | 2 +- .../common/component/MenuSeparatorEditor.java | 2 +- .../common/component/PartDescriptorEditor.java | 2 +- .../ui/internal/common/component/PartEditor.java | 2 +- .../common/component/PartSashContainerEditor.java | 4 ++-- .../common/component/PartStackEditor.java | 2 +- .../common/component/PerspectiveEditor.java | 2 +- .../common/component/PerspectiveStackEditor.java | 2 +- .../common/component/PlaceholderEditor.java | 2 +- .../internal/common/component/ToolBarEditor.java | 2 +- .../common/component/ToolBarSeparatorEditor.java | 2 +- .../common/component/ToolControlEditor.java | 2 +- .../internal/common/component/TrimBarEditor.java | 2 +- .../internal/common/component/WindowEditor.java | 2 +- 50 files changed, 24 insertions(+), 27 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledToolItem.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuItem.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuSeparator.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartDescriptor.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Perspective.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Placeholder.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBar.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.gif new file mode 100644 index 0000000000000000000000000000000000000000..c3193fd9ef95e62945158833e9c18f3e3840934d GIT binary patch literal 495 zcmZ?wbhEHb6krfwc*elMo9x7&<}8rrER^9Ql;J9z;U<#lCR6AqoZ%vt?JkkyE}7$@ zSQe;M9wbxXC6ntRSLCf&>aSEDs8SWITo#~I;;&K}tWg`LSsSKZAE{FxsaqeZRvoNf z6|7bsXwVcDvZ^q2bz#WL!q8QPp373bmZy0xO^sS#61BcGVs(+%@)W<-8F8D-eO9FU zuS`qcUKzM9J#|xJ%ErWut;rn+S~9jJb{uGG+t=8>zp49RYtGK3z9X&uN7|>H>@3-x zShgo|`iYLp{fQO(5@(#~n0K~&*2&I!XL=T2=<7J1)N>+n&Bgw8mnLkyGI7hbiHGh^ zKX7~6|Ns9P1`|;H$->CM5Wt`Vaug^|7}$Lp0-BmzTHD$?I=i}?Bd&FJc z+<9cW#4JoKZEQv5I(U^7lr=SU^hMeQRkU>V4EO{(*bPmsxcIxc9a%Yh*jOf_G0d^h!b{zrfwJY8FI($4fnS;>paJ0>r0o4hV#Nq+9Kg60`}vzJ%3&pA-OuA*{XO|$2}Z33-WqE1G7=(! zKKiYC?j9a)UY=g=?mDg7uG44E7If8aHFb7&+TpO<*{p^Az`;WYo7wD-pRhL<=94pT zX129mKZ{ROQ-!yg$@=bHb3QA-$CkJ18DG2<67`dnRaKB`W-$3`!prT)$-&9P-^^06 thl{b1qfgkcDMCV}soh!5oNI-|^Tn=>j><+^G7A%&+qk*@u`n@M0|1ELV=n*z literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif new file mode 100644 index 0000000000000000000000000000000000000000..b225cd5e7eff03b548ac67cf89a219a5b564ad70 GIT binary patch literal 227 zcmZ?wbhEHb6krfwXc1%3aM)lGu)-o>gGa=IfP@th2{R%xHe_VXFlqFvD45Vu(NWNF zprGNzga#n+_>UJT{$ycfV323fVE_VJL`zxO=l$QZPcAt)j+eHfxO>Lt|5Qv9WqeT836im$sTBgEatw Cpl`(h literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif new file mode 100644 index 0000000000000000000000000000000000000000..710188a996266d6a4263249d010e55bbb2f1013b GIT binary patch literal 587 zcmZ?wbhEHb6krfwc*Xz%|NsC0{`t@MFF^G7+xOpJzyC?EU76FgHXy#Xyk~3MyJO0`A0Of zcWPzr)Jk5d9Wzrqy#LaSEDs9YAHRN}8v8LUwordb=NQy-~T9jsmztX3Xq&=eK2 zsxV|_Vd$zt&t<7m>q{e67kMpDiQ8Q6vm(`hWm@v~%D{E$shbiz4zy%!OKjiY)P1lu zXJ=CXk@hJkJ1h4m&N|sS?@Z6)3w>LzP29SnZ{ylYJ2!Rj+}yKmL;wD59ecNQ?cLgS z@$`|4r;h@|2OLf`ArybIFfuSCGU$Lz2gL~k`-+CdrskH`mY9ytu9((X{{9IQ;##AW zMTLd91Uc9xBU_`{SXudarFhxc!doN6r_Y?tE*{Yu&%(mIgK0NQLW}f)1GW|i4>rpx zom8?6Gqye@(=4Z=GTl5lBvjW*MXp(1^`WYnueV=7ps7u>!rQlc_I3`=POcs%%>rV- zjT~Lv+$ZhnaO80A@YbASP`Qc8t;tEm$sC{K6RR^nA1*??@8ZaUyUzwJ?y)tlJdg`Xcjsq7YZHM!0{d(T5Q;xp7#SGc8FWBy1;q&idtZZl zQ*%peTYE=mR~H*oU;l)DHg{$L!Ra$*3h^+zvj_?=T(nr2kHwu;kbO0~uEv_xe5~$V zf}-0+HQki8ckpq!^9pht;ZS#Wah28L;Nx`{5#+qgsb*_!=isQSBXWVC_aU#GzMg@x tk*S4>I~(`=_ezE)X6Baiij&(Ut!(V26+{XJiX0CwQkKw>;bLL11^^5Oj}`y` literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.gif new file mode 100644 index 0000000000000000000000000000000000000000..57f410224cf0e125fefdfbfd424b34ca32650ac4 GIT binary patch literal 379 zcmZ?wbhEHb6krfwxXQqw(BP;BL>-Qf6T{aP*iM?lCLeYNChZ zME|t4Kq*J#ax2FU508od{@|VOltj+J(UOww!N5}U3iQCI3ZqHwGu%qFO+M$;f|G|KP zbfEZ?g^__lk3k2d733!dwiyo73p{kh9NV1~0xTMO)-@+?HCpL1C+*_|jkQs$L%3SK zWZD#%Uw+AK^#3sVq2$yax7_cq>g;#(C^lABHOjI%u}OEy<@M@F%Q8AK@K5dOm7mJO z;KV30f4Z*Rd;#G}fjokO)8$r)3o+Lza0p5E$no(>iVJg;1ab?@$%#scNeOe;IkR(c Y3G?y_b8(z@@nG_1@(Z}@>d0UX09ibCp#T5? literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.gif new file mode 100644 index 0000000000000000000000000000000000000000..d289b194fb6f9229adc4f0dc93850e926fe0da0d GIT binary patch literal 321 zcmZ?wbhEHb6krfwxXJ(m|NsBLaN)s+4?kYK_;BFF2iNdL6%8{QIu;x_aU-K*LP5if zf(aW=T)6Sz#Rs7b7oiMS;S4vCOgEWAKe23gi5z#y91q2^K$!wBnOqOKB5$SgK$Xg1 zjoL8H+Ay8^NVV!<^{QacWvO1vQ+!sW`man2T$i4@DKTSPV$RN_%KeG6PIk^a)3f+O z-D1Yer_X)7c;)NW z>z}gnrrdw{`OVw!8M%|wvil3m=G?mb_3_iMNf~`9S^YUhGfJu!(UZ&*rdcJ=uuYxi zkTKUWW3Ef~eD~aiUImMNi=g^ zZDXsWr>|ycY?5r}?BeO_=I-U~;oxZRG{e-)T*FdROIvrcfuYe1CB+>(cdGCyC`cuX z2(y{;s3^%GTjmp72xL)lMob_RF;;N zOHK;>@$=Wuq~wIapj9kWlv+C-n?v{YycA+RHAT~Jj?Em4R<9X`af@trep+&Js*| literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif new file mode 100644 index 0000000000000000000000000000000000000000..2b6925602975de13459862ee32e1b0d97549bf67 GIT binary patch literal 129 zcmZ?wbhEHb6krfw*vtS14M4Jip`qcxfddT<4GjN*-2XuK|Nmgt|Nocvyx7!pb7tC^ z28RQRKUo+V7&sYpKsrHYFtF$uob+71*W&e;Zz}u`3thLHvffHb@LI6&tBu~rX=+!^ W%6nF7^6M^V>~uRaQAn7P!5RPvM=;_5 literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuItem.gif new file mode 100644 index 0000000000000000000000000000000000000000..b7c3c562a84a27efbd225a694b4e00311ddd0781 GIT binary patch literal 348 zcmZ?wbhEHb6krfwxXQrr{qvviUx4WEx9`8de*cqRyE3O~Z9sf&dC%6i$?G~ME&ul8 z&)4t2fByO-q2piJzOi=F&gL0=J0>r0pL1aKjZhcJ!>TKmKUuAJNR- zsg<=;D|w}M%uMa@{(CRKzx(p*`_JFEUw_|w|I6M7U$$=O+qibp&Q0ArH}`DY(7%6M z$KEYnd$)F7JbmQi>7)Pu|7RctDE?$&WMD90&;e-z`H6w8(qTq{hmKJAi6up$DW>xR zGFHzJ@>LQzayVeef-bE?2?rul#8{eER;-HIeB0@1NC_tkqfLT-g`jCeV^gEEjADC7 zr=qm8tg>=`R7}6Dvz*F|nJTI?C7k6KEL^nEg->MpiWPjWVhR%r71&*c6t-^L#^uVn Md(U1@Cr1Wr0A~!CQUCw| literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuSeparator.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuSeparator.gif new file mode 100644 index 0000000000000000000000000000000000000000..16d63ff2495cf72b733d25700545d6bc28b6a506 GIT binary patch literal 352 zcmZ?wbhEHb6krfwxXQrr{qvviUx4WEx9`6NW$nLy|0AR0C#&OUysuRn>E%Mz=WB~~u=PiiS_-&i|oXY-7`#jQ&dtCprzFG{Uh)IR6H>K$jF zz5V&|>+kPB|9t!L`@yRp4_l({rK&Vr|*9J z`1NPfr0Pi%s{{NjrcWuGJ*{xg^r9uRvlh(ET|Osc$*imeGxGj}0Rsk5{K>+|z+lOs z1CjyxiGi*5z?=dP9ii+KOE!gVv78t1VogPIrq-0BE)zdo=-PNb;X*=>L~GL;j_jDt zw^=yDa+b0%+9cdB6pa^aY--YXwrKC@?6Oqt?dzZ5%pyHy>Qok2cJ2JA7#TKK4kab6 n#Y!5BIb4O*=M<_7xk@UkZQZ7(AmJ(?$S=O{fPjFLBZD;n(S@u* literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif new file mode 100644 index 0000000000000000000000000000000000000000..610f58441a37376b23e26b89ccd311ebdac642b4 GIT binary patch literal 342 zcmZ?wbhEHb6krfwxXQrLG2_651qWuVII&>Ei4{98XasZ^L`<+qnBkDIpku)Shm08- z5fcm&CM?)-Az;RZhy^z?R^0HIaUo&FjfxF78g@LGaNxm(4?kY~`0?S#kHmP}#CXSw z9J9hStM($J%y`>|9HWLDv&2ZpX_fl@Mf!#DR{z0(fqFpkCkrD3gBpVl$ViZ%7}$y( zf>&-ZkdSC^KID{X<~y7w#A}E7wRtEQ4_ao$K@}3 z?wT|`e=e@9CRr>0jBDab;8Ht-Uo@H)R6d26iJ(Lh&aHBLjmegAPaq$WIJxZ3ku* zc<2a4o=`D5ptFtR!it`&D!VusT^Ae8ytv}1kdx9v9j(=oZ$e#oMQ$Byk}(twZV67^ zZ!Z|+s#PiK!zfm#<*L9@)!NRX;Ht=M(BdOzz^Uk}%q~5xO`2cXRfb7PRD6}V603}> lERV|OEh+-Cu5xT_e7pDVk#m)ol#q}*eDt{6X;()EYXHB3l%W6s literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif new file mode 100644 index 0000000000000000000000000000000000000000..bbbdd559a918bb27921ae8feb93d597c3c4cfb75 GIT binary patch literal 378 zcmZ?wbhEHb6krfwxXQrr^Vh#0KmUIF@$cJ@zcmwfCsnV`Y1vfJzNNf(XZ@7DP1E+b z%s7})HtGH6-(SA}O{iL#TDLZ{ab0ouw(N=t`BlAdKK}an_0O}nKTB%6UVixXQD%Ty=D{`L=jry~!AaOm5~t@6>9J7(sa^L<>ggUVxK&9nue2_s@MWCw)qRi)SZ-7`Bw7@u3E#V z;v}ug#Kg=juyy+m2`3R%DJe!q)`N$Sh&TzWGMr=JKYN}**oo)*jhi>!?zlKISOWmH C)28qM literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif new file mode 100644 index 0000000000000000000000000000000000000000..013e818ecb54b04fe97baea83dc819b9688b2c24 GIT binary patch literal 347 zcmZ?wbhEHb6krfwSZd7h^Vh#0KmUIF@$cJ@zcmwfCsnV`Y1vfJzNNf(XZ@7DP1E+b z%s7})HtGH6-(SA}O{iL#TDLZ{ab0ouw(N=t`BlAdKK}an_0O}nKTB%6UVixXFf{ zcs!HjQZT`@+mG{4W2NGH{z*(b*xo6wNAD?bN~`Z*FYUd$-~3tLd%0XLt>)slGt1M9 zUZa%qpI)N>J~lXi4k3(&&z7Ejf^=UJIGIXk(!rUTAf69}=C^{g;qYwG^TJa|`JR`< zzRKGQ_C*}ZxNc}jK{|(H+=ugCoa3ptr6F;(d-(Tz&H9#CiUY&Wpj5cH5|2%7QP1N vvX?AgeJ*#%A2W|0{q5 z2na9=Py!`Uh$0lD0yR(*m8e2B8qfkQ(TFBAqXRwA6P@TnHwG{QBQb~}49~aWfD}qlMNu3TQ6p+bWmH9VG(?MN8I92t&CwA(qGxnQS9HffjEIpj z7(+1}MmWM5W?12=V~!n(OfaD-D+{tjmdwH|%HpiZ8d)y zRF$gLpcZPWMm4Ef9qOT;>QtAyHJ}k1sX+~CScV*O%9JI0JqXi{iDc@U#TkVHmvBiJ zy2!<@a1GaVrK?=+2DflaH@eBq?r;zHbf>%A?E#PQNDq3*W4+l7+H`v&pL74${C4i= zw*9X=HvoU*vGuFh_HU)b^O z%d1Zwz4gZRcTc>2{^z5se?0u#cgIgHUf|-9!*4ycw)o-)YYQ*k4E?mijc0dXdjHzK juMT{F^|ME=TwVO~j$ck}xo@X7U4HGK>z_QZfW7|$RvM;ZyS2w)hAZnsX>}2zVX*MY{9n$AGWXy5Np6{A7 z-y?sKXZ|AZ!lgb%OZ-Zf`pScU zmb#R!@@d@a+qgAq^3kX%M-yhBO`LtUf8Ud}=U(o-`sU!xcYbrOhA+6DwER}y+Peko z?lx?DF#q`TtDpXV`u+d)&;Rd!{r~v;|I45M-~Rgl<%4cj)lu zTgMN+KJ_0A7#J87f3h$#Fz_+x0NFqj1Q-}t>@J-2T)o#K`}(bEyiFAm*A-7zn7Z9I w>U8w;-FWB6BoSkGjROlFIlL%j^LX;mz@W*8so_9mCJR%D_w&PVtCSh60i=6AEC2ui literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBar.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBar.gif new file mode 100644 index 0000000000000000000000000000000000000000..64173281d286c3eaad051b4f19e6393d1e6f7f40 GIT binary patch literal 607 zcmZ?wbhEHb6krfwc*el+;K8TUXMyPB{Rf{PJp6qB!KcShzMVez>D1Yer_X)7c;)NW z>z}gnrrdw{`OVw!8M%|wvil3m=G?mb_3_iMNf~`9S^YUhGfJu!(UZ&*rdcJ=uuYxi zkTKUWW3Ef~eD~aiUImMNi=g^ zZDXsWr>|ycY?5r}?BeO_=I-U~;oxZRG{e-)T*FdROIvrcfuYe1CB+>(cdGCyC`cuX z2(y{;s3^%GTjmp72xL)lMob_RF;;N zOHK;>@$=Wuq~wIapj9kWlv+C-n?v{YycA+RHAT~Jj?Em4R<9X`af@trep+&Js*| literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif new file mode 100644 index 0000000000000000000000000000000000000000..81d54f3192b7255ee504a683afe2e25fc72a0140 GIT binary patch literal 608 zcmZ?wbhEHb6krfwc*el+;K8TUXMyPBgNL6VKlyg*?8npRK3=@?_3HIc_aA`qou7P0JeER@JqvXlPrx@9_PXufKiz{4*xG zqq1R%gHPG}k3U?3YO4DVR`(rfoO-aReN#r+B>SL}_Spv&oGKKZD%3q{z4I6Ag!dap zPjbng@1DERt6;Hj@iPCC<^HA11It!ST5+7os!ltsS0}tzFLHum%p~L3$;NS$oys@3 zl&uPH+qUcK+ZCr@ZoK&B;LUe_bFK!@yOz4*)|_L{W0u@_`ThULU;p3!{Qu$C|2IGX zU;X_5<nY`ilPe6{3e4u# z=>G=;23i8epDc_F3<(T6AWJ}T!oa?_A)%?crM0ao-n2czOxwcJTD?_YP~;X30S0RTeCPCY literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif new file mode 100644 index 0000000000000000000000000000000000000000..3e53cbdc5fc65bfd4f7178bf328195067ae8b7f1 GIT binary patch literal 377 zcmV-<0fzoZNk%w1VGsZi0M!5h_xSzx_x$+z{rC9%_4obu`2F?w{PFbr^Y;Ar`Th3z z{B3!U@%8-h^!xAg`fz)V=NS`tbGp@AUfU@cHWT`R?@ld4PxR^!k5;gnomA)#u}c zhk%5Ke~OEHii>=Zj(3obc$JcLmXdUvm2anNbQm zZi;N#65GD*$FDz^pME*>=<|~EZ+6}KaOD1{jLi@8wmmA_^|)c*)1D*Gr=NVa{_4B0 zzy5yv_2<#Ie~-WY`~2(gy>I{TfBXO7+rNk3{=NP6@8hq(Z+`uI|LgCx&eTPHv2(i< zW_G3Qo8`TGhVS<20h^`-t(_dUd_vU!|Nj|?1ByRc7#SFh7<53&L4IOjYj&7f;Gx6C z+s3T4Fv38pp&`LRKukmQH0$Kf3>D!Miwk`8W}kntMJu`S-iIHvRZC{S`?04}FT3$e zgRYaFqDotPhl-w)zM^{ngo*0chP0Fl$Aa{vGU literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif new file mode 100644 index 0000000000000000000000000000000000000000..37aad784dd4e7aa04e1ecbfbc79e9b48c6116943 GIT binary patch literal 358 zcmZ?wbhEHb6krfwxXQqg*tsL6dsjx^p6m&Gb0_V~pS<6_e6?rA8tNbQm zZi;N#65GD*$FDz^pME*>=<|~EZ+6}KaOD1{jLi@8wmmA_^|)c*)1D*Gr=NVa{_4B0 zzy5yv_2<#Ie~-WY`~2(gy>I{TfBXO7+rNk3{=NP6@8hq(Z+`uI|LgCx&eTPHv2(i< zW_G3Qo8`TGhVS<20h^`-t(_dUd_vU!|Nj|?1ByRc7#SFh7<53&L4IOjYj&7f;Gx6C z+s3T4Fv38pp&`LRKukmQH0$Kf3>D!Miwk`8W}kntMJu`S-iIHvRZC{S`?04}FT3$e zgRYaFqDotPhl-w)zM^{ngo*0chP0Fl$Aa{vGU literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index 16d87a9c49..f84587b8b6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -52,7 +52,6 @@ public Image getImage(Object element, Display display) { if( image == null ) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Addons.png")); //$NON-NLS-1$ -// image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Addons.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 1963b3ea76..08c1ea03ea 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -60,7 +60,6 @@ public Image getImage(Object element, Display display) { if( image == null ) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Application.png")); //$NON-NLS-1$ -// image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Application.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index f7a962be86..b43fe55612 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -75,7 +75,6 @@ public Image getImage(Object element, Display display) { if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingTable.png")); //$NON-NLS-1$ -// image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/BindingTable.gif")); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index c7f4bc3132..01d09e2d93 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -71,7 +71,7 @@ public CommandEditor(EditingDomain editingDomain) { public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Command.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index 00d1935f3f..8d4f3708e1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -46,7 +46,7 @@ public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IPr public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/DirectMenuItem.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index 1fe284e840..58dce81561 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -45,7 +45,7 @@ public DirectToolItemEditor(EditingDomain editingDomain, IProject project) { public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/DirectToolItem.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index 1b96a69451..332cd2f951 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -73,7 +73,7 @@ public HandledMenuItemEditor(EditingDomain editingDomain, IProject project, IMod public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/HandledMenuItem.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index bdc0808588..e6c904ed58 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -73,7 +73,7 @@ public HandledToolItemEditor(EditingDomain editingDomain, IProject project, IMod public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/HandledToolItem.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledToolItem.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 0ed2eac203..76fe6b43cb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -58,7 +58,7 @@ public HandlerEditor(EditingDomain editingDomain, IModelResource resource, IProj public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Handler.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 5fbdb5ee35..9df457b8ff 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -74,7 +74,7 @@ public KeyBindingEditor(EditingDomain editingDomain, IModelResource resource) { public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/KeyBinding.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index b9b52b084b..4eeb588c6f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -104,7 +104,7 @@ public MenuContributionEditor(EditingDomain editingDomain, IProject project, Mod public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/MenuContribution.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 383d8aab20..06e9155219 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -101,7 +101,7 @@ public MenuEditor(EditingDomain editingDomain, IProject project, ModelEditor edi public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Menu.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 0d97e1f193..25da1ff5c1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -62,7 +62,7 @@ public MenuItemEditor(EditingDomain editingDomain, IProject project) { public Image getImage(Object element, Display display) { if (menuImage == null) { try { - menuImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/MenuItem.gif")); //$NON-NLS-1$ + menuImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuItem.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index c8b160bcbd..9beed58ead 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -44,7 +44,7 @@ public MenuSeparatorEditor(EditingDomain editingDomain) { public Image getImage(Object element, Display display) { if (separatorImage == null) { try { - separatorImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/MenuSeparator.gif")); //$NON-NLS-1$ + separatorImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuSeparator.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 2b4e6b921c..ae4239c405 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -74,7 +74,7 @@ public PartDescriptorEditor(EditingDomain editingDomain, IProject project) { public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Part.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index a154bc9fef..ede939b53d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -74,7 +74,7 @@ public PartEditor(EditingDomain editingDomain, IProject project) { public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Part.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 6199416884..f5426e3fda 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -91,7 +91,7 @@ public Image getImage(Object element, Display display) { if( vImage == null && ! horizontal ) { try { - vImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/PartSashContainer_vertical.gif")); //$NON-NLS-1$ + vImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -100,7 +100,7 @@ public Image getImage(Object element, Display display) { if( hImage == null && horizontal ) { try { - hImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/PartSashContainer.gif")); //$NON-NLS-1$ + hImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 53463c6c13..6d2362f751 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -86,7 +86,7 @@ public PartStackEditor(EditingDomain editingDomain, ModelEditor editor) { public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/PartStack.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 7d54cd9b47..efbb64e1f0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -90,7 +90,7 @@ public PerspectiveEditor(EditingDomain editingDomain, IProject project, ModelEdi public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Perspective.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Perspective.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 45d3e9163e..c5fdfd9eb1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -79,7 +79,7 @@ public PerspectiveStackEditor(EditingDomain editingDomain, ModelEditor modelEdit public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/PerspectiveStack.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 5a79bae233..5a9c4ae362 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -65,7 +65,7 @@ public PlaceholderEditor(EditingDomain editingDomain, ModelEditor editor, IModel public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Placeholder.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Placeholder.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 4bd21de456..93d3401cb3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -92,7 +92,7 @@ public ToolBarEditor(EditingDomain editingDomain, ModelEditor editor) { public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ToolBar.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBar.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index effe2e31fd..a15848fbdb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -44,7 +44,7 @@ public ToolBarSeparatorEditor(EditingDomain editingDomain) { public Image getImage(Object element, Display display) { if (separatorImage == null) { try { - separatorImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ToolBarSeparator.gif")); //$NON-NLS-1$ + separatorImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index 21ddb8c23d..ba7e3a80d9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -68,7 +68,7 @@ public String getDescription(Object element) { public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/ToolControl.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index 717cf6940d..20fa76a201 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -76,7 +76,7 @@ public TrimBarEditor(EditingDomain editingDomain, ModelEditor editor) { public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/WindowTrim.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 254dc19754..5be7359726 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -90,7 +90,7 @@ public void run() { public Image getImage(Object element, Display display) { if( image == null ) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/Window.gif")); + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif")); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); From 47c84f960e21d7b19b6347b5bd0aa687f8df3fae Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 23 Jun 2010 15:28:53 +0000 Subject: [PATCH 0151/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * adding support for ToolBar and MenuContribution --- .../modelelements/ToolBarContribution.gif | Bin 0 -> 129 bytes .../e4/tools/emf/ui/internal/Messages.java | 3 + .../tools/emf/ui/internal/Messages.properties | 2 + .../emf/ui/internal/common/ModelEditor.java | 8 + .../common/component/ApplicationEditor.java | 20 +- .../component/ToolBarContributionEditor.java | 350 ++++++++++++++++++ .../virtual/VToolBarContributionsEditor.java | 258 +++++++++++++ 7 files changed, 640 insertions(+), 1 deletion(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif new file mode 100644 index 0000000000000000000000000000000000000000..5915591825a5301b9f9a3d398baea497ef02311d GIT binary patch literal 129 zcmZ?wbhEHb6krfw*vtS14M4Jip`qcxfddT<4GjN*-2XuK|Nmgt|Nk#u?74Zf=ggV3 z0|y)wf3h$#FmN*HfOLY)U|`WRIO(~1uf^*x-&FV?7P@XXWxbV>;I&}kR~x;L)6}k- WmG`XFk literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 183288dca6..f6bafe952a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -24,6 +24,8 @@ public class Messages { public static String ApplicationEditor_Commands; public static String ApplicationEditor_Windows; public static String ApplicationEditor_Addons; + public static String ApplicationEditor_MenuContributions; + public static String ApplicationEditor_ToolBarContributions; public static String BindingTableEditor_Label; public static String BindingTableEditor_Description; @@ -349,6 +351,7 @@ public class Messages { public static String FeatureSelectionDialog_DialogMessage; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 58fa497251..47c911aac9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -19,6 +19,8 @@ ApplicationEditor_BindingTables=BindingTables ApplicationEditor_Commands=Commands ApplicationEditor_Windows=Windows ApplicationEditor_Addons=Addons +ApplicationEditor_MenuContributions=Menu Contributions +ApplicationEditor_ToolBarContributions=Toolbar Contributions BindingTableEditor_Label=BindingTable BindingTableEditor_Description=BindingTable bla bla bla diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index d72d280599..633769c614 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -10,6 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VToolBarContributionsEditor; + +import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarContributionEditor; + import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowSharedElementsEditor; import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; @@ -143,6 +147,7 @@ public class ModelEditor { public static final String VIRTUAL_TRIMMED_WINDOW_TRIMS = ModelEditor.class.getName() + ".VIRTUAL_TRIMMED_WINDOW_TRIMS"; //$NON-NLS-1$ public static final String VIRTUAL_ADDONS = ModelEditor.class.getName() + ".VIRTUAL_ADDONS"; //$NON-NLS-1$ public static final String VIRTUAL_MENU_CONTRIBUTIONS = ModelEditor.class.getName() + ".VIRTUAL_MENU_CONTRIBUTIONS"; //$NON-NLS-1$ + public static final String VIRTUAL_TOOLBAR_CONTRIBUTIONS = ModelEditor.class.getName() + ".VIRTUAL_TOOLBAR_CONTRIBUTIONS"; //$NON-NLS-1$ public static final String VIRTUAL_WINDOW_SHARED_ELEMENTS = ModelEditor.class.getName() + ".VIRTUAL_WINDOW_SHARED_ELEMENTS"; //$NON-NLS-1$ @@ -421,6 +426,7 @@ private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_TRIMMED_WINDOW_TRIMS, new VWindowTrimEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_ADDONS, new VApplicationAddons(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_MENU_CONTRIBUTIONS, new VMenuContributionsEditor(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_TOOLBAR_CONTRIBUTIONS, new VToolBarContributionsEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_WINDOW_SHARED_ELEMENTS, new VWindowSharedElementsEditor(modelProvider.getEditingDomain(), this)); } @@ -474,6 +480,8 @@ private void registerDefaultEditors() { registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), project, modelProvider)); registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(MenuPackageImpl.Literals.MENU_CONTRIBUTION, new MenuContributionEditor(modelProvider.getEditingDomain(),project, this)); + registerEditor(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION, new ToolBarContributionEditor(modelProvider.getEditingDomain(),project, this)); + registerEditor(BasicPackageImpl.Literals.PART, new PartEditor(modelProvider.getEditingDomain(), project)); registerEditor(BasicPackageImpl.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain(), project)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 08c1ea03ea..4d0fb5cd77 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; + import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -50,7 +52,9 @@ public class ApplicationEditor extends AbstractComponentEditor { private IListProperty PART_DESCRIPTOR_CONTAINER__DESCRIPTORS = EMFProperties.list(BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS); private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private IListProperty APPLICATION__ADDONS = EMFProperties.list(ApplicationPackageImpl.Literals.APPLICATION__ADDONS); - + private IListProperty MENU_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS); + private IListProperty TOOLBAR_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS); + public ApplicationEditor(EditingDomain editingDomain) { super(editingDomain); } @@ -168,6 +172,20 @@ protected boolean accepted(Object o) { } }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_MENU_CONTRIBUTIONS, MENU_CONTRIBUTIONS, element, Messages.ApplicationEditor_MenuContributions ) { + @Override + protected boolean accepted(Object o) { + return true; + } + }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_TOOLBAR_CONTRIBUTIONS, TOOLBAR_CONTRIBUTIONS, element, Messages.ApplicationEditor_ToolBarContributions ) { + @Override + protected boolean accepted(Object o) { + return true; + } + }); return list; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java new file mode 100644 index 0000000000..977a26ca7e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -0,0 +1,350 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; + +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.emf.databinding.EMFProperties; + +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + +import java.util.List; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenu; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +import org.eclipse.swt.SWT; + +import org.eclipse.core.databinding.observable.value.WritableValue; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.emf.databinding.EMFDataBindingContext; + +import org.eclipse.emf.edit.domain.EditingDomain; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; + +public class ToolBarContributionEditor extends AbstractComponentEditor { + private Composite composite; + private Image image; + private EMFDataBindingContext context; + private ModelEditor editor; + private IProject project; + + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + + private static class Struct { + private final String label; + private final EClass eClass; + private final boolean separator; + + public Struct(String label, EClass eClass, boolean separator) { + this.label = label; + this.eClass = eClass; + this.separator = separator; + } + } + + public ToolBarContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + this.project = project; + } + + @Override + public Image getImage(Object element, Display display) { + if( image == null ) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "ToolBar Contribution"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "ToolBar Contribution Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context2, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.MenuContributionEditor_Id); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.MenuContributionEditor_ParentId); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__PARENT_ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.MenuContributionEditor_Position); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__POSITION_IN_PARENT).observeDetail(getMaster())); + } + + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.ToolBarEditor_ToolbarItems); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final TableViewer viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + + { + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText(Messages.ToolBarEditor_ToolbarItemsType); + column.getColumn().setWidth(300); + column.setLabelProvider(new ComponentLabelProvider(editor)); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText(Messages.ToolBarEditor_ToolbarItemsItemType); + column.getColumn().setWidth(100); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + viewer.setInput(prop.observeDetail(master)); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ToolBarEditor_Up); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ToolBarEditor_Down); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if (idx < container.getChildren().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + Struct struct = (Struct) element; + return struct.label; + } + }); + + Struct defaultStruct = new Struct(Messages.ToolBarEditor_HandledToolItem, MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, false); + childrenDropDown.setInput(new Struct[] { defaultStruct, new Struct(Messages.ToolBarEditor_DirectToolItem, MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, false), new Struct(Messages.ToolBarEditor_ToolControl, MenuPackageImpl.Literals.TOOL_CONTROL, false), new Struct(Messages.ToolBarEditor_Separator, MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, true) }); + childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!childrenDropDown.getSelection().isEmpty()) { + Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); + EClass eClass = struct.eClass; + MToolBarElement eObject = (MToolBarElement) EcoreUtil.create(eClass); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + if (!struct.separator) { + editor.setSelection(eObject); + } + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ToolBarEditor_Remove); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + ControlFactory.createTagsWidget(parent, this); + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return ELEMENT_CONTAINER__CHILDREN.observe(element); + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java new file mode 100644 index 0000000000..6ec691383a --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java @@ -0,0 +1,258 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution; + +import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContributions; + +import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; + +import org.eclipse.e4.ui.model.application.ui.menu.MMenuContributions; + +import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution; + +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; + +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; + +import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory; +import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; +import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptorContainer; +import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VToolBarContributionsEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private ModelEditor editor; + private TableViewer viewer; + + public VToolBarContributionsEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "ToolBar Contributions"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "ToolBar Contributions Bla Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + VirtualEntry o = (VirtualEntry)object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("ToolBar Contributions"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Id"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__PARENT_ID); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("ParentId"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__POSITION_IN_PARENT); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Position"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MToolBarContributions container = (MToolBarContributions) getMaster().getValue(); + int idx = container.getToolBarContributions().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MToolBarContributions container = (MToolBarContributions) getMaster().getValue(); + int idx = container.getToolBarContributions().indexOf(obj) + 1; + if( idx < container.getToolBarContributions().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MToolBarContribution command = MMenuFactory.INSTANCE.createToolBarContribution(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, command); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(command); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List commands = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, commands); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } +} From 17c6762b4ce7df6701d5859de77b4a01ef9c5fa2 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 23 Jun 2010 16:02:00 +0000 Subject: [PATCH 0152/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * adding support for TrimContribution --- .../full/modelelements/TrimContribution.gif | Bin 0 -> 129 bytes .../e4/tools/emf/ui/internal/Messages.java | 2 + .../tools/emf/ui/internal/Messages.properties | 1 + .../emf/ui/internal/common/ModelEditor.java | 7 + .../common/component/ApplicationEditor.java | 8 + .../common/component/TrimBarEditor.java | 35 +- .../component/TrimContributionEditor.java | 331 ++++++++++++++++++ .../virtual/VTrimContributionsEditor.java | 262 ++++++++++++++ 8 files changed, 640 insertions(+), 6 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif new file mode 100644 index 0000000000000000000000000000000000000000..5915591825a5301b9f9a3d398baea497ef02311d GIT binary patch literal 129 zcmZ?wbhEHb6krfw*vtS14M4Jip`qcxfddT<4GjN*-2XuK|Nmgt|Nk#u?74Zf=ggV3 z0|y)wf3h$#FmN*HfOLY)U|`WRIO(~1uf^*x-&FV?7P@XXWxbV>;I&}kR~x;L)6}k- WmG`XFk literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index f6bafe952a..ccfa9bbb95 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -26,6 +26,7 @@ public class Messages { public static String ApplicationEditor_Addons; public static String ApplicationEditor_MenuContributions; public static String ApplicationEditor_ToolBarContributions; + public static String ApplicationEditor_TrimContributions; public static String BindingTableEditor_Label; public static String BindingTableEditor_Description; @@ -350,6 +351,7 @@ public class Messages { public static String FeatureSelectionDialog_DialogTitle; public static String FeatureSelectionDialog_DialogMessage; + static { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 47c911aac9..b40306cfb9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -21,6 +21,7 @@ ApplicationEditor_Windows=Windows ApplicationEditor_Addons=Addons ApplicationEditor_MenuContributions=Menu Contributions ApplicationEditor_ToolBarContributions=Toolbar Contributions +ApplicationEditor_TrimContributions=Trim Contributions BindingTableEditor_Label=BindingTable BindingTableEditor_Description=BindingTable bla bla bla diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 633769c614..e4066ed061 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -10,6 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; +import org.eclipse.e4.tools.emf.ui.internal.common.component.TrimContributionEditor; + +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VTrimContributionsEditor; + import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VToolBarContributionsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarContributionEditor; @@ -148,6 +152,7 @@ public class ModelEditor { public static final String VIRTUAL_ADDONS = ModelEditor.class.getName() + ".VIRTUAL_ADDONS"; //$NON-NLS-1$ public static final String VIRTUAL_MENU_CONTRIBUTIONS = ModelEditor.class.getName() + ".VIRTUAL_MENU_CONTRIBUTIONS"; //$NON-NLS-1$ public static final String VIRTUAL_TOOLBAR_CONTRIBUTIONS = ModelEditor.class.getName() + ".VIRTUAL_TOOLBAR_CONTRIBUTIONS"; //$NON-NLS-1$ + public static final String VIRTUAL_TRIM_CONTRIBUTIONS = ModelEditor.class.getName() + ".VIRTUAL_TRIM_CONTRIBUTIONS"; //$NON-NLS-1$ public static final String VIRTUAL_WINDOW_SHARED_ELEMENTS = ModelEditor.class.getName() + ".VIRTUAL_WINDOW_SHARED_ELEMENTS"; //$NON-NLS-1$ @@ -427,6 +432,7 @@ private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_ADDONS, new VApplicationAddons(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_MENU_CONTRIBUTIONS, new VMenuContributionsEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_TOOLBAR_CONTRIBUTIONS, new VToolBarContributionsEditor(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_TRIM_CONTRIBUTIONS, new VTrimContributionsEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_WINDOW_SHARED_ELEMENTS, new VWindowSharedElementsEditor(modelProvider.getEditingDomain(), this)); } @@ -481,6 +487,7 @@ private void registerDefaultEditors() { registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(MenuPackageImpl.Literals.MENU_CONTRIBUTION, new MenuContributionEditor(modelProvider.getEditingDomain(),project, this)); registerEditor(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION, new ToolBarContributionEditor(modelProvider.getEditingDomain(),project, this)); + registerEditor(MenuPackageImpl.Literals.TRIM_CONTRIBUTION, new TrimContributionEditor(modelProvider.getEditingDomain(),project, this)); registerEditor(BasicPackageImpl.Literals.PART, new PartEditor(modelProvider.getEditingDomain(), project)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 4d0fb5cd77..4ab3699fad 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -54,6 +54,7 @@ public class ApplicationEditor extends AbstractComponentEditor { private IListProperty APPLICATION__ADDONS = EMFProperties.list(ApplicationPackageImpl.Literals.APPLICATION__ADDONS); private IListProperty MENU_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS); private IListProperty TOOLBAR_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS); + private IListProperty TRIM_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS); public ApplicationEditor(EditingDomain editingDomain) { super(editingDomain); @@ -186,6 +187,13 @@ protected boolean accepted(Object o) { return true; } }); + + list.add(new VirtualEntry( ModelEditor.VIRTUAL_TRIM_CONTRIBUTIONS, TRIM_CONTRIBUTIONS, element, Messages.ApplicationEditor_TrimContributions ) { + @Override + protected boolean accepted(Object o) { + return true; + } + }); return list; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index 20fa76a201..c496fa822f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -10,6 +10,16 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.emf.ecore.util.EcoreUtil; + +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.jface.viewers.LabelProvider; + import java.net.MalformedURLException; import java.net.URL; import java.util.List; @@ -158,7 +168,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); + GridLayout gl = new GridLayout(2,false); gl.marginLeft=0; gl.marginRight=0; gl.marginWidth=0; @@ -168,7 +178,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -195,7 +205,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Down"); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -219,14 +229,27 @@ public void widgetSelected(SelectionEvent e) { } }); + final ComboViewer typeViewer = new ComboViewer(buttonComp,SWT.READ_ONLY); + typeViewer.setContentProvider(new ArrayContentProvider()); + typeViewer.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + return ((EClass)element).getName(); + } + }); + typeViewer.setInput(new Object[] { + MenuPackageImpl.Literals.TOOL_BAR, + MenuPackageImpl.Literals.TOOL_CONTROL + }); + typeViewer.setSelection(new StructuredSelection(MenuPackageImpl.Literals.TOOL_BAR)); + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add Toolbar"); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MToolBar toolbar = MMenuFactory.INSTANCE.createToolBar(); + EObject toolbar = EcoreUtil.create((EClass) ((IStructuredSelection)typeViewer.getSelection()).getFirstElement()); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar); if( cmd.canExecute() ) { @@ -240,7 +263,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Remove"); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java new file mode 100644 index 0000000000..62b58f7beb --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -0,0 +1,331 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; +import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; + +import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; + +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.emf.databinding.EMFProperties; + +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + +import java.util.List; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenu; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +import org.eclipse.swt.SWT; + +import org.eclipse.core.databinding.observable.value.WritableValue; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.emf.databinding.EMFDataBindingContext; + +import org.eclipse.emf.edit.domain.EditingDomain; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; + +public class TrimContributionEditor extends AbstractComponentEditor { + private Composite composite; + private Image image; + private EMFDataBindingContext context; + private ModelEditor editor; + private IProject project; + + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + + private static class Struct { + private final String label; + private final EClass eClass; + private final boolean separator; + + public Struct(String label, EClass eClass, boolean separator) { + this.label = label; + this.eClass = eClass; + this.separator = separator; + } + } + + public TrimContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + this.project = project; + } + + @Override + public Image getImage(Object element, Display display) { + if( image == null ) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "Trim Contribution"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Trim Contribution Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context2, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.MenuContributionEditor_Id); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.MenuContributionEditor_ParentId); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__PARENT_ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.MenuContributionEditor_Position); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__POSITION_IN_PARENT).observeDetail(getMaster())); + } + + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Controls"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final TableViewer viewer = new TableViewer(parent); + viewer.setLabelProvider(new ComponentLabelProvider(editor)); + viewer.setContentProvider(new ObservableListContentProvider()); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + + IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + viewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(2,false); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if( idx < container.getChildren().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + final ComboViewer typeViewer = new ComboViewer(buttonComp,SWT.READ_ONLY); + typeViewer.setContentProvider(new ArrayContentProvider()); + typeViewer.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + return ((EClass)element).getName(); + } + }); + typeViewer.setInput(new Object[] { + MenuPackageImpl.Literals.TOOL_BAR, + MenuPackageImpl.Literals.TOOL_CONTROL + }); + typeViewer.setSelection(new StructuredSelection(MenuPackageImpl.Literals.TOOL_BAR)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + EObject toolbar = EcoreUtil.create((EClass) ((IStructuredSelection)typeViewer.getSelection()).getFirstElement()); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(toolbar); + } + } + }); + + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List elements = ((IStructuredSelection)viewer.getSelection()).toList(); + + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + ControlFactory.createTagsWidget(parent, this); + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return ELEMENT_CONTAINER__CHILDREN.observe(element); + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java new file mode 100644 index 0000000000..245466d599 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java @@ -0,0 +1,262 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import org.eclipse.e4.ui.model.application.ui.menu.MTrimContribution; + +import org.eclipse.e4.ui.model.application.ui.menu.MTrimContributions; + +import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution; + +import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContributions; + +import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; + +import org.eclipse.e4.ui.model.application.ui.menu.MMenuContributions; + +import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution; + +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; + +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; + +import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory; +import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; +import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptorContainer; +import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VTrimContributionsEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private ModelEditor editor; + private TableViewer viewer; + + public VTrimContributionsEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain); + this.editor = editor; + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "Trim Contributions"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Trim Contributions Bla Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + VirtualEntry o = (VirtualEntry)object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Trim Contributions"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Id"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__PARENT_ID); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("ParentId"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + { + IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__POSITION_IN_PARENT); + + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); + column.getColumn().setText("Position"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); + } + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MTrimContributions container = (MTrimContributions) getMaster().getValue(); + int idx = container.getTrimContributions().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MTrimContributions container = (MTrimContributions) getMaster().getValue(); + int idx = container.getTrimContributions().indexOf(obj) + 1; + if( idx < container.getTrimContributions().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MTrimContribution command = MMenuFactory.INSTANCE.createTrimContribution(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, command); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(command); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List commands = ((IStructuredSelection)viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, commands); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } +} From 97091d456c1f3912b9f330e1c5286a162e370fdf Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 24 Jun 2010 10:53:16 +0000 Subject: [PATCH 0153/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * toolbar for part * main menu creation more visible * element container have to allow to define the selected element * ModelFragments miss possibility to define imports * Items don't allow to edit enabled and selected * HandledToolItem Parameters are not hooked up --- .../icons/full/obj16/headermenu.png | Bin 0 -> 711 bytes .../icons/full/wizban/newclass_wiz.png | Bin 0 -> 7824 bytes .../icons/full/wizban/newexp_wiz.png | Bin 0 -> 6210 bytes .../icons/full/wizban/typerefact_wiz.png | Bin 0 -> 8536 bytes .../eclipse/e4/tools/emf/ui/common/Util.java | 7 + .../component/AbstractComponentEditor.java | 11 +- .../e4/tools/emf/ui/internal/Messages.java | 2 + .../tools/emf/ui/internal/Messages.properties | 1 + .../emf/ui/internal/common/ModelEditor.java | 70 +++-- .../emf/ui/internal/common/VirtualEntry.java | 22 +- .../common/component/AddonsEditor.java | 16 +- .../common/component/ApplicationEditor.java | 4 +- .../common/component/BindingTableEditor.java | 16 +- .../common/component/CommandEditor.java | 17 +- .../common/component/ControlFactory.java | 125 ++++++++ .../component/DirectMenuItemEditor.java | 2 +- .../component/DirectToolItemEditor.java | 6 +- .../component/HandledMenuItemEditor.java | 6 +- .../component/HandledToolItemEditor.java | 10 +- .../common/component/HandlerEditor.java | 17 +- .../common/component/InputPartEditor.java | 6 +- .../common/component/KeyBindingEditor.java | 17 +- .../component/MenuContributionEditor.java | 19 +- .../internal/common/component/MenuEditor.java | 21 +- .../common/component/MenuItemEditor.java | 61 +++- .../common/component/MenuSeparatorEditor.java | 19 +- .../component/ModelFragmentsEditor.java | 206 ++++++++++++- .../component/PartDescriptorEditor.java | 94 +++++- .../internal/common/component/PartEditor.java | 90 +++++- .../component/PartSashContainerEditor.java | 53 +--- .../common/component/PartStackEditor.java | 53 +--- .../common/component/PerspectiveEditor.java | 53 +--- .../component/PerspectiveStackEditor.java | 56 +--- .../common/component/PlaceholderEditor.java | 72 ++++- .../common/component/StringModelFragment.java | 10 +- .../component/ToolBarContributionEditor.java | 18 +- .../common/component/ToolBarEditor.java | 18 +- .../component/ToolBarSeparatorEditor.java | 19 +- .../common/component/ToolControlEditor.java | 17 +- .../common/component/ToolItemEditor.java | 57 +++- .../common/component/TrimBarEditor.java | 11 +- .../component/TrimContributionEditor.java | 18 +- .../common/component/TrimmedWindowEditor.java | 4 +- .../common/component/WindowEditor.java | 75 ++++- .../AbstractCommandSelectionDialog.java | 17 +- .../dialogs/ContributionClassDialog.java | 4 + .../dialogs/FindImportElementDialog.java | 26 ++ .../dialogs/SharedElementsDialog.java | 4 + .../component/virtual/VApplicationAddons.java | 6 +- .../virtual/VBindingTableEditor.java | 8 +- .../component/virtual/VCommandEditor.java | 6 +- .../component/virtual/VHandlerEditor.java | 6 +- .../virtual/VMenuContributionsEditor.java | 6 +- .../common/component/virtual/VMenuEditor.java | 6 +- .../virtual/VModelFragmentsEditor.java | 233 +++++++++++++++ .../virtual/VModelImportsEditor.java | 277 ++++++++++++++++++ .../component/virtual/VPartDescriptor.java | 6 +- .../virtual/VToolBarContributionsEditor.java | 6 +- .../virtual/VTrimContributionsEditor.java | 6 +- .../virtual/VWindowControlEditor.java | 8 +- .../component/virtual/VWindowEditor.java | 6 +- .../virtual/VWindowSharedElementsEditor.java | 8 +- .../component/virtual/VWindowTrimEditor.java | 8 +- 63 files changed, 1674 insertions(+), 372 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/headermenu.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newclass_wiz.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newexp_wiz.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/typerefact_wiz.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/headermenu.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/headermenu.png new file mode 100644 index 0000000000000000000000000000000000000000..45c2900089c5b3867019ddf2d1c9c41552d66b32 GIT binary patch literal 711 zcmV;&0yzDNP)uCxwbv=KH9zoUDon>V zr>UxI+l z#KOV?tXAtCMJ|^E)z;P)Ha0epPNyNuGGeh9*4Njuva*6;Fo-}P0FTGRu}4QoI5;?f z$z&=kve_(-kB`yqcK=$PP6rN$<5RocMzvanBuNc}!7!r8WHP+bYPFEh=h197LA^$! zfn+j?{r!DJA`y-Wg+eHo%iPh-%*WOJf!=_4JdR?q$TO(d>pTNeCUT`x=_#{;C=?2$j;X1sGkv$Py1I(P z!$Twz39zJva5zj#0@-C@2}IWEbb{S(Co+D!Mh2YN-Q7j4Rs)eqd1+}0rBaCoa%Hv( z_V)ImR4Tvy@g2C`Zb};S^YgG+ER-}@($Hu$P#T`&g=Gkj-rm5_>p@&oUYt1fLwX|J ze5DHBL!@j);j;`WIfC2L1zdi5R^$Me%XOaFdp9>XM@hqIG(xY}Q_`58p2l6>Rjidv zSo>h6-65tPLP|ZR0blt578bWNJ3BinisDB`9zE&c`pZjrU$*1q7cN?9zz+a>(-SOd zeqB2|JMjDcJn8ZAag2?P;mWgfcq8A3P9ElDU1GT3!LQP4wNR;4n4FyKbHIS=TjBtW t@&m3+C;j&_I88CIp4At!{qxjQ|2w4%;hGY8=Cl9+002ovPDHLkV1ip>OPc@y literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newclass_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newclass_wiz.png new file mode 100644 index 0000000000000000000000000000000000000000..cc123864111e5acc8a884143fbcf463cf8775588 GIT binary patch literal 7824 zcmV;B9&h1^P)002S=1^@s6A3-Z300009a7bBm000XU z000XU0RWnu7ytkYO=&|zP*7-ZbZ>KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-ePrx>>xFPTiH1=E+A$W$=bG8>s^ zm=Bn5Rah$aDtr}@$`X}2l~$F0mFKEdRdZE8)p@E5RI61Ft6o-prbbn>P~)iy)E2AN zsU20jsWz_8Qg>31P|s0cqrPALg8E|(vWA65poU1JRAaZs8I2(p#xiB`SVGovRs-uS zYnV-9TeA7=Om+qP8+I>yOjAR1s%ETak!GFdam@h^# z)@rS0t$wXH+Irf)+G6c;?H29p+V6F6oj{!|o%K3xI`?%6x;DB|x`n#ibhIR?(H}Q3Gzd138Ei2)WAMz7W9Vy`X}HnwgyEn!VS)>mv$8&{hQn>w4zwy3R}t;BYlZQm5)6pty=DfLrs+A-|>>;~;Q z_F?uV_HFjh9n2gO9o9Q^JA86v({H5aB!kjoO6 zc9$1ZZKsN-Zl8L~mE{`ly3)1N^`o1+o7}D0ZPeY&J;i;i`%NyJ8_8Y6J?}yE@b_5a zam?eLr<8@mESk|3$_SkmS{wQ>%qC18))9_|&j{ZT zes8AvOzF(F2#DZEY>2oYX&IRp`F#{ADl)1r>QS^)ba8a|EY_^#S^HO&t^Rgqwv=MZThqqEWH8 zxJo>d=ABlR_Bh=;eM9Tw|Ih34~oTE|= zX_mAr*D$vzw@+p(E0Yc6dFE}(8oqt`+R{gE3x4zjX+Sb3_cYE^= zgB=w+-tUy`ytONMS8KgRef4hA?t0j zufM;t32jm~jUGrkaOInTZ`zyfns>EuS}G30LFK_G-==(f<51|K&cocp&EJ`SxAh3? zNO>#LI=^+SEu(FqJ)ynt=!~PC9bO$rzPJB=?=j6w@a-(u02P7 zaQ)#(uUl{HW%tYNS3ItC^iAtK(eKlL`f9+{bJzISE?u8_z3;~C8@FyI-5j_jy7l;W z_U#vU3hqqYU3!mrul&B+{ptt$59)uk{;_4iZQ%G|z+lhASr6|H35TBkl>gI*;nGLU zN7W-nBaM%pA0HbH8olyl&XeJ%vZoWz%6?Y=dFykl=imL}`%BMQ{Mhgd`HRoLu6e2R za__6DuR6yg#~-}Tc|Gx_{H@O0eebyMy5GmWADJlpK>kqk(fVV@r_fLLKIeS?{4e)} z^ZO;zpECde00d`2O+f$vv5tKEQIh}w03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(` z>RI+y?e7jKeZ#YO-C6Rk-^K~#9!?3-zjUB`9bf8BR^`68f8iHfsgzQRQ=uw$99I|>Whtq$%CSV*imlBy6`3-{ zP!PcdTtt8XvCd#H%UkcexBHxYxNjZ?{VLkA_j|Zw$L@A1BNkuE7#Oq!A zu7&mc-#k$gp{%O0LV#)w)xsNn=3NErkN*6m6{Vo6HB|y*K$SA8RlvO2=ifE3{`;U{!%!O?3mYd5dja^02=AmvbdiawP$pOQ@t!Ghp;>v~|hC`pS3bV^!*^8X3(Y zk%OvXD6c*Du7&kKzkeza)w(LhSHUpG&;Vl9ch>eL1?zwP;8aDGssVcz4?}1TBPxV? z4((qOu)hAc3(-JLF~F;o6I#QV>f5tVmn5t|ePp2`O4VSjzRC(22#qmgs(Q|#ex+f3 z<432h2&0O|>ltg454|x_jOzKh=dUEJhyU($QIrv5hB4EtEqQ1RV=9=p@AG~Muti)YJ^cVg+k#ehXCuPcP{(KYxs4M_=anvBR7^c61qd82J2yU)X!- zjqde-9$U1cjH(igf{G#vqKXQLf~tnrm@!c`q9BsLFRRzCt>x_h{h(IO+d6Ns&OkE1 zamB7H8`s@*E90XZs1~ZkVUZ{ZvBnSt2EpOI!%0deDQV_NGf(O=mR3&j;&V^){8RhL z()25@2kkF^vJ|N@rm9v3oq07Zg}@lbRWWBETwqxD-GBXEz(cb;-!r@CeK)gda+cBZ zIOVv4!D5U(t5L-xn&Ii=G$GSAnRZFDjDBiJdWLpyndhE*lKnq@avAu|2fwiQE32RX z&f`lZg@y>It^#@$EX54MgYax9=NDG+HbMPv6h{x;_K)vwTz}(jY@go6cx8%0SjL)& zz(iQ`5)fesu!IAEX7F?j##pdI5cRNy7RD4Ao8G|GmJP+l`GtG0zHxMR?~hJ=>w8Zu z*MYjOiJf#%&@->Yz>I?lb@kj^sdfGHtM@o3W!-oG^$*p?Mm}@f$3MjOsrNEnyDWz? z0AvX0`!@6411xl3p_4AN+&h66!HXvohZ9F^E5t#8MtPE{kx8oMfIcfEiPCNrXm^`D z^Y=gF_<>_jUw7@l`6t`9exkXmlJ%5j4RxUO8s+=~loh^pP_@t8`mwv%wP`n_r70{S zfr+t1H2d=$ZSCV^`{!6nRN^V>g;^#lR}%*nqM!^wE1AQIqnXSx-#NtolY6PeqwLvy zBXPM$X=DK>HLkgR4}!nu$*2C{&$ey-#D`z+dj-~%jnR_GFDGO%ZvoV2tE1HiZu;mg zT({+BYVjC>DH56jDwZRypK)a6Daz4C8pUl?;t3*CAhZz%OJE|5$!{a-hs9}1;=26V z)Bm13XFp9bs*(nCxabJ2r5b&g^6cO3fAO2IR+d3yYs_e_9QXw(%cv5n zY6zI{&5U^%hYwtH&$aB>w1aY79@rm?7vZV7Kd0vsHdJq-UYMa^OGLIvWD7(#CNS~P zQmtA8MRAhhG^Le1PaKpOEpDXmyO^wwPc{=(4%1&LvhBtzXf5vj)L(t~)BFF?hyUck zHPLwx7}L=68AvHclt@HFRU%cwSBuHMNfQrkd;d1JOwBM_t`AM0myDmD_y(Oc;qs9? z7%R?F2}h_#qtv2t>d^%CXo6ZeMlG747L5g*eN zzQ$!Ev(vMaTsAt6B6(5e@#Ej1-A|Yuy@N_PN;#}k2^&1Xq{&F#!pfSM=1q0ib0KXP@@o( zF$4bd-IqAH^7ouhUg1>tWt?|33Nw_$QD#SOV5W8zhgY6v*TgM@j^w^v(ZMq{hzNo( zxpRVrmlr%kx!_PEkM;hbfRVt+buPFhJ zzI51sVlT6!H&KfxiEW8OP@xo5hM+R(@#yg{bF%XS)8$=Em3J^v*oISwmyF}>7x~V? z-zW1K<)}_Ms*_4@V9jLEK|xi>yu+!(Mux`h2uBWl|F?Hvec$iAm5zBK&H+h5{FE0LsZnlDudq-7|sN}Da+!1(BlJ$v;hOzfFn1A-APtKp(`=2Hz zu5Z1b9dcevPP8b3mGeB4w(AVR*{B@uDNe@JD+Z?tPWz<3$BT2%GgiKw(8h!&CNjC_ z3kFX0he!U1Mtm8!Z2FhPVRbOgaftdez|;}gkSoS+~{cMTs(}Bbn1tRSLi8pme=qcx_=kq*8)R6I3liz|qBo%sVElTd*d? znjo(S)60V^PcTv1j=_*gA5{Tz1MOGUGXOS(C@D@eoaE4)=4A*LPv$cEE~Qv0QkV!? zezv_+M5D}U*$a{K%RAPCHEYX;DE4HU;MI^NhEuI2s__^GJNOH+gDeBU$@T#@*RRQg zOUy6;RrLd4uLEmUg}PRaeKJXh%F42gB(;QfgY(Hw=NZvoCZ#tRhId8dpf;tiJyK0r z>2^qcA7etS$zvd6%pkd!9|xCzhN_TCk5sy(zBecdsqc~bgj5nzpO8tPRQhC+PQs=wFuDb$MjtfY;h0^<(VW=zh*`rk+?2B-x>s_X3cdn^m?l{$!R*so(@1s zZ&32rPBQvwf2b_y2dNp93w5loEO8_vn86G@b7h=lSj|w?Gi8{5GmIB6XR&vZT48jU z>|5>F+H6Cvt~6K8z+SBm*}nAX`+Nv{btGw@%w?p`;XL?@5|%pp10X1P&A`CHh5cx5 zu7|;-s3$O%UE{a##K~_nS)IuZykVFfRh4{ZDXU?@86%%cFSlU>SgG$0LyT6ZH&B+t z33xR~R~fl{=gA8JYdr)1WO~}u>NpbV)0I9>9EB*viRXCp&>GK{+aQ3OHhqlaE3Yuu zIZV$t>A4nN*P`cI^n9D1Yv#3IJ(t&s@6dDY+}`>20Ae0OG}~P=mwQAL2wpOz2Q!;K zICrtYI^?=SujlD$N=k+|eagiGU^uw&?65O#Fq{NWDXQ_2EAHd*!+%S&e>#WbR_MAW zUAHnUJ=dh`nrnbHNqmcB71SWsT4{C2vVnnj88#5IrVxdd0~gaU{Go4hZ_*JW$q0-^ z;si|$^>Ud<4}OQ+wtZ}1ocp9EA(V*Nmih3uf5E}UXZX(kZ?bd4dzq?D69&;>N+JWB z0f)mTfY4_Xgp565tn!sz;*) z-wl{()YyOM2#+8B8*ZKb2%$uzCL-`5hJeTx_*XZ6k?S{ph_65M0DBLAn?`wbuyP`# zE@P#;f~a!!^!qtD|L8E<7tQUUS5H4pSz77foFj9da>e9cbiP2Xx@F%*1M9&r?0xdS z`>#LbnlhU#T5L6gVuD+aiQ|A;rNsB1|5L8scvGHVCpar@9NGf!o4JSg&D_I$=O|Cl z{g}D-5mc4w%4Vjjo7ue~&tcvD<#F0cn>Y^9f$Bs(M~*HHhM>neN2y-Grw*B~vg7uD z{^N_v8v=hUhYP=x);fe8B`hU)il~HKK0U_M2afRN$G*tFzWv{=nfd2anm8yD+aiI9 zn5taHhqnFNI;oUAM!RbI{VaEnF&0*b!?4**Xf}H|=gFKy5z2M&a{-mg%=a22JKA!A zqKDT@WqgSf#bxP2a?0YZLn~dJq^NORv3ZJv3;TKS$Nz!FWNzU7nsod!?QEG=wnW=4 z(e*1NzCD}*^?Zx2U!k2X(#%e=xp4){oz^gn==6FVIkHTa(K*cHcY?& zdlz!|&blkodw+Byx#9MWr9et|G3xO)C1_;0r66Ac4lVUciRX^~od0+D|1w?Q#7Jcn z5tpZ9G#$?W`qCxwgU~>_^n5c97krCXmS5uO6F*^eq)6s7UOCjH*UNCu;habDY`&sG zc)UTpG_mj2n}6?Xt6{LNS&@FDm1oemz9RijU;*54`^G1=WjXiaU%Ts$Km4kQ3>R5t&Bl;7T4Ys~_1~9uu2&sG ze5WhY50s`xKD*)0o%H-1zJ8eI$&}Q$QFX(O9tML5v^puh#L?`eYj#=a>PidcQb-&H z)T%N4wy-eQ$2&p9fP@%IY}~MstFF9~rJo)rJ(2DE#7DpJxx8~17S@~YqS^bS6W`r^ z{n)HY!aY;7R}my*#6gY7RDO)UQO2)(1N19#r`d-oTM<7wUr<)XA%uLAb1tFEbTbt~zf z4YSu$j7N!sI+3jt*&30p6Nfdzpp-A!n;?(BjLl!0fPNP`EyLoRA!)~0sSw&akr^Sf zbwXQb*Y<1K^WK{|`IBd8y>jZn2k!XKpBruLXrJleg@yH&m%vXgXXBs$(g*)*RI7e! z=N%syWxGGDzxqmuC*r)RFdmE_H8EHK>jSt* zVZC(dSfC;WW6Vex#+$u!Q{MT8cWz9D%_4q-I6u9(d~Dkj&po{T<+;5~ZQ0G_WmhwG z*;OAGhK?4p`*QB81K zjcs{?Whb`n)b{!==sKsF%LRIIzu?ZEK7B3sXY{$!t_kKdWOp4FXi}&N={MhQ} z)2z$Ob9*^)`UMu6uW-8g3e}N~R7W-r&1RakS)BhlwbBIR^~;&va2;ExuP2Vm!_>bG zf+cLQWCFWrf?ydNEUO8Y!~~08?NTOoDanGRcHgdC2w3Y)q?;JyqB!=}SnHi%Hr|Z^ z)8b@7M2?8}BjTkdA`L`~L0GF?IeTZg>+(AzkO(Dcc2C(>cVYFBm^iF3dD9lb;4sD; zg99>SZ5Lzu#sil}v0Wb*7zUws+BF9j=(2Nn2g#R4J&k zBC5sxKQN`vRWDE$c4YGWnN|0jn#S9aGA4u1% zkuz%~9tEasttqb#2_1I)jP$)S_?3j7*#~+7p}gf3O(*dcFh#&H0Cf(#drc6S5|_wv z7OY<12S62csHk&kJPK{;T=#xn%*tv2!TA7X3?{sURCN}tB=serkPkg`&OfcY)KoQu zm1bfMrg1(Lb*ZZAjIs=)3gejb^JC30Fa^V-C{~rKy(Y&;(zo0t+0000rc|c@ literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newexp_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newexp_wiz.png new file mode 100644 index 0000000000000000000000000000000000000000..a473ea86cc0497d99b0a46bf0ca5b96a63e6269d GIT binary patch literal 6210 zcmV-I7`^9-P)002S=1^@s6A3-Z300009a7bBm000XU z000XU0RWnu7ytkYO=&|zP*7-ZbZ>KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-ePrx>>xFPTiH1=E+A$W$=bG8>s^ zm=Bn5Rah$aDtr}@$`X}2l~$F0mFKEdRdZE8)p@E5RI61Ft6o-prbbn>P~)iy)E2AN zsU20jsWz_8Qg>31P|s0cqrPALg8E|(vWA65poU1JRAaZs8I2(p#xiB`SVGovRs-uS zYnV-9TeA7=Om+qP8+I>yOjAR1s%ETak!GFdam@h^# z)@rS0t$wXH+Irf)+G6c;?H29p+V6F6oj{!|o%K3xI`?%6x;DB|x`n#ibhIR?(H}Q3Gzd138Ei2)WAMz7W9Vy`X}HnwgyEn!VS)>mv$8&{hQn>w4zwy3R}t;BYlZQm5)6pty=DfLrs+A-|>>;~;Q z_F?uV_HFjh9n2gO9o9Q^JA86v({H5aB!kjoO6 zc9$1ZZKsN-Zl8L~mE{`ly3)1N^`o1+o7}D0ZPeY&J;i;i`%NyJ8_8Y6J?}yE@b_5a zam?eLr<8@mESk|3$_SkmS{wQ>%qC18))9_|&j{ZT zes8AvOzF(F2#DZEY>2oYX&IRp`F#{ADl)1r>QS^)ba8a|EY_^#S^HO&t^Rgqwv=MZThqqEWH8 zxJo>d=ABlR_Bh=;eM9Tw|Ih34~oTE|= zX_mAr*D$vzw@+p(E0Yc6dFE}(8oqt`+R{gE3x4zjX+Sb3_cYE^= zgB=w+-tUy`ytONMS8KgRef4hA?t0j zufM;t32jm~jUGrkaOInTZ`zyfns>EuS}G30LFK_G-==(f<51|K&cocp&EJ`SxAh3? zNO>#LI=^+SEu(FqJ)ynt=!~PC9bO$rzPJB=?=j6w@a-(u02P7 zaQ)#(uUl{HW%tYNS3ItC^iAtK(eKlL`f9+{bJzISE?u8_z3;~C8@FyI-5j_jy7l;W z_U#vU3hqqYU3!mrul&B+{ptt$59)uk{;_4iZQ%G|z+lhASr6|H35TBkl>gI*;nGLU zN7W-nBaM%pA0HbH8olyl&XeJ%vZoWz%6?Y=dFykl=imL}`%BMQ{Mhgd`HRoLu6e2R za__6DuR6yg#~-}Tc|Gx_{H@O0eebyMy5GmWADJlpK>kqk(fVV@r_fLLKIeS?{4e)} z^ZO;zpECde00d`2O+f$vv5tKEQIh}w03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(` z>RI+y?e7jKeZ#YO-C4PQw_K~#9!?3>$O-Lw6+#H{fLf^%PrLyV>Yspk;Q=85QV|azTD3H^qJh$wRBh7YG`Bi#-Na7q z@qIiqXJ*cAU)S%;!`?GKGah?x$If`t^)P#%*?X_E&u9PEcYW7ytu6RPS+)H2m#HvP@-FiNb2eRbi`%U)_D-&qm zRip)C1VjYl1RTm;2O0wp}xP z@r?zeWQ&Bq*16V5MTBM5+m9XI>y01UgNa(j9kT{CC6XjH?fIVh`Ps?z?B$zD_ko7> z-8UCZCgkwf(jH?_FoK${II&(e#ix$Rr@!~conq0LZq1^}W*zK8Y3qvsP~=0&7KX6a8w*6rMgVzyA-yNdEzLJA8A1VD1o;puh_5t@8u)aviF&ZqlezSG=*1}E+#|?UzHvSpM-}M+0$(S z>!r6kIVi46LwzevlD7?GjvunezkTZb=iWTOF#g3a9KzB4V*p!lsxUH(M-J9;vwaXh zI6b}Z#N&q!Dseh>^i}CQg{LIQ+Xmv>N8n#R)A0ec)_X6$mAc644|%-do<8}bseQlq ziN|nw-vnG5!D1F=F94Y0%8d%9=XwxjGts6pcZ7 zSf{KJ^T7k=pkVOC%ctAV^a7esedH+Sy8%3DpxQL>y&@6^lnWtL3D^g$H#~K=drPC% z<8cJmv(nI^He!vK1LM)N|9 z^Lqm8m7isxHX;MQXPP9J{nA5w&AyYbOn%|QRPgYhf9?c6u(yHlzcz^*?LOkv!Rb8u zk9PaZ4d=a(*G;^=P7 zE(AzY#UQ$jnS~-2`Z3yFV5Tz;*?eFvzX5V^5McRUfl5+%-2hEegn4r!B+ z$+tkNC?qNBS#;#RRi50tKD+Ql7@>G#Vn4!o25Cwd0eV3KQZc=71f@a@-y>9kFfKr3 z1kI2f?0^03bKm^oTQf)M)!KF%UdgIX3&6$egTmqcb@-OJG#w#`fxWE?&P=wktL(v= z>~iNaI}oQFRb;Vv^3|J1{_Q(IZhiDupF|j^2xGUcGZIna@VmeD2!b%dTvyQ#iHDkH zB&kCf3yc5)3$+=nBvEW7#XJPdo2r(|SD&7Ev~}#^F_g+BZ0RxFhjMOm21W#_Q?$D& zI)fBSAaMku6xL+GQk$i?5=ZD3Xbr(K(f-}dcL!1NLkfd1PPcthFmVb6aD8@wnS~hh z-3X3=a|(e$oH$69nE(Mqi6V8nX%8@TS@0`Yr~AKsZ8|_dT6ho=sOSx1INc3}V7?cl zA0$vEoD#+mLFAA+F2M?-G=sHC6EMuU@XUv5==9@goJL3RTkhJ1t(AgvjI#`ac*bn} zd0&}wID2sxzyA0EB&i~bQ%ubTP$g6ef=E)$J1`AUEC*} zW5p?U8Ih`pRFs)7TD)#)tGaZ(D)F0-@2UUY*M9nJ;<8~(7&`<}7Cj;gD)NYPNS#6i zTZ*iaI{0%}f&$i&Gaqh^svILx6M<)qY$&RGfn1(A+L$?c>H><^B8pR7xH^wUtpw+Y z)G6Y`A&64+f&~2_fzxdO>)mUCFM_f4p08v@mE%CRn8UMDglbfU{^^$=Irf)-^`}pr>W^yX5lPK`+(IlF^sc_rUY0pXpvUcA6ZY55b-e|kIZeZW}*sqO;r%qok z8By#Wt1fj6Y3h)~4nBt9AU!&Pom^Hgqjg4oeBEZN7pp!S# z8)ECv|HU6qyxwXQU6catZj5#(LO)F46c}$5-RD2^!8147yf{*qeW!A5CNfIwCSez6 zL>9eI?x7@AHdIl(lg|>sw^kaegd;%BJeMxp-l}sopS9@IhR+p&JbJ)8e00Bl{KeO< z{KkAQ8Z!b*fDb=ZojdXP-nXyK+EYI`6TRLWxMXErcbnbWEUYmCrNtk%43@%k%BCvq z-At)xr2)VnHLS(0?}=Bhm};wrh7s{J)3&7D(a!bRw3DRd@cHY3wPAt3(T;0Mlvb;e zWLa^`65P>=X0yq@-oqs?QNna;&Mn+%>%wXcQF_L~T=;2W^fEp)Q23-40a#=`rUhsPsA}f7GI)d`)kC(tNJthz$|6`0MN$g@ zEdV2VU`h6%e8FPGfe<)CTtN`fm>!JnuwdpX(swW&N7GAH<|Ai1L5xm6lx{yl&<_!* zt}h}zATx_p-7_rA%%C(x#Dky?C0y!S1gwY@ASh9_MAhoB{?NJRvT01!0+clXU^e~} zb*_%ZXaPWK0m|xdu8ZnwvTXK=K2=xO%a!{^dLr5pW4aX66)|%brfZFidB${#R(h3! zS*Rz{=||F8=%YK=$6)=YD0ASHqjk%%HzK)bm3OpNri zh@b)BLnIM{K7lfT6ohY#?Nc>-gA~k0J4PXdA(+==yP%e`B}lXoabk>uED-co_d$|U zkc!w2jOkEJ2V%Mu=_^cMDLtj>J7SPJ3E~uC5F>~ZB=NRDHaMv z6_JFbuS#nmD5_LvM8AtdCWA~k}MjLdfwD52@%jzVE{_r^ewVu zc6j{*mxV122~WUfFAGp41)-X4BZUbS2oxrCl#X)}#!h-cBAqyuaF8{>FpQZldboAL zdi2P_7(l%8z(PMQfe4+dq^a`=sZ-Ha08X7HY1GjwvUO6q=);gclvYWDOpjoVDT_#1 z^XcSev&*Ull7(FF>{9A@Nx*LzMdmZri^r6CCdSdFG>IylBV3dqbSf@M;bO-mO`(Z{ zE;FGzBJ0o{q=rNzn(xnk3MN9p7)h3TrXc{({KrV{tn=sYS)08>1BC-_Iq$`^ z@;z|y%SH_&G8EWz(q~-!tWnWCl!yEk>2>kf>TMvYMG;+&U-`h_{2HY8k9Bc4Yv?tm$oi$@fl+swG%) zqDCOiQAE^EjjCIbB^V002S=1^@s6A3-Z300009a7bBm000XU z000XU0RWnu7ytkYO=&|zP*7-ZbZ>KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-ePrx>>xFPTiH1=E+A$W$=bG8>s^ zm=Bn5Rah$aDtr}@$`X}2l~$F0mFKEdRdZE8)p@E5RI61Ft6o-prbbn>P~)iy)E2AN zsU20jsWz_8Qg>31P|s0cqrPALg8E|(vWA65poU1JRAaZs8I2(p#xiB`SVGovRs-uS zYnV-9TeA7=Om+qP8+I>yOjAR1s%ETak!GFdam@h^# z)@rS0t$wXH+Irf)+G6c;?H29p+V6F6oj{!|o%K3xI`?%6x;DB|x`n#ibhIR?(H}Q3Gzd138Ei2)WAMz7W9Vy`X}HnwgyEn!VS)>mv$8&{hQn>w4zwy3R}t;BYlZQm5)6pty=DfLrs+A-|>>;~;Q z_F?uV_HFjh9n2gO9o9Q^JA86v({H5aB!kjoO6 zc9$1ZZKsN-Zl8L~mE{`ly3)1N^`o1+o7}D0ZPeY&J;i;i`%NyJ8_8Y6J?}yE@b_5a zam?eLr<8@mESk|3$_SkmS{wQ>%qC18))9_|&j{ZT zes8AvOzF(F2#DZEY>2oYX&IRp`F#{ADl)1r>QS^)ba8a|EY_^#S^HO&t^Rgqwv=MZThqqEWH8 zxJo>d=ABlR_Bh=;eM9Tw|Ih34~oTE|= zX_mAr*D$vzw@+p(E0Yc6dFE}(8oqt`+R{gE3x4zjX+Sb3_cYE^= zgB=w+-tUy`ytONMS8KgRef4hA?t0j zufM;t32jm~jUGrkaOInTZ`zyfns>EuS}G30LFK_G-==(f<51|K&cocp&EJ`SxAh3? zNO>#LI=^+SEu(FqJ)ynt=!~PC9bO$rzPJB=?=j6w@a-(u02P7 zaQ)#(uUl{HW%tYNS3ItC^iAtK(eKlL`f9+{bJzISE?u8_z3;~C8@FyI-5j_jy7l;W z_U#vU3hqqYU3!mrul&B+{ptt$59)uk{;_4iZQ%G|z+lhASr6|H35TBkl>gI*;nGLU zN7W-nBaM%pA0HbH8olyl&XeJ%vZoWz%6?Y=dFykl=imL}`%BMQ{Mhgd`HRoLu6e2R za__6DuR6yg#~-}Tc|Gx_{H@O0eebyMy5GmWADJlpK>kqk(fVV@r_fLLKIeS?{4e)} z^ZO;zpECde00d`2O+f$vv5tKEQIh}w03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(` z>RI+y?e7jKeZ#YO-C7IjHPK~#9!?3;VAUDbKmf8SdBarQaqz8^wJfP@4>yb;1O zel+p}8=M$pkL}hO#{+THrkxgtPXDQ9JS5{8GIi1tx05Dg+Tv#HX_`6_et?Zb3K(pj z7D7fKfdC=t>b~Fiy!PH}ef{H{dvzr)x)KuZSY&C=?5%zG*=O(H`QG1mgnwL1uCM>~ zfK{cSsvWAd0ZH(WSdIY{0*NZ^-fKyfWbxnM^|0>#?h&g>$twl#HBql6uS83o`>uuc zUv>;8-cwZ7NWr4ohH8AG_q?lM{pI(Ej8|e+ZBxaHfGR~)%YZER{&x+mZ~kz&&8rp# zj4IHSrgniyPVyROJ*@x!z;NP~rX&H{6rn_+O+fS%u65SJ`qqOZkt*$~8j3a{(FE0o zP+WZMT?^~me?MxyYP%|h<6wvgoj|1e_O5+a!TQcaqa{_!0_GSVLSTdr^#pnv*FP&@ z{qKjz!j?2e0LMvAV1#bfQ?pNJC9MDR$XLlMWkHM{XN3d;5$RUd(+2fx4eRe78#mt5 zrD(L2v6iOlb$dlr&&+2o3v1i2N#f!_eOMsb1O-hPe@9GpL87w`!1jeG9edEi$8 z>b}Rv3ts6ES%{gAx8#8c-RhB3_jzx=K}EP0Gpty5ZBG zDt!38pQOKiHL)oZkYI_iTEJ)lTns(}4H1)L3KMkpchS+mqA)QscFX0PyWiOP*x;@+ z0qTLLCPR>3Xu5uFeq$`&N3h074>WC*w!Gq7ZguJ7^Osu|*0$}NZY`7x_kQ%VzsctH zA0)9Igi482-o?DZUFmP>!*GJ+_$w{_jOwSMyKRC_DxKCzdw(k&wIxMyGd0e7Bz z`O3~KHe7@;O;eU-LS!Q%n;-}x2AszuJhST|cJFiUPg|)2BL>CcG^L)`n3X`@QFK)9Tw7(--)Hvi6wl&BJ@Y5*+g`PQ!U6Kqtc<|nDm7ATuC4ObyB z5gyOq{ov0zQrX96zj!O_R$NYGiUhF()Jm2L&I*ut($|NgQhbbsW-WO2YFV8X@LSOi)=;AlM5 zatS7#qET=B;`!Qj-xnzd&A+5TLEZRTjcx&s%UqbfY zz4^NSL%)5Xuw~os>ZW~46He|l^j<^f3B2lpmpq|2j0-6hKf}oEB$aHExom>jY>eG| zA7}4tPjmf;-_P2f3o!)E@WGWRm@bl_gV>g_Cc>DOmy`f2A%R3q@7Y*^*82#PjEk<{ zKoA9Y&wI(Ay)Y93-HY#K@yc3meK9BzhyqW0sX|+Ej?n4?G=m%k*xK5@jU=lsMJM*R zt*-s_zpV>*Z_0D+aZcM+Nm^30>@omhk5Kb9Dt?B!Y?_&DjOlcg>2#FG9=V?lA6U=2 zb5@~vz>sIA1tMy}u^0@h(vsZy8#V}n5sUZ)pBG3v6Z$vwcLH}l@#1VK(gYP)OgWLT zEs?OTC=13tce+ryYXX2U@Jv)6<<1?qF*^4n!XP~cj*(-}7X)+e^>khGK@yXe*XNIZ zV^wru#oIFQ*|;)Ys}Xr+rectE0)yem{)14+x#W`7U_4G!=4y4?f({hLt3yQacsz>Y z@aj{?Q@6^!sls&Z^WKL@pyW0pbIu(h)`vOw)criMEoG`5N^`g~*l3 zY=hL*nxZKdRdAZ&e1_AETr-@e5Bo=Uxn1UVZwU&@7j?wfag|Msq3Z|qwc z#);`@>p&5*-0`&?f5Db@8|H4la_hjx_KnmOtWhSa5A)R>U*pCbf1e|xhfzPY2+*<8 zBrygTU-x{v2BPIkF;nguaP+{E% zdda0iU1z9N3Uq{R)blxvSaQvg)LO^}k1Zdly~>r-n=|^&DP$<(K8JKfGhZ6)T?P_8Y#+fw5Qk4-fna zzj@=ojIl{W?iKY4B6N2Y>1;1jE*6L)i}xO>PU6!F#t2D}(_P>5 zJ1c@q9vn>944(?D?`6YmtxkF3q=IuXjp>ZA!%}Q_)ciD+MuN+VgffGb5Ktmp#7fJ< zs^Z9TJ|*>a8m>y}s-&()>T1-p3Zs+boExv=Cr>|tk3(+%(!T%`Fg!WQYr`WnGR3JO zj1tP_E-u<|9cwOrFT0+5gxkNpjmcVr&wuLQva0U_)H?#PhzR9Ug4brpT~(XCt~eqJ z1FUV@Pbwn>-a}r;gdrpe<>?X5E$#lyAZz~ORAAkwN8-DyN9HgatK=qzMvMdz4PRr{ zd+L>tC@VL^2{CweM7G`xO2vSJS4XZ5Qr{qTRqAezx|^e#&oVSIM1R!J!_PfMv9pWc z`p}KMeCPlJV`DfqIBynh=WxU0goloB;o3{M?5dAaDt55C?*dl#UBJ#)_HgOS^C=jE z2y}OrDVIvesNM1E7*4!|m;!U{m+*Sp!&Eh+mX1@hGwV)P4K2XV#|EdaegC;@0$aS= zwWrWtB^$Lc8Pa~S5+o^;lL9U}8m*I)Yf7dKa^Gl5lCMyA73yw|MqZ(o&r-{08Japm zTF)699cL`7@rkV;XV=Sn7@3@8bZU~ZsR_oWCYYF>Vq$uVxoV9pSB#Aq934dwHmtjn zo>CVtzV;GF#)i1$ob#BS8z;ynC~*}B4ox#KGRfg1lMD<`QL8pkl+YT2z*2NG)HnW9 z(%x&x!ftB5K$SLB^WibQ_$SKpHPyxO#U0sxZs|GiicYuo0JBjI)Km3ULZ{5-0eK#w zD7jB*xGJ$NE`$$)pm?0-O&jIv)Ln(y+9X30gIwIXmjChdpYgk&`y#tueu0t6F~+86 za89XJt7N&us~{#K520GmnVGB8*T0&9frA9OBesUI@nMp{GG8zj5xP4{L{Xttwo!}- zQ5aB&LxR9!1oD;FVnis%G>;iW7=}y@jet7^$!bYg{n`(%+}Ai#|7U$Y*HP{-GyVJw zW?ci?>NI9TvdrUr)5AH<$bCxcYYR52p3gO<$<0#Dr>W*sjLZySUBs&g53^?NdTLpN zgTn(%%uF*rGD48$jm_s@bZ}kIs@FF3ub7^l9W9NIzY$tvNqtD8k<#1QO;)dxHmbyd zB{qiDy(^iT9V2#AY`X9!l0qBhQcPPZp{-P)n8d_kKwu5Vn4=!kG(iSIfB<8ohlVHo z`csxH?zwB{ecQHgx^3X$U*5a%#!oUDPg5DK5Ui|2SRt=jyym2?MlF~nwnai)z+jqo zi>6o1wL$8d0LSOX*s|h1{P3}#^QF&xf#>({VQOZI+3`s}b;bJ*ZTsl$caG1jdbZYx z>g~l^*H=D1vh`2y|Kr>L;iX-xKK`*U(pl=^rMLvhK~e)w)?epKlZ+vk0mjs|M}Qo-S`iCcdh#PC;t`wy=!@K&vOJKgr*59ww9=6 z*yn@L-mW&1Ld<-F)rb&90ZAMZg%)FuOMzM`L%CeS*znYY(j_G9k-Sm6n}da0YZq3L z3#&L{oXfEil52pK2F6=tkz}Dt^Pk77BXxDWbp%1c^xOwS`2@Gjy$%5vq5EvSH11n7kT^%Lb z%H@T;QA8Fh5sUN5jIj=|c~?;GB8*Ul;6wr$%tb=v(aZb{4I&@oLuUcyR%)c_;G zf(o{7qm|q=Qyq^d^>r$9=|Z|Axno271>86KyMJiU7e4dd|L7GfXy^GWMn3((o_$+;d-{3c;Rl(mG*A_c z2&pxwX>O~wS@8?4VQBnyf-vIx^H*`UhawzPz(&xibmtp1XD) z*tUJsZ4-|V?l>=cKc%)AW*MNCjgt8)>KhA5>q4a<^GuFq%uIT`3n-U5xOUBYo_OU& zwr;pATeJFoU-ha*?;8PMD&8v~YF7287bQ{kVk8f|53|K>s-YtX z)^>OH{ccb9iiN@+i>nF<-WL{?g<7T5CDd-Iwc~-meg0te{r_&EVS9q&-$}QRT3+(N zo*&(J@2U-(*Q~wv!=%NG$=M^!R3~U?g$4}@K~5?0gh7#2ee38jAqRIo#`i{#?74pP zm;d#?!&_z>8Gc@NyvGlY7e-YJ6Ud8Q#Bdq_*X%KH58yqEid_p+qQ4|v$4Z3etzuGo)0^ho#%Xh zxvFm$F^8-P4h2DBPr20h#J~CSqYpW+o!%3_dD;bQj3g)ea&xZ>Wo2s(EBia}UYAfY zT~H$siiMCu+>GE)WNh+xO0pKOJMVa+qRRKY>JR3JDdq<)bbi>vYteh{IYB46xSZWw zfQ1lPVf8s(r=@nka#%;k8pbPKZ`EW#RebXYLh)Po{UkI-V!zDI&f63tkUPhoR|d)Q zoFF**(SETSdc_(;PiK*yt}^YV0&yH*ME<`?R)+|7Nw1*2eTyG(1XsKXR4Ml`f5)&A+tiN|26UPKzS@a;XHz zdh+J5y@;SFA~=LhjAT(*u&P?asZ;f#C<0d!jL8v`VN8xO%F$+VV67xx zX|$Zf@~~VJmJzUFz?B~a@*=L$ae1=Xym9;?kZ zwJNG2CU!=`=9qyv5tCYD8dhvW#nctkaK<#eN}6NR+)Hjua{%N_*r&HJ@B!*Onm*i) zs+h4%!j~(VeRXi!?j4$BEOX7m^RhOpySv{i6jaGX6m>bO8mlqg>OG1IiuzVW*wTI9 z8fj5j=;<3V5-;)wAR3_FBch_H3SvNvl_auxo6)@Yg1(NcAAIsDo`2<)cLdhZ_&BVS zhMM4zli=m55BH8&?7qX}GEiyIIB9PL=>e`Qq;QiugUQtD&&~&S+xcQOmm<0N0B7O8cnuh(j&szH2qwi7mOaI+3 zasJ7U938)=D|taUI@762J1jrrxzq{+lbpCv^6RmdRKwY7ZdB>eqoab|Z#UW(kYJf) z`PXHcrK4IpXoeA|1!`WZ5CqObSe3dffiz2xrwK|xtd)ebWE}&m)^HXmgPyiTE!e8F zM5>mOtWLn52~Z+Pa283`F|g{XOMtkkdZ+)>j{p(=> literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java new file mode 100644 index 0000000000..06bdb50641 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java @@ -0,0 +1,7 @@ +package org.eclipse.e4.tools.emf.ui.common; + +public class Util { + public static final boolean isNullOrEmpty(String element) { + return element == null || element.trim().length() == 0; + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index feb758061f..3df9f5032f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + import java.io.IOException; import java.io.InputStream; import java.net.URL; @@ -47,13 +49,20 @@ public abstract class AbstractComponentEditor { public static final int ARROW_UP = 3; public static final int ARROW_DOWN = 4; - public AbstractComponentEditor(EditingDomain editingDomain) { + private ModelEditor editor; + + public AbstractComponentEditor(EditingDomain editingDomain, ModelEditor editor) { this.editingDomain = editingDomain; + this.editor = editor; } public EditingDomain getEditingDomain() { return editingDomain; } + + public ModelEditor getEditor() { + return editor; + } public WritableValue getMaster() { return master; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index ccfa9bbb95..616c1b1309 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -223,6 +223,7 @@ public class Messages { public static String PartEditor_Menus; public static String PartEditor_Handlers; public static String PartEditor_ContainerData; + public static String PartEditor_ToolBar; public static String PartSashContainerEditor_Label; public static String PartSashContainerEditor_Description; @@ -352,6 +353,7 @@ public class Messages { public static String FeatureSelectionDialog_DialogMessage; + static { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index b40306cfb9..8be1d380f3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -217,6 +217,7 @@ PartEditor_Add=Add ... PartEditor_Remove=Remove PartEditor_Menus=Menus PartEditor_Handlers=Handlers +PartEditor_ToolBar=ToolBar PartSashContainerEditor_Label=Sash PartSashContainerEditor_Description=Sash bla bla bla diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index e4066ed061..278aca833d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -10,6 +10,18 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; +import org.eclipse.e4.ui.model.fragment.MModelFragments; + +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelImportsEditor; + +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelFragmentsEditor; + +import org.eclipse.swt.graphics.Image; + +import org.eclipse.swt.widgets.ToolItem; + +import org.eclipse.swt.widgets.ToolBar; + import org.eclipse.e4.tools.emf.ui.internal.common.component.TrimContributionEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VTrimContributionsEditor; @@ -154,7 +166,8 @@ public class ModelEditor { public static final String VIRTUAL_TOOLBAR_CONTRIBUTIONS = ModelEditor.class.getName() + ".VIRTUAL_TOOLBAR_CONTRIBUTIONS"; //$NON-NLS-1$ public static final String VIRTUAL_TRIM_CONTRIBUTIONS = ModelEditor.class.getName() + ".VIRTUAL_TRIM_CONTRIBUTIONS"; //$NON-NLS-1$ public static final String VIRTUAL_WINDOW_SHARED_ELEMENTS = ModelEditor.class.getName() + ".VIRTUAL_WINDOW_SHARED_ELEMENTS"; //$NON-NLS-1$ - + public static final String VIRTUAL_MODEL_FRAGEMENTS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_FRAGEMENTS"; //$NON-NLS-1$ + public static final String VIRTUAL_MODEL_IMPORTS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_IMPORTS"; //$NON-NLS-1$ private Map editorMap = new HashMap(); private Map virtualEditors = new HashMap(); @@ -169,11 +182,15 @@ public class ModelEditor { private IProject project; private ISelectionProviderService selectionService; private IEclipseContext context; + private Image toolmenuIcon; + private boolean fragment; public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project) { this.modelProvider = modelProvider; this.project = project; this.context = context; + this.context.set(ModelEditor.class, this); + this.toolmenuIcon = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/headermenu.png")); registerDefaultEditors(); registerVirtualEditors(); @@ -182,6 +199,8 @@ public ModelEditor(Composite composite, IEclipseContext context, IModelResource registerContributedVirtualEditors(); loadEditorFeatures(); + fragment = modelProvider.getRoot().get(0) instanceof MModelFragments; + SashForm form = new SashForm(composite, SWT.HORIZONTAL); form.setBackground(form.getDisplay().getSystemColor(SWT.COLOR_WHITE)); @@ -206,7 +225,7 @@ public ModelEditor(Composite composite, IEclipseContext context, IModelResource Composite headerContainer = new Composite(editingArea, SWT.NONE); headerContainer.setBackgroundMode(SWT.INHERIT_DEFAULT); headerContainer.setData(CSS_CLASS_KEY, "headerSectionContainer"); //$NON-NLS-1$ - headerContainer.setLayout(new GridLayout(2, false)); + headerContainer.setLayout(new GridLayout(3, false)); headerContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final Label iconLabel = new Label(headerContainer, SWT.NONE); @@ -215,7 +234,11 @@ public ModelEditor(Composite composite, IEclipseContext context, IModelResource final Label textLabel = new Label(headerContainer, SWT.NONE); textLabel.setData(CSS_CLASS_KEY, "sectionHeader"); //$NON-NLS-1$ textLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - + +// ToolBar toolbar = new ToolBar(headerContainer, SWT.NONE); +// ToolItem item = new ToolItem(toolbar, SWT.PUSH); +// item.setImage(toolmenuIcon); + final ScrolledComposite scrolling = new ScrolledComposite(editingArea, SWT.H_SCROLL | SWT.V_SCROLL); scrolling.setBackgroundMode(SWT.INHERIT_DEFAULT); scrolling.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ @@ -327,6 +350,10 @@ private void loadEditorFeatures() { } } + public boolean isModelFragment() { + return fragment; + } + public List getFeatureClasses(EClass eClass, EStructuralFeature feature) { List list = new ArrayList(); @@ -399,7 +426,7 @@ public void handleMapChange(MapChangeEvent event) { } viewer.setInput(modelProvider.getRoot()); - viewer.expandAll(); + viewer.expandToLevel(2); return viewer; } @@ -434,6 +461,9 @@ private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_TOOLBAR_CONTRIBUTIONS, new VToolBarContributionsEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_TRIM_CONTRIBUTIONS, new VTrimContributionsEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_WINDOW_SHARED_ELEMENTS, new VWindowSharedElementsEditor(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_MODEL_FRAGEMENTS, new VModelFragmentsEditor(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_MODEL_IMPORTS, new VModelImportsEditor(modelProvider.getEditingDomain(), this)); + } private void registerVirtualEditor(String id, AbstractComponentEditor editor) { @@ -467,38 +497,38 @@ private void registerContributedEditors() { } private void registerDefaultEditors() { - registerEditor(ApplicationPackageImpl.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain())); - registerEditor(ApplicationPackageImpl.Literals.ADDON, new AddonsEditor(modelProvider.getEditingDomain(), project)); + registerEditor(ApplicationPackageImpl.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain(),this)); + registerEditor(ApplicationPackageImpl.Literals.ADDON, new AddonsEditor(modelProvider.getEditingDomain(),this, project)); - registerEditor(CommandsPackageImpl.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(), modelProvider)); - registerEditor(CommandsPackageImpl.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain(), modelProvider, project)); - registerEditor(CommandsPackageImpl.Literals.COMMAND, new CommandEditor(modelProvider.getEditingDomain())); + registerEditor(CommandsPackageImpl.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(),this, modelProvider)); + registerEditor(CommandsPackageImpl.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain(),this, modelProvider, project)); + registerEditor(CommandsPackageImpl.Literals.COMMAND, new CommandEditor(modelProvider.getEditingDomain(),this)); registerEditor(CommandsPackageImpl.Literals.BINDING_TABLE, new BindingTableEditor(modelProvider.getEditingDomain(), this)); registerEditor(MenuPackageImpl.Literals.TOOL_BAR, new ToolBarEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain(), project)); - registerEditor(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, new HandledToolItemEditor(modelProvider.getEditingDomain(), project, modelProvider)); - registerEditor(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, new ToolBarSeparatorEditor(modelProvider.getEditingDomain())); - registerEditor(MenuPackageImpl.Literals.TOOL_CONTROL, new ToolControlEditor(modelProvider.getEditingDomain(), project)); + registerEditor(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain(), this, project)); + registerEditor(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, new HandledToolItemEditor(modelProvider.getEditingDomain(), this, project, modelProvider)); + registerEditor(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, new ToolBarSeparatorEditor(modelProvider.getEditingDomain(), this)); + registerEditor(MenuPackageImpl.Literals.TOOL_CONTROL, new ToolControlEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(MenuPackageImpl.Literals.MENU, new MenuEditor(modelProvider.getEditingDomain(), project, this)); - registerEditor(MenuPackageImpl.Literals.MENU_SEPARATOR, new MenuSeparatorEditor(modelProvider.getEditingDomain())); - registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), project, modelProvider)); + registerEditor(MenuPackageImpl.Literals.MENU_SEPARATOR, new MenuSeparatorEditor(modelProvider.getEditingDomain(), this)); + registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), this, project, modelProvider)); registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(MenuPackageImpl.Literals.MENU_CONTRIBUTION, new MenuContributionEditor(modelProvider.getEditingDomain(),project, this)); registerEditor(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION, new ToolBarContributionEditor(modelProvider.getEditingDomain(),project, this)); registerEditor(MenuPackageImpl.Literals.TRIM_CONTRIBUTION, new TrimContributionEditor(modelProvider.getEditingDomain(),project, this)); - registerEditor(BasicPackageImpl.Literals.PART, new PartEditor(modelProvider.getEditingDomain(), project)); - registerEditor(BasicPackageImpl.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain(), project)); - registerEditor(BasicPackageImpl.Literals.TRIMMED_WINDOW, new TrimmedWindowEditor(modelProvider.getEditingDomain(), project)); + registerEditor(BasicPackageImpl.Literals.PART, new PartEditor(modelProvider.getEditingDomain(), this, project)); + registerEditor(BasicPackageImpl.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain(), this, project)); + registerEditor(BasicPackageImpl.Literals.TRIMMED_WINDOW, new TrimmedWindowEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(BasicPackageImpl.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor(modelProvider.getEditingDomain(), this)); registerEditor(BasicPackageImpl.Literals.PART_STACK, new PartStackEditor(modelProvider.getEditingDomain(), this)); - registerEditor(BasicPackageImpl.Literals.INPUT_PART, new InputPartEditor(modelProvider.getEditingDomain(), project)); + registerEditor(BasicPackageImpl.Literals.INPUT_PART, new InputPartEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(BasicPackageImpl.Literals.TRIM_BAR, new TrimBarEditor(modelProvider.getEditingDomain(), this)); - registerEditor(org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain(), project)); + registerEditor(org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, new PerspectiveStackEditor(modelProvider.getEditingDomain(), this)); registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE, new PerspectiveEditor(modelProvider.getEditingDomain(), project, this)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java index 024e032b85..84d6af1a45 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java @@ -10,6 +10,12 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; +import org.eclipse.core.databinding.observable.DisposeEvent; +import org.eclipse.core.databinding.observable.IDisposeListener; + +import org.eclipse.core.databinding.observable.DisposeEvent; +import org.eclipse.core.databinding.observable.IDisposeListener; + import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.Diffs; @@ -31,17 +37,21 @@ public VirtualEntry(String id, IListProperty property, Object originalParent, St this.originalParent = originalParent; this.label = label; this.list = new WritableList(); - IObservableList origList = property.observe(originalParent); + final IObservableList origList = property.observe(originalParent); list.addAll(cleanedList(origList)); - origList.addListChangeListener(new IListChangeListener() { + final IListChangeListener listener = new IListChangeListener() { public void handleListChange(ListChangeEvent event) { - List clean = cleanedList(event.getObservableList()); - ListDiff diff = Diffs.computeListDiff(VirtualEntry.this.list, clean); - diff.applyTo(VirtualEntry.this.list); + if( ! VirtualEntry.this.list.isDisposed() ) { + List clean = cleanedList(event.getObservableList()); + ListDiff diff = Diffs.computeListDiff(VirtualEntry.this.list, clean); + diff.applyTo(VirtualEntry.this.list); + } } - }); + }; + + origList.addListChangeListener(listener); } @SuppressWarnings("unchecked") diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index f84587b8b6..71789db0e9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -10,6 +10,12 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; + +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -42,8 +48,8 @@ public class AddonsEditor extends AbstractComponentEditor { private IProject project; private Image image; - public AddonsEditor(EditingDomain editingDomain, IProject project) { - super(editingDomain); + public AddonsEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { + super(editingDomain,editor); this.project = project; } @@ -96,6 +102,12 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + { Label l = new Label(parent, SWT.NONE); l.setText(Messages.AddonsEditor_Id); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 4ab3699fad..437ffc19ff 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -56,8 +56,8 @@ public class ApplicationEditor extends AbstractComponentEditor { private IListProperty TOOLBAR_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS); private IListProperty TRIM_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS); - public ApplicationEditor(EditingDomain editingDomain) { - super(editingDomain); + public ApplicationEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain,editor); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index b43fe55612..37f11bcba6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.emf.ecore.EObject; + import java.net.MalformedURLException; import java.net.URL; import java.util.List; @@ -60,14 +63,12 @@ public class BindingTableEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; - private ModelEditor editor; private IListProperty BINDING_TABLE__BINDINGS = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS); public BindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); } @Override @@ -110,6 +111,13 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + + { Label l = new Label(parent, SWT.NONE); l.setText(Messages.BindingTableEditor_Id); @@ -254,7 +262,7 @@ public void widgetSelected(SelectionEvent e) { if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); + getEditor().setSelection(handler); } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 01d09e2d93..af5c12abc0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -10,6 +10,11 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -63,8 +68,8 @@ public class CommandEditor extends AbstractComponentEditor { private Image image; private EMFDataBindingContext context; - public CommandEditor(EditingDomain editingDomain) { - super(editingDomain); + public CommandEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain,editor); } @Override @@ -106,6 +111,12 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + + return parent; + } { Label l = new Label(parent, SWT.NONE); @@ -117,7 +128,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 6a2c7b608a..a8f99174ef 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -10,6 +10,41 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; + +import org.eclipse.emf.edit.domain.EditingDomain; + +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; + +import org.eclipse.core.databinding.observable.list.IObservableList; + +import org.eclipse.e4.tools.emf.ui.common.Util; + +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.e4.ui.model.application.ui.MUILabel; + +import org.eclipse.e4.ui.workbench.UIEvents.UILabel; + +import org.eclipse.core.databinding.observable.map.IObservableMap; + +import org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider; + +import org.eclipse.emf.databinding.EMFDataBindingContext; + +import org.eclipse.core.databinding.Binding; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.jface.databinding.viewers.IViewerValueProperty; +import org.eclipse.jface.databinding.viewers.ViewerProperties; +import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.viewers.ComboViewer; + import org.eclipse.e4.ui.model.application.commands.MBindings; import org.eclipse.e4.ui.model.application.ui.MContext; @@ -50,6 +85,96 @@ import org.eclipse.swt.widgets.Text; public class ControlFactory { + public static void createFindImport(Composite parent, final AbstractComponentEditor editor, EMFDataBindingContext context) { + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + Label l = new Label(parent, SWT.NONE); + l.setText("Reference-Id"); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(editor.getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(editor.getMaster())); + + final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + b.setText("Find ..."); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FindImportElementDialog dialog = new FindImportElementDialog(b.getShell(), editor.getEditingDomain(), (EObject) editor.getMaster().getValue()); + dialog.open(); + } + }); + } + + public static void createSelectedElement(Composite parent, final AbstractComponentEditor editor, final EMFDataBindingContext context, String label) { + Label l = new Label(parent, SWT.NONE); + l.setText(label); + + ComboViewer viewer = new ComboViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + viewer.getControl().setLayoutData(gd); + IEMFEditListProperty listProp = EMFEditProperties.list(editor.getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + IEMFEditValueProperty labelProp = EMFEditProperties.value(editor.getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL); + IEMFEditValueProperty idProp = EMFEditProperties.value(editor.getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); + + IViewerValueProperty vProp = ViewerProperties.singleSelection(); + + final Binding[] binding = new Binding[1]; + final IObservableValue uiObs = vProp.observe(viewer); + final IObservableValue mObs = EMFEditProperties.value(editor.getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(editor.getMaster()); + editor.getMaster().addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + if( binding[0] != null ) { + binding[0].dispose(); + } + + } + }); + + final IObservableList list = listProp.observeDetail(editor.getMaster()); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + IObservableMap[] attributeMaps = { + labelProp.observeDetail(cp.getKnownElements()), + idProp.observeDetail(cp.getKnownElements()) + }; + viewer.setLabelProvider(new ObservableMapLabelProvider(attributeMaps) { + @Override + public String getText(Object element) { + EObject o = (EObject) element; + String rv = o.eClass().getName(); + + if( element instanceof MUILabel ) { + MUILabel label = (MUILabel) element; + if( ! Util.isNullOrEmpty(label.getLabel()) ) { + return rv + " - " + label.getLabel().trim(); + } + + } + + if(element instanceof MApplicationElement) { + MApplicationElement appEl = (MApplicationElement) element; + if( ! Util.isNullOrEmpty(appEl.getElementId()) ) { + return rv + " - " + appEl.getElementId(); + } + } + + return rv + "["+list.indexOf(element)+"]"; + } + }); + viewer.setInput(list); + + editor.getMaster().addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + binding[0] = context.bindValue(uiObs, mObs); + } + }); + } + public static void createStringListWidget(Composite parent, final AbstractComponentEditor editor, String label, final EStructuralFeature feature) { Label l = new Label(parent, SWT.NONE); l.setText(label); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index 8d4f3708e1..fd3b66445e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -39,7 +39,7 @@ public class DirectMenuItemEditor extends MenuItemEditor { private Image image; public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain,project); + super(editingDomain,editor, project); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index 58dce81561..6e46514585 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -37,8 +39,8 @@ public class DirectToolItemEditor extends ToolItemEditor { private Image image; - public DirectToolItemEditor(EditingDomain editingDomain, IProject project) { - super(editingDomain,project); + public DirectToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { + super(editingDomain,editor, project); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index 332cd2f951..a8ef32c707 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -64,8 +66,8 @@ public class HandledMenuItemEditor extends MenuItemEditor { private Image image; private IModelResource resource; - public HandledMenuItemEditor(EditingDomain editingDomain, IProject project, IModelResource resource) { - super(editingDomain,project); + public HandledMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource) { + super(editingDomain,editor,project); this.resource = resource; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index e6c904ed58..5f3d845cbe 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -64,8 +66,8 @@ public class HandledToolItemEditor extends ToolItemEditor { private Image image; private IModelResource resource; - public HandledToolItemEditor(EditingDomain editingDomain, IProject project, IModelResource resource) { - super(editingDomain, project); + public HandledToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource) { + super(editingDomain, editor, project); this.resource = resource; } @@ -136,7 +138,7 @@ public void widgetSelected(SelectionEvent e) { @Override protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.PARAMETER__NAME, value); + Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.PARAMETER__NAME, value); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } @@ -172,7 +174,7 @@ protected boolean canEdit(Object element) { @Override protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.PARAMETER__VALUE, value); + Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.PARAMETER__VALUE, value); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 76fe6b43cb..dce8bfc693 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -10,6 +10,11 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -48,8 +53,8 @@ public class HandlerEditor extends AbstractComponentEditor { private IModelResource resource; private IProject project; - public HandlerEditor(EditingDomain editingDomain, IModelResource resource, IProject project) { - super(editingDomain); + public HandlerEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource, IProject project) { + super(editingDomain,editor); this.resource = resource; this.project = project; } @@ -93,6 +98,12 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -104,7 +115,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java index c81967a887..7119cc4e49 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.internal.Messages; @@ -27,8 +29,8 @@ public class InputPartEditor extends PartEditor { - public InputPartEditor(EditingDomain editingDomain, IProject project) { - super(editingDomain, project); + public InputPartEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { + super(editingDomain, editor, project); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 9df457b8ff..4cdf045ece 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -10,6 +10,11 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -65,8 +70,8 @@ public class KeyBindingEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IModelResource resource; - public KeyBindingEditor(EditingDomain editingDomain, IModelResource resource) { - super(editingDomain); + public KeyBindingEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource) { + super(editingDomain,editor); this.resource = resource; } @@ -110,6 +115,12 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -121,7 +132,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index 4eeb588c6f..9629abd00a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.emf.ecore.EObject; + import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.emf.databinding.EMFProperties; @@ -77,7 +80,6 @@ public class MenuContributionEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; - private ModelEditor editor; private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); @@ -95,8 +97,7 @@ public Struct(String label, EClass eClass, boolean separator) { } public MenuContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); this.project = project; } @@ -145,6 +146,12 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -156,7 +163,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -201,7 +208,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText(Messages.MenuContributionEditor_MenuItemType); column.getColumn().setWidth(300); - column.setLabelProvider(new ComponentLabelProvider(editor)); + column.setLabelProvider(new ComponentLabelProvider(getEditor())); } { @@ -310,7 +317,7 @@ public void widgetSelected(SelectionEvent e) { if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); if (!struct.separator) { - editor.setSelection(eObject); + getEditor().setSelection(eObject); } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 06e9155219..a4958d5b39 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; + import java.net.MalformedURLException; import java.net.URL; import java.util.List; @@ -73,7 +75,6 @@ public class MenuEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; - private ModelEditor editor; private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); @@ -92,8 +93,7 @@ public Struct(String label, EClass eClass, boolean separator) { } public MenuEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); this.project = project; } @@ -129,7 +129,7 @@ public Composite getEditor(Composite parent, Object object) { } EObject o = (EObject) object; Control topControl; - if( o.eContainer() instanceof MWindow ) { + if( o.eContainer() instanceof MWindow || o.eContainer() == null ) { topControl = composite.getChildren()[1]; } else { topControl = composite.getChildren()[0]; @@ -150,6 +150,12 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -161,7 +167,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ if( ! rootMenu ) { @@ -229,7 +235,7 @@ public void widgetSelected(SelectionEvent e) { TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText(Messages.MenuEditor_MenuItemType); column.getColumn().setWidth(300); - column.setLabelProvider(new ComponentLabelProvider(editor)); + column.setLabelProvider(new ComponentLabelProvider(getEditor())); } { @@ -338,7 +344,7 @@ public void widgetSelected(SelectionEvent e) { if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); if (!struct.separator) { - editor.setSelection(eObject); + getEditor().setSelection(eObject); } } } @@ -388,6 +394,7 @@ public String getLabel(Object element) { @Override public String getDetailLabel(Object element) { MMenu menu = (MMenu) element; + if( menu.getLabel() != null && menu.getLabel().trim().length() > 0 ) { return menu.getLabel(); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 25da1ff5c1..a8b4c89f36 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -10,6 +10,15 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.core.databinding.conversion.Converter; + +import org.eclipse.core.databinding.UpdateValueStrategy; + +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -53,8 +62,8 @@ public abstract class MenuItemEditor extends AbstractComponentEditor { private EMFDataBindingContext context; protected IProject project; - public MenuItemEditor(EditingDomain editingDomain, IProject project) { - super(editingDomain); + public MenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { + super(editingDomain,editor); this.project = project; } @@ -87,7 +96,14 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - + IWidgetValueProperty checkProp = WidgetProperties.selection(); + IWidgetValueProperty enabled = WidgetProperties.enabled(); + + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -99,7 +115,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + if (this.getClass() != MenuItemEditor.class) { // ------------------------------------------------------------ { @@ -161,6 +177,43 @@ public void widgetSelected(SelectionEvent e) { } }); } + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Enabled"); + + Button b = new Button(parent, SWT.CHECK); + b.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); + context.bindValue(checkProp.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__ENABLED).observeDetail(getMaster())); + } + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Selected"); + + Button b = new Button(parent, SWT.CHECK); + b.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); + context.bindValue(checkProp.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__SELECTED).observeDetail(getMaster())); + + UpdateValueStrategy t2m = new UpdateValueStrategy(); + t2m.setConverter(new Converter(boolean.class, ItemType.class) { + + public Object convert(Object fromObject) { + return null; + } + }); + UpdateValueStrategy m2t = new UpdateValueStrategy(); + m2t.setConverter(new Converter(ItemType.class, boolean.class) { + + public Object convert(Object fromObject) { + return fromObject == ItemType.CHECK || fromObject == ItemType.RADIO; + } + }); + + context.bindValue(enabled.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(getMaster()),t2m,m2t); + + } + createFormSubTypeForm(parent, context, master); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index 9beed58ead..4040f05fce 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -10,6 +10,14 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.widgets.Button; + +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -36,8 +44,8 @@ public class MenuSeparatorEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - public MenuSeparatorEditor(EditingDomain editingDomain) { - super(editingDomain); + public MenuSeparatorEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain,editor); } @Override @@ -85,6 +93,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -96,7 +109,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + //TODO Should we add visible to mimic a GroupMarker of 3.x return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java index a141bb10c4..dd21635a31 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java @@ -10,6 +10,27 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EPackage; + +import java.util.ArrayList; +import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerComparator; + +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; + +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; + +import org.eclipse.core.databinding.observable.list.WritableList; + import org.eclipse.e4.ui.model.fragment.MFragmentFactory; @@ -53,14 +74,13 @@ public class ModelFragmentsEditor extends AbstractComponentEditor { private IListProperty MODEL_FRAGMENTS__FRAGMENTS = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS); - + private IListProperty MODEL_FRAGMENTS__IMPORTS = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS); + private Composite composite; private Image image; - private ModelEditor editor; public ModelFragmentsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); } @Override @@ -98,6 +118,147 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Imports"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final TableViewer viewer = new TableViewer(parent); + viewer.setContentProvider(new ObservableListContentProvider()); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 200; + viewer.getControl().setLayoutData(gd); + + IEMFListProperty prop = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS); + viewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MModelFragments container = (MModelFragments) getMaster().getValue(); + int idx = container.getImports().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MModelFragments container = (MModelFragments) getMaster().getValue(); + int idx = container.getImports().indexOf(obj) + 1; + if (idx < container.getImports().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + FeatureClass eclass = (FeatureClass) element; + return eclass.label; + } + }); + childrenDropDown.setComparator(new ViewerComparator() { + @Override + public int compare(Viewer viewer, Object e1, Object e2) { + FeatureClass eClass1 = (FeatureClass) e1; + FeatureClass eClass2 = (FeatureClass) e2; + return eClass1.label.compareTo(eClass2.label); + } + }); + + List list = new ArrayList(); + addClasses(ApplicationPackageImpl.eINSTANCE, list); + list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS)); + + childrenDropDown.setInput(list); + childrenDropDown.getCombo().select(0); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + EClass eClass = ((FeatureClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement()).eClass; + EObject eObject = EcoreUtil.create(eClass); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(eObject); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List elements = ((IStructuredSelection) viewer.getSelection()).toList(); + + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, elements); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } { Label l = new Label(parent, SWT.NONE); @@ -106,9 +267,9 @@ private Composite createForm(Composite parent) { final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(editor)); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + gd.heightHint = 200; viewer.getControl().setLayoutData(gd); IEMFListProperty prop = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS); @@ -190,7 +351,7 @@ public void widgetSelected(SelectionEvent e) { if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(component); + getEditor().setSelection(component); } } }); @@ -217,9 +378,38 @@ public void widgetSelected(SelectionEvent e) { return parent; } + public void addClasses(EPackage ePackage, List list) { + for (EClassifier c : ePackage.getEClassifiers()) { + if (c instanceof EClass) { + EClass eclass = (EClass) c; + if (eclass != ApplicationPackageImpl.Literals.APPLICATION && !eclass.isAbstract() && !eclass.isInterface() && eclass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT)) { + list.add(new FeatureClass(eclass.getName(), eclass)); + } + } + } + + for (EPackage eSubPackage : ePackage.getESubpackages()) { + addClasses(eSubPackage, list); + } + } + @Override public IObservableList getChildList(Object element) { - return MODEL_FRAGMENTS__FRAGMENTS.observe(element); + WritableList list = new WritableList(); + list.add(new VirtualEntry(ModelEditor.VIRTUAL_MODEL_IMPORTS, MODEL_FRAGMENTS__IMPORTS, element, "Imports") { + @Override + protected boolean accepted(Object o) { + return true; + } + }); + list.add(new VirtualEntry(ModelEditor.VIRTUAL_MODEL_FRAGEMENTS, MODEL_FRAGMENTS__FRAGMENTS, element, "Fragments") { + @Override + protected boolean accepted(Object o) { + return true; + } + }); + + return list; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index ae4239c405..9b569d1583 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -10,6 +10,19 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; +import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.command.SetCommand; + +import org.eclipse.core.databinding.property.value.IValueProperty; + +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; + import java.net.MalformedURLException; import java.net.URL; import java.util.Map.Entry; @@ -64,9 +77,11 @@ public class PartDescriptorEditor extends AbstractComponentEditor { private IListProperty PART__MENUS = EMFProperties.list(BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS); private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); + private IValueProperty PART__TOOLBAR = EMFProperties.value(BasicPackageImpl.Literals.PART_DESCRIPTOR__TOOLBAR); + private Button createRemoveToolBar; - public PartDescriptorEditor(EditingDomain editingDomain, IProject project) { - super(editingDomain); + public PartDescriptorEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { + super(editingDomain,editor); this.project = project; } @@ -101,6 +116,7 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent,context, getMaster()); } getMaster().setValue(object); + createRemoveToolBar.setSelection(((MPartDescriptor)object).getToolbar() != null); return composite; } @@ -110,6 +126,13 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -121,7 +144,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -188,6 +211,26 @@ public void widgetSelected(SelectionEvent e) { }); } + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.PartEditor_ToolBar); + + createRemoveToolBar = new Button(parent, SWT.CHECK); + createRemoveToolBar.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MPartDescriptor window = (MPartDescriptor) getMaster().getValue(); + if( window.getToolbar() == null ) { + addToolBar(); + } else { + removeToolBar(); + } + } + }); + createRemoveToolBar.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -356,9 +399,25 @@ public String getText(Object element) { return parent; } + private void addToolBar() { + MToolBar menu = MMenuFactory.INSTANCE.createToolBar(); + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR__TOOLBAR, menu); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + private void removeToolBar() { + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR__TOOLBAR, null); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + @Override - public IObservableList getChildList(Object element) { - WritableList list = new WritableList(); + public IObservableList getChildList(final Object element) { + final WritableList list = new WritableList(); list.add(new VirtualEntry( ModelEditor.VIRTUAL_PARTDESCRIPTOR_MENU, PART__MENUS, element, Messages.PartDescriptorEditor_Menus) { @Override @@ -377,6 +436,31 @@ protected boolean accepted(Object o) { }); + MPartDescriptor window = (MPartDescriptor) element; + if( window.getToolbar() != null ) { + list.add(0,window.getToolbar()); + } + + PART__TOOLBAR.observe(element).addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + if( event.diff.getOldValue() != null ) { + list.remove(event.diff.getOldValue()); + if( getMaster().getValue() == element ) { + createRemoveToolBar.setSelection(false); + } + + } + + if( event.diff.getNewValue() != null ) { + list.add(0,event.diff.getNewValue()); + if( getMaster().getValue() == element ) { + createRemoveToolBar.setSelection(true); + } + } + } + }); + return list; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index ede939b53d..f3d49c0aeb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -10,6 +10,24 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.core.databinding.property.value.IValueProperty; + +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; + +import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; + +import org.eclipse.e4.ui.model.application.ui.menu.MMenu; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.command.SetCommand; + +import org.eclipse.e4.ui.model.application.ui.basic.MWindow; + import java.net.MalformedURLException; import java.net.URL; import java.util.Map.Entry; @@ -64,9 +82,12 @@ public class PartEditor extends AbstractComponentEditor { private IListProperty PART__MENUS = EMFProperties.list(BasicPackageImpl.Literals.PART__MENUS); private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); + private IValueProperty PART__TOOLBAR = EMFProperties.value(BasicPackageImpl.Literals.PART__TOOLBAR); + private Button createRemoveToolBar; + - public PartEditor(EditingDomain editingDomain, IProject project) { - super(editingDomain); + public PartEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { + super(editingDomain,editor); this.project = project; } @@ -101,6 +122,7 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent,context, getMaster()); } getMaster().setValue(object); + createRemoveToolBar.setSelection(((MPart)object).getToolbar() != null); return composite; } @@ -110,6 +132,11 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -121,7 +148,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -188,6 +215,26 @@ public void widgetSelected(SelectionEvent e) { }); } + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.PartEditor_ToolBar); + + createRemoveToolBar = new Button(parent, SWT.CHECK); + createRemoveToolBar.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MPart window = (MPart) getMaster().getValue(); + if( window.getToolbar() == null ) { + addToolBar(); + } else { + removeToolBar(); + } + } + }); + createRemoveToolBar.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -323,13 +370,28 @@ public String getText(Object element) { return parent; } + private void addToolBar() { + MToolBar menu = MMenuFactory.INSTANCE.createToolBar(); + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART__TOOLBAR, menu); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + private void removeToolBar() { + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART__TOOLBAR, null); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + protected void createSubformElements(Composite parent, EMFDataBindingContext context, IObservableValue master) { } @Override public IObservableList getChildList(Object element) { - WritableList list = new WritableList(); + final WritableList list = new WritableList(); list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART_MENU, PART__MENUS, element, Messages.PartEditor_Menus) { @Override @@ -347,6 +409,26 @@ protected boolean accepted(Object o) { } }); + + MPart window = (MPart) element; + if( window.getToolbar() != null ) { + list.add(0,window.getToolbar()); + } + + PART__TOOLBAR.observe(element).addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + if( event.diff.getOldValue() != null ) { + list.remove(event.diff.getOldValue()); + createRemoveToolBar.setSelection(false); + } + + if( event.diff.getNewValue() != null ) { + list.add(0,event.diff.getNewValue()); + createRemoveToolBar.setSelection(true); + } + } + }); return list; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index f5426e3fda..f1384ba72c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; + import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import java.net.MalformedURLException; @@ -76,13 +78,11 @@ public class PartSashContainerEditor extends AbstractComponentEditor { private Image vImage; private Image hImage; private EMFDataBindingContext context; - private ModelEditor editor; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); public PartSashContainerEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); } @Override @@ -141,6 +141,11 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -152,7 +157,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -174,41 +179,7 @@ public String getText(Object element) { context.bindValue(vProp.observe(viewer), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL).observeDetail(getMaster())); } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartSashContainerEditor_SelectedElement); - - ComboViewer viewer = new ComboViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - viewer.getControl().setLayoutData(gd); - IEMFEditListProperty listProp = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - IViewerValueProperty vProp = ViewerProperties.singleSelection(); - - final Binding[] binding = new Binding[1]; - final IObservableValue uiObs = vProp.observe(viewer); - final IObservableValue mObs = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(getMaster()); - getMaster().addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - if( binding[0] != null ) { - binding[0].dispose(); - } - - } - }); - - ViewerSupport.bind(viewer, listProp.observeDetail(getMaster()), valProp); - - getMaster().addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - binding[0] = context.bindValue(uiObs, mObs); - } - }); - } + ControlFactory.createSelectedElement(parent, this, context, Messages.PartSashContainerEditor_SelectedElement); // ------------------------------------------------------------ { @@ -235,7 +206,7 @@ public void handleValueChange(ValueChangeEvent event) { viewer.getControl().setLayoutData(gd); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(editor)); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(getMaster())); @@ -336,7 +307,7 @@ public void widgetSelected(SelectionEvent e) { if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(eObject); + getEditor().setSelection(eObject); } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 6d2362f751..43567b2b24 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; + import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import java.net.MalformedURLException; @@ -73,13 +75,11 @@ public class PartStackEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; - private ModelEditor editor; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); public PartStackEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); } @Override @@ -123,6 +123,11 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -134,42 +139,8 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartStackEditor_SelectedElement); - - ComboViewer viewer = new ComboViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - viewer.getControl().setLayoutData(gd); - IEMFEditListProperty listProp = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL); - IViewerValueProperty vProp = ViewerProperties.singleSelection(); - - final Binding[] binding = new Binding[1]; - final IObservableValue uiObs = vProp.observe(viewer); - final IObservableValue mObs = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(getMaster()); - getMaster().addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - if( binding[0] != null ) { - binding[0].dispose(); - } - - } - }); - - ViewerSupport.bind(viewer, listProp.observeDetail(getMaster()), valProp); - - getMaster().addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - binding[0] = context.bindValue(uiObs, mObs); - } - }); - } + + ControlFactory.createSelectedElement(parent, this, context, Messages.PartStackEditor_SelectedElement); // ------------------------------------------------------------ { @@ -190,7 +161,7 @@ public void handleValueChange(ValueChangeEvent event) { final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(editor)); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); @@ -292,7 +263,7 @@ public void widgetSelected(SelectionEvent e) { if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(eObject); + getEditor().setSelection(eObject); } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index efbb64e1f0..3a2798ef8b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; + import java.net.MalformedURLException; import java.net.URL; import java.util.List; @@ -75,15 +77,13 @@ public class PerspectiveEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; - private ModelEditor editor; private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); public PerspectiveEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain); + super(editingDomain,editor); this.project = project; - this.editor = editor; } @Override @@ -143,6 +143,11 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -154,42 +159,8 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PerspectiveEditor_SelectedElement); - - ComboViewer viewer = new ComboViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - viewer.getControl().setLayoutData(gd); - IEMFEditListProperty listProp = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - IViewerValueProperty vProp = ViewerProperties.singleSelection(); - - final Binding[] binding = new Binding[1]; - final IObservableValue uiObs = vProp.observe(viewer); - final IObservableValue mObs = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(getMaster()); - getMaster().addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - if (binding[0] != null) { - binding[0].dispose(); - } - - } - }); - - ViewerSupport.bind(viewer, listProp.observeDetail(getMaster()), valProp); - - getMaster().addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - binding[0] = context.bindValue(uiObs, mObs); - } - }); - } + + ControlFactory.createSelectedElement(parent, this, context, Messages.PerspectiveEditor_SelectedElement); // ------------------------------------------------------------ { @@ -246,7 +217,7 @@ public void widgetSelected(SelectionEvent e) { viewer.getControl().setLayoutData(gd); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(editor)); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(getMaster())); @@ -347,7 +318,7 @@ public void widgetSelected(SelectionEvent e) { if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(eObject); + getEditor().setSelection(eObject); } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index c5fdfd9eb1..a133dd158a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.emf.ecore.EObject; + import java.net.MalformedURLException; import java.net.URL; import java.util.List; @@ -66,13 +69,11 @@ public class PerspectiveStackEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; - private ModelEditor modelEditor; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - public PerspectiveStackEditor(EditingDomain editingDomain, ModelEditor modelEditor) { - super(editingDomain); - this.modelEditor = modelEditor; + public PerspectiveStackEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain,editor); } @Override @@ -121,6 +122,11 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -132,43 +138,9 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PerspectiveStackEditor_SelectedElement); - - ComboViewer viewer = new ComboViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - viewer.getControl().setLayoutData(gd); - IEMFEditListProperty listProp = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL); - IViewerValueProperty vProp = ViewerProperties.singleSelection(); - - final Binding[] binding = new Binding[1]; - final IObservableValue uiObs = vProp.observe(viewer); - final IObservableValue mObs = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(getMaster()); - getMaster().addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - if( binding[0] != null ) { - binding[0].dispose(); - } - - } - }); - - ViewerSupport.bind(viewer, listProp.observeDetail(getMaster()), valProp); - - getMaster().addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - binding[0] = context.bindValue(uiObs, mObs); - } - }); - } + ControlFactory.createSelectedElement(parent, this, context, Messages.PerspectiveStackEditor_SelectedElement); + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -176,7 +148,7 @@ public void handleValueChange(ValueChangeEvent event) { final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(modelEditor)); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); @@ -260,7 +232,7 @@ public void widgetSelected(SelectionEvent e) { if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); - modelEditor.setSelection(eObject); + getEditor().setSelection(eObject); } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 5a9c4ae362..d721775c86 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -10,6 +10,22 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.Util; + +import org.eclipse.e4.ui.workbench.UIEvents.UIElement; + +import org.eclipse.e4.ui.model.application.ui.MUIElement; + +import org.eclipse.core.databinding.conversion.Converter; + +import org.eclipse.core.databinding.conversion.Converter; + +import org.eclipse.core.databinding.UpdateValueStrategy; + +import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; + +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; + import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.common.IModelResource; @@ -53,12 +69,10 @@ public class PlaceholderEditor extends AbstractComponentEditor { private Image image; private EMFDataBindingContext context; private IModelResource resource; - private ModelEditor editor; public PlaceholderEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource) { - super(editingDomain); + super(editingDomain,editor); this.resource = resource; - this.editor = editor; } @Override @@ -131,6 +145,11 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -138,20 +157,61 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan=2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText("Reference"); + + Text t = new Text(parent, SWT.BORDER); + t.setEditable(false); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - final Button b = new Button(parent, SWT.PUSH); + UpdateValueStrategy t2m = new UpdateValueStrategy(); + t2m.setConverter(new Converter(String.class, MUIElement.class) { + + public Object convert(Object fromObject) { + return null; + } + }); + UpdateValueStrategy m2t = new UpdateValueStrategy(); + m2t.setConverter(new Converter(MUIElement.class,String.class) { + + public Object convert(Object fromObject) { + if( fromObject != null ) { + EObject o = (EObject) fromObject; + if( o instanceof MUILabel ) { + MUILabel label = (MUILabel) o; + if( ! Util.isNullOrEmpty(label.getLabel()) ) { + return o.eClass().getName() + " - " + label.getLabel(); + } + } + + return o.eClass().getName() + " - "+((MUIElement)fromObject).getElementId(); + } + return null; + } + }); + + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), AdvancedPackageImpl.Literals.PLACEHOLDER__REF).observeDetail(getMaster()),t2m,m2t); + + final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setText(Messages.PlaceholderEditor_FindReference); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - SharedElementsDialog dialog = new SharedElementsDialog(b.getShell(),editor,(MPlaceholder) getMaster().getValue(), resource); + SharedElementsDialog dialog = new SharedElementsDialog(b.getShell(),getEditor(),(MPlaceholder) getMaster().getValue(), resource); dialog.open(); } }); } + return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index e6c929a377..363b921867 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -89,13 +89,11 @@ public class StringModelFragment extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; - private ModelEditor editor; private IListProperty MODEL_FRAGMENT__ELEMENTS = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS); public StringModelFragment(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); } @Override @@ -202,7 +200,7 @@ public void widgetSelected(SelectionEvent e) { final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(editor)); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); @@ -294,7 +292,7 @@ public int compare(Viewer viewer, Object e1, Object e2) { List list = new ArrayList(); addClasses(ApplicationPackageImpl.eINSTANCE, list); - list.addAll(editor.getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS)); + list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS)); childrenDropDown.setInput(list); childrenDropDown.getCombo().select(0); @@ -312,7 +310,7 @@ public void widgetSelected(SelectionEvent e) { if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(eObject); + getEditor().setSelection(eObject); } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index 977a26ca7e..c8ab8ba3b2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.emf.ecore.EObject; + import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; import org.eclipse.core.databinding.property.list.IListProperty; @@ -79,7 +82,6 @@ public class ToolBarContributionEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; - private ModelEditor editor; private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); @@ -97,8 +99,7 @@ public Struct(String label, EClass eClass, boolean separator) { } public ToolBarContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); this.project = project; } @@ -147,6 +148,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -158,7 +164,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -203,7 +209,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText(Messages.ToolBarEditor_ToolbarItemsType); column.getColumn().setWidth(300); - column.setLabelProvider(new ComponentLabelProvider(editor)); + column.setLabelProvider(new ComponentLabelProvider(getEditor())); } { @@ -312,7 +318,7 @@ public void widgetSelected(SelectionEvent e) { if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); if (!struct.separator) { - editor.setSelection(eObject); + getEditor().setSelection(eObject); } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 93d3401cb3..99c10786cc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.emf.ecore.EObject; + import java.net.MalformedURLException; import java.net.URL; import java.util.List; @@ -66,7 +69,6 @@ public class ToolBarEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; - private ModelEditor editor; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); @@ -84,8 +86,7 @@ public Struct(String label, EClass eClass, boolean separator) { public ToolBarEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); } @Override @@ -127,6 +128,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -138,7 +144,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -158,7 +164,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText(Messages.ToolBarEditor_ToolbarItemsType); column.getColumn().setWidth(300); - column.setLabelProvider(new ComponentLabelProvider(editor)); + column.setLabelProvider(new ComponentLabelProvider(getEditor())); } { @@ -267,7 +273,7 @@ public void widgetSelected(SelectionEvent e) { if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); if (!struct.separator) { - editor.setSelection(eObject); + getEditor().setSelection(eObject); } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index a15848fbdb..84d9570547 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -10,6 +10,14 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.widgets.Button; + +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -36,8 +44,8 @@ public class ToolBarSeparatorEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - public ToolBarSeparatorEditor(EditingDomain editingDomain) { - super(editingDomain); + public ToolBarSeparatorEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain,editor); } @Override @@ -85,6 +93,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -96,7 +109,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index ba7e3a80d9..7f9674c263 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -10,6 +10,11 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + import java.net.MalformedURLException; import java.net.URL; import java.util.Map.Entry; @@ -49,8 +54,8 @@ public class ToolControlEditor extends AbstractComponentEditor { private Composite composite; private IProject project; - public ToolControlEditor(EditingDomain editingDomain, IProject project) { - super(editingDomain); + public ToolControlEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { + super(editingDomain,editor); this.project = project; } @@ -99,7 +104,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -111,7 +120,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 6d2e67ddcc..0abd550d1e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -10,6 +10,14 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.core.databinding.UpdateValueStrategy; +import org.eclipse.core.databinding.conversion.Converter; + +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; + import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -46,8 +54,8 @@ public abstract class ToolItemEditor extends AbstractComponentEditor { private EMFDataBindingContext context; protected IProject project; - public ToolItemEditor(EditingDomain editingDomain, IProject project) { - super(editingDomain); + public ToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { + super(editingDomain, editor); this.project = project; } @@ -67,6 +75,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + Label l = new Label(parent, SWT.NONE); l.setText("Id"); @@ -75,7 +88,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gd.horizontalSpan = 2; t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); - + createFormSubTypeForm(parent, context, master); return parent; @@ -83,6 +96,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr private void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, final WritableValue master) { IValueProperty textProp = WidgetProperties.text(SWT.Modify); + IWidgetValueProperty checkProp = WidgetProperties.selection(); + IWidgetValueProperty enabled = WidgetProperties.enabled(); // ------------------------------------------------------------ { @@ -144,6 +159,42 @@ public void widgetSelected(SelectionEvent e) { } }); } + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Enabled"); + + Button b = new Button(parent, SWT.CHECK); + b.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); + context.bindValue(checkProp.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__ENABLED).observeDetail(getMaster())); + } + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Selected"); + + Button b = new Button(parent, SWT.CHECK); + b.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); + context.bindValue(checkProp.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__SELECTED).observeDetail(getMaster())); + + UpdateValueStrategy t2m = new UpdateValueStrategy(); + t2m.setConverter(new Converter(boolean.class, ItemType.class) { + + public Object convert(Object fromObject) { + return null; + } + }); + UpdateValueStrategy m2t = new UpdateValueStrategy(); + m2t.setConverter(new Converter(ItemType.class, boolean.class) { + + public Object convert(Object fromObject) { + return fromObject == ItemType.CHECK || fromObject == ItemType.RADIO; + } + }); + + context.bindValue(enabled.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(getMaster()),t2m,m2t); + + } // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index c496fa822f..8b9c1af94d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; + import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.ecore.EObject; @@ -78,7 +80,7 @@ public class TrimBarEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); public TrimBarEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); + super(editingDomain,editor); this.editor = editor; } @@ -123,6 +125,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -134,7 +141,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index 62b58f7beb..3f1cf15d35 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; + import org.eclipse.emf.ecore.EObject; import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; @@ -84,7 +86,6 @@ public class TrimContributionEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; - private ModelEditor editor; private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); @@ -102,8 +103,7 @@ public Struct(String label, EClass eClass, boolean separator) { } public TrimContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); this.project = project; } @@ -151,7 +151,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -163,7 +167,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -196,7 +200,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); final TableViewer viewer = new TableViewer(parent); - viewer.setLabelProvider(new ComponentLabelProvider(editor)); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); viewer.setContentProvider(new ObservableListContentProvider()); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; @@ -293,7 +297,7 @@ public void widgetSelected(SelectionEvent e) { if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(toolbar); + getEditor().setSelection(toolbar); } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java index 4119793bab..9e81ea8c1e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java @@ -12,8 +12,8 @@ public class TrimmedWindowEditor extends WindowEditor { private IListProperty TRIMMED_WINDOW__TRIM_BARS = EMFProperties.list(BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS); - public TrimmedWindowEditor(EditingDomain editingDomain, IProject project) { - super(editingDomain,project); + public TrimmedWindowEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { + super(editingDomain,editor, project); } public IObservableList getChildList(Object element) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 5be7359726..795032b3df 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -10,6 +10,13 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.emf.edit.command.RemoveCommand; + +import org.eclipse.e4.tools.emf.ui.internal.Messages; + import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; @@ -68,20 +75,16 @@ public class WindowEditor extends AbstractComponentEditor { private IListProperty SHARED_ELEMENTS = EMFProperties.list(BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS); private IValueProperty WINDOW__MAIN_MENU = EMFProperties.value(BasicPackageImpl.Literals.WINDOW__MAIN_MENU); - - private Action addMainMenu; + private Action addMainMenu; + private Button createRemoveMainMenu; - public WindowEditor(EditingDomain editingDomain, IProject project) { - super(editingDomain); + public WindowEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { + super(editingDomain,editor); this.project = project; addMainMenu = new Action("Add Main Menu") { @Override public void run() { - MMenu menu = MMenuFactory.INSTANCE.createMenu(); - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__MAIN_MENU, menu); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } + addMenu(); } }; } @@ -117,6 +120,7 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent,context, getMaster()); } getMaster().setValue(object); + createRemoveMainMenu.setSelection(((MWindow)object).getMainMenu() != null); return composite; } @@ -126,7 +130,12 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - + + if( getEditor().isModelFragment() ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -138,7 +147,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -231,18 +240,52 @@ public void widgetSelected(SelectionEvent e) { dialog.open(); } }); - + } + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Main Menu"); + + createRemoveMainMenu = new Button(parent, SWT.CHECK); + createRemoveMainMenu.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MWindow window = (MWindow) getMaster().getValue(); + if( window.getMainMenu() == null ) { + addMenu(); + } else { + removeMenu(); + } + } + }); + createRemoveMainMenu.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); } + ControlFactory.createSelectedElement(parent, this, context, "Selected Element"); ControlFactory.createBindingsWidget(parent, this); ControlFactory.createVariablesWidget(parent, this); ControlFactory.createTagsWidget(parent, this); return parent; } + + void removeMenu() { + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__MAIN_MENU, null); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + void addMenu() { + MMenu menu = MMenuFactory.INSTANCE.createMenu(); + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__MAIN_MENU, menu); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } @Override - public IObservableList getChildList(Object element) { + public IObservableList getChildList(final Object element) { final WritableList list = new WritableList(); list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { @@ -287,10 +330,16 @@ protected boolean accepted(Object o) { public void handleValueChange(ValueChangeEvent event) { if( event.diff.getOldValue() != null ) { list.remove(event.diff.getOldValue()); + if( getMaster().getValue() == element ) { + createRemoveMainMenu.setSelection(false); + } } if( event.diff.getNewValue() != null ) { list.add(0,event.diff.getNewValue()); + if( getMaster().getValue() == element ) { + createRemoveMainMenu.setSelection(true); + } } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java index 1f84e7aaa7..6134c2a0f1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java @@ -10,6 +10,12 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; + +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; + import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.emf.ecore.EObject; @@ -72,7 +78,16 @@ protected Control createDialogArea(Composite parent) { getShell().setText( getShellTitle()); setTitle( getDialogTitle() ); setMessage( getDialogMessage() ); - + + final Image titleImage = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newexp_wiz.png")); + setTitleImage(titleImage); + getShell().addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + titleImage.dispose(); + } + }); + Composite container = new Composite(composite, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); container.setLayout(new GridLayout(2, false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java index 1dbe714f9d..005cba0506 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -74,10 +74,14 @@ protected Control createDialogArea(Composite parent) { setTitle(Messages.ContributionClassDialog_DialogTitle); setMessage(Messages.ContributionClassDialog_DialogMessage); + final Image titleImage = new Image(comp.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newclass_wiz.png")); + setTitleImage(titleImage); + getShell().addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { javaClassImage.dispose(); + titleImage.dispose(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java new file mode 100644 index 0000000000..5ad34a9763 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java @@ -0,0 +1,26 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +import org.eclipse.emf.edit.domain.EditingDomain; + +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.swt.widgets.Shell; + +import org.eclipse.jface.dialogs.TitleAreaDialog; + +public class FindImportElementDialog extends TitleAreaDialog { + + public FindImportElementDialog(Shell parentShell, EditingDomain domain, EObject element) { + super(parentShell); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite comp = (Composite) super.createDialogArea(parent); + + return comp; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java index 0daebd280d..f843431ff4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java @@ -97,6 +97,10 @@ public SharedElementsDialog(Shell parentShell, ModelEditor editor, MPlaceholder @Override protected Control createDialogArea(Composite parent) { Composite comp = (Composite) super.createDialogArea(parent); + + setTitle("Find Shared Elements"); + setMessage("Find Shared Elements of an Window"); + Composite container = new Composite(comp, SWT.NONE); container.setLayout(new GridLayout(2, false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java index bbc39d63e8..5b4a622efc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java @@ -35,7 +35,6 @@ public class VApplicationAddons extends AbstractComponentEditor { private Composite composite; - private ModelEditor editor; private TableViewer viewer; private EMFDataBindingContext context; @@ -46,8 +45,7 @@ public class VApplicationAddons extends AbstractComponentEditor { private RemoveAddonCommand removeAddonCommand = new RemoveAddonCommand(); public VApplicationAddons(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); actions.add(new Action("Add Addon") { @Override public void run() { @@ -105,7 +103,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, gd.heightHint = 300; viewer.getControl().setLayoutData(gd); viewer.getTable().setHeaderVisible(true); - viewer.setLabelProvider(new ComponentLabelProvider(editor)); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index e2e59a00e1..aec316a1aa 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -74,13 +74,11 @@ public class VBindingTableEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private ModelEditor editor; private TableViewer bindingViewer; private TreeViewer contextsViewer; public VBindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); } @Override @@ -368,7 +366,7 @@ public void widgetSelected(SelectionEvent e) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 180; bindingViewer.getControl().setLayoutData(gd); - bindingViewer.setLabelProvider(new ComponentLabelProvider(editor)); + bindingViewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); @@ -445,7 +443,7 @@ public void widgetSelected(SelectionEvent e) { if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(command); + getEditor().setSelection(command); } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index 277414fc32..156bdd2a51 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -51,14 +51,12 @@ public class VCommandEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private ModelEditor editor; private TableViewer viewer; private EStructuralFeature commandsFeature; public VCommandEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature commandsFeature) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); this.commandsFeature = commandsFeature; } @@ -205,7 +203,7 @@ public void widgetSelected(SelectionEvent e) { if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(command); + getEditor().setSelection(command); } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index 9a6646f54c..9744229f4f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -50,12 +50,10 @@ public class VHandlerEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private ModelEditor editor; private TableViewer viewer; public VHandlerEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); } @Override @@ -210,7 +208,7 @@ public void widgetSelected(SelectionEvent e) { if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); + getEditor().setSelection(handler); } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java index 2db0267278..54a03e5c2c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java @@ -60,12 +60,10 @@ public class VMenuContributionsEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private ModelEditor editor; private TableViewer viewer; public VMenuContributionsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); } @Override @@ -220,7 +218,7 @@ public void widgetSelected(SelectionEvent e) { if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(command); + getEditor().setSelection(command); } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java index ef947589a8..6a187c8cf2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -46,13 +46,11 @@ public class VMenuEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private ModelEditor editor; private TableViewer viewer; private EStructuralFeature feature; public VMenuEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature feature) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); this.feature = feature; } @@ -138,7 +136,7 @@ public void widgetSelected(SelectionEvent e) { if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); + getEditor().setSelection(handler); } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java new file mode 100644 index 0000000000..22c351910c --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java @@ -0,0 +1,233 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import org.eclipse.e4.ui.model.fragment.MModelFragments; + +import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; + +import org.eclipse.e4.ui.model.fragment.MStringModelFragment; + +import org.eclipse.e4.ui.model.fragment.MFragmentFactory; + +import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VModelFragmentsEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private TableViewer viewer; + + public VModelFragmentsEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain,editor); + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "Fragments"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Fragments Bla Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + VirtualEntry o = (VirtualEntry)object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Fragments"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + + + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS); + viewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + GridLayout gl = new GridLayout(2,false); + gl.marginLeft=0; + gl.marginRight=0; + gl.marginWidth=0; + gl.marginHeight=0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MModelFragments container = (MModelFragments) getMaster().getValue(); + int idx = container.getFragments().indexOf(obj) - 1; + if( idx >= 0 ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + if( s.size() == 1 ) { + Object obj = s.getFirstElement(); + MModelFragments container = (MModelFragments) getMaster().getValue(); + int idx = container.getFragments().indexOf(obj) + 1; + if( idx < container.getFragments().size() ) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, obj, idx); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add"); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + + MStringModelFragment eObject = MFragmentFactory.INSTANCE.createStringModelFragment(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, eObject); + + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(eObject); + } + + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if( ! viewer.getSelection().isEmpty() ) { + List elements = ((IStructuredSelection)viewer.getSelection()).toList(); + + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, elements); + if( cmd.canExecute() ) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java new file mode 100644 index 0000000000..4152290714 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java @@ -0,0 +1,277 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EPackage; + +import java.util.ArrayList; +import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerComparator; + +import org.eclipse.e4.ui.model.fragment.MModelFragments; + +import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; + +import org.eclipse.e4.ui.model.fragment.MStringModelFragment; + +import org.eclipse.e4.ui.model.fragment.MFragmentFactory; + +import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VModelImportsEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private TableViewer viewer; + + public VModelImportsEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain, editor); + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "Imports"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Imports Bla Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if( composite == null ) { + context = new EMFDataBindingContext(); + composite = createForm(parent,context, getMaster()); + } + VirtualEntry o = (VirtualEntry)object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, + WritableValue master) { + parent = new Composite(parent,SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Imports"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + viewer.setContentProvider(new ObservableListContentProvider()); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 200; + viewer.getControl().setLayoutData(gd); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MModelFragments container = (MModelFragments) getMaster().getValue(); + int idx = container.getImports().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MModelFragments container = (MModelFragments) getMaster().getValue(); + int idx = container.getImports().indexOf(obj) + 1; + if (idx < container.getImports().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + FeatureClass eclass = (FeatureClass) element; + return eclass.label; + } + }); + childrenDropDown.setComparator(new ViewerComparator() { + @Override + public int compare(Viewer viewer, Object e1, Object e2) { + FeatureClass eClass1 = (FeatureClass) e1; + FeatureClass eClass2 = (FeatureClass) e2; + return eClass1.label.compareTo(eClass2.label); + } + }); + + List list = new ArrayList(); + addClasses(ApplicationPackageImpl.eINSTANCE, list); + list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS)); + + childrenDropDown.setInput(list); + childrenDropDown.getCombo().select(0); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + EClass eClass = ((FeatureClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement()).eClass; + EObject eObject = EcoreUtil.create(eClass); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(eObject); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List elements = ((IStructuredSelection) viewer.getSelection()).toList(); + + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, elements); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + return parent; + } + + public void addClasses(EPackage ePackage, List list) { + for (EClassifier c : ePackage.getEClassifiers()) { + if (c instanceof EClass) { + EClass eclass = (EClass) c; + if (eclass != ApplicationPackageImpl.Literals.APPLICATION && !eclass.isAbstract() && !eclass.isInterface() && eclass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT)) { + list.add(new FeatureClass(eclass.getName(), eclass)); + } + } + } + + for (EPackage eSubPackage : ePackage.getESubpackages()) { + addClasses(eSubPackage, list); + } + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java index 455c857ae8..aac36fea5c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java @@ -50,12 +50,10 @@ public class VPartDescriptor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private ModelEditor editor; private TableViewer viewer; public VPartDescriptor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain, editor); } @Override @@ -201,7 +199,7 @@ public void widgetSelected(SelectionEvent e) { if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(command); + getEditor().setSelection(command); } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java index 6ec691383a..e1edb402f7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java @@ -64,12 +64,10 @@ public class VToolBarContributionsEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private ModelEditor editor; private TableViewer viewer; public VToolBarContributionsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain, editor); } @Override @@ -224,7 +222,7 @@ public void widgetSelected(SelectionEvent e) { if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(command); + getEditor().setSelection(command); } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java index 245466d599..42b3bd4a4d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java @@ -68,12 +68,10 @@ public class VTrimContributionsEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private ModelEditor editor; private TableViewer viewer; public VTrimContributionsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); } @Override @@ -228,7 +226,7 @@ public void widgetSelected(SelectionEvent e) { if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(command); + getEditor().setSelection(command); } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index ac3be06810..12ce25b892 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -53,12 +53,10 @@ public class VWindowControlEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private ModelEditor editor; private TableViewer viewer; public VWindowControlEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); } @Override @@ -106,7 +104,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(editor)); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; @@ -213,7 +211,7 @@ public void widgetSelected(SelectionEvent e) { if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(eObject); + getEditor().setSelection(eObject); } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index 416b90ede2..3f358ad029 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -54,12 +54,10 @@ public class VWindowEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private ModelEditor editor; private TableViewer viewer; public VWindowEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); } @Override @@ -246,7 +244,7 @@ public void widgetSelected(SelectionEvent e) { if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); + getEditor().setSelection(handler); } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java index 6cfe2aa514..253f4fe051 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java @@ -57,12 +57,10 @@ public class VWindowSharedElementsEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private ModelEditor editor; private TableViewer viewer; public VWindowSharedElementsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); } @Override @@ -110,7 +108,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(editor)); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; @@ -215,7 +213,7 @@ public void widgetSelected(SelectionEvent e) { if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(eObject); + getEditor().setSelection(eObject); } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java index 50b959eee8..1d7ea1156f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -42,12 +42,10 @@ public class VWindowTrimEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private ModelEditor editor; private TableViewer viewer; public VWindowTrimEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain); - this.editor = editor; + super(editingDomain,editor); } @Override @@ -95,7 +93,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(editor)); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; @@ -122,7 +120,7 @@ public void widgetSelected(SelectionEvent e) { if( cmd.canExecute() ) { getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(handler); + getEditor().setSelection(handler); } } }); From 017c5f85ce8345b45398b6f3be867c1be42627c1 Mon Sep 17 00:00:00 2001 From: Paul Webster Date: Fri, 25 Jun 2010 17:55:10 +0000 Subject: [PATCH 0154/1286] Bug 318026 - support ability to uninject without specific context Just fixed the compile error --- .../compat/internal/ReflectionContributionFactory.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java index 1dce9b056a..9e4ed7f352 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java @@ -257,4 +257,10 @@ private URI(String uriString) { segments = uriString.substring(uriString.indexOf('/')+1).split("/"); } } + + public Object create(String uriString, IEclipseContext context, + IEclipseContext staticContext) { + // TODO Auto-generated method stub + return null; + } } From f9d939e2732e1b01bfa6c8e086cf8265e2c4bcf1 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 26 Jun 2010 13:03:44 +0000 Subject: [PATCH 0155/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixing problem with fragments (treats everything as import) * some minor layout improvements (everything right aligned) --- .../emf/editor3x/EditorProjectFunction.java | 5 +- .../META-INF/MANIFEST.MF | 3 +- .../e4/tools/emf/ui/common/ImageTooltip.java | 192 ++++++++++++ .../eclipse/e4/tools/emf/ui/common/Util.java | 8 + .../emf/ui/internal/common/ModelEditor.java | 91 +++--- .../common/component/AddonsEditor.java | 44 ++- .../common/component/ApplicationEditor.java | 1 + .../common/component/BindingTableEditor.java | 42 ++- .../common/component/CommandEditor.java | 42 ++- .../common/component/ControlFactory.java | 85 +++--- .../component/DirectMenuItemEditor.java | 1 + .../component/DirectToolItemEditor.java | 1 + .../component/HandledMenuItemEditor.java | 3 +- .../component/HandledToolItemEditor.java | 3 +- .../common/component/HandlerEditor.java | 42 ++- .../common/component/InputPartEditor.java | 1 + .../common/component/KeyBindingEditor.java | 42 ++- .../component/MenuContributionEditor.java | 42 ++- .../internal/common/component/MenuEditor.java | 42 ++- .../common/component/MenuItemEditor.java | 58 +++- .../common/component/MenuSeparatorEditor.java | 35 ++- .../component/ModelFragmentsEditor.java | 4 +- .../component/PartDescriptorEditor.java | 84 ++++- .../internal/common/component/PartEditor.java | 286 +++++++++++------- .../component/PartSashContainerEditor.java | 44 ++- .../common/component/PartStackEditor.java | 39 ++- .../common/component/PerspectiveEditor.java | 57 +++- .../component/PerspectiveStackEditor.java | 38 ++- .../common/component/PlaceholderEditor.java | 35 ++- .../common/component/StringModelFragment.java | 5 +- .../component/ToolBarContributionEditor.java | 41 ++- .../common/component/ToolBarEditor.java | 39 ++- .../component/ToolBarSeparatorEditor.java | 36 ++- .../common/component/ToolControlEditor.java | 39 ++- .../common/component/ToolItemEditor.java | 58 +++- .../common/component/TrimBarEditor.java | 42 ++- .../component/TrimContributionEditor.java | 42 ++- .../common/component/TrimmedWindowEditor.java | 17 ++ .../common/component/WindowEditor.java | 74 ++++- .../dialogs/FindImportElementDialog.java | 70 ++++- 40 files changed, 1512 insertions(+), 321 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java index 0544e40d45..c99606b515 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java @@ -10,7 +10,10 @@ public class EditorProjectFunction extends ContextFunction { @Override public Object compute(IEclipseContext context) { final IEditorInput input = context.get(IEditorInput.class); - return ((IFileEditorInput)input).getFile().getProject(); + if( input != null ) { + return ((IFileEditorInput)input).getFile().getProject(); + } + return null; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index b8003bef0b..bd341a4098 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -25,7 +25,8 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.e4.ui.services;bundle-version="0.9.1", org.eclipse.equinox.registry;bundle-version="3.5.0", org.eclipse.e4.core.contexts;bundle-version="0.9.0", - org.eclipse.e4.ui.di;bundle-version="0.9.0" + org.eclipse.e4.ui.di;bundle-version="0.9.0", + javax.annotation;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Import-Package: javax.inject;version="1.0.0", org.eclipse.core.runtime.jobs, diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java new file mode 100644 index 0000000000..87251ca5b5 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java @@ -0,0 +1,192 @@ +package org.eclipse.e4.tools.emf.ui.common; + +import java.io.FileNotFoundException; + +import java.text.DecimalFormat; + +import java.text.NumberFormat; + +import java.io.ByteArrayInputStream; + +import org.eclipse.swt.graphics.ImageData; + +import java.io.ByteArrayOutputStream; + +import org.eclipse.swt.layout.GridLayout; + +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.emf.common.util.URI; + +import org.eclipse.jface.resource.JFaceResources; + +import org.eclipse.swt.graphics.Image; + +import org.eclipse.swt.graphics.Font; + +import org.eclipse.swt.widgets.Label; + +import org.eclipse.swt.SWT; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; + +import org.eclipse.swt.widgets.Control; + +import org.eclipse.jface.window.ToolTip; + +public abstract class ImageTooltip extends ToolTip { + private Image image; + + public ImageTooltip(Control control) { + super(control); + + } + + @Override + protected boolean shouldCreateToolTip(Event event) { + if( getImageURI() != null ) { + return super.shouldCreateToolTip(event); + } + return false; + } + + @Override + protected Composite createToolTipContentArea(Event event, Composite parent) { + clearResources(); + parent = new Composite(parent, SWT.NONE); + parent.setBackground(event.widget.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); + parent.setBackgroundMode(SWT.INHERIT_DEFAULT); + parent.setLayout(new GridLayout(2, false)); + + URI uri = getImageURI(); + + if( uri != null ) { + int fileSize = -1; + ByteArrayOutputStream out = null; + InputStream stream = null; + InputStream bStream = null; + String errorMessage = ""; + try { + URL url = new URL(uri.toString()); + stream = url.openStream(); + + if( stream != null ) { + out = new ByteArrayOutputStream(); + byte[] buf = new byte[1024]; + int length; + while( ( length = stream.read(buf)) != -1 ) { + out.write(buf,0,length); + } + fileSize = out.size(); + bStream = new ByteArrayInputStream(out.toByteArray()); + image = new Image(parent.getDisplay(),bStream); + } + } catch (MalformedURLException e) { + errorMessage = e.getMessage(); + } catch (FileNotFoundException e) { + if( uri.isPlatform() ) { + errorMessage = "File '" + e.getMessage() + "' not found in bundle '"+uri.segment(1)+"'"; + } else { + errorMessage = e.getMessage(); + } + } catch (IOException e) { + errorMessage = e.getMessage(); + } catch(Exception e) { + errorMessage = e.getMessage(); + }finally { + if(out != null) { + try { + out.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + if( bStream != null ) { + try { + bStream.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + if( stream != null ) { + try { + stream.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + // --------------------------------- + Label l = new Label(parent, SWT.NONE); + l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); + l.setText("Icon:"); + + l = new Label(parent,SWT.NONE); + if( image == null ) { + System.err.println(errorMessage); + l.setText(errorMessage); + } else { + l.setImage(image); + } + + // --------------------------------- + + l = new Label(parent, SWT.NONE); + l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); + l.setText("Name:"); + + l = new Label(parent,SWT.NONE); + l.setText(uri.lastSegment()); + + // --------------------------------- + + l = new Label(parent, SWT.NONE); + l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); + l.setText("Dimensions:"); + + l = new Label(parent,SWT.NONE); + if( image != null ) { + l.setText(image.getBounds().width + "x" + image.getBounds().height+" px"); + } else { + l.setText("0x0 px"); + } + + + // --------------------------------- + + l = new Label(parent, SWT.NONE); + l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); + l.setText("File-Size:"); + + l = new Label(parent,SWT.NONE); + l.setText( new DecimalFormat("#,##0.00").format((fileSize / 1024.0)) + "KB" ); + } + + return parent; + } + + @Override + protected void afterHideToolTip(Event event) { + super.afterHideToolTip(event); + clearResources(); + } + + protected abstract URI getImageURI(); + + private void clearResources() { + if( image != null ) { + image.dispose(); + image = null; + } + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java index 06bdb50641..19d535ce1f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java @@ -1,7 +1,15 @@ package org.eclipse.e4.tools.emf.ui.common; +import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; + +import org.eclipse.emf.ecore.EObject; + public class Util { public static final boolean isNullOrEmpty(String element) { return element == null || element.trim().length() == 0; } + + public static final boolean isImport(EObject object) { + return object.eContainingFeature() == FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 278aca833d..0874d5b5b5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -10,51 +10,20 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; -import org.eclipse.e4.ui.model.fragment.MModelFragments; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelImportsEditor; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelFragmentsEditor; - -import org.eclipse.swt.graphics.Image; - -import org.eclipse.swt.widgets.ToolItem; - -import org.eclipse.swt.widgets.ToolBar; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.TrimContributionEditor; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VTrimContributionsEditor; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VToolBarContributionsEditor; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarContributionEditor; +import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowSharedElementsEditor; - -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; - -import org.eclipse.emf.ecore.EStructuralFeature; - -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.StringModelFragment; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.ModelFragmentsEditor; - -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuContributionEditor; +import javax.annotation.PostConstruct; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuContributionsEditor; +import org.eclipse.e4.ui.internal.workbench.E4XMIResource; -import org.eclipse.e4.ui.di.Focus; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.annotation.PreDestroy; import javax.inject.Inject; import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -76,6 +45,8 @@ import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.core.services.contributions.IContributionFactory; import org.eclipse.e4.tools.emf.ui.common.IEditorDescriptor; +import org.eclipse.e4.tools.emf.ui.common.IEditorFeature; +import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.ISelectionProviderService; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -91,8 +62,10 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.HandlerEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.InputPartEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.KeyBindingEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuContributionEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuSeparatorEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ModelFragmentsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PartDescriptorEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PartEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PartSashContainerEditor; @@ -100,31 +73,44 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.PerspectiveEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PerspectiveStackEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PlaceholderEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.StringModelFragment; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarContributionEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarSeparatorEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolControlEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.TrimBarEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.TrimContributionEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.TrimmedWindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VApplicationAddons; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VBindingTableEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VCommandEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuContributionsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelFragmentsEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelImportsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VToolBarContributionsEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VTrimContributionsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowControlEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowSharedElementsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor; +import org.eclipse.e4.ui.di.Focus; import org.eclipse.e4.ui.di.Persist; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.e4.ui.model.fragment.MModelFragments; +import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; @@ -182,15 +168,17 @@ public class ModelEditor { private IProject project; private ISelectionProviderService selectionService; private IEclipseContext context; - private Image toolmenuIcon; private boolean fragment; + @Inject + @Optional + private MPart editorPart; + public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project) { this.modelProvider = modelProvider; this.project = project; this.context = context; this.context.set(ModelEditor.class, this); - this.toolmenuIcon = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/headermenu.png")); registerDefaultEditors(); registerVirtualEditors(); @@ -234,15 +222,12 @@ public ModelEditor(Composite composite, IEclipseContext context, IModelResource final Label textLabel = new Label(headerContainer, SWT.NONE); textLabel.setData(CSS_CLASS_KEY, "sectionHeader"); //$NON-NLS-1$ textLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - -// ToolBar toolbar = new ToolBar(headerContainer, SWT.NONE); -// ToolItem item = new ToolItem(toolbar, SWT.PUSH); -// item.setImage(toolmenuIcon); - + final ScrolledComposite scrolling = new ScrolledComposite(editingArea, SWT.H_SCROLL | SWT.V_SCROLL); scrolling.setBackgroundMode(SWT.INHERIT_DEFAULT); scrolling.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ + final StackLayout layout = new StackLayout(); final Composite contentContainer = new Composite(scrolling, SWT.NONE); contentContainer.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ scrolling.setExpandHorizontal(true); @@ -251,13 +236,14 @@ public ModelEditor(Composite composite, IEclipseContext context, IModelResource scrolling.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { - Rectangle r = scrolling.getClientArea(); - scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); + if( layout.topControl != null ) { + Rectangle r = scrolling.getClientArea(); + scrolling.setMinSize(layout.topControl.computeSize(r.width, SWT.DEFAULT)); + } } }); scrolling.setLayoutData(new GridData(GridData.FILL_BOTH)); - final StackLayout layout = new StackLayout(); contentContainer.setLayout(layout); viewer.addSelectionChangedListener(new ISelectionChangedListener() { @@ -290,7 +276,9 @@ public void selectionChanged(SelectionChangedEvent event) { } Rectangle r = scrolling.getClientArea(); - scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); + scrolling.setMinSize(layout.topControl.computeSize(r.width, SWT.DEFAULT)); + scrolling.setOrigin(0, 0); + scrolling.layout(true,true); if (selectionService != null) { selectionService.setSelection(s.getFirstElement()); @@ -354,6 +342,10 @@ public boolean isModelFragment() { return fragment; } + public boolean isLiveModel() { + return ! modelProvider.isSaveable(); + } + public List getFeatureClasses(EClass eClass, EStructuralFeature feature) { List list = new ArrayList(); @@ -365,11 +357,10 @@ public List getFeatureClasses(EClass eClass, EStructuralFeature fe } @Inject - @Optional - public void setSelectionService(ISelectionProviderService selectionService) { + public void setSelectionService(@Optional ISelectionProviderService selectionService) { this.selectionService = selectionService; if (viewer != null && !viewer.getControl().isDisposed()) { - if (!viewer.getSelection().isEmpty()) { + if (!viewer.getSelection().isEmpty() && selectionService != null) { selectionService.setSelection(((IStructuredSelection) viewer.getSelection()).getFirstElement()); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index 71789db0e9..f6f381cf77 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -10,6 +10,14 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.core.databinding.observable.value.IObservableValue; + +import org.eclipse.e4.ui.model.application.ui.basic.MPart; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + +import org.eclipse.e4.tools.emf.ui.common.Util; + import org.eclipse.emf.ecore.EObject; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; @@ -47,6 +55,7 @@ public class AddonsEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IProject project; private Image image; + private StackLayout stackLayout; public AddonsEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain,editor); @@ -88,22 +97,45 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context); - } + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } + } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + getMaster().setValue(object); return composite; } - protected Composite createForm(Composite parent, EMFDataBindingContext context) { + protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { + if( getEditor().isModelFragment() && isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -111,6 +143,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) { Label l = new Label(parent, SWT.NONE); l.setText(Messages.AddonsEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -123,6 +156,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) { Label l = new Label(parent, SWT.NONE); l.setText(Messages.AddonsEditor_ClassURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 437ffc19ff..abdf91432c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -103,6 +103,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ApplicationEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index 37f11bcba6..bc93505433 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -10,6 +10,12 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.core.databinding.observable.value.IObservableValue; + +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.emf.ecore.EObject; @@ -65,6 +71,7 @@ public class BindingTableEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IListProperty BINDING_TABLE__BINDINGS = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS); + private StackLayout stackLayout; public BindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { @@ -99,28 +106,50 @@ public String getDescription(Object element) { public Composite getEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent, context); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context) { + private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } - { Label l = new Label(parent, SWT.NONE); l.setText(Messages.BindingTableEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -132,6 +161,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.BindingTableEditor_ContextId); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -145,7 +175,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.BindingTableEditor_Keybindings); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index af5c12abc0..5dabe39385 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -10,6 +10,12 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.core.databinding.observable.value.IObservableValue; + +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.emf.ecore.EObject; @@ -67,6 +73,7 @@ public class CommandEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; + private StackLayout stackLayout; public CommandEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain,editor); @@ -100,19 +107,42 @@ public String getDescription(Object element) { public Composite getEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent, context); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context) { + private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; @@ -121,6 +151,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.CommandEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -133,6 +164,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.CommandEditor_Name); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -145,7 +177,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.CommandEditor_LabelDescription); - l.setLayoutData(new GridData(GridData.BEGINNING,GridData.BEGINNING,false,false)); + l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); Text t = new Text(parent, SWT.BORDER|SWT.H_SCROLL|SWT.V_SCROLL); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -159,7 +191,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.CommandEditor_Parameters); - l.setLayoutData(new GridData(GridData.BEGINNING,GridData.BEGINNING,false,false)); + l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); final TableViewer viewer = new TableViewer(parent,SWT.FULL_SELECTION|SWT.MULTI|SWT.BORDER); ObservableListContentProvider cp = new ObservableListContentProvider(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index a8f99174ef..782a1f73e4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -87,38 +87,41 @@ public class ControlFactory { public static void createFindImport(Composite parent, final AbstractComponentEditor editor, EMFDataBindingContext context) { IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - + Label l = new Label(parent, SWT.NONE); - l.setText("Reference-Id"); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(editor.getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(editor.getMaster())); - - final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); - b.setText("Find ..."); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - FindImportElementDialog dialog = new FindImportElementDialog(b.getShell(), editor.getEditingDomain(), (EObject) editor.getMaster().getValue()); - dialog.open(); - } - }); + l.setText("Reference-Id"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(editor.getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(editor.getMaster())); + + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText("Find ..."); + b.setImage(editor.getImage(t.getDisplay(), AbstractComponentEditor.SEARCH_IMAGE)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FindImportElementDialog dialog = new FindImportElementDialog(b.getShell(), editor.getEditingDomain(), (EObject) editor.getMaster().getValue()); + dialog.open(); + } + }); } - + public static void createSelectedElement(Composite parent, final AbstractComponentEditor editor, final EMFDataBindingContext context, String label) { Label l = new Label(parent, SWT.NONE); l.setText(label); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); ComboViewer viewer = new ComboViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; viewer.getControl().setLayoutData(gd); IEMFEditListProperty listProp = EMFEditProperties.list(editor.getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); IEMFEditValueProperty labelProp = EMFEditProperties.value(editor.getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL); IEMFEditValueProperty idProp = EMFEditProperties.value(editor.getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - + IViewerValueProperty vProp = ViewerProperties.singleSelection(); final Binding[] binding = new Binding[1]; @@ -127,7 +130,7 @@ public static void createSelectedElement(Composite parent, final AbstractCompone editor.getMaster().addValueChangeListener(new IValueChangeListener() { public void handleValueChange(ValueChangeEvent event) { - if( binding[0] != null ) { + if (binding[0] != null) { binding[0].dispose(); } @@ -137,36 +140,33 @@ public void handleValueChange(ValueChangeEvent event) { final IObservableList list = listProp.observeDetail(editor.getMaster()); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - IObservableMap[] attributeMaps = { - labelProp.observeDetail(cp.getKnownElements()), - idProp.observeDetail(cp.getKnownElements()) - }; + IObservableMap[] attributeMaps = { labelProp.observeDetail(cp.getKnownElements()), idProp.observeDetail(cp.getKnownElements()) }; viewer.setLabelProvider(new ObservableMapLabelProvider(attributeMaps) { @Override public String getText(Object element) { EObject o = (EObject) element; String rv = o.eClass().getName(); - - if( element instanceof MUILabel ) { + + if (element instanceof MUILabel) { MUILabel label = (MUILabel) element; - if( ! Util.isNullOrEmpty(label.getLabel()) ) { - return rv + " - " + label.getLabel().trim(); + if (!Util.isNullOrEmpty(label.getLabel())) { + return rv + " - " + label.getLabel().trim(); } - + } - - if(element instanceof MApplicationElement) { + + if (element instanceof MApplicationElement) { MApplicationElement appEl = (MApplicationElement) element; - if( ! Util.isNullOrEmpty(appEl.getElementId()) ) { + if (!Util.isNullOrEmpty(appEl.getElementId())) { return rv + " - " + appEl.getElementId(); } } - - return rv + "["+list.indexOf(element)+"]"; + + return rv + "[" + list.indexOf(element) + "]"; } }); viewer.setInput(list); - + editor.getMaster().addValueChangeListener(new IValueChangeListener() { public void handleValueChange(ValueChangeEvent event) { @@ -174,11 +174,11 @@ public void handleValueChange(ValueChangeEvent event) { } }); } - + public static void createStringListWidget(Composite parent, final AbstractComponentEditor editor, String label, final EStructuralFeature feature) { Label l = new Label(parent, SWT.NONE); l.setText(label); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); final Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -298,12 +298,11 @@ public void widgetSelected(SelectionEvent e) { } }); } - - + public static void createVariablesWidget(Composite parent, final AbstractComponentEditor editor) { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ControlFactory_ContextVariables); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); final Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -427,7 +426,7 @@ public void widgetSelected(SelectionEvent e) { public static void createBindingsWidget(Composite parent, final AbstractComponentEditor editor) { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ControlFactory_BindingContexts); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); final Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -551,7 +550,7 @@ public void widgetSelected(SelectionEvent e) { public static void createTagsWidget(Composite parent, final AbstractComponentEditor editor) { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ControlFactory_Tags); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); final Text tagText = new Text(parent, SWT.BORDER); tagText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index fd3b66445e..7ebc2b32b6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -74,6 +74,7 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con { Label l = new Label(parent, SWT.NONE); l.setText(Messages.DirectMenuItemEditor_ClassURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index 6e46514585..43f64ed338 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -64,6 +64,7 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext Label l = new Label(parent, SWT.NONE); l.setText(Messages.DirectToolItemEditor_ClassURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index a8ef32c707..8ed2596dc2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -103,6 +103,7 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con { Label l = new Label(parent, SWT.NONE); l.setText(Messages.HandledMenuItemEditor_Command); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -126,7 +127,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.HandledMenuItemEditor_Parameters); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer tableviewer = new TableViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index 5f3d845cbe..e0eb7458f7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -92,6 +92,7 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext { Label l = new Label(parent, SWT.NONE); l.setText(Messages.HandledToolItemEditor_Command); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -115,7 +116,7 @@ public void widgetSelected(SelectionEvent e) { Label l = new Label(parent, SWT.NONE); l.setText(Messages.HandledToolItemEditor_Parameters); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer tableviewer = new TableViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index dce8bfc693..d0e07976e0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -10,6 +10,12 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.core.databinding.observable.value.IObservableValue; + +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.emf.ecore.EObject; @@ -52,6 +58,7 @@ public class HandlerEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IModelResource resource; private IProject project; + private StackLayout stackLayout; public HandlerEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource, IProject project) { super(editingDomain,editor); @@ -86,20 +93,42 @@ public String getDescription(Object element) { public Composite getEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent, context); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } + } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } } + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context) { + private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -108,7 +137,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.HandlerEditor_Id); - + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; @@ -120,6 +150,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.HandlerEditor_Command); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -143,6 +174,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.HandlerEditor_ClassURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java index 7119cc4e49..b1164d29fa 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java @@ -47,6 +47,7 @@ protected void createSubformElements(Composite parent, EMFDataBindingContext con { Label l = new Label(parent, SWT.NONE); l.setText(Messages.InputPartEditor_InputURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 4cdf045ece..f72445c709 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -10,6 +10,12 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.core.databinding.observable.value.IObservableValue; + +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.emf.ecore.EObject; @@ -69,6 +75,7 @@ public class KeyBindingEditor extends AbstractComponentEditor { private Image image; private EMFDataBindingContext context; private IModelResource resource; + private StackLayout stackLayout; public KeyBindingEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource) { super(editingDomain,editor); @@ -103,20 +110,42 @@ public String getDescription(Object element) { public Composite getEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent, context); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context) { + private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -125,6 +154,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.KeyBindingEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -137,6 +167,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.KeyBindingEditor_Sequence); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -149,6 +180,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.KeyBindingEditor_Command); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -170,7 +202,7 @@ public void widgetSelected(SelectionEvent e) { Label l = new Label(parent, SWT.NONE); l.setText(Messages.KeyBindingEditor_Parameters); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer tableviewer = new TableViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index 9629abd00a..d4f8ea5f5a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -10,6 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.emf.ecore.EObject; @@ -83,6 +87,7 @@ public class MenuContributionEditor extends AbstractComponentEditor { private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + private StackLayout stackLayout; private static class Struct { private final String label; @@ -132,22 +137,44 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } + } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } } + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context2, WritableValue master) { + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -156,6 +183,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuContributionEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -168,6 +196,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuContributionEditor_ParentId); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -180,6 +209,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuContributionEditor_Position); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -193,7 +223,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuContributionEditor_MenuItems); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index a4958d5b39..266b9ff1a1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -10,6 +10,12 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; +import org.eclipse.e4.ui.model.application.ui.MUILabel; +import org.eclipse.emf.common.util.URI; + +import org.eclipse.e4.tools.emf.ui.common.Util; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import java.net.MalformedURLException; @@ -124,12 +130,17 @@ public Composite getEditor(Composite parent, Object object) { stackLayout = new StackLayout(); composite.setLayout(stackLayout); - createForm(composite, context, getMaster(),false); - createForm(composite, context, getMaster(),true); + createForm(composite, context, getMaster(),false,false); + createForm(composite, context, getMaster(),true,false); + if( getEditor().isModelFragment() ) { + createForm(composite, context, getMaster(),false,true); + } } EObject o = (EObject) object; Control topControl; - if( o.eContainer() instanceof MWindow || o.eContainer() == null ) { + if( Util.isImport(o) && getEditor().isModelFragment() ) { + topControl = composite.getChildren()[2]; + } else if( o.eContainer() instanceof MWindow || o.eContainer() == null ) { topControl = composite.getChildren()[1]; } else { topControl = composite.getChildren()[0]; @@ -144,14 +155,13 @@ public Composite getEditor(Composite parent, Object object) { return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean rootMenu) { + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean rootMenu, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -160,6 +170,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -173,6 +184,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuEditor_LabelLabel); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -186,6 +198,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuEditor_Tooltip); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -199,11 +212,26 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuEditor_IconURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + new ImageTooltip(t) { + + @Override + protected URI getImageURI() { + MUILabel part = (MUILabel) getMaster().getValue(); + String uri = part.getIconURI(); + if( uri == null || uri.trim().length() == 0 ) { + return null; + } + return URI.createURI(part.getIconURI()); + } + }; + + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText(Messages.MenuItemEditor_Find); @@ -220,7 +248,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuEditor_MenuItems); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index a8b4c89f36..6a187edef1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -10,6 +10,14 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; +import org.eclipse.emf.common.util.URI; + +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.core.databinding.conversion.Converter; import org.eclipse.core.databinding.UpdateValueStrategy; @@ -61,6 +69,7 @@ public abstract class MenuItemEditor extends AbstractComponentEditor { private Image menuImage; private EMFDataBindingContext context; protected IProject project; + private StackLayout stackLayout; public MenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain,editor); @@ -85,13 +94,36 @@ public Image getImage(Object element, Display display) { public Composite getEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); @@ -99,7 +131,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty checkProp = WidgetProperties.selection(); IWidgetValueProperty enabled = WidgetProperties.enabled(); - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -108,6 +140,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuItemEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -121,6 +154,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuItemEditor_Type); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); ComboViewer viewer = new ComboViewer(parent); viewer.setContentProvider(new ArrayContentProvider()); @@ -137,6 +171,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuItemEditor_Label); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -149,6 +184,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuItemEditor_Tooltip); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -161,11 +197,25 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuItemEditor_IconURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + new ImageTooltip(t) { + + @Override + protected URI getImageURI() { + MUILabel part = (MUILabel) getMaster().getValue(); + String uri = part.getIconURI(); + if( uri == null || uri.trim().length() == 0 ) { + return null; + } + return URI.createURI(part.getIconURI()); + } + }; + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText(Messages.MenuItemEditor_Find); @@ -181,6 +231,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText("Enabled"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Button b = new Button(parent, SWT.CHECK); b.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); @@ -190,6 +241,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText("Selected"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Button b = new Button(parent, SWT.CHECK); b.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index 4040f05fce..dbc90e44f1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -10,6 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.emf.ecore.EObject; import org.eclipse.swt.events.SelectionAdapter; @@ -43,6 +47,7 @@ public class MenuSeparatorEditor extends AbstractComponentEditor { private Image separatorImage; private Composite composite; private EMFDataBindingContext context; + private StackLayout stackLayout; public MenuSeparatorEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain,editor); @@ -81,19 +86,42 @@ public String getDescription(Object element) { public Composite getEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -102,6 +130,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuSeparatorEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java index dd21635a31..708cd12b60 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java @@ -122,7 +122,7 @@ private Composite createForm(Composite parent) { { Label l = new Label(parent, SWT.NONE); l.setText("Imports"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); @@ -263,7 +263,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ModelFragmentsEditor_ModelFragments); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 9b569d1583..fe58797890 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -10,6 +10,16 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.ui.model.application.ui.MUILabel; + +import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; +import org.eclipse.emf.common.util.URI; + +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.emf.ecore.EObject; @@ -79,6 +89,7 @@ public class PartDescriptorEditor extends AbstractComponentEditor { private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); private IValueProperty PART__TOOLBAR = EMFProperties.value(BasicPackageImpl.Literals.PART_DESCRIPTOR__TOOLBAR); private Button createRemoveToolBar; + private StackLayout stackLayout; public PartDescriptorEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain,editor); @@ -111,23 +122,49 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } + } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + + if (createRemoveToolBar != null) { + createRemoveToolBar.setSelection(((MPartDescriptor) object).getToolbar() != null); } + getMaster().setValue(object); - createRemoveToolBar.setSelection(((MPartDescriptor)object).getToolbar() != null); return composite; } - protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master) { + protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -137,6 +174,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartDescriptorEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -149,6 +187,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartDescriptorEditor_LabelLabel); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -161,7 +200,8 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartDescriptorEditor_Tooltip); - + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; @@ -173,11 +213,25 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartDescriptorEditor_IconURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + new ImageTooltip(t) { + + @Override + protected URI getImageURI() { + MUILabel part = (MUILabel) getMaster().getValue(); + String uri = part.getIconURI(); + if( uri == null || uri.trim().length() == 0 ) { + return null; + } + return URI.createURI(part.getIconURI()); + } + }; + final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText(Messages.PartDescriptorEditor_Find); @@ -194,6 +248,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartDescriptorEditor_ClassURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -215,6 +270,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartEditor_ToolBar); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); createRemoveToolBar = new Button(parent, SWT.CHECK); createRemoveToolBar.addSelectionListener(new SelectionAdapter() { @@ -235,6 +291,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartDescriptorEditor_ContainerData); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -247,6 +304,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartDescriptorEditor_Dirtyable); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Button checkbox = new Button(parent, SWT.CHECK); checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); @@ -262,6 +320,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartDescriptorEditor_Closeable); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Button checkbox = new Button(parent, SWT.CHECK); checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); @@ -276,6 +335,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartDescriptorEditor_Multiple); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Button checkbox = new Button(parent, SWT.CHECK); checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); @@ -290,6 +350,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartDescriptorEditor_Category); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL,GridData.BEGINNING, true, false, 2, 1)); @@ -300,7 +361,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartDescriptorEditor_PersitedState); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); TableViewer tableviewer = new TableViewer(parent); tableviewer.getTable().setHeaderVisible(true); @@ -362,7 +423,7 @@ public String getText(Object element) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartDescriptorEditor_Variables); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); ListViewer viewer = new ListViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -375,7 +436,7 @@ public String getText(Object element) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartDescriptorEditor_Properties); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); TableViewer tableviewer = new TableViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -418,6 +479,11 @@ private void removeToolBar() { @Override public IObservableList getChildList(final Object element) { final WritableList list = new WritableList(); + + if( getEditor().isModelFragment() && Util.isImport((EObject) element) ) { + return list; + } + list.add(new VirtualEntry( ModelEditor.VIRTUAL_PARTDESCRIPTOR_MENU, PART__MENUS, element, Messages.PartDescriptorEditor_Menus) { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index f3d49c0aeb..d5f54996e9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -10,6 +10,26 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.ui.model.application.ui.MUILabel; + +import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; + +import java.io.InputStream; + +import java.io.IOException; + +import org.eclipse.emf.common.util.URI; + +import org.eclipse.swt.widgets.Event; + +import org.eclipse.jface.window.DefaultToolTip; + +import org.eclipse.swt.widgets.Control; + +import org.eclipse.e4.tools.emf.ui.common.Util; + +import org.eclipse.swt.custom.StackLayout; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.emf.ecore.EObject; @@ -84,16 +104,16 @@ public class PartEditor extends AbstractComponentEditor { private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); private IValueProperty PART__TOOLBAR = EMFProperties.value(BasicPackageImpl.Literals.PART__TOOLBAR); private Button createRemoveToolBar; - + private StackLayout stackLayout; public PartEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain,editor); + super(editingDomain, editor); this.project = project; } @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { @@ -117,78 +137,122 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } + } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + + if (createRemoveToolBar != null) { + createRemoveToolBar.setSelection(((MPart) object).getToolbar() != null); } + getMaster().setValue(object); - createRemoveToolBar.setSelection(((MPart)object).getToolbar() != null); + return composite; } - protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master) { - parent = new Composite(parent,SWT.NONE); + protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { + parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - + if( isImport ) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartEditor_Id); - + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartEditor_LabelLabel); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartEditor_Tooltip); - + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartEditor_IconURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - Text t = new Text(parent, SWT.BORDER); + final Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + new ImageTooltip(t) { + + @Override + protected URI getImageURI() { + MUILabel part = (MUILabel) getMaster().getValue(); + String uri = part.getIconURI(); + if( uri == null || uri.trim().length() == 0 ) { + return null; + } + return URI.createURI(part.getIconURI()); + } + }; + + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText(Messages.PartEditor_Find); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - PartIconDialogEditor dialog = new PartIconDialogEditor(b.getShell(), project,getEditingDomain(),(MPart) getMaster().getValue()); + PartIconDialogEditor dialog = new PartIconDialogEditor(b.getShell(), project, getEditingDomain(), (MPart) getMaster().getValue()); dialog.open(); } }); @@ -198,115 +262,122 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartEditor_ClassURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); - final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText(Messages.PartEditor_Find); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); dialog.open(); } }); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartEditor_ToolBar); - + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + createRemoveToolBar = new Button(parent, SWT.CHECK); createRemoveToolBar.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { MPart window = (MPart) getMaster().getValue(); - if( window.getToolbar() == null ) { + if (window.getToolbar() == null) { addToolBar(); } else { removeToolBar(); } } }); - createRemoveToolBar.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); + createRemoveToolBar.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartEditor_ContainerData); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); } - + createSubformElements(parent, context, master); - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartEditor_Closeable); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Button checkbox = new Button(parent, SWT.CHECK); checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); - + IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART__CLOSEABLE); IWidgetValueProperty uiProp = WidgetProperties.selection(); - + context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); } // ------------------------------------------------------------ ControlFactory.createBindingsWidget(parent, this); -//TODO Does the user need to edit this? -// // ------------------------------------------------------------ -// { -// Label l = new Label(parent, SWT.NONE); -// l.setText("Variables"); -// l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); -// -// ListViewer viewer = new ListViewer(parent); -// GridData gd = new GridData(GridData.FILL_HORIZONTAL); -// gd.horizontalSpan=2; -// gd.heightHint = 80; -// viewer.getList().setLayoutData(gd); -// } - -// // ------------------------------------------------------------ -// { -// Label l = new Label(parent, SWT.NONE); -// l.setText("Properties"); -// l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); -// -// TableViewer tableviewer = new TableViewer(parent); -// GridData gd = new GridData(GridData.FILL_HORIZONTAL); -// gd.horizontalSpan=2; -// gd.heightHint = 80; -// tableviewer.getTable().setHeaderVisible(true); -// tableviewer.getControl().setLayoutData(gd); -// -// TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); -// column.getColumn().setText("Key"); -// column.getColumn().setWidth(200); -// -// column = new TableViewerColumn(tableviewer, SWT.NONE); -// column.getColumn().setText("Value"); -// column.getColumn().setWidth(200); -// } + // TODO Does the user need to edit this? + // // ------------------------------------------------------------ + // { + // Label l = new Label(parent, SWT.NONE); + // l.setText("Variables"); + // l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, + // false, false)); + // + // ListViewer viewer = new ListViewer(parent); + // GridData gd = new GridData(GridData.FILL_HORIZONTAL); + // gd.horizontalSpan=2; + // gd.heightHint = 80; + // viewer.getList().setLayoutData(gd); + // } + + // // ------------------------------------------------------------ + // { + // Label l = new Label(parent, SWT.NONE); + // l.setText("Properties"); + // l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, + // false, false)); + // + // TableViewer tableviewer = new TableViewer(parent); + // GridData gd = new GridData(GridData.FILL_HORIZONTAL); + // gd.horizontalSpan=2; + // gd.heightHint = 80; + // tableviewer.getTable().setHeaderVisible(true); + // tableviewer.getControl().setLayoutData(gd); + // + // TableViewerColumn column = new TableViewerColumn(tableviewer, + // SWT.NONE); + // column.getColumn().setText("Key"); + // column.getColumn().setWidth(200); + // + // column = new TableViewerColumn(tableviewer, SWT.NONE); + // column.getColumn().setText("Value"); + // column.getColumn().setWidth(200); + // } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartEditor_PersitedState); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); TableViewer tableviewer = new TableViewer(parent); tableviewer.getTable().setHeaderVisible(true); @@ -315,7 +386,7 @@ public void widgetSelected(SelectionEvent e) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 80; tableviewer.getControl().setLayoutData(gd); - + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); column.getColumn().setText(Messages.PartEditor_PersitedStateKey); column.getColumn().setWidth(200); @@ -326,9 +397,9 @@ public String getText(Object element) { Entry entry = (Entry) element; return entry.getKey(); } - }); + }); - //FIXME How can we react upon changes in the Map-Value? + // FIXME How can we react upon changes in the Map-Value? column = new TableViewerColumn(tableviewer, SWT.NONE); column.getColumn().setText(Messages.PartEditor_PersitedStateValue); column.getColumn().setWidth(200); @@ -340,17 +411,17 @@ public String getText(Object element) { return entry.getValue(); } }); - + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE); tableviewer.setInput(prop.observeDetail(getMaster())); - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); @@ -369,30 +440,35 @@ public String getText(Object element) { return parent; } - + private void addToolBar() { MToolBar menu = MMenuFactory.INSTANCE.createToolBar(); Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART__TOOLBAR, menu); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } - + private void removeToolBar() { Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART__TOOLBAR, null); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } - + protected void createSubformElements(Composite parent, EMFDataBindingContext context, IObservableValue master) { - + } @Override public IObservableList getChildList(Object element) { final WritableList list = new WritableList(); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART_MENU, PART__MENUS, element, Messages.PartEditor_Menus) { + + if( getEditor().isModelFragment() && Util.isImport((EObject) element) ) { + return list; + } + + list.add(new VirtualEntry(ModelEditor.VIRTUAL_PART_MENU, PART__MENUS, element, Messages.PartEditor_Menus) { @Override protected boolean accepted(Object o) { @@ -401,7 +477,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.PartEditor_Handlers) { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.PartEditor_Handlers) { @Override protected boolean accepted(Object o) { @@ -409,22 +485,22 @@ protected boolean accepted(Object o) { } }); - + MPart window = (MPart) element; - if( window.getToolbar() != null ) { - list.add(0,window.getToolbar()); + if (window.getToolbar() != null) { + list.add(0, window.getToolbar()); } - + PART__TOOLBAR.observe(element).addValueChangeListener(new IValueChangeListener() { - + public void handleValueChange(ValueChangeEvent event) { - if( event.diff.getOldValue() != null ) { + if (event.diff.getOldValue() != null) { list.remove(event.diff.getOldValue()); createRemoveToolBar.setSelection(false); } - - if( event.diff.getNewValue() != null ) { - list.add(0,event.diff.getNewValue()); + + if (event.diff.getNewValue() != null) { + list.add(0, event.diff.getNewValue()); createRemoveToolBar.setSelection(true); } } @@ -441,8 +517,6 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { - FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) - }; + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index f1384ba72c..a5b691fbed 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -10,6 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; @@ -80,6 +84,7 @@ public class PartSashContainerEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + private StackLayout stackLayout; public PartSashContainerEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain,editor); @@ -126,22 +131,45 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } + } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } } + getMaster().setValue(object); return composite; } private Composite createForm(Composite parent, final EMFDataBindingContext context, - WritableValue master) { + WritableValue master, boolean isImport) { parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -150,6 +178,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartSashContainerEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -162,7 +191,8 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartSashContainerEditor_Orientation); - + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + ComboViewer viewer = new ComboViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; @@ -185,6 +215,7 @@ public String getText(Object element) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartSashContainerEditor_ContainerData); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -198,7 +229,7 @@ public String getText(Object element) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartSashContainerEditor_Controls); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); final TableViewer viewer = new TableViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -342,7 +373,6 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { - // TODO Auto-generated method stub return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 43567b2b24..7d66d1efea 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -10,6 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; @@ -77,6 +81,7 @@ public class PartStackEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + private StackLayout stackLayout; public PartStackEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain,editor); @@ -108,22 +113,45 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } + } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } } + getMaster().setValue(object); return composite; } private Composite createForm(Composite parent, final EMFDataBindingContext context, - WritableValue master) { + WritableValue master, boolean isImport) { parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -132,6 +160,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartStackEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -146,6 +175,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartStackEditor_ContainerData); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -158,6 +188,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartStackEditor_Parts); + l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 3a2798ef8b..19385e282d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -10,6 +10,14 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; +import org.eclipse.e4.ui.model.application.ui.MUILabel; +import org.eclipse.emf.common.util.URI; + +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import java.net.MalformedURLException; @@ -80,6 +88,7 @@ public class PerspectiveEditor extends AbstractComponentEditor { private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + private StackLayout stackLayout; public PerspectiveEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { super(editingDomain,editor); @@ -131,19 +140,42 @@ public String getDescription(Object element) { public Composite getEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master) { + private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -152,6 +184,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PerspectiveEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -166,6 +199,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PerspectiveEditor_LabelLabel); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -178,6 +212,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PerspectiveEditor_Tooltip); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -190,11 +225,25 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PerspectiveEditor_IconURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + new ImageTooltip(t) { + + @Override + protected URI getImageURI() { + MUILabel part = (MUILabel) getMaster().getValue(); + String uri = part.getIconURI(); + if( uri == null || uri.trim().length() == 0 ) { + return null; + } + return URI.createURI(part.getIconURI()); + } + }; + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.PerspectiveEditor_Find); b.addSelectionListener(new SelectionAdapter() { @@ -209,7 +258,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PerspectiveEditor_Controls); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); final TableViewer viewer = new TableViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index a133dd158a..fc674650e3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -10,6 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.emf.ecore.EObject; @@ -71,6 +75,7 @@ public class PerspectiveStackEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + private StackLayout stackLayout; public PerspectiveStackEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain,editor); @@ -107,22 +112,45 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } + } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } } + getMaster().setValue(object); return composite; } private Composite createForm(Composite parent, final EMFDataBindingContext context, - WritableValue master) { + WritableValue master, boolean isImport) { parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -131,6 +159,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PerspectiveStackEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -145,6 +174,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PerspectiveStackEditor_Perspectives); + l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index d721775c86..57ee751b5b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.ui.workbench.UIEvents.UIElement; @@ -69,6 +72,7 @@ public class PlaceholderEditor extends AbstractComponentEditor { private Image image; private EMFDataBindingContext context; private IModelResource resource; + private StackLayout stackLayout; public PlaceholderEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource) { super(editingDomain,editor); @@ -133,19 +137,42 @@ public String getDescription(Object element) { public Composite getEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } + } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } } + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master) { + private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -154,6 +181,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PlaceholderEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -166,6 +194,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte { Label l = new Label(parent, SWT.NONE); l.setText("Reference"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setEditable(false); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index 363b921867..0bc7185bda 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -142,6 +142,7 @@ private Composite createForm(Composite parent) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.StringModelFragment_ParentId); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -153,6 +154,7 @@ private Composite createForm(Composite parent) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.StringModelFragment_Featurename); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Composite comp = new Composite(parent, SWT.NONE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -184,6 +186,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.StringModelFragment_PositionInList); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -196,7 +199,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.StringModelFragment_Elements); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index c8ab8ba3b2..4887cdf1f0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -10,6 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.emf.ecore.EObject; @@ -85,6 +89,7 @@ public class ToolBarContributionEditor extends AbstractComponentEditor { private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + private StackLayout stackLayout; private static class Struct { private final String label; @@ -134,21 +139,44 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context2, WritableValue master) { + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -157,6 +185,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuContributionEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -169,6 +198,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuContributionEditor_ParentId); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -181,6 +211,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuContributionEditor_Position); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -194,7 +225,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ToolBarEditor_ToolbarItems); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 99c10786cc..41e114f6af 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -10,6 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.emf.ecore.EObject; @@ -71,6 +75,7 @@ public class ToolBarEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + private StackLayout stackLayout; private static class Struct { private final String label; @@ -114,21 +119,44 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -137,6 +165,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ToolBarEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -149,7 +178,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ToolBarEditor_ToolbarItems); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index 84d9570547..47a639ef7a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -10,6 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.emf.ecore.EObject; import org.eclipse.swt.events.SelectionAdapter; @@ -43,6 +47,7 @@ public class ToolBarSeparatorEditor extends AbstractComponentEditor { private Image separatorImage; private Composite composite; private EMFDataBindingContext context; + private StackLayout stackLayout; public ToolBarSeparatorEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain,editor); @@ -81,19 +86,42 @@ public String getDescription(Object element) { public Composite getEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -102,6 +130,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ToolBarSeparatorEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -115,7 +144,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index 7f9674c263..dcc8a364d0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -10,6 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.emf.ecore.EObject; @@ -53,6 +57,7 @@ public class ToolControlEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private Composite composite; private IProject project; + private StackLayout stackLayout; public ToolControlEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain,editor); @@ -93,18 +98,42 @@ public String getDetailLabel(Object element) { public Composite getEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context2, WritableValue master) { + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { + + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -113,6 +142,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ToolControlEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -125,6 +155,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ToolControlEditor_ClassURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -146,7 +177,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText("Persited State"); - l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); TableViewer tableviewer = new TableViewer(parent); tableviewer.getTable().setHeaderVisible(true); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 0abd550d1e..8376509aad 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -10,6 +10,14 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; +import org.eclipse.e4.ui.model.application.ui.MUILabel; +import org.eclipse.emf.common.util.URI; + +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.conversion.Converter; @@ -53,6 +61,7 @@ public abstract class ToolItemEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; protected IProject project; + private StackLayout stackLayout; public ToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain, editor); @@ -63,25 +72,49 @@ public ToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject public Composite getEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } + } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } } + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } Label l = new Label(parent, SWT.NONE); l.setText("Id"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -103,6 +136,7 @@ private void createFormSubTypeForm(Composite parent, EMFDataBindingContext conte { Label l = new Label(parent, SWT.NONE); l.setText("Type"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); ComboViewer viewer = new ComboViewer(parent); viewer.setContentProvider(new ArrayContentProvider()); @@ -118,6 +152,7 @@ private void createFormSubTypeForm(Composite parent, EMFDataBindingContext conte { Label l = new Label(parent, SWT.NONE); l.setText("Label"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -130,6 +165,7 @@ private void createFormSubTypeForm(Composite parent, EMFDataBindingContext conte { Label l = new Label(parent, SWT.NONE); l.setText("Tooltip"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -142,11 +178,25 @@ private void createFormSubTypeForm(Composite parent, EMFDataBindingContext conte { Label l = new Label(parent, SWT.NONE); l.setText("Icon URI"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + new ImageTooltip(t) { + + @Override + protected URI getImageURI() { + MUILabel part = (MUILabel) getMaster().getValue(); + String uri = part.getIconURI(); + if( uri == null || uri.trim().length() == 0 ) { + return null; + } + return URI.createURI(part.getIconURI()); + } + }; + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText("Find ..."); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); @@ -163,6 +213,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText("Enabled"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Button b = new Button(parent, SWT.CHECK); b.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); @@ -172,6 +223,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText("Selected"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Button b = new Button(parent, SWT.CHECK); b.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index 8b9c1af94d..21a5ad7375 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -10,6 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.emf.ecore.util.EcoreUtil; @@ -78,6 +82,7 @@ public class TrimBarEditor extends AbstractComponentEditor { private ModelEditor editor; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + private StackLayout stackLayout; public TrimBarEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain,editor); @@ -110,22 +115,45 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } + } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } } + getMaster().setValue(object); return composite; } private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { + WritableValue master, boolean isImport) { parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -134,7 +162,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); l.setText("Id"); - + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; @@ -146,6 +175,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); l.setText("Side"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); ComboViewer viewer = new ComboViewer(parent); viewer.setContentProvider(new ArrayContentProvider()); @@ -161,7 +191,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); l.setText("Controls"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); final TableViewer viewer = new TableViewer(parent); viewer.setLabelProvider(new ComponentLabelProvider(editor)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index 3f1cf15d35..55bbf9d60b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -10,6 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.emf.ecore.EObject; @@ -89,6 +93,7 @@ public class TrimContributionEditor extends AbstractComponentEditor { private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + private StackLayout stackLayout; private static class Struct { private final String label; @@ -138,20 +143,44 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context2, WritableValue master) { + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { + + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -160,6 +189,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuContributionEditor_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -172,6 +202,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuContributionEditor_ParentId); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -184,6 +215,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuContributionEditor_Position); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -197,7 +229,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context2, W { Label l = new Label(parent, SWT.NONE); l.setText("Controls"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); final TableViewer viewer = new TableViewer(parent); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java index 9e81ea8c1e..b00e589e71 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java @@ -1,5 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.emf.ecore.EObject; + import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.resources.IProject; @@ -19,6 +32,10 @@ public TrimmedWindowEditor(EditingDomain editingDomain, ModelEditor editor, IPro public IObservableList getChildList(Object element) { IObservableList list = super.getChildList(element); + if( getEditor().isModelFragment() && Util.isImport((EObject) element) ) { + return list; + } + list.add(new VirtualEntry( ModelEditor.VIRTUAL_TRIMMED_WINDOW_TRIMS, TRIMMED_WINDOW__TRIM_BARS, element, "TrimBars") { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 795032b3df..44363b33a2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -10,6 +10,14 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; +import org.eclipse.e4.ui.model.application.ui.MUILabel; +import org.eclipse.emf.common.util.URI; + +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.widgets.Control; + import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.emf.ecore.EObject; @@ -76,7 +84,8 @@ public class WindowEditor extends AbstractComponentEditor { private IValueProperty WINDOW__MAIN_MENU = EMFProperties.value(BasicPackageImpl.Literals.WINDOW__MAIN_MENU); private Action addMainMenu; - private Button createRemoveMainMenu; + private Button createRemoveMainMenu; + private StackLayout stackLayout; public WindowEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain,editor); @@ -115,23 +124,50 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new StackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } + } + + if( getEditor().isModelFragment() ) { + Control topControl; + if( Util.isImport((EObject) object) ) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if( stackLayout.topControl != topControl ) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + + if( createRemoveMainMenu != null ) { + createRemoveMainMenu.setSelection(((MWindow)object).getMainMenu() != null); } + getMaster().setValue(object); - createRemoveMainMenu.setSelection(((MWindow)object).getMainMenu() != null); + return composite; } private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { + WritableValue master, boolean isImport) { parent = new Composite(parent,SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( getEditor().isModelFragment() ) { + if( isImport ) { ControlFactory.createFindImport(parent, this, context); return parent; } @@ -140,6 +176,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); l.setText("Id"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -152,6 +189,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); l.setText("X"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -164,6 +202,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); l.setText("Y"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -176,6 +215,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); l.setText("Width"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -188,6 +228,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); l.setText("Height"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -200,6 +241,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); l.setText("Label"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -212,6 +254,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); l.setText("Tooltip"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -224,11 +267,25 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); l.setText("Icon URI"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + new ImageTooltip(t) { + + @Override + protected URI getImageURI() { + MUILabel part = (MUILabel) getMaster().getValue(); + String uri = part.getIconURI(); + if( uri == null || uri.trim().length() == 0 ) { + return null; + } + return URI.createURI(part.getIconURI()); + } + }; + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText("Find ..."); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); @@ -245,6 +302,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText("Main Menu"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); createRemoveMainMenu = new Button(parent, SWT.CHECK); createRemoveMainMenu.addSelectionListener(new SelectionAdapter() { @@ -287,6 +345,10 @@ void addMenu() { @Override public IObservableList getChildList(final Object element) { final WritableList list = new WritableList(); + if( getEditor().isModelFragment() && Util.isImport((EObject) element) ) { + return list; + } + list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java index 5ad34a9763..9a508b9271 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java @@ -1,5 +1,29 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; +import org.eclipse.jface.viewers.TableViewer; + +import org.eclipse.e4.ui.model.application.MApplication; + +import org.eclipse.swt.widgets.Button; + +import org.eclipse.swt.widgets.Text; + +import org.eclipse.swt.layout.GridLayout; + +import org.eclipse.swt.widgets.Label; + +import org.eclipse.swt.layout.GridData; + +import org.eclipse.swt.SWT; + +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; + +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; + +import org.eclipse.swt.graphics.Image; + import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -12,15 +36,59 @@ import org.eclipse.jface.dialogs.TitleAreaDialog; public class FindImportElementDialog extends TitleAreaDialog { + private MApplication runningApp; - public FindImportElementDialog(Shell parentShell, EditingDomain domain, EObject element) { + public FindImportElementDialog(Shell parentShell, EditingDomain domain, EObject element/*, MApplication runningApp*/) { super(parentShell); + this.runningApp = runningApp; } @Override protected Control createDialogArea(Composite parent) { Composite comp = (Composite) super.createDialogArea(parent); + final Image titleImage = new Image(parent.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/import_wiz.png")); + setTitleImage(titleImage); + getShell().addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + titleImage.dispose(); + } + }); + + getShell().setText("Find Import Elements"); + setTitle("Find Import Elements"); + setMessage("Search for an elements whose ID you'd like to import"); + + Composite container = new Composite(comp,SWT.NONE); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + container.setLayout(new GridLayout(3, false)); + + + Label l = new Label(container, SWT.NONE); + l.setText("Search"); + + final Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + searchText.setLayoutData(gd); + + new Label(container, SWT.NONE); + + l = new Label(container, SWT.NONE); + l.setText("File"); + + Text t = new Text(container, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + t.setText("memory://running-model"); + + Button b = new Button(container, SWT.PUSH); + b.setText("Browse"); + + l = new Label(container, SWT.PUSH); + + TableViewer viewer = new TableViewer(container); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + return comp; } } \ No newline at end of file From 2f659cf957a5585bf35da2f2440383c56521f618 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 26 Jun 2010 14:41:06 +0000 Subject: [PATCH 0156/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * more accurate stack layout --- .../e4/tools/emf/ui/common/EStackLayout.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/EStackLayout.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/EStackLayout.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/EStackLayout.java new file mode 100644 index 0000000000..2b3b836c24 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/EStackLayout.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.common; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Composite; + +import org.eclipse.swt.custom.StackLayout; + +public class EStackLayout extends StackLayout { + private boolean onlyVisible; + + public EStackLayout() { + this(true); + } + + public EStackLayout(boolean onlyVisible) { + this.onlyVisible = onlyVisible; + } + + @Override + protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) { + if( topControl != null && onlyVisible ) { + int maxWidth = 0; + int maxHeight = 0; + Point size = topControl.computeSize(wHint, hHint, flushCache); + maxWidth = Math.max(size.x, maxWidth); + maxHeight = Math.max(size.y, maxHeight); + int width = maxWidth + 2 * marginWidth; + int height = maxHeight + 2 * marginHeight; + if (wHint != SWT.DEFAULT) width = wHint; + if (hHint != SWT.DEFAULT) height = hHint; + return new Point(width, height); + } + return super.computeSize(composite, wHint, hHint, flushCache); + } +} From 2ab58a4fa6831aff5ea53810158bc7e8504aa469 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 26 Jun 2010 15:17:28 +0000 Subject: [PATCH 0157/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed minor layout tweaks --- .../.settings/org.eclipse.jdt.ui.prefs | 55 ++++- .../e4/tools/emf/ui/internal/Messages.java | 67 +++--- .../tools/emf/ui/internal/Messages.properties | 2 + .../emf/ui/internal/common/ModelEditor.java | 12 +- .../common/component/AddonsEditor.java | 24 +- .../common/component/ApplicationEditor.java | 3 +- .../common/component/BindingTableEditor.java | 105 ++++---- .../common/component/CommandEditor.java | 21 +- .../common/component/ControlFactory.java | 63 ++--- .../component/DirectMenuItemEditor.java | 17 +- .../common/component/HandlerEditor.java | 21 +- .../common/component/KeyBindingEditor.java | 45 ++-- .../component/MenuContributionEditor.java | 93 +++---- .../internal/common/component/MenuEditor.java | 83 +++---- .../common/component/MenuItemEditor.java | 104 ++++---- .../common/component/MenuSeparatorEditor.java | 51 ++-- .../component/PartDescriptorEditor.java | 226 ++++++++---------- .../internal/common/component/PartEditor.java | 98 +++----- 18 files changed, 510 insertions(+), 580 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs index 5b21ea9bc2..2e80c9eb7a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs +++ b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs @@ -1,8 +1,61 @@ -#Fri Jun 04 16:11:07 EDT 2010 +#Sat Jun 26 16:51:30 CEST 2010 eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_custom formatter_settings_version=11 org.eclipse.jdt.ui.ignorelowercasenames=true org.eclipse.jdt.ui.importorder=; org.eclipse.jdt.ui.ondemandthreshold=99 org.eclipse.jdt.ui.staticondemandthreshold=99 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 616c1b1309..1460779f1c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -14,7 +14,7 @@ public class Messages { public static String AbstractCommandSelectionDialog_Label_CommandId; - + public static String ApplicationEditor_Label; public static String ApplicationEditor_Description; public static String ApplicationEditor_Id; @@ -39,8 +39,8 @@ public class Messages { public static String BindingTableEditor_Up; public static String BindingTableEditor_Down; public static String BindingTableEditor_Add; - public static String BindingTableEditor_Remove; - + public static String BindingTableEditor_Remove; + public static String CommandEditor_Label; public static String CommandEditor_Description; public static String CommandEditor_Id; @@ -57,12 +57,12 @@ public class Messages { public static String CommandEditor_Add; public static String CommandEditor_Remove; public static String CommandEditor_ParameterId; - + public static String DirectMenuItemEditor_Label; public static String DirectMenuItemEditor_Description; public static String DirectMenuItemEditor_ClassURI; public static String DirectMenuItemEditor_Find; - + public static String ControlFactory_BindingContexts; public static String ControlFactory_Add; public static String ControlFactory_Up; @@ -72,12 +72,13 @@ public class Messages { public static String ControlFactory_Key; public static String ControlFactory_Value; public static String ControlFactory_ContextVariables; - + public static String ControlFactory_AddNoEllipse; + public static String DirectToolItemEditor_ClassURI; public static String DirectToolItemEditor_Find; public static String DirectToolItemEditor_Label; public static String DirectToolItemEditor_Description; - + public static String HandledMenuItemEditor_Label; public static String HandledMenuItemEditor_Description; public static String HandledMenuItemEditor_Command; @@ -89,7 +90,7 @@ public class Messages { public static String HandledMenuItemEditor_Down; public static String HandledMenuItemEditor_Add; public static String HandledMenuItemEditor_Remove; - + public static String HandledToolItemEditor_Command; public static String HandledToolItemEditor_Find; public static String HandledToolItemEditor_Parameters; @@ -101,17 +102,17 @@ public class Messages { public static String HandledToolItemEditor_Remove; public static String HandledToolItemEditor_Label; public static String HandledToolItemEditor_Description; - + public static String HandlerEditor_Label; public static String HandlerEditor_Description; public static String HandlerEditor_Id; public static String HandlerEditor_Command; public static String HandlerEditor_Find; public static String HandlerEditor_ClassURI; - + public static String InputPartEditor_Label; public static String InputPartEditor_InputURI; - + public static String KeyBindingEditor_Label; public static String KeyBindingEditor_Description; public static String KeyBindingEditor_Id; @@ -125,7 +126,7 @@ public class Messages { public static String KeyBindingEditor_Down; public static String KeyBindingEditor_Add; public static String KeyBindingEditor_Remove; - + public static String MenuEditor_Label; public static String MenuEditor_Description; public static String MenuEditor_Id; @@ -142,8 +143,7 @@ public class Messages { public static String MenuEditor_LabelLabel; public static String MenuEditor_Tooltip; public static String MenuEditor_IconURI; - - + public static String MenuItemEditor_Id; public static String MenuItemEditor_Type; public static String MenuItemEditor_Label; @@ -151,10 +151,10 @@ public class Messages { public static String MenuItemEditor_IconURI; public static String MenuItemEditor_Find; public static String MenuEditor_MainMenu; - + public static String MenuSeparatorEditor_Label; public static String MenuSeparatorEditor_Id; - + public static String ModelComponentEditor_Id; public static String ModelComponentEditor_ParentId; public static String ModelComponentEditor_Find; @@ -172,7 +172,7 @@ public class Messages { public static String ModelComponentEditor_PartDescriptors; public static String ModelComponentEditor_DetailParentId; public static String ModelComponentEditor_MenuContributions; - + public static String ModelComponentsEditor_Label; public static String ModelComponentsEditor_Description; public static String ModelComponentsEditor_ModelContributions; @@ -180,7 +180,7 @@ public class Messages { public static String ModelComponentsEditor_Down; public static String ModelComponentsEditor_Add; public static String ModelComponentsEditor_Remove; - + public static String PartDescriptorEditor_Label; public static String PartDescriptorEditor_Descriptor; public static String PartDescriptorEditor_Id; @@ -205,7 +205,7 @@ public class Messages { public static String PartDescriptorEditor_Menus; public static String PartDescriptorEditor_Handlers; public static String PartDescriptorEditor_ContainerData; - + public static String PartEditor_Label; public static String PartEditor_Description; public static String PartEditor_Id; @@ -224,7 +224,7 @@ public class Messages { public static String PartEditor_Handlers; public static String PartEditor_ContainerData; public static String PartEditor_ToolBar; - + public static String PartSashContainerEditor_Label; public static String PartSashContainerEditor_Description; public static String PartSashContainerEditor_Id; @@ -237,7 +237,7 @@ public class Messages { public static String PartSashContainerEditor_Down; public static String PartSashContainerEditor_Remove; public static String PartSashContainerEditor_ContainerData; - + public static String PartStackEditor_Label; public static String PartStackEditor_Description; public static String PartStackEditor_Id; @@ -247,11 +247,12 @@ public class Messages { public static String PartStackEditor_Down; public static String PartStackEditor_Remove; public static String PartStackEditor_ContainerData; - + public static String PerspectiveStackEditor_Add; + public static String PerspectiveEditor_Label; public static String PerspectiveEditor_Description; public static String PerspectiveEditor_Id; - public static String PerspectiveEditor_LabelLabel; + public static String PerspectiveEditor_LabelLabel; public static String PerspectiveEditor_SelectedElement; public static String PerspectiveEditor_Tooltip; public static String PerspectiveEditor_IconURI; @@ -260,18 +261,18 @@ public class Messages { public static String PerspectiveEditor_Up; public static String PerspectiveEditor_Down; public static String PerspectiveEditor_Remove; - + public static String PerspectiveStackEditor_Perspectives; public static String PerspectiveStackEditor_Label; public static String PerspectiveStackEditor_Description; public static String PerspectiveStackEditor_Id; public static String PerspectiveStackEditor_SelectedElement; - + public static String PlaceholderEditor_Label; public static String PlaceholderEditor_Descriptor; public static String PlaceholderEditor_Id; public static String PlaceholderEditor_FindReference; - + public static String ToolBarEditor_Label; public static String ToolBarEditor_Description; public static String ToolBarEditor_Id; @@ -285,15 +286,15 @@ public class Messages { public static String ToolBarEditor_ToolControl; public static String ToolBarEditor_Separator; public static String ToolBarEditor_Remove; - + public static String ToolBarSeparatorEditor_Label; public static String ToolBarSeparatorEditor_Id; - + public static String ToolControlEditor_Label; public static String ToolControlEditor_Description; public static String ToolControlEditor_Id; public static String ToolControlEditor_ClassURI; - + public static String VBindingTableEditor_Label; public static String VBindingTableEditor_Description; public static String VBindingTableEditor_Contexts; @@ -304,11 +305,11 @@ public class Messages { public static String VBindingTableEditor_Down; public static String VBindingTableEditor_Add; public static String VBindingTableEditor_Remove; - + public static String AddonsEditor_Id; public static String AddonsEditor_ClassURI; public static String AddonsEditor_Find; - + public static String ContributionClassDialog_DialogMessage; public static String ContributionClassDialog_DialogTitle; public static String ContributionClassDialog_Label_Classname; @@ -352,10 +353,6 @@ public class Messages { public static String FeatureSelectionDialog_DialogTitle; public static String FeatureSelectionDialog_DialogMessage; - - - - static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 8be1d380f3..e3408ff1eb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -67,6 +67,7 @@ ControlFactory_Tags=Tags ControlFactory_Key=Key ControlFactory_Value=Value ControlFactory_ContextVariables=Context Variables +ControlFactory_AddNoEllipse=Add DirectToolItemEditor_ClassURI=Class URI DirectToolItemEditor_Find=Find ... @@ -262,6 +263,7 @@ PerspectiveStackEditor_Description=Perspective Stack Bla Bla Bla PerspectiveStackEditor_Id=Id PerspectiveStackEditor_SelectedElement=Selected Element PerspectiveStackEditor_Perspectives=Perspectives +PerspectiveStackEditor_Add=Add ... PlaceholderEditor_Label=Placeholder PlaceholderEditor_Descriptor=Placeholder Bla Bla Bla Bla diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 0874d5b5b5..23b38b7d2d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; + import org.eclipse.swt.widgets.TreeItem; import javax.annotation.PostConstruct; @@ -227,7 +229,7 @@ public ModelEditor(Composite composite, IEclipseContext context, IModelResource scrolling.setBackgroundMode(SWT.INHERIT_DEFAULT); scrolling.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ - final StackLayout layout = new StackLayout(); + final EStackLayout layout = new EStackLayout(); final Composite contentContainer = new Composite(scrolling, SWT.NONE); contentContainer.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ scrolling.setExpandHorizontal(true); @@ -236,10 +238,8 @@ public ModelEditor(Composite composite, IEclipseContext context, IModelResource scrolling.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { - if( layout.topControl != null ) { - Rectangle r = scrolling.getClientArea(); - scrolling.setMinSize(layout.topControl.computeSize(r.width, SWT.DEFAULT)); - } + Rectangle r = scrolling.getClientArea(); + scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); } }); @@ -276,7 +276,7 @@ public void selectionChanged(SelectionChangedEvent event) { } Rectangle r = scrolling.getClientArea(); - scrolling.setMinSize(layout.topControl.computeSize(r.width, SWT.DEFAULT)); + scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); scrolling.setOrigin(0, 0); scrolling.layout(true,true); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index f6f381cf77..9b75c4e5a5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -10,31 +10,22 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.core.databinding.observable.value.IObservableValue; - -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.common.Util; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -46,6 +37,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -55,7 +47,7 @@ public class AddonsEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IProject project; private Image image; - private StackLayout stackLayout; + private EStackLayout stackLayout; public AddonsEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain,editor); @@ -101,7 +93,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index abdf91432c..810c571577 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; - import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -25,6 +23,7 @@ import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.edit.EMFEditProperties; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index bc93505433..53f4c33078 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -10,20 +10,14 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.core.databinding.observable.value.IObservableValue; - -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.emf.ecore.EObject; - import java.net.MalformedURLException; import java.net.URL; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; @@ -41,6 +35,7 @@ import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; @@ -60,6 +55,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -69,13 +65,12 @@ public class BindingTableEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; - - private IListProperty BINDING_TABLE__BINDINGS = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS); - private StackLayout stackLayout; + private IListProperty BINDING_TABLE__BINDINGS = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS); + private EStackLayout stackLayout; public BindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override @@ -108,7 +103,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -116,21 +111,21 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } @@ -138,14 +133,14 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); - + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + { Label l = new Label(parent, SWT.NONE); l.setText(Messages.BindingTableEditor_Id); @@ -155,9 +150,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + { Label l = new Label(parent, SWT.NONE); l.setText(Messages.BindingTableEditor_ContextId); @@ -165,17 +160,18 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID).observeDetail(getMaster())); - Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.BindingTableEditor_Find); + b.setText(Messages.BindingTableEditor_Find); } - + { Label l = new Label(parent, SWT.NONE); l.setText(Messages.BindingTableEditor_Keybindings); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); @@ -212,7 +208,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO column.getColumn().setWidth(170); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - + IEMFListProperty prop = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS); viewer.setInput(prop.observeDetail(getMaster())); @@ -232,21 +228,21 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MBindingTable container = (MBindingTable) getMaster().getValue(); int idx = container.getBindings().indexOf(obj) - 1; - if( idx >= 0 ) { + if (idx >= 0) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -259,21 +255,21 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MBindingTable container = (MBindingTable) getMaster().getValue(); int idx = container.getBindings().indexOf(obj) + 1; - if( idx < container.getBindings().size() ) { + if (idx < container.getBindings().size()) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -304,18 +300,17 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List keybinding = ((IStructuredSelection)viewer.getSelection()).toList(); + if (!viewer.getSelection().isEmpty()) { + List keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS, keybinding); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } } }); } - - + return parent; } @@ -333,11 +328,9 @@ public String getDetailLabel(Object element) { return null; } - + @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { - FeaturePath.fromList(CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID) - }; + return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID) }; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 5dabe39385..9c5284bfbc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -10,23 +10,16 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.core.databinding.observable.value.IObservableValue; - -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.commands.MCommand; import org.eclipse.e4.ui.model.application.commands.MCommandParameter; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; @@ -38,6 +31,7 @@ import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; @@ -64,6 +58,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -73,7 +68,7 @@ public class CommandEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; - private StackLayout stackLayout; + private EStackLayout stackLayout; public CommandEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain,editor); @@ -109,7 +104,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 782a1f73e4..adb04cabea 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -10,64 +10,45 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; - -import org.eclipse.emf.edit.domain.EditingDomain; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; - +import java.util.Arrays; +import java.util.List; +import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.observable.list.IObservableList; - -import org.eclipse.e4.tools.emf.ui.common.Util; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.e4.ui.model.application.ui.MUILabel; - -import org.eclipse.e4.ui.workbench.UIEvents.UILabel; - import org.eclipse.core.databinding.observable.map.IObservableMap; - -import org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider; - -import org.eclipse.emf.databinding.EMFDataBindingContext; - -import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.jface.databinding.viewers.IViewerValueProperty; -import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.databinding.viewers.ViewerSupport; -import org.eclipse.jface.viewers.ComboViewer; - -import org.eclipse.e4.ui.model.application.commands.MBindings; - -import org.eclipse.e4.ui.model.application.ui.MContext; - -import java.util.Arrays; -import java.util.List; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationElement; +import org.eclipse.e4.ui.model.application.commands.MBindings; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MContext; +import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.IViewerValueProperty; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider; +import org.eclipse.jface.databinding.viewers.ViewerProperties; +import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; @@ -178,7 +159,7 @@ public void handleValueChange(ValueChangeEvent event) { public static void createStringListWidget(Composite parent, final AbstractComponentEditor editor, String label, final EStructuralFeature feature) { Label l = new Label(parent, SWT.NONE); l.setText(label); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -192,7 +173,7 @@ public void keyPressed(KeyEvent e) { }); Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Add); + b.setText(Messages.ControlFactory_AddNoEllipse); b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @@ -316,7 +297,7 @@ public void keyPressed(KeyEvent e) { }); Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Add); + b.setText(Messages.ControlFactory_AddNoEllipse); b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @@ -440,7 +421,7 @@ public void keyPressed(KeyEvent e) { }); Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Add); + b.setText(Messages.ControlFactory_AddNoEllipse); b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @@ -564,7 +545,7 @@ public void keyPressed(KeyEvent e) { }); Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Add); + b.setText(Messages.ControlFactory_AddNoEllipse); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index 7ebc2b32b6..45998f7875 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -37,14 +37,14 @@ public class DirectMenuItemEditor extends MenuItemEditor { private Image image; - + public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain,editor, project); + super(editingDomain, editor, project); } @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { @@ -65,11 +65,11 @@ public String getLabel(Object element) { public String getDescription(Object element) { return Messages.DirectMenuItemEditor_Description; } - + @Override protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, WritableValue master) { IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -78,15 +78,16 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); - final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText(Messages.DirectMenuItemEditor_Find); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); dialog.open(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index d0e07976e0..3c0566e9dc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -10,24 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.core.databinding.observable.value.IObservableValue; - -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandlerCommandSelectionDialog; import org.eclipse.e4.ui.model.application.MContribution; @@ -37,6 +30,7 @@ import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -48,6 +42,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -58,7 +53,7 @@ public class HandlerEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IModelResource resource; private IProject project; - private StackLayout stackLayout; + private EStackLayout stackLayout; public HandlerEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource, IProject project) { super(editingDomain,editor); @@ -95,7 +90,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index f72445c709..49e35c8694 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -10,24 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.core.databinding.observable.value.IObservableValue; - -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.KeyBindingCommandSelectionDialog; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MKeyBinding; @@ -40,6 +33,7 @@ import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; @@ -65,6 +59,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -75,10 +70,10 @@ public class KeyBindingEditor extends AbstractComponentEditor { private Image image; private EMFDataBindingContext context; private IModelResource resource; - private StackLayout stackLayout; + private EStackLayout stackLayout; public KeyBindingEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource) { - super(editingDomain,editor); + super(editingDomain, editor); this.resource = resource; } @@ -112,7 +107,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -120,21 +115,21 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } @@ -145,11 +140,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -162,7 +157,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index d4f8ea5f5a..acec042efa 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -10,40 +10,39 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.emf.ecore.EObject; - +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.emf.databinding.EMFProperties; - import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - -import java.util.List; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -54,41 +53,28 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -import org.eclipse.swt.SWT; - -import org.eclipse.core.databinding.observable.value.WritableValue; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.emf.databinding.EMFDataBindingContext; - -import org.eclipse.emf.edit.domain.EditingDomain; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; - -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class MenuContributionEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; private IProject project; - + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; - + private EStackLayout stackLayout; + private static class Struct { private final String label; private final EClass eClass; @@ -100,15 +86,15 @@ public Struct(String label, EClass eClass, boolean separator) { this.separator = separator; } } - + public MenuContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); this.project = project; } @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { @@ -141,7 +127,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -149,21 +135,21 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } @@ -174,11 +160,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -191,7 +177,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -218,12 +204,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__POSITION_IN_PARENT).observeDetail(getMaster())); } - // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuContributionEditor_MenuItems); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); @@ -371,8 +356,8 @@ public void widgetSelected(SelectionEvent e) { } }); } - - ControlFactory.createTagsWidget(parent, this); + + ControlFactory.createTagsWidget(parent, this); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 266b9ff1a1..6a8f0edece 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -10,14 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.emf.common.util.URI; - -import org.eclipse.e4.tools.emf.ui.common.Util; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; - import java.net.MalformedURLException; import java.net.URL; import java.util.List; @@ -25,6 +17,9 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; @@ -34,12 +29,14 @@ import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.URI; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFListProperty; @@ -63,7 +60,6 @@ import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.StackLayout; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -84,7 +80,7 @@ public class MenuEditor extends AbstractComponentEditor { private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; + private EStackLayout stackLayout; private static class Struct { private final String label; @@ -99,7 +95,7 @@ public Struct(String label, EClass eClass, boolean separator) { } public MenuEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); this.project = project; } @@ -127,30 +123,30 @@ public Composite getEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); - - createForm(composite, context, getMaster(),false,false); - createForm(composite, context, getMaster(),true,false); - if( getEditor().isModelFragment() ) { - createForm(composite, context, getMaster(),false,true); + + createForm(composite, context, getMaster(), false, false); + createForm(composite, context, getMaster(), true, false); + if (getEditor().isModelFragment()) { + createForm(composite, context, getMaster(), false, true); } } EObject o = (EObject) object; Control topControl; - if( Util.isImport(o) && getEditor().isModelFragment() ) { + if (Util.isImport(o) && getEditor().isModelFragment()) { topControl = composite.getChildren()[2]; - } else if( o.eContainer() instanceof MWindow || o.eContainer() == null ) { + } else if (o.eContainer() instanceof MWindow || o.eContainer() == null) { topControl = composite.getChildren()[1]; } else { topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } - + getMaster().setValue(object); return composite; } @@ -161,11 +157,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( isImport ) { + if (isImport) { ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -178,10 +174,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ - if( ! rootMenu ) - { + if (!rootMenu) { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuEditor_LabelLabel); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); @@ -194,8 +189,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } // ------------------------------------------------------------ - if( ! rootMenu ) - { + if (!rootMenu) { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuEditor_Tooltip); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); @@ -208,8 +202,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } // ------------------------------------------------------------ - if( ! rootMenu ) - { + if (!rootMenu) { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuEditor_IconURI); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); @@ -219,36 +212,36 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); new ImageTooltip(t) { - + @Override protected URI getImageURI() { MUILabel part = (MUILabel) getMaster().getValue(); String uri = part.getIconURI(); - if( uri == null || uri.trim().length() == 0 ) { + if (uri == null || uri.trim().length() == 0) { return null; } return URI.createURI(part.getIconURI()); } }; - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText(Messages.MenuItemEditor_Find); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MenuIconDialogEditor dialog = new MenuIconDialogEditor(b.getShell(), project, getEditingDomain(),(MMenu) getMaster().getValue()); + MenuIconDialogEditor dialog = new MenuIconDialogEditor(b.getShell(), project, getEditingDomain(), (MMenu) getMaster().getValue()); dialog.open(); } - }); + }); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.MenuEditor_MenuItems); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); @@ -396,8 +389,8 @@ public void widgetSelected(SelectionEvent e) { } }); } - - ControlFactory.createTagsWidget(parent, this); + + ControlFactory.createTagsWidget(parent, this); return parent; } @@ -410,20 +403,20 @@ public IObservableList getChildList(Object element) { @Override public String getLabel(Object element) { MMenu menu = (MMenu) element; - if( menu.getParent() == null ) { + if (menu.getParent() == null) { EObject o = (EObject) element; - if( o.eContainer() instanceof MWindow ) { + if (o.eContainer() instanceof MWindow) { return Messages.MenuEditor_MainMenu; } } return Messages.MenuEditor_Label; } - + @Override public String getDetailLabel(Object element) { MMenu menu = (MMenu) element; - - if( menu.getLabel() != null && menu.getLabel().trim().length() > 0 ) { + + if (menu.getLabel() != null && menu.getLabel().trim().length() > 0) { return menu.getLabel(); } return null; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 6a187edef1..e9b634d624 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -10,31 +10,20 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.emf.common.util.URI; - -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.core.databinding.conversion.Converter; - -import org.eclipse.core.databinding.UpdateValueStrategy; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.core.databinding.UpdateValueStrategy; +import org.eclipse.core.databinding.conversion.Converter; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuItemIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUILabel; @@ -42,9 +31,11 @@ import org.eclipse.e4.ui.model.application.ui.menu.ItemType; import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.common.util.URI; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -59,6 +50,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -69,25 +61,25 @@ public abstract class MenuItemEditor extends AbstractComponentEditor { private Image menuImage; private EMFDataBindingContext context; protected IProject project; - private StackLayout stackLayout; + private EStackLayout stackLayout; public MenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain,editor); + super(editingDomain, editor); this.project = project; } @Override public Image getImage(Object element, Display display) { - if (menuImage == null) { - try { - menuImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + if (menuImage == null) { + try { + menuImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuItem.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } + } - return menuImage; + return menuImage; } @Override @@ -96,7 +88,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -104,21 +96,21 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } @@ -130,12 +122,12 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); IWidgetValueProperty checkProp = WidgetProperties.selection(); IWidgetValueProperty enabled = WidgetProperties.enabled(); - - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -148,7 +140,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + if (this.getClass() != MenuItemEditor.class) { // ------------------------------------------------------------ { @@ -166,7 +158,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(ViewerProperties.singleSelection().observe(viewer), itemTypeObs); } } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -204,37 +196,38 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); new ImageTooltip(t) { - + @Override protected URI getImageURI() { MUILabel part = (MUILabel) getMaster().getValue(); String uri = part.getIconURI(); - if( uri == null || uri.trim().length() == 0 ) { + if (uri == null || uri.trim().length() == 0) { return null; } return URI.createURI(part.getIconURI()); } }; - + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setText(Messages.MenuItemEditor_Find); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MenuItemIconDialogEditor dialog = new MenuItemIconDialogEditor(b.getShell(), project, getEditingDomain(),(MMenuItem) getMaster().getValue()); + MenuItemIconDialogEditor dialog = new MenuItemIconDialogEditor(b.getShell(), project, getEditingDomain(), (MMenuItem) getMaster().getValue()); dialog.open(); } }); } - + { Label l = new Label(parent, SWT.NONE); l.setText("Enabled"); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - + Button b = new Button(parent, SWT.CHECK); - b.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); + b.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); context.bindValue(checkProp.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__ENABLED).observeDetail(getMaster())); } @@ -242,11 +235,11 @@ public void widgetSelected(SelectionEvent e) { Label l = new Label(parent, SWT.NONE); l.setText("Selected"); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - + Button b = new Button(parent, SWT.CHECK); - b.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); + b.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); context.bindValue(checkProp.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__SELECTED).observeDetail(getMaster())); - + UpdateValueStrategy t2m = new UpdateValueStrategy(); t2m.setConverter(new Converter(boolean.class, ItemType.class) { @@ -256,21 +249,20 @@ public Object convert(Object fromObject) { }); UpdateValueStrategy m2t = new UpdateValueStrategy(); m2t.setConverter(new Converter(ItemType.class, boolean.class) { - + public Object convert(Object fromObject) { return fromObject == ItemType.CHECK || fromObject == ItemType.RADIO; } }); - - context.bindValue(enabled.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(getMaster()),t2m,m2t); + + context.bindValue(enabled.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(getMaster()), t2m, m2t); } - createFormSubTypeForm(parent, context, master); ControlFactory.createTagsWidget(parent, this); - + return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index dbc90e44f1..8479ac77ea 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -10,27 +10,19 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Button; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -39,6 +31,7 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -47,10 +40,10 @@ public class MenuSeparatorEditor extends AbstractComponentEditor { private Image separatorImage; private Composite composite; private EMFDataBindingContext context; - private StackLayout stackLayout; - + private EStackLayout stackLayout; + public MenuSeparatorEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override @@ -88,7 +81,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -96,36 +89,36 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } - + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -138,8 +131,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - - //TODO Should we add visible to mimic a GroupMarker of 3.x + + // TODO Should we add visible to mimic a GroupMarker of 3.x return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index fe58797890..12a4911cfa 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -10,37 +10,20 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.ui.model.application.ui.MUILabel; - -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.emf.common.util.URI; - -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.SetCommand; - -import org.eclipse.core.databinding.property.value.IValueProperty; - -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; - import java.net.MalformedURLException; import java.net.URL; import java.util.Map.Entry; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; @@ -51,13 +34,20 @@ import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; +import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.URI; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -74,6 +64,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -84,21 +75,21 @@ public class PartDescriptorEditor extends AbstractComponentEditor { private Image image; private EMFDataBindingContext context; private IProject project; - + private IListProperty PART__MENUS = EMFProperties.list(BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS); private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); private IValueProperty PART__TOOLBAR = EMFProperties.value(BasicPackageImpl.Literals.PART_DESCRIPTOR__TOOLBAR); private Button createRemoveToolBar; - private StackLayout stackLayout; + private EStackLayout stackLayout; public PartDescriptorEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain,editor); + super(editingDomain, editor); this.project = project; } @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { @@ -126,7 +117,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -134,42 +125,40 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + if (createRemoveToolBar != null) { createRemoveToolBar.setSelection(((MPartDescriptor) object).getToolbar() != null); } - + getMaster().setValue(object); return composite; } protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - parent = new Composite(parent,SWT.NONE); + parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -178,11 +167,11 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -191,9 +180,9 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); } // ------------------------------------------------------------ @@ -201,12 +190,12 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartDescriptorEditor_Tooltip); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - + Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); } // ------------------------------------------------------------ @@ -217,31 +206,32 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); new ImageTooltip(t) { - + @Override protected URI getImageURI() { MUILabel part = (MUILabel) getMaster().getValue(); String uri = part.getIconURI(); - if( uri == null || uri.trim().length() == 0 ) { + if (uri == null || uri.trim().length() == 0) { return null; } return URI.createURI(part.getIconURI()); } }; - - final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText(Messages.PartDescriptorEditor_Find); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - PartDescriptorIconDialogEditor dialog = new PartDescriptorIconDialogEditor(b.getShell(), project, getEditingDomain(),(MPartDescriptor) getMaster().getValue()); + PartDescriptorIconDialogEditor dialog = new PartDescriptorIconDialogEditor(b.getShell(), project, getEditingDomain(), (MPartDescriptor) getMaster().getValue()); dialog.open(); } - }); + }); } // ------------------------------------------------------------ @@ -252,41 +242,42 @@ public void widgetSelected(SelectionEvent e) { Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CONTRIBUTION_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CONTRIBUTION_URI).observeDetail(master)); - final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText(Messages.PartDescriptorEditor_Find); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MPartDescriptor) getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CONTRIBUTION_URI); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MPartDescriptor) getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CONTRIBUTION_URI); dialog.open(); } }); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartEditor_ToolBar); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - + createRemoveToolBar = new Button(parent, SWT.CHECK); createRemoveToolBar.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { MPartDescriptor window = (MPartDescriptor) getMaster().getValue(); - if( window.getToolbar() == null ) { + if (window.getToolbar() == null) { addToolBar(); } else { removeToolBar(); } } }); - createRemoveToolBar.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); + createRemoveToolBar.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -295,11 +286,11 @@ public void widgetSelected(SelectionEvent e) { Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -308,14 +299,13 @@ public void widgetSelected(SelectionEvent e) { Button checkbox = new Button(parent, SWT.CHECK); checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); - + IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__DIRTYABLE); IWidgetValueProperty uiProp = WidgetProperties.selection(); - + context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); } - // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -324,13 +314,13 @@ public void widgetSelected(SelectionEvent e) { Button checkbox = new Button(parent, SWT.CHECK); checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); - + IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CLOSEABLE); IWidgetValueProperty uiProp = WidgetProperties.selection(); - + context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -339,24 +329,24 @@ public void widgetSelected(SelectionEvent e) { Button checkbox = new Button(parent, SWT.CHECK); checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); - + IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__ALLOW_MULTIPLE); IWidgetValueProperty uiProp = WidgetProperties.selection(); - + context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartDescriptorEditor_Category); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - + Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL,GridData.BEGINNING, true, false, 2, 1)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CATEGORY).observeDetail(master)); + t.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 2, 1)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CATEGORY).observeDetail(master)); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -370,7 +360,7 @@ public void widgetSelected(SelectionEvent e) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 80; tableviewer.getControl().setLayoutData(gd); - + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); column.getColumn().setText(Messages.PartDescriptorEditor_PersitedStateKey); column.getColumn().setWidth(200); @@ -381,9 +371,9 @@ public String getText(Object element) { Entry entry = (Entry) element; return entry.getKey(); } - }); + }); - //FIXME How can we react upon changes in the Map-Value? + // FIXME How can we react upon changes in the Map-Value? column = new TableViewerColumn(tableviewer, SWT.NONE); column.getColumn().setText(Messages.PartDescriptorEditor_PersitedStateValue); column.getColumn().setWidth(200); @@ -395,17 +385,17 @@ public String getText(Object element) { return entry.getValue(); } }); - + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE); tableviewer.setInput(prop.observeDetail(getMaster())); - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); @@ -418,7 +408,7 @@ public String getText(Object element) { b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -427,7 +417,7 @@ public String getText(Object element) { ListViewer viewer = new ListViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; gd.heightHint = 80; viewer.getList().setLayoutData(gd); } @@ -440,7 +430,7 @@ public String getText(Object element) { TableViewer tableviewer = new TableViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; gd.heightHint = 80; tableviewer.getTable().setHeaderVisible(true); tableviewer.getControl().setLayoutData(gd); @@ -454,7 +444,6 @@ public String getText(Object element) { column.getColumn().setWidth(200); } - ControlFactory.createTagsWidget(parent, this); return parent; @@ -463,28 +452,27 @@ public String getText(Object element) { private void addToolBar() { MToolBar menu = MMenuFactory.INSTANCE.createToolBar(); Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR__TOOLBAR, menu); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } - + private void removeToolBar() { Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR__TOOLBAR, null); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } - @Override public IObservableList getChildList(final Object element) { final WritableList list = new WritableList(); - - if( getEditor().isModelFragment() && Util.isImport((EObject) element) ) { + + if (getEditor().isModelFragment() && Util.isImport((EObject) element)) { return list; } - - list.add(new VirtualEntry( ModelEditor.VIRTUAL_PARTDESCRIPTOR_MENU, PART__MENUS, element, Messages.PartDescriptorEditor_Menus) { + + list.add(new VirtualEntry(ModelEditor.VIRTUAL_PARTDESCRIPTOR_MENU, PART__MENUS, element, Messages.PartDescriptorEditor_Menus) { @Override protected boolean accepted(Object o) { @@ -493,7 +481,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.PartDescriptorEditor_Handlers) { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.PartDescriptorEditor_Handlers) { @Override protected boolean accepted(Object o) { @@ -503,30 +491,30 @@ protected boolean accepted(Object o) { }); MPartDescriptor window = (MPartDescriptor) element; - if( window.getToolbar() != null ) { - list.add(0,window.getToolbar()); + if (window.getToolbar() != null) { + list.add(0, window.getToolbar()); } - + PART__TOOLBAR.observe(element).addValueChangeListener(new IValueChangeListener() { - + public void handleValueChange(ValueChangeEvent event) { - if( event.diff.getOldValue() != null ) { + if (event.diff.getOldValue() != null) { list.remove(event.diff.getOldValue()); - if( getMaster().getValue() == element ) { - createRemoveToolBar.setSelection(false); + if (getMaster().getValue() == element) { + createRemoveToolBar.setSelection(false); } - + } - - if( event.diff.getNewValue() != null ) { - list.add(0,event.diff.getNewValue()); - if( getMaster().getValue() == element ) { - createRemoveToolBar.setSelection(true); + + if (event.diff.getNewValue() != null) { + list.add(0, event.diff.getNewValue()); + if (getMaster().getValue() == element) { + createRemoveToolBar.setSelection(true); } } } }); - + return list; } @@ -538,8 +526,6 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { - FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) - }; + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index d5f54996e9..6a8463e73d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -10,52 +10,20 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.ui.model.application.ui.MUILabel; - -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; - -import java.io.InputStream; - -import java.io.IOException; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.swt.widgets.Event; - -import org.eclipse.jface.window.DefaultToolTip; - -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.common.Util; - -import org.eclipse.swt.custom.StackLayout; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.core.databinding.property.value.IValueProperty; - -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; - -import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.SetCommand; - -import org.eclipse.e4.ui.model.application.ui.basic.MWindow; - import java.net.MalformedURLException; import java.net.URL; import java.util.Map.Entry; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; @@ -65,15 +33,22 @@ import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; +import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.URI; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -89,6 +64,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -104,7 +80,7 @@ public class PartEditor extends AbstractComponentEditor { private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); private IValueProperty PART__TOOLBAR = EMFProperties.value(BasicPackageImpl.Literals.PART__TOOLBAR); private Button createRemoveToolBar; - private StackLayout stackLayout; + private EStackLayout stackLayout; public PartEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain, editor); @@ -141,7 +117,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -149,25 +125,25 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + if (createRemoveToolBar != null) { createRemoveToolBar.setSelection(((MPart) object).getToolbar() != null); } - + getMaster().setValue(object); return composite; @@ -179,17 +155,17 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } + if (isImport) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartEditor_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - + Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; @@ -215,7 +191,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartEditor_Tooltip); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - + Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; @@ -234,19 +210,20 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); new ImageTooltip(t) { - + @Override protected URI getImageURI() { MUILabel part = (MUILabel) getMaster().getValue(); String uri = part.getIconURI(); - if( uri == null || uri.trim().length() == 0 ) { + if (uri == null || uri.trim().length() == 0) { return null; } return URI.createURI(part.getIconURI()); } }; - + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText(Messages.PartEditor_Find); b.addSelectionListener(new SelectionAdapter() { @@ -269,6 +246,7 @@ public void widgetSelected(SelectionEvent e) { context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText(Messages.PartEditor_Find); b.addSelectionListener(new SelectionAdapter() { @@ -463,11 +441,11 @@ protected void createSubformElements(Composite parent, EMFDataBindingContext con @Override public IObservableList getChildList(Object element) { final WritableList list = new WritableList(); - - if( getEditor().isModelFragment() && Util.isImport((EObject) element) ) { + + if (getEditor().isModelFragment() && Util.isImport((EObject) element)) { return list; } - + list.add(new VirtualEntry(ModelEditor.VIRTUAL_PART_MENU, PART__MENUS, element, Messages.PartEditor_Menus) { @Override From 53aa4ff9dd0991a80a1e98e90864797f80d091de Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 26 Jun 2010 15:18:20 +0000 Subject: [PATCH 0158/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed minor layout tweaks --- .../internal/common/component/PartEditor.java | 39 ---- .../component/PartSashContainerEditor.java | 168 +++++++--------- .../common/component/PartStackEditor.java | 154 +++++++-------- .../common/component/PerspectiveEditor.java | 163 +++++++-------- .../component/PerspectiveStackEditor.java | 131 ++++++------ .../common/component/PlaceholderEditor.java | 128 +++++------- .../component/ToolBarContributionEditor.java | 97 ++++----- .../common/component/ToolBarEditor.java | 44 ++--- .../component/ToolBarSeparatorEditor.java | 49 ++--- .../common/component/ToolControlEditor.java | 67 +++---- .../common/component/ToolItemEditor.java | 74 ++++--- .../common/component/TrimBarEditor.java | 165 +++++++--------- .../component/TrimContributionEditor.java | 186 ++++++++---------- .../common/component/WindowEditor.java | 179 ++++++++--------- 14 files changed, 708 insertions(+), 936 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 6a8463e73d..81f3b23f52 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -312,45 +312,6 @@ public void widgetSelected(SelectionEvent e) { // ------------------------------------------------------------ ControlFactory.createBindingsWidget(parent, this); - // TODO Does the user need to edit this? - // // ------------------------------------------------------------ - // { - // Label l = new Label(parent, SWT.NONE); - // l.setText("Variables"); - // l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, - // false, false)); - // - // ListViewer viewer = new ListViewer(parent); - // GridData gd = new GridData(GridData.FILL_HORIZONTAL); - // gd.horizontalSpan=2; - // gd.heightHint = 80; - // viewer.getList().setLayoutData(gd); - // } - - // // ------------------------------------------------------------ - // { - // Label l = new Label(parent, SWT.NONE); - // l.setText("Properties"); - // l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, - // false, false)); - // - // TableViewer tableviewer = new TableViewer(parent); - // GridData gd = new GridData(GridData.FILL_HORIZONTAL); - // gd.horizontalSpan=2; - // gd.heightHint = 80; - // tableviewer.getTable().setHeaderVisible(true); - // tableviewer.getControl().setLayoutData(gd); - // - // TableViewerColumn column = new TableViewerColumn(tableviewer, - // SWT.NONE); - // column.getColumn().setText("Key"); - // column.getColumn().setWidth(200); - // - // column = new TableViewerColumn(tableviewer, SWT.NONE); - // column.getColumn().setText("Value"); - // column.getColumn().setWidth(200); - // } - // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index a5b691fbed..ed04e02e7e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -10,30 +10,21 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; - -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; - import java.net.MalformedURLException; import java.net.URL; import java.util.List; -import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -43,8 +34,6 @@ import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; @@ -57,7 +46,6 @@ import org.eclipse.jface.databinding.viewers.IViewerValueProperty; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.databinding.viewers.ViewerSupport; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IStructuredSelection; @@ -72,6 +60,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -84,17 +73,17 @@ public class PartSashContainerEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; + private EStackLayout stackLayout; public PartSashContainerEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override public Image getImage(Object element, Display display) { - boolean horizontal = ((MPartSashContainer)element).isHorizontal(); + boolean horizontal = ((MPartSashContainer) element).isHorizontal(); - if( vImage == null && ! horizontal ) { + if (vImage == null && !horizontal) { try { vImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { @@ -103,7 +92,7 @@ public Image getImage(Object element, Display display) { } } - if( hImage == null && horizontal ) { + if (hImage == null && horizontal) { try { hImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { @@ -112,7 +101,7 @@ public Image getImage(Object element, Display display) { } } - if( horizontal ) { + if (horizontal) { return hImage; } else { return vImage; @@ -135,7 +124,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -143,37 +132,36 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, final EMFDataBindingContext context, - WritableValue master, boolean isImport) { - parent = new Composite(parent,SWT.NONE); + private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { + parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -182,26 +170,26 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartSashContainerEditor_Orientation); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - + ComboViewer viewer = new ComboViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; viewer.getControl().setLayoutData(gd); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { - return ((Boolean)element).booleanValue() ? Messages.PartSashContainerEditor_Horizontal : Messages.PartSashContainerEditor_Vertical; + return ((Boolean) element).booleanValue() ? Messages.PartSashContainerEditor_Horizontal : Messages.PartSashContainerEditor_Vertical; } }); viewer.setInput(new Boolean[] { Boolean.TRUE, Boolean.FALSE }); @@ -210,7 +198,7 @@ public String getText(Object element) { } ControlFactory.createSelectedElement(parent, this, context, Messages.PartSashContainerEditor_SelectedElement); - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -219,9 +207,9 @@ public String getText(Object element) { Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); } ControlFactory.createTagsWidget(parent, this); @@ -229,8 +217,8 @@ public String getText(Object element) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartSashContainerEditor_Controls); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); - + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); + final TableViewer viewer = new TableViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 200; @@ -238,41 +226,41 @@ public String getText(Object element) { ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - + IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(getMaster())); - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(2,false); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.PartSashContainerEditor_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; - if( idx >= 0 ) { + if (idx >= 0) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -281,30 +269,30 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.PartSashContainerEditor_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; - if( idx < container.getChildren().size() ) { + if (idx < container.getChildren().size()) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } }); - + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); childrenDropDown.setContentProvider(new ArrayContentProvider()); @@ -315,54 +303,48 @@ public String getText(Object element) { return eclass.getName(); } }); - childrenDropDown.setInput(new EClass[] { - BasicPackageImpl.Literals.PART_SASH_CONTAINER, - BasicPackageImpl.Literals.PART_STACK, - BasicPackageImpl.Literals.PART, - BasicPackageImpl.Literals.INPUT_PART, - AdvancedPackageImpl.Literals.PLACEHOLDER - }); + childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, AdvancedPackageImpl.Literals.PLACEHOLDER }); childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! childrenDropDown.getSelection().isEmpty() ) { - EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); + if (!childrenDropDown.getSelection().isEmpty()) { + EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); EObject eObject = EcoreUtil.create(eClass); - + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); getEditor().setSelection(eObject); } } } }); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.PartSashContainerEditor_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List elements = ((IStructuredSelection)viewer.getSelection()).toList(); - + if (!viewer.getSelection().isEmpty()) { + List elements = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } } }); } - + return parent; } @@ -378,8 +360,6 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { - FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL) - }; + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL) }; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 7d66d1efea..690624b177 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -10,30 +10,22 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; - -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import java.net.MalformedURLException; import java.net.URL; import java.util.List; -import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; @@ -41,8 +33,6 @@ import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; @@ -52,10 +42,7 @@ import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.IViewerValueProperty; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.databinding.viewers.ViewerSupport; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IStructuredSelection; @@ -63,6 +50,7 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StackLayout; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -70,6 +58,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -84,12 +73,12 @@ public class PartStackEditor extends AbstractComponentEditor { private StackLayout stackLayout; public PartStackEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { @@ -117,7 +106,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -125,37 +114,36 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, final EMFDataBindingContext context, - WritableValue master, boolean isImport) { - parent = new Composite(parent,SWT.NONE); + private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { + parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -164,13 +152,13 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + ControlFactory.createSelectedElement(parent, this, context, Messages.PartStackEditor_SelectedElement); - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -179,59 +167,58 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartStackEditor_Parts); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); - + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); + final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - - + IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(getMaster())); - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(2,false); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.PartStackEditor_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); - b.addSelectionListener(new SelectionAdapter() { + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; - if( idx >= 0 ) { + if (idx >= 0) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -240,30 +227,30 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.PartStackEditor_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; - if( idx < container.getChildren().size() ) { + if (idx < container.getChildren().size()) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } }); - + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); childrenDropDown.setContentProvider(new ArrayContentProvider()); @@ -274,44 +261,39 @@ public String getText(Object element) { return eclass.getName(); } }); - childrenDropDown.setInput(new EClass[] { - BasicPackageImpl.Literals.PART, - BasicPackageImpl.Literals.INPUT_PART, - AdvancedPackageImpl.Literals.PLACEHOLDER - }); + childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, AdvancedPackageImpl.Literals.PLACEHOLDER }); childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); + EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); EObject eObject = EcoreUtil.create(eClass); - + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); getEditor().setSelection(eObject); } } }); - - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.PartStackEditor_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List elements = ((IStructuredSelection)viewer.getSelection()).toList(); - + if (!viewer.getSelection().isEmpty()) { + List elements = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 19385e282d..d20ada0abe 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -10,27 +10,16 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.emf.common.util.URI; - -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; - import java.net.MalformedURLException; import java.net.URL; import java.util.List; -import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; @@ -38,18 +27,18 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PerspectiveIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.URI; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; @@ -59,10 +48,7 @@ import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.IViewerValueProperty; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.databinding.viewers.ViewerSupport; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IStructuredSelection; @@ -77,6 +63,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -88,10 +75,10 @@ public class PerspectiveEditor extends AbstractComponentEditor { private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; + private EStackLayout stackLayout; public PerspectiveEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); this.project = project; } @@ -126,11 +113,9 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { - FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) - }; + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; } - + @Override public String getDescription(Object element) { return Messages.PerspectiveEditor_Description; @@ -142,7 +127,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -150,21 +135,21 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } @@ -175,11 +160,11 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -190,9 +175,9 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + ControlFactory.createSelectedElement(parent, this, context, Messages.PerspectiveEditor_SelectedElement); // ------------------------------------------------------------ @@ -205,7 +190,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); } // ------------------------------------------------------------ @@ -218,7 +203,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); } // ------------------------------------------------------------ @@ -229,27 +214,27 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); new ImageTooltip(t) { - + @Override protected URI getImageURI() { MUILabel part = (MUILabel) getMaster().getValue(); String uri = part.getIconURI(); - if( uri == null || uri.trim().length() == 0 ) { + if (uri == null || uri.trim().length() == 0) { return null; } return URI.createURI(part.getIconURI()); } }; - + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.PerspectiveEditor_Find); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - PerspectiveIconDialogEditor dialog = new PerspectiveIconDialogEditor(b.getShell(), project,getEditingDomain(),(MPerspective) getMaster().getValue()); + PerspectiveIconDialogEditor dialog = new PerspectiveIconDialogEditor(b.getShell(), project, getEditingDomain(), (MPerspective) getMaster().getValue()); dialog.open(); } }); @@ -258,8 +243,8 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PerspectiveEditor_Controls); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); - + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); + final TableViewer viewer = new TableViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 200; @@ -267,41 +252,41 @@ public void widgetSelected(SelectionEvent e) { ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - + IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(getMaster())); - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(2,false); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.PerspectiveEditor_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; - if( idx >= 0 ) { + if (idx >= 0) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -310,30 +295,30 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.PerspectiveEditor_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; - if( idx < container.getChildren().size() ) { + if (idx < container.getChildren().size()) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } }); - + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); childrenDropDown.setContentProvider(new ArrayContentProvider()); @@ -344,54 +329,48 @@ public String getText(Object element) { return eclass.getName(); } }); - childrenDropDown.setInput(new EClass[] { - BasicPackageImpl.Literals.PART_SASH_CONTAINER, - BasicPackageImpl.Literals.PART_STACK, - BasicPackageImpl.Literals.PART, - BasicPackageImpl.Literals.INPUT_PART, - AdvancedPackageImpl.Literals.PLACEHOLDER - }); + childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, AdvancedPackageImpl.Literals.PLACEHOLDER }); childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! childrenDropDown.getSelection().isEmpty() ) { - EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); + if (!childrenDropDown.getSelection().isEmpty()) { + EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); EObject eObject = EcoreUtil.create(eClass); - + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); getEditor().setSelection(eObject); } } } }); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.PerspectiveEditor_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List elements = ((IStructuredSelection)viewer.getSelection()).toList(); - + if (!viewer.getSelection().isEmpty()) { + List elements = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } } }); } - + ControlFactory.createTagsWidget(parent, this); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index fc674650e3..110771590e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -10,23 +10,14 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.emf.ecore.EObject; - import java.net.MalformedURLException; import java.net.URL; import java.util.List; -import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; @@ -41,19 +32,14 @@ import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.IViewerValueProperty; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.databinding.viewers.ViewerSupport; -import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; @@ -65,6 +51,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -75,15 +62,15 @@ public class PerspectiveStackEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; + private EStackLayout stackLayout; public PerspectiveStackEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { @@ -116,7 +103,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -124,37 +111,36 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, final EMFDataBindingContext context, - WritableValue master, boolean isImport) { - parent = new Composite(parent,SWT.NONE); + private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { + parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -163,61 +149,60 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + ControlFactory.createSelectedElement(parent, this, context, Messages.PerspectiveStackEditor_SelectedElement); // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PerspectiveStackEditor_Perspectives); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); - + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); + final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - - + IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(getMaster())); - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.PartStackEditor_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { + b.addSelectionListener(new SelectionAdapter() { @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; - if( idx >= 0 ) { + if (idx >= 0) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -230,44 +215,44 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; - if( idx < container.getChildren().size() ) { + if (idx < container.getChildren().size()) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } }); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setText(Messages.PerspectiveStackEditor_Add); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { MPerspective eObject = MAdvancedFactory.INSTANCE.createPerspective(); - + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); getEditor().setSelection(eObject); } } }); - - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.PartStackEditor_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); @@ -275,11 +260,11 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List elements = ((IStructuredSelection)viewer.getSelection()).toList(); - + if (!viewer.getSelection().isEmpty()) { + List elements = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 57ee751b5b..b0571a0da3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -10,48 +10,24 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.common.Util; - -import org.eclipse.e4.ui.workbench.UIEvents.UIElement; - -import org.eclipse.e4.ui.model.application.ui.MUIElement; - -import org.eclipse.core.databinding.conversion.Converter; - -import org.eclipse.core.databinding.conversion.Converter; - -import org.eclipse.core.databinding.UpdateValueStrategy; - -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.SharedElementsDialog; - -import org.eclipse.swt.events.SelectionEvent; - -import org.eclipse.swt.events.SelectionAdapter; - -import org.eclipse.swt.events.SelectionAdapter; - -import org.eclipse.swt.widgets.Button; - import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.core.databinding.UpdateValueStrategy; +import org.eclipse.core.databinding.conversion.Converter; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.SharedElementsDialog; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder; +import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; @@ -59,10 +35,14 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -72,10 +52,10 @@ public class PlaceholderEditor extends AbstractComponentEditor { private Image image; private EMFDataBindingContext context; private IModelResource resource; - private StackLayout stackLayout; - + private EStackLayout stackLayout; + public PlaceholderEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource) { - super(editingDomain,editor); + super(editingDomain, editor); this.resource = resource; } @@ -101,24 +81,24 @@ public String getLabel(Object element) { @Override public String getDetailLabel(Object element) { MPlaceholder pl = (MPlaceholder) element; - if( pl.getRef() != null ) { + if (pl.getRef() != null) { StringBuilder b = new StringBuilder(); - b.append(((EObject)pl.getRef()).eClass().getName()); - if( pl.getRef() instanceof MUILabel ) { + b.append(((EObject) pl.getRef()).eClass().getName()); + if (pl.getRef() instanceof MUILabel) { MUILabel label = (MUILabel) pl.getRef(); - if( label.getLabel() != null && label.getLabel().trim().length() > 0 ) { - b.append(" (" + label.getLabel() + ")"); //$NON-NLS-1$//$NON-NLS-2$ - } else if( label.getTooltip() != null && label.getTooltip().trim().length() > 0 ) { + if (label.getLabel() != null && label.getLabel().trim().length() > 0) { + b.append(" (" + label.getLabel() + ")"); //$NON-NLS-1$//$NON-NLS-2$ + } else if (label.getTooltip() != null && label.getTooltip().trim().length() > 0) { b.append(" (" + label.getTooltip() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ } else { - if( pl.getRef().getElementId() != null && pl.getRef().getElementId().trim().length() > 0 ) { + if (pl.getRef().getElementId() != null && pl.getRef().getElementId().trim().length() > 0) { b.append(pl.getRef().getElementId()); } } } else { - if( pl.getRef().getElementId() != null && pl.getRef().getElementId().trim().length() > 0 ) { - b.append(" (" + pl.getRef().getElementId() + ")"); //$NON-NLS-1$//$NON-NLS-2$ + if (pl.getRef().getElementId() != null && pl.getRef().getElementId().trim().length() > 0) { + b.append(" (" + pl.getRef().getElementId() + ")"); //$NON-NLS-1$//$NON-NLS-2$ } } @@ -139,7 +119,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -147,21 +127,21 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } @@ -172,11 +152,11 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -185,11 +165,11 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -200,47 +180,47 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte t.setEditable(false); GridData gd = new GridData(GridData.FILL_HORIZONTAL); t.setLayoutData(gd); - + UpdateValueStrategy t2m = new UpdateValueStrategy(); t2m.setConverter(new Converter(String.class, MUIElement.class) { - + public Object convert(Object fromObject) { return null; } }); UpdateValueStrategy m2t = new UpdateValueStrategy(); - m2t.setConverter(new Converter(MUIElement.class,String.class) { - + m2t.setConverter(new Converter(MUIElement.class, String.class) { + public Object convert(Object fromObject) { - if( fromObject != null ) { + if (fromObject != null) { EObject o = (EObject) fromObject; - if( o instanceof MUILabel ) { + if (o instanceof MUILabel) { MUILabel label = (MUILabel) o; - if( ! Util.isNullOrEmpty(label.getLabel()) ) { + if (!Util.isNullOrEmpty(label.getLabel())) { return o.eClass().getName() + " - " + label.getLabel(); } } - - return o.eClass().getName() + " - "+((MUIElement)fromObject).getElementId(); + + return o.eClass().getName() + " - " + ((MUIElement) fromObject).getElementId(); } return null; } }); - - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), AdvancedPackageImpl.Literals.PLACEHOLDER__REF).observeDetail(getMaster()),t2m,m2t); - - final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + + context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), AdvancedPackageImpl.Literals.PLACEHOLDER__REF).observeDetail(getMaster()), t2m, m2t); + + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setText(Messages.PlaceholderEditor_FindReference); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - SharedElementsDialog dialog = new SharedElementsDialog(b.getShell(),getEditor(),(MPlaceholder) getMaster().getValue(), resource); + SharedElementsDialog dialog = new SharedElementsDialog(b.getShell(), getEditor(), (MPlaceholder) getMaster().getValue(), resource); dialog.open(); } }); } - return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index 4887cdf1f0..0b0fdf2726 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -10,42 +10,39 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; - +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.emf.databinding.EMFProperties; - import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - -import java.util.List; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; +import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -56,41 +53,28 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -import org.eclipse.swt.SWT; - -import org.eclipse.core.databinding.observable.value.WritableValue; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.emf.databinding.EMFDataBindingContext; - -import org.eclipse.emf.edit.domain.EditingDomain; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; - -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class ToolBarContributionEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; private IProject project; - + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; - + private EStackLayout stackLayout; + private static class Struct { private final String label; private final EClass eClass; @@ -102,15 +86,15 @@ public Struct(String label, EClass eClass, boolean separator) { this.separator = separator; } } - + public ToolBarContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); this.project = project; } @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { @@ -143,7 +127,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -151,21 +135,21 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } @@ -176,11 +160,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -193,7 +177,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -220,12 +204,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__POSITION_IN_PARENT).observeDetail(getMaster())); } - // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ToolBarEditor_ToolbarItems); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); @@ -373,8 +356,8 @@ public void widgetSelected(SelectionEvent e) { } }); } - - ControlFactory.createTagsWidget(parent, this); + + ControlFactory.createTagsWidget(parent, this); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 41e114f6af..8a644d3134 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -10,19 +10,14 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.emf.ecore.EObject; - import java.net.MalformedURLException; import java.net.URL; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; @@ -41,6 +36,7 @@ import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; @@ -64,6 +60,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -75,7 +72,7 @@ public class ToolBarEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; + private EStackLayout stackLayout; private static class Struct { private final String label; @@ -89,14 +86,13 @@ public Struct(String label, EClass eClass, boolean separator) { } } - public ToolBarEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBar.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { @@ -123,7 +119,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -131,21 +127,21 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } @@ -156,11 +152,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -173,12 +169,12 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ToolBarEditor_ToolbarItems); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index 47a639ef7a..a8eeac79d9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -10,27 +10,19 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Button; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -39,6 +31,7 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -47,10 +40,10 @@ public class ToolBarSeparatorEditor extends AbstractComponentEditor { private Image separatorImage; private Composite composite; private EMFDataBindingContext context; - private StackLayout stackLayout; - + private EStackLayout stackLayout; + public ToolBarSeparatorEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override @@ -88,7 +81,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -96,36 +89,36 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } - + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -138,7 +131,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index dcc8a364d0..f1344ce398 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -10,29 +10,24 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - import java.net.MalformedURLException; import java.net.URL; import java.util.Map.Entry; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -48,6 +43,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -57,10 +53,10 @@ public class ToolControlEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private Composite composite; private IProject project; - private StackLayout stackLayout; + private EStackLayout stackLayout; public ToolControlEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain,editor); + super(editingDomain, editor); this.project = project; } @@ -100,7 +96,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -108,21 +104,21 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } @@ -132,12 +128,12 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -150,7 +146,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -162,6 +158,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText("Find ..."); b.addSelectionListener(new SelectionAdapter() { @@ -172,7 +169,7 @@ public void widgetSelected(SelectionEvent e) { } }); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -186,7 +183,7 @@ public void widgetSelected(SelectionEvent e) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 80; tableviewer.getControl().setLayoutData(gd); - + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); column.getColumn().setText("Key"); column.getColumn().setWidth(200); @@ -197,9 +194,9 @@ public String getText(Object element) { Entry entry = (Entry) element; return entry.getKey(); } - }); + }); - //FIXME How can we react upon changes in the Map-Value? + // FIXME How can we react upon changes in the Map-Value? column = new TableViewerColumn(tableviewer, SWT.NONE); column.getColumn().setText("Value"); column.getColumn().setWidth(200); @@ -211,17 +208,17 @@ public String getText(Object element) { return entry.getValue(); } }); - + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE); tableviewer.setInput(prop.observeDetail(getMaster())); - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 8376509aad..94256a0d95 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -10,37 +10,30 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.emf.common.util.URI; - -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.conversion.Converter; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ToolItemIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.ItemType; import org.eclipse.e4.ui.model.application.ui.menu.MToolItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.common.util.URI; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -54,6 +47,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -61,7 +55,7 @@ public abstract class ToolItemEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; protected IProject project; - private StackLayout stackLayout; + private EStackLayout stackLayout; public ToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain, editor); @@ -74,7 +68,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -82,21 +76,21 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } @@ -107,11 +101,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + Label l = new Label(parent, SWT.NONE); l.setText("Id"); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); @@ -121,7 +115,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gd.horizontalSpan = 2; t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); - + createFormSubTypeForm(parent, context, master); return parent; @@ -185,18 +179,18 @@ private void createFormSubTypeForm(Composite parent, EMFDataBindingContext conte context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); new ImageTooltip(t) { - + @Override protected URI getImageURI() { MUILabel part = (MUILabel) getMaster().getValue(); String uri = part.getIconURI(); - if( uri == null || uri.trim().length() == 0 ) { + if (uri == null || uri.trim().length() == 0) { return null; } return URI.createURI(part.getIconURI()); } }; - + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText("Find ..."); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); @@ -204,19 +198,19 @@ protected URI getImageURI() { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ToolItemIconDialogEditor dialog = new ToolItemIconDialogEditor(b.getShell(), project,getEditingDomain(),(MToolItem) getMaster().getValue()); + ToolItemIconDialogEditor dialog = new ToolItemIconDialogEditor(b.getShell(), project, getEditingDomain(), (MToolItem) getMaster().getValue()); dialog.open(); } }); } - + { Label l = new Label(parent, SWT.NONE); l.setText("Enabled"); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - + Button b = new Button(parent, SWT.CHECK); - b.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); + b.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); context.bindValue(checkProp.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__ENABLED).observeDetail(getMaster())); } @@ -224,11 +218,11 @@ public void widgetSelected(SelectionEvent e) { Label l = new Label(parent, SWT.NONE); l.setText("Selected"); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - + Button b = new Button(parent, SWT.CHECK); - b.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); + b.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); context.bindValue(checkProp.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__SELECTED).observeDetail(getMaster())); - + UpdateValueStrategy t2m = new UpdateValueStrategy(); t2m.setConverter(new Converter(boolean.class, ItemType.class) { @@ -238,13 +232,13 @@ public Object convert(Object fromObject) { }); UpdateValueStrategy m2t = new UpdateValueStrategy(); m2t.setConverter(new Converter(ItemType.class, boolean.class) { - + public Object convert(Object fromObject) { return fromObject == ItemType.CHECK || fromObject == ItemType.RADIO; } }); - - context.bindValue(enabled.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(getMaster()),t2m,m2t); + + context.bindValue(enabled.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(getMaster()), t2m, m2t); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index 21a5ad7375..cf5520040d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -10,22 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; - -import org.eclipse.emf.ecore.util.EcoreUtil; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.jface.viewers.LabelProvider; - import java.net.MalformedURLException; import java.net.URL; import java.util.List; @@ -33,6 +17,8 @@ import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; @@ -41,14 +27,16 @@ import org.eclipse.e4.ui.model.application.ui.MGenericTrimContainer; import org.eclipse.e4.ui.model.application.ui.SideValue; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; @@ -60,6 +48,7 @@ import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; @@ -70,6 +59,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -82,16 +72,16 @@ public class TrimBarEditor extends AbstractComponentEditor { private ModelEditor editor; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; + private EStackLayout stackLayout; public TrimBarEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); this.editor = editor; } @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { @@ -119,7 +109,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -127,50 +117,49 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master, boolean isImport) { - parent = new Composite(parent,SWT.NONE); + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { + parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText("Id"); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - + Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -191,49 +180,49 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { Label l = new Label(parent, SWT.NONE); l.setText("Controls"); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); - + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); + final TableViewer viewer = new TableViewer(parent); viewer.setLabelProvider(new ComponentLabelProvider(editor)); viewer.setContentProvider(new ObservableListContentProvider()); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - + IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(getMaster())); - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(2,false); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; - if( idx >= 0 ) { + if (idx >= 0) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -242,80 +231,76 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Down"); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; - if( idx < container.getChildren().size() ) { + if (idx < container.getChildren().size()) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } }); - - final ComboViewer typeViewer = new ComboViewer(buttonComp,SWT.READ_ONLY); + + final ComboViewer typeViewer = new ComboViewer(buttonComp, SWT.READ_ONLY); typeViewer.setContentProvider(new ArrayContentProvider()); typeViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { - return ((EClass)element).getName(); + return ((EClass) element).getName(); } }); - typeViewer.setInput(new Object[] { - MenuPackageImpl.Literals.TOOL_BAR, - MenuPackageImpl.Literals.TOOL_CONTROL - }); + typeViewer.setInput(new Object[] { MenuPackageImpl.Literals.TOOL_BAR, MenuPackageImpl.Literals.TOOL_CONTROL }); typeViewer.setSelection(new StructuredSelection(MenuPackageImpl.Literals.TOOL_BAR)); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - EObject toolbar = EcoreUtil.create((EClass) ((IStructuredSelection)typeViewer.getSelection()).getFirstElement()); + EObject toolbar = EcoreUtil.create((EClass) ((IStructuredSelection) typeViewer.getSelection()).getFirstElement()); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); editor.setSelection(toolbar); } } }); - - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Remove"); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List elements = ((IStructuredSelection)viewer.getSelection()).toList(); - + if (!viewer.getSelection().isEmpty()) { + List elements = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } } }); } - + return parent; } @@ -327,19 +312,17 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { MGenericTrimContainer trim = (MGenericTrimContainer) element; - - if( trim.getSide() != null ) { + + if (trim.getSide() != null) { return trim.getSide().toString(); } - + return null; } - + @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { - FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TRIM_CONTAINER__SIDE) - }; + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TRIM_CONTAINER__SIDE) }; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index 55bbf9d60b..b9fb8c6056 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -10,46 +10,35 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; - -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; - +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.emf.databinding.EMFProperties; - import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - -import java.util.List; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; -import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -59,42 +48,28 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -import org.eclipse.swt.SWT; - -import org.eclipse.core.databinding.observable.value.WritableValue; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.emf.databinding.EMFDataBindingContext; - -import org.eclipse.emf.edit.domain.EditingDomain; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; - -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class TrimContributionEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; private IProject project; - + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; - + private EStackLayout stackLayout; + private static class Struct { private final String label; private final EClass eClass; @@ -106,15 +81,15 @@ public Struct(String label, EClass eClass, boolean separator) { this.separator = separator; } } - + public TrimContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); this.project = project; } @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif")); //$NON-NLS-1$ } catch (MalformedURLException e) { @@ -147,7 +122,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -155,21 +130,21 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } @@ -180,11 +155,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -197,7 +172,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -224,54 +199,53 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__POSITION_IN_PARENT).observeDetail(getMaster())); } - // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText("Controls"); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); - + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); + final TableViewer viewer = new TableViewer(parent); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); viewer.setContentProvider(new ObservableListContentProvider()); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - + IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(getMaster())); - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(2,false); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; - if( idx >= 0 ) { + if (idx >= 0) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -280,81 +254,77 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Down"); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; - if( idx < container.getChildren().size() ) { + if (idx < container.getChildren().size()) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } }); - - final ComboViewer typeViewer = new ComboViewer(buttonComp,SWT.READ_ONLY); + + final ComboViewer typeViewer = new ComboViewer(buttonComp, SWT.READ_ONLY); typeViewer.setContentProvider(new ArrayContentProvider()); typeViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { - return ((EClass)element).getName(); + return ((EClass) element).getName(); } }); - typeViewer.setInput(new Object[] { - MenuPackageImpl.Literals.TOOL_BAR, - MenuPackageImpl.Literals.TOOL_CONTROL - }); + typeViewer.setInput(new Object[] { MenuPackageImpl.Literals.TOOL_BAR, MenuPackageImpl.Literals.TOOL_CONTROL }); typeViewer.setSelection(new StructuredSelection(MenuPackageImpl.Literals.TOOL_BAR)); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - EObject toolbar = EcoreUtil.create((EClass) ((IStructuredSelection)typeViewer.getSelection()).getFirstElement()); + EObject toolbar = EcoreUtil.create((EClass) ((IStructuredSelection) typeViewer.getSelection()).getFirstElement()); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); getEditor().setSelection(toolbar); } } }); - - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Remove"); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List elements = ((IStructuredSelection)viewer.getSelection()).toList(); - + if (!viewer.getSelection().isEmpty()) { + List elements = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } } }); } - - ControlFactory.createTagsWidget(parent, this); + + ControlFactory.createTagsWidget(parent, this); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 44363b33a2..35e393b973 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -10,21 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.emf.common.util.URI; - -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.edit.command.RemoveCommand; - -import org.eclipse.e4.tools.emf.ui.internal.Messages; - import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; @@ -37,22 +22,28 @@ import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.WindowIconDialogEditor; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.URI; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; @@ -66,6 +57,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -82,13 +74,13 @@ public class WindowEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private IListProperty SHARED_ELEMENTS = EMFProperties.list(BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS); private IValueProperty WINDOW__MAIN_MENU = EMFProperties.value(BasicPackageImpl.Literals.WINDOW__MAIN_MENU); - + private Action addMainMenu; private Button createRemoveMainMenu; - private StackLayout stackLayout; - + private EStackLayout stackLayout; + public WindowEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain,editor); + super(editingDomain, editor); this.project = project; addMainMenu = new Action("Add Main Menu") { @Override @@ -100,7 +92,7 @@ public void run() { @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif")); } catch (MalformedURLException e) { @@ -128,7 +120,7 @@ public Composite getEditor(Composite parent, Object object) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); + stackLayout = new EStackLayout(); composite.setLayout(stackLayout); createForm(composite, context, getMaster(), false); createForm(composite, context, getMaster(), true); @@ -136,42 +128,41 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - if( createRemoveMainMenu != null ) { - createRemoveMainMenu.setSelection(((MWindow)object).getMainMenu() != null); + if (createRemoveMainMenu != null) { + createRemoveMainMenu.setSelection(((MWindow) object).getMainMenu() != null); } - + getMaster().setValue(object); - + return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master, boolean isImport) { - parent = new Composite(parent,SWT.NONE); + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { + parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -180,11 +171,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -193,9 +184,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__X).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__X).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -206,9 +197,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__Y).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__Y).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -219,9 +210,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__WIDTH).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__WIDTH).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -232,9 +223,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__HEIGHT).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__HEIGHT).observeDetail(getMaster())); } // ------------------------------------------------------------ @@ -247,7 +238,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); } // ------------------------------------------------------------ @@ -260,7 +251,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); } // ------------------------------------------------------------ @@ -271,21 +262,21 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); new ImageTooltip(t) { - + @Override protected URI getImageURI() { MUILabel part = (MUILabel) getMaster().getValue(); String uri = part.getIconURI(); - if( uri == null || uri.trim().length() == 0 ) { + if (uri == null || uri.trim().length() == 0) { return null; } return URI.createURI(part.getIconURI()); } }; - + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText("Find ..."); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); @@ -293,30 +284,30 @@ protected URI getImageURI() { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - WindowIconDialogEditor dialog = new WindowIconDialogEditor(b.getShell(), project,getEditingDomain(),(MWindow) getMaster().getValue()); + WindowIconDialogEditor dialog = new WindowIconDialogEditor(b.getShell(), project, getEditingDomain(), (MWindow) getMaster().getValue()); dialog.open(); } }); } - + { Label l = new Label(parent, SWT.NONE); l.setText("Main Menu"); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - + createRemoveMainMenu = new Button(parent, SWT.CHECK); createRemoveMainMenu.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { MWindow window = (MWindow) getMaster().getValue(); - if( window.getMainMenu() == null ) { + if (window.getMainMenu() == null) { addMenu(); } else { removeMenu(); } } }); - createRemoveMainMenu.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER,false,false,2,1)); + createRemoveMainMenu.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); } ControlFactory.createSelectedElement(parent, this, context, "Selected Element"); @@ -326,18 +317,18 @@ public void widgetSelected(SelectionEvent e) { return parent; } - + void removeMenu() { Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__MAIN_MENU, null); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } - + void addMenu() { MMenu menu = MMenuFactory.INSTANCE.createMenu(); Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__MAIN_MENU, menu); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } @@ -345,11 +336,11 @@ void addMenu() { @Override public IObservableList getChildList(final Object element) { final WritableList list = new WritableList(); - if( getEditor().isModelFragment() && Util.isImport((EObject) element) ) { + if (getEditor().isModelFragment() && Util.isImport((EObject) element)) { return list; } - - list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { + + list.add(new VirtualEntry(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { @Override protected boolean accepted(Object o) { @@ -357,8 +348,8 @@ protected boolean accepted(Object o) { } }); - - list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOWS, WINDOW__WINDOWS, element, "Windows") { + + list.add(new VirtualEntry(ModelEditor.VIRTUAL_WINDOWS, WINDOW__WINDOWS, element, "Windows") { @Override protected boolean accepted(Object o) { @@ -367,7 +358,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOW_CONTROLS, ELEMENT_CONTAINER__CHILDREN, element, "Controls") { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_WINDOW_CONTROLS, ELEMENT_CONTAINER__CHILDREN, element, "Controls") { @Override protected boolean accepted(Object o) { @@ -375,32 +366,32 @@ protected boolean accepted(Object o) { } }); - - list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOW_SHARED_ELEMENTS, SHARED_ELEMENTS, element, "Shared Elements" ) { + + list.add(new VirtualEntry(ModelEditor.VIRTUAL_WINDOW_SHARED_ELEMENTS, SHARED_ELEMENTS, element, "Shared Elements") { protected boolean accepted(Object o) { return true; } }); - + MWindow window = (MWindow) element; - if( window.getMainMenu() != null ) { - list.add(0,window.getMainMenu()); + if (window.getMainMenu() != null) { + list.add(0, window.getMainMenu()); } - + WINDOW__MAIN_MENU.observe(element).addValueChangeListener(new IValueChangeListener() { - + public void handleValueChange(ValueChangeEvent event) { - if( event.diff.getOldValue() != null ) { + if (event.diff.getOldValue() != null) { list.remove(event.diff.getOldValue()); - if( getMaster().getValue() == element ) { - createRemoveMainMenu.setSelection(false); + if (getMaster().getValue() == element) { + createRemoveMainMenu.setSelection(false); } } - - if( event.diff.getNewValue() != null ) { - list.add(0,event.diff.getNewValue()); - if( getMaster().getValue() == element ) { - createRemoveMainMenu.setSelection(true); + + if (event.diff.getNewValue() != null) { + list.add(0, event.diff.getNewValue()); + if (getMaster().getValue() == element) { + createRemoveMainMenu.setSelection(true); } } } @@ -411,29 +402,27 @@ public void handleValueChange(ValueChangeEvent event) { @Override public String getDetailLabel(Object element) { - MWindow window = (MWindow)element; - if( window.getLabel() != null && window.getLabel().trim().length() > 0 ) { + MWindow window = (MWindow) element; + if (window.getLabel() != null && window.getLabel().trim().length() > 0) { return window.getLabel(); } return null; } - + @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { - FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) - }; + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; } - + @Override public List getActions(Object element) { List actions = new ArrayList(); - + MWindow window = (MWindow) element; - if( window.getMainMenu() == null ) { + if (window.getMainMenu() == null) { actions.add(addMainMenu); } - + return actions; } } \ No newline at end of file From 6898999e7c3daae7e438b93a5a170d30307b7e9a Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 26 Jun 2010 15:52:40 +0000 Subject: [PATCH 0159/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed minor layout tweaks --- .../component/AbstractComponentEditor.java | 36 +- .../tools/emf/ui/internal/Messages.properties | 2 +- .../common/component/ApplicationEditor.java | 48 +-- .../common/component/CommandEditor.java | 131 ++++--- .../common/component/ControlFactory.java | 347 +----------------- .../common/component/HandlerEditor.java | 32 +- .../common/component/KeyBindingEditor.java | 2 +- .../component/MenuContributionEditor.java | 2 +- .../internal/common/component/MenuEditor.java | 2 +- .../common/component/MenuItemEditor.java | 2 +- .../component/PartDescriptorEditor.java | 2 +- .../internal/common/component/PartEditor.java | 13 +- .../component/PartSashContainerEditor.java | 4 +- .../common/component/PartStackEditor.java | 5 +- .../common/component/PerspectiveEditor.java | 2 +- .../component/PerspectiveStackEditor.java | 2 +- .../component/ToolBarContributionEditor.java | 2 +- .../common/component/ToolItemEditor.java | 2 +- .../component/TrimContributionEditor.java | 2 +- .../common/component/WindowEditor.java | 6 +- 20 files changed, 160 insertions(+), 484 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index 3df9f5032f..5ca17b80a6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.common.component; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - import java.io.IOException; import java.io.InputStream; import java.net.URL; @@ -22,6 +20,7 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.runtime.FileLocator; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; @@ -33,12 +32,11 @@ public abstract class AbstractComponentEditor { private EditingDomain editingDomain; private static Map IMAGE_MAP = new HashMap(); - private static final String[] IMAGES = { - "/icons/full/obj16/zoom.png", //$NON-NLS-1$ - "/icons/full/obj16/table_add.png", //$NON-NLS-1$ - "/icons/full/obj16/table_delete.png", //$NON-NLS-1$ - "/icons/full/obj16/arrow_up.png", //$NON-NLS-1$ - "/icons/full/obj16/arrow_down.png" //$NON-NLS-1$ + private static final String[] IMAGES = { "/icons/full/obj16/zoom.png", //$NON-NLS-1$ + "/icons/full/obj16/table_add.png", //$NON-NLS-1$ + "/icons/full/obj16/table_delete.png", //$NON-NLS-1$ + "/icons/full/obj16/arrow_up.png", //$NON-NLS-1$ + "/icons/full/obj16/arrow_down.png" //$NON-NLS-1$ }; private WritableValue master = new WritableValue(); @@ -49,8 +47,10 @@ public abstract class AbstractComponentEditor { public static final int ARROW_UP = 3; public static final int ARROW_DOWN = 4; + protected static final int VERTICAL_LIST_WIDGET_INDENT = 10; + private ModelEditor editor; - + public AbstractComponentEditor(EditingDomain editingDomain, ModelEditor editor) { this.editingDomain = editingDomain; this.editor = editor; @@ -59,7 +59,7 @@ public AbstractComponentEditor(EditingDomain editingDomain, ModelEditor editor) public EditingDomain getEditingDomain() { return editingDomain; } - + public ModelEditor getEditor() { return editor; } @@ -68,9 +68,9 @@ public WritableValue getMaster() { return master; } - public Image getImage( Display d, int id) { + public Image getImage(Display d, int id) { Image img = IMAGE_MAP.get(id); - if( img == null ) { + if (img == null) { try { InputStream in = AbstractComponentEditor.class.getClassLoader().getResourceAsStream(IMAGES[id]); img = new Image(d, in); @@ -85,18 +85,22 @@ public Image getImage( Display d, int id) { return img; } - public abstract Image getImage(Object element,Display display); + public abstract Image getImage(Object element, Display display); + public abstract String getLabel(Object element); + public abstract String getDetailLabel(Object element); public abstract String getDescription(Object element); + public abstract Composite getEditor(Composite parent, Object object); + public abstract IObservableList getChildList(Object element); protected Image loadSharedImage(Display d, URL path) { try { URL url = FileLocator.resolve(path); - if( url != null ) { + if (url != null) { InputStream in = url.openStream(); Image image = new Image(d, in); in.close(); @@ -108,11 +112,11 @@ protected Image loadSharedImage(Display d, URL path) { } return null; } - + public FeaturePath[] getLabelProperties() { return new FeaturePath[] {}; } - + public List getActions(Object element) { return Collections.emptyList(); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index e3408ff1eb..efb9a05514 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -79,7 +79,7 @@ HandledMenuItemEditor_Description=HandledMenuItem bla bla bla HandledMenuItemEditor_Command=Command HandledMenuItemEditor_Find=Find ... HandledMenuItemEditor_Parameters=Parameters -HandledMenuItemEditor_Tag=Tag +HandledMenuItemEditor_Tag=Name HandledMenuItemEditor_Value=Value HandledMenuItemEditor_Up=Up HandledMenuItemEditor_Down=Down diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 810c571577..c2bed1d240 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -54,14 +54,14 @@ public class ApplicationEditor extends AbstractComponentEditor { private IListProperty MENU_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS); private IListProperty TOOLBAR_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS); private IListProperty TRIM_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS); - + public ApplicationEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Application.png")); //$NON-NLS-1$ } catch (MalformedURLException e) { @@ -85,9 +85,9 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context); + composite = createForm(parent, context); } getMaster().setValue(object); return composite; @@ -108,19 +108,19 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - - ControlFactory.createVariablesWidget(parent, this); - ControlFactory.createBindingsWidget(parent, this); + + ControlFactory.createStringListWidget(parent, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, "Binding Contexts", CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); return parent; } - + @Override public IObservableList getChildList(Object element) { WritableList list = new WritableList(); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_ADDONS, APPLICATION__ADDONS, element, Messages.ApplicationEditor_Addons) { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_ADDONS, APPLICATION__ADDONS, element, Messages.ApplicationEditor_Addons) { @Override protected boolean accepted(Object o) { @@ -128,8 +128,8 @@ protected boolean accepted(Object o) { } }); - - list.add(new VirtualEntry( ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.ApplicationEditor_Handlers) { + + list.add(new VirtualEntry(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.ApplicationEditor_Handlers) { @Override protected boolean accepted(Object o) { @@ -137,8 +137,8 @@ protected boolean accepted(Object o) { } }); - - list.add(new VirtualEntry( ModelEditor.VIRTUAL_PART_DESCRIPTORS, PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, element, Messages.ApplicationEditor_PartDescriptors) { + + list.add(new VirtualEntry(ModelEditor.VIRTUAL_PART_DESCRIPTORS, PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, element, Messages.ApplicationEditor_PartDescriptors) { @Override protected boolean accepted(Object o) { @@ -147,7 +147,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_BINDING_TABLE, BINDING_CONTAINER__BINDINGS, element, Messages.ApplicationEditor_BindingTables) { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_BINDING_TABLE, BINDING_CONTAINER__BINDINGS, element, Messages.ApplicationEditor_BindingTables) { @Override protected boolean accepted(Object o) { @@ -156,7 +156,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_COMMAND, APPLICATION__COMMANDS, element, Messages.ApplicationEditor_Commands) { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_COMMAND, APPLICATION__COMMANDS, element, Messages.ApplicationEditor_Commands) { @Override protected boolean accepted(Object o) { @@ -165,7 +165,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry( ModelEditor.VIRTUAL_WINDOWS, ELEMENT_CONTAINER__CHILDREN, element, Messages.ApplicationEditor_Windows) { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_WINDOWS, ELEMENT_CONTAINER__CHILDREN, element, Messages.ApplicationEditor_Windows) { @Override protected boolean accepted(Object o) { @@ -173,22 +173,22 @@ protected boolean accepted(Object o) { } }); - - list.add(new VirtualEntry( ModelEditor.VIRTUAL_MENU_CONTRIBUTIONS, MENU_CONTRIBUTIONS, element, Messages.ApplicationEditor_MenuContributions ) { + + list.add(new VirtualEntry(ModelEditor.VIRTUAL_MENU_CONTRIBUTIONS, MENU_CONTRIBUTIONS, element, Messages.ApplicationEditor_MenuContributions) { @Override protected boolean accepted(Object o) { return true; } }); - - list.add(new VirtualEntry( ModelEditor.VIRTUAL_TOOLBAR_CONTRIBUTIONS, TOOLBAR_CONTRIBUTIONS, element, Messages.ApplicationEditor_ToolBarContributions ) { + + list.add(new VirtualEntry(ModelEditor.VIRTUAL_TOOLBAR_CONTRIBUTIONS, TOOLBAR_CONTRIBUTIONS, element, Messages.ApplicationEditor_ToolBarContributions) { @Override protected boolean accepted(Object o) { return true; } }); - - list.add(new VirtualEntry( ModelEditor.VIRTUAL_TRIM_CONTRIBUTIONS, TRIM_CONTRIBUTIONS, element, Messages.ApplicationEditor_TrimContributions ) { + + list.add(new VirtualEntry(ModelEditor.VIRTUAL_TRIM_CONTRIBUTIONS, TRIM_CONTRIBUTIONS, element, Messages.ApplicationEditor_TrimContributions) { @Override protected boolean accepted(Object o) { return true; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 9c5284bfbc..4e55a7a0fb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -71,7 +71,7 @@ public class CommandEditor extends AbstractComponentEditor { private EStackLayout stackLayout; public CommandEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override @@ -112,21 +112,21 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } @@ -136,10 +136,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if( isImport ) { + + if (isImport) { ControlFactory.createFindImport(parent, this, context); - + return parent; } @@ -152,9 +152,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -165,30 +165,30 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME).observeDetail(getMaster())); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.CommandEditor_LabelDescription); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - Text t = new Text(parent, SWT.BORDER|SWT.H_SCROLL|SWT.V_SCROLL); + Text t = new Text(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; - gd.heightHint=100; + gd.heightHint = 100; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__DESCRIPTION).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__DESCRIPTION).observeDetail(getMaster())); } // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.CommandEditor_Parameters); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - final TableViewer viewer = new TableViewer(parent,SWT.FULL_SELECTION|SWT.MULTI|SWT.BORDER); + final TableViewer viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); viewer.getTable().setHeaderVisible(true); @@ -199,73 +199,73 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO { IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText(Messages.CommandEditor_ParameterId); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); column.setEditingSupport(new EditingSupport(viewer) { private TextCellEditor editor = new TextCellEditor(viewer.getTable()); - + @Override protected void setValue(Object element, Object value) { - if( value.toString().trim().length() == 0 ) { + if (value.toString().trim().length() == 0) { value = null; } - + Command cmd = SetCommand.create(getEditingDomain(), element, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, value); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } - + @Override protected Object getValue(Object element) { MCommandParameter obj = (MCommandParameter) element; return obj.getElementId() != null ? obj.getElementId() : ""; //$NON-NLS-1$ } - + @Override protected CellEditor getCellEditor(Object element) { return editor; } - + @Override protected boolean canEdit(Object element) { return true; } }); } - + { IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__NAME); - + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText(Messages.CommandEditor_ParameterName); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); column.setEditingSupport(new EditingSupport(viewer) { private TextCellEditor editor = new TextCellEditor(viewer.getTable()); - + @Override protected void setValue(Object element, Object value) { Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.COMMAND_PARAMETER__NAME, value); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } - + @Override protected Object getValue(Object element) { MCommandParameter obj = (MCommandParameter) element; return obj.getName() != null ? obj.getName() : ""; //$NON-NLS-1$ } - + @Override protected CellEditor getCellEditor(Object element) { return editor; } - + @Override protected boolean canEdit(Object element) { return true; @@ -275,33 +275,33 @@ protected boolean canEdit(Object element) { { IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__TYPE_ID); - + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText(Messages.CommandEditor_ParameterTypeId); - column.getColumn().setWidth(200); + column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); column.setEditingSupport(new EditingSupport(viewer) { private TextCellEditor editor = new TextCellEditor(viewer.getTable()); - + @Override protected void setValue(Object element, Object value) { Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.COMMAND_PARAMETER__TYPE_ID, value); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } - + @Override protected Object getValue(Object element) { MCommandParameter obj = (MCommandParameter) element; return obj.getTypeId() != null ? obj.getTypeId() : ""; //$NON-NLS-1$ } - + @Override protected CellEditor getCellEditor(Object element) { return editor; } - + @Override protected boolean canEdit(Object element) { return true; @@ -311,10 +311,10 @@ protected boolean canEdit(Object element) { { IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__OPTIONAL); - + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText(Messages.CommandEditor_ParameterOptional); - column.getColumn().setWidth(200); + column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements())) { @Override public String getText(MCommandParameter element) { @@ -323,27 +323,27 @@ public String getText(MCommandParameter element) { }); column.setEditingSupport(new EditingSupport(viewer) { private ComboBoxCellEditor editor = new ComboBoxCellEditor(viewer.getTable(), new String[] { Messages.CommandEditor_ParameterOptional_Yes, Messages.CommandEditor_ParameterOptional_No }); - + @Override protected void setValue(Object element, Object value) { - int idx = ((Number)value).intValue(); + int idx = ((Number) value).intValue(); Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.COMMAND_PARAMETER__OPTIONAL, idx == 0); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } - + @Override protected Object getValue(Object element) { MCommandParameter obj = (MCommandParameter) element; return obj.isOptional() ? 0 : 1; } - + @Override protected CellEditor getCellEditor(Object element) { return editor; } - + @Override protected boolean canEdit(Object element) { return true; @@ -354,27 +354,24 @@ protected boolean canEdit(Object element) { ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(viewer) { @Override protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { - boolean singleSelect = ((IStructuredSelection)viewer.getSelection()).size() == 1; - boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent)event.sourceEvent).button == 1; + boolean singleSelect = ((IStructuredSelection) viewer.getSelection()).size() == 1; + boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent) event.sourceEvent).button == 1; - return singleSelect && (isLeftDoubleMouseSelect - || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC - || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); + return singleSelect && (isLeftDoubleMouseSelect || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); } }; TableViewerEditor.create(viewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); - IEMFEditListProperty mProp = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__PARAMETERS); viewer.setInput(mProp.observeDetail(getMaster())); Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); @@ -396,8 +393,8 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even public void widgetSelected(SelectionEvent e) { MCommandParameter param = MCommandsFactory.INSTANCE.createCommandParameter(); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.COMMAND__PARAMETERS, param); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.editElement(param, 0); } @@ -410,7 +407,7 @@ public void widgetSelected(SelectionEvent e) { b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); } - ControlFactory.createTagsWidget(parent, this); + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } @@ -429,12 +426,10 @@ public String getDetailLabel(Object element) { return null; } - + @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { - FeaturePath.fromList(CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME) - }; + return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME) }; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index adb04cabea..7c12c0b296 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -24,8 +24,6 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.commands.MBindings; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MContext; import org.eclipse.e4.ui.model.application.ui.MUILabel; @@ -156,13 +154,17 @@ public void handleValueChange(ValueChangeEvent event) { }); } - public static void createStringListWidget(Composite parent, final AbstractComponentEditor editor, String label, final EStructuralFeature feature) { + public static void createStringListWidget(Composite parent, final AbstractComponentEditor editor, String label, final EStructuralFeature feature, int vIndent) { Label l = new Label(parent, SWT.NONE); l.setText(label); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); + GridData gd = new GridData(GridData.END, GridData.BEGINNING, false, false); + gd.verticalIndent = vIndent; + l.setLayoutData(gd); final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + gd = new GridData(GridData.FILL, GridData.BEGINNING, true, false); + gd.verticalIndent = vIndent; + t.setLayoutData(gd); t.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { @@ -175,7 +177,9 @@ public void keyPressed(KeyEvent e) { Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ControlFactory_AddNoEllipse); b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + gd = new GridData(GridData.FILL, GridData.CENTER, false, false); + gd.verticalIndent = vIndent; + b.setLayoutData(gd); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -188,7 +192,7 @@ public void widgetSelected(SelectionEvent e) { final TableViewer viewer = new TableViewer(parent); viewer.setLabelProvider(new LabelProvider()); viewer.setContentProvider(new ObservableListContentProvider()); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 150; viewer.getControl().setLayoutData(gd); @@ -280,335 +284,6 @@ public void widgetSelected(SelectionEvent e) { }); } - public static void createVariablesWidget(Composite parent, final AbstractComponentEditor editor) { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ControlFactory_ContextVariables); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { - handleAddText(editor, UiPackageImpl.Literals.CONTEXT__VARIABLES, t); - } - } - }); - - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_AddNoEllipse); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleAddText(editor, UiPackageImpl.Literals.CONTEXT__VARIABLES, t); - } - }); - - new Label(parent, SWT.NONE); - - final TableViewer viewer = new TableViewer(parent); - viewer.setLabelProvider(new LabelProvider()); - viewer.setContentProvider(new ObservableListContentProvider()); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 150; - viewer.getControl().setLayoutData(gd); - - IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.CONTEXT__VARIABLES); - viewer.setInput(prop.observeDetail(editor.getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Up); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MContext container = (MContext) editor.getMaster().getValue(); - int idx = container.getVariables().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), UiPackageImpl.Literals.CONTEXT__VARIABLES, obj, idx); - - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Down); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MContext container = (MApplication) editor.getMaster().getValue(); - int idx = container.getVariables().indexOf(obj) + 1; - if (idx < container.getVariables().size()) { - Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), UiPackageImpl.Literals.CONTEXT__VARIABLES, obj, idx); - - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Remove); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - MContext el = (MContext) editor.getMaster().getValue(); - List ids = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(editor.getEditingDomain(), el, UiPackageImpl.Literals.CONTEXT__VARIABLES, ids); - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - if (el.getVariables().size() > 0) { - viewer.setSelection(new StructuredSelection(el.getVariables().get(0))); - } - } - } - } - }); - } - - public static void createBindingsWidget(Composite parent, final AbstractComponentEditor editor) { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ControlFactory_BindingContexts); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { - handleAddText(editor, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, t); - } - } - }); - - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_AddNoEllipse); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleAddText(editor, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, t); - } - }); - - new Label(parent, SWT.NONE); - - final TableViewer viewer = new TableViewer(parent); - viewer.setLabelProvider(new LabelProvider()); - viewer.setContentProvider(new ObservableListContentProvider()); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 150; - viewer.getControl().setLayoutData(gd); - - IEMFListProperty prop = EMFProperties.list(CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS); - viewer.setInput(prop.observeDetail(editor.getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Up); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MBindings container = (MBindings) editor.getMaster().getValue(); - int idx = container.getBindingContexts().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); - - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Down); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MBindings container = (MBindings) editor.getMaster().getValue(); - int idx = container.getBindingContexts().indexOf(obj) + 1; - if (idx < container.getBindingContexts().size()) { - Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); - - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Remove); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - MBindings el = (MBindings) editor.getMaster().getValue(); - List ids = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(editor.getEditingDomain(), el, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, ids); - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - if (el.getBindingContexts().size() > 0) { - viewer.setSelection(new StructuredSelection(el.getBindingContexts().get(0))); - } - } - } - } - }); - } - - public static void createTagsWidget(Composite parent, final AbstractComponentEditor editor) { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ControlFactory_Tags); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text tagText = new Text(parent, SWT.BORDER); - tagText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - tagText.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { - handleAddText(editor, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, tagText); - } - } - }); - - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_AddNoEllipse); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleAddText(editor, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, tagText); - } - }); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - - new Label(parent, SWT.NONE); - final TableViewer viewer = new TableViewer(parent); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - return element.toString(); - } - }); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 120; - viewer.getControl().setLayoutData(gd); - - IEMFEditListProperty prop = EMFEditProperties.list(editor.getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS); - viewer.setInput(prop.observeDetail(editor.getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Up); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Down); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Remove); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (!s.isEmpty()) { - MApplicationElement appEl = (MApplicationElement) editor.getMaster().getValue(); - Command cmd = RemoveCommand.create(editor.getEditingDomain(), appEl, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, s.toList()); - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - private static void handleAddText(AbstractComponentEditor editor, EStructuralFeature feature, Text tagText) { if (tagText.getText().trim().length() > 0) { String[] tags = tagText.getText().split(";"); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 3c0566e9dc..6788e92afe 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -56,7 +56,7 @@ public class HandlerEditor extends AbstractComponentEditor { private EStackLayout stackLayout; public HandlerEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource, IProject project) { - super(editingDomain,editor); + super(editingDomain, editor); this.resource = resource; this.project = project; } @@ -98,21 +98,21 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } @@ -122,25 +122,25 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if( isImport ) { - ControlFactory.createFindImport(parent, this, context); + + if (isImport) { + ControlFactory.createFindImport(parent, this, context); return parent; } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.HandlerEditor_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - + Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -182,13 +182,13 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); dialog.open(); } }); } - ControlFactory.createTagsWidget(parent, this); + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 49e35c8694..05c8a27716 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -330,7 +330,7 @@ public void widgetSelected(SelectionEvent e) { b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - ControlFactory.createTagsWidget(parent, this); + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index acec042efa..8593eb2718 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -357,7 +357,7 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createTagsWidget(parent, this); + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 6a8f0edece..33d7513cdb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -390,7 +390,7 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createTagsWidget(parent, this); + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index e9b634d624..662a124d85 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -261,7 +261,7 @@ public Object convert(Object fromObject) { createFormSubTypeForm(parent, context, master); - ControlFactory.createTagsWidget(parent, this); + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 12a4911cfa..8f1d50c42e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -444,7 +444,7 @@ public String getText(Object element) { column.getColumn().setWidth(200); } - ControlFactory.createTagsWidget(parent, this); + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 81f3b23f52..00e32c6653 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -310,20 +310,23 @@ public void widgetSelected(SelectionEvent e) { } // ------------------------------------------------------------ - ControlFactory.createBindingsWidget(parent, this); + ControlFactory.createStringListWidget(parent, this, "Binding Contexts", CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartEditor_PersitedState); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); + GridData gd = new GridData(GridData.END, GridData.BEGINNING, false, false); + gd.verticalIndent = VERTICAL_LIST_WIDGET_INDENT; + l.setLayoutData(gd); TableViewer tableviewer = new TableViewer(parent); tableviewer.getTable().setHeaderVisible(true); ObservableListContentProvider cp = new ObservableListContentProvider(); tableviewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 80; + gd.verticalIndent = VERTICAL_LIST_WIDGET_INDENT; tableviewer.getControl().setLayoutData(gd); TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); @@ -374,8 +377,8 @@ public String getText(Object element) { b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); } - ControlFactory.createVariablesWidget(parent, this); - ControlFactory.createTagsWidget(parent, this); + ControlFactory.createStringListWidget(parent, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index ed04e02e7e..1435e6e19e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -212,8 +212,6 @@ public String getText(Object element) { context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); } - ControlFactory.createTagsWidget(parent, this); - { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PartSashContainerEditor_Controls); @@ -345,6 +343,8 @@ public void widgetSelected(SelectionEvent e) { }); } + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 690624b177..6c82eb7bf0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -10,14 +10,13 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; - import java.net.MalformedURLException; import java.net.URL; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; @@ -301,7 +300,7 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createTagsWidget(parent, this); + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index d20ada0abe..65528d5a34 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -371,7 +371,7 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createTagsWidget(parent, this); + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 110771590e..46f968a2fc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -272,7 +272,7 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createTagsWidget(parent, this); + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index 0b0fdf2726..220e61d440 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -357,7 +357,7 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createTagsWidget(parent, this); + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 94256a0d95..9d2f9401d7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -246,7 +246,7 @@ public Object convert(Object fromObject) { createSubTypeFormElements(parent, context, master); - ControlFactory.createTagsWidget(parent, this); + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); } protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, WritableValue master) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index b9fb8c6056..d3fa9a9a11 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -324,7 +324,7 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createTagsWidget(parent, this); + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 35e393b973..f025d062a4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -311,9 +311,9 @@ public void widgetSelected(SelectionEvent e) { } ControlFactory.createSelectedElement(parent, this, context, "Selected Element"); - ControlFactory.createBindingsWidget(parent, this); - ControlFactory.createVariablesWidget(parent, this); - ControlFactory.createTagsWidget(parent, this); + ControlFactory.createStringListWidget(parent, this, "Binding Contexts", CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } From 8e9841a82f120acb8a3c44f184b290d51938ee24 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 26 Jun 2010 17:17:15 +0000 Subject: [PATCH 0160/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * provide logging implementations --- .../internal/ContextServiceFactory.java | 5 +++++ .../internal/DefaultLoggerProvider.java | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DefaultLoggerProvider.java diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java index e6d3ef7682..55a4242a88 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java @@ -14,6 +14,7 @@ import org.eclipse.e4.core.contexts.EclipseContextFactory; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.core.services.contributions.IContributionFactory; +import org.eclipse.e4.core.services.log.ILoggerProvider; import org.eclipse.e4.core.services.log.Logger; import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; import org.eclipse.e4.ui.css.swt.theme.IThemeManager; @@ -90,6 +91,10 @@ public void style(Object widget) { } }); + if( appContext.get(ILoggerProvider.class) == null ) { + appContext.set(ILoggerProvider.class, ContextInjectionFactory.make(DefaultLoggerProvider.class, appContext)); + } + return appContext; } else if( o != null && site == null ) { final IEclipseContext windowContext = ((IEclipseContext)o).createChild("WindowContext("+window+")"); diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DefaultLoggerProvider.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DefaultLoggerProvider.java new file mode 100644 index 0000000000..b3f922b062 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DefaultLoggerProvider.java @@ -0,0 +1,20 @@ +package org.eclipse.e4.tools.compat.internal; + +import javax.inject.Inject; + +import org.eclipse.e4.core.contexts.ContextInjectionFactory; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.core.services.log.ILoggerProvider; +import org.eclipse.e4.core.services.log.Logger; +import org.osgi.framework.FrameworkUtil; + +public class DefaultLoggerProvider implements ILoggerProvider { + @Inject + private IEclipseContext context; + + public Logger getClassLogger(Class clazz) { + IEclipseContext childContext = context.createChild(); + childContext.set("logger.bundlename", FrameworkUtil.getBundle(clazz).getSymbolicName()); //$NON-NLS-1$ + return (Logger) ContextInjectionFactory.make(WorkbenchLogger.class, childContext); + } +} \ No newline at end of file From ce7d22685a5076f49600cfaa5f8a5d29a82a1a61 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 26 Jun 2010 17:21:11 +0000 Subject: [PATCH 0161/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * update to latest shadow drawing code --- .../emf/ui/internal/ShadowComposite.java | 1444 +++++++---------- 1 file changed, 608 insertions(+), 836 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ShadowComposite.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ShadowComposite.java index af103a6432..d6ec1ccaa3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ShadowComposite.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ShadowComposite.java @@ -11,21 +11,48 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal; +import javax.inject.Inject; +import javax.inject.Named; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.PaintEvent; -import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.custom.CTabFolderRenderer; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.ImageData; import org.eclipse.swt.graphics.PaletteData; import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.graphics.Region; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; public class ShadowComposite extends Composite { + + // ================================ + // Dummy to not modify code + // ================================ + public int marginWidth = 0; + public int marginHeight = 0; + + ShadowComposite parent; + + private int getTabHeight() { + return 0; + } + + private boolean getMinimized() { + return false; + } + + public static final int PART_BODY = -1; + public static final int PART_HEADER = -2; + public static final int PART_BORDER = -3; + public static final int PART_BACKGROUND = -4; + // Constants for circle drawing final static int LEFT_TOP = 0; final static int LEFT_BOTTOM = 1; @@ -34,766 +61,185 @@ public class ShadowComposite extends Composite { // drop shadow constants final static int SIDE_DROP_WIDTH = 3; - final static int BOTTOM_DROP_WIDTH = 5; + final static int BOTTOM_DROP_WIDTH = 4; // keylines - final static int OUTER_KEYLINE = 2; - final static int INNER_KEYLINE = 1; - final static int TOP_KEYLINE = 2; + final static int OUTER_KEYLINE = 1; + final static int INNER_KEYLINE = 0; + final static int TOP_KEYLINE = 0; - static final int CORNER_SIZE = 24; + // Item Constants + static final int ITEM_TOP_MARGIN = 2; + static final int ITEM_BOTTOM_MARGIN = 6; + static final int ITEM_LEFT_MARGIN = 4; + static final int ITEM_RIGHT_MARGIN = 4; + static final int INTERNAL_SPACING = 4; - static final String E4_SHADOW_IMAGE = "org.eclipse.e4.renderer.comp_image"; //$NON-NLS-1$ - - int marginWidth; - int marginHeight; + static final String E4_SHADOW_IMAGE = "org.eclipse.e4.renderer.shadowcomposite_image"; //$NON-NLS-1$ static int[] shape; - static int[] shadow = { 0x02fefefe, 0x03fefefe, 0x05fefefe, 0x06fdfdfd, - 0x08fdfdfd, 0x0bfcfcfc, 0x0dfcfcfc, 0x10fbfbfb, 0x13fafafa, - 0x17f9f9f9, 0x1af9f9f9, 0x1df8f8f8, 0x20f7f7f7, 0x23f6f6f6, - 0x26f6f6f6, 0x28f5f5f5, 0x29f5f5f5, 0x2bf4f4f4, 0x2cf4f4f4, - 0x2df4f4f4, 0x2df4f4f4, 0x2ef4f4f4, 0x2ef4f4f4, 0x2ef4f4f4, - 0x2ff4f4f4, 0x2ff3f3f3, 0x2ff3f3f3, 0x2ff3f3f3, 0x2ff3f3f3, - 0x2ff3f3f3, 0x2ff3f3f3, 0x2ff3f3f3, 0x2ff3f3f3, 0x2ff3f3f3, - 0x2ff3f3f3, 0x2ff4f4f4, 0x2ef4f4f4, 0x2ef4f4f4, 0x2ef4f4f4, - 0x2df4f4f4, 0x2df4f4f4, 0x2cf4f4f4, 0x2bf4f4f4, 0x29f5f5f5, - 0x28f5f5f5, 0x26f6f6f6, 0x23f6f6f6, 0x20f7f7f7, 0x1df8f8f8, - 0x1af9f9f9, 0x17f9f9f9, 0x13fafafa, 0x10fbfbfb, 0x0dfcfcfc, - 0x0bfcfcfc, 0x08fdfdfd, 0x06fdfdfd, 0x05fefefe, 0x03fefefe, - 0x02fefefe, 0x03fefefe, 0x05fefefe, 0x07fdfdfd, 0x09fdfdfd, - 0x0cfcfcfc, 0x0ffbfbfb, 0x13fafafa, 0x17f9f9f9, 0x1bf8f8f8, - 0x1ff7f7f7, 0x23f6f6f6, 0x27f5f5f5, 0x2bf4f4f4, 0x2ff3f3f3, - 0x32f3f3f3, 0x35f2f2f2, 0x37f1f1f1, 0x39f1f1f1, 0x3af1f1f1, - 0x3bf0f0f0, 0x3cf0f0f0, 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, - 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, - 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, - 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, 0x3df0f0f0, - 0x3cf0f0f0, 0x3bf0f0f0, 0x3af1f1f1, 0x39f1f1f1, 0x37f1f1f1, - 0x35f2f2f2, 0x32f3f3f3, 0x2ff3f3f3, 0x2bf4f4f4, 0x27f5f5f5, - 0x23f6f6f6, 0x1ff7f7f7, 0x1bf8f8f8, 0x17f9f9f9, 0x13fafafa, - 0x0ffbfbfb, 0x0cfcfcfc, 0x09fdfdfd, 0x07fdfdfd, 0x05fefefe, - 0x03fefefe, 0x05fefefe, 0x07fdfdfd, 0x09fdfdfd, 0x0dfcfcfc, - 0x10fbfbfb, 0x15fafafa, 0x19f9f9f9, 0x1ef8f8f8, 0x24f6f6f6, - 0x29f5f5f5, 0x2ff4f4f4, 0x34f2f2f2, 0x39f1f1f1, 0x3df0f0f0, - 0x41efefef, 0x44eeeeee, 0x47ededed, 0x49ededed, 0x4bededed, - 0x4cececec, 0x4dececec, 0x4dececec, 0x4eececec, 0x4eececec, - 0x4eececec, 0x4eececec, 0x4eececec, 0x4fececec, 0x4fececec, - 0x4fececec, 0x4fececec, 0x4fececec, 0x4fececec, 0x4eececec, - 0x4eececec, 0x4eececec, 0x4eececec, 0x4eececec, 0x4dececec, - 0x4dececec, 0x4cececec, 0x4bededed, 0x49ededed, 0x47ededed, - 0x44eeeeee, 0x41efefef, 0x3df0f0f0, 0x39f1f1f1, 0x34f2f2f2, - 0x2ff4f4f4, 0x29f5f5f5, 0x24f6f6f6, 0x1ef8f8f8, 0x19f9f9f9, - 0x15fafafa, 0x10fbfbfb, 0x0dfcfcfc, 0x09fdfdfd, 0x07fdfdfd, - 0x05fefefe, 0x07fdfdfd, 0x09fdfdfd, 0x0dfcfcfc, 0x11fbfbfb, - 0x16fafafa, 0x1bf8f8f8, 0x21f7f7f7, 0x27f5f5f5, 0x2ef4f4f4, - 0x35f2f2f2, 0x3cf0f0f0, 0x42efefef, 0x48ededed, 0x4dececec, - 0x51ebebeb, 0x55eaeaea, 0x58e9e9e9, 0x5be9e9e9, 0x5de8e8e8, - 0x5ee8e8e8, 0x5fe7e7e7, 0x60e7e7e7, 0x61e7e7e7, 0x61e7e7e7, - 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, - 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, - 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x60e7e7e7, - 0x5fe7e7e7, 0x5ee8e8e8, 0x5de8e8e8, 0x5be9e9e9, 0x58e9e9e9, - 0x55eaeaea, 0x51ebebeb, 0x4dececec, 0x48ededed, 0x42efefef, - 0x3cf0f0f0, 0x35f2f2f2, 0x2ef4f4f4, 0x27f5f5f5, 0x21f7f7f7, - 0x1bf8f8f8, 0x16fafafa, 0x11fbfbfb, 0x0dfcfcfc, 0x09fdfdfd, - 0x07fdfdfd, 0x09fdfdfd, 0x0dfcfcfc, 0x11fbfbfb, 0x16fafafa, - 0x1cf8f8f8, 0x23f6f6f6, 0x2af5f5f5, 0x32f3f3f3, 0x3af1f1f1, - 0x42efefef, 0x4aededed, 0x51ebebeb, 0x58e9e9e9, 0x5ee8e8e8, - 0x64e6e6e6, 0x68e5e5e5, 0x6ce4e4e4, 0x6ee4e4e4, 0x70e3e3e3, - 0x72e3e3e3, 0x73e3e3e3, 0x74e2e2e2, 0x75e2e2e2, 0x75e2e2e2, - 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, - 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, - 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x74e2e2e2, - 0x73e3e3e3, 0x72e3e3e3, 0x70e3e3e3, 0x6ee4e4e4, 0x6ce4e4e4, - 0x68e5e5e5, 0x64e6e6e6, 0x5ee8e8e8, 0x58e9e9e9, 0x51ebebeb, - 0x4aededed, 0x42efefef, 0x3af1f1f1, 0x32f3f3f3, 0x2af5f5f5, - 0x23f6f6f6, 0x1cf8f8f8, 0x16fafafa, 0x11fbfbfb, 0x0dfcfcfc, - 0x09fdfdfd, 0x0cfcfcfc, 0x10fbfbfb, 0x16fafafa, 0x1cf8f8f8, - 0x23f6f6f6, 0x2cf4f4f4, 0x35f2f2f2, 0x3ef0f0f0, 0x48ededed, - 0x51ebebeb, 0x5ae9e9e9, 0x62e7e7e7, 0x6ae5e5e5, 0x71e3e3e3, - 0x77e2e2e2, 0x7be1e1e1, 0x7fe0e0e0, 0x82dfdfdf, 0x85dedede, - 0x86dedede, 0x88dedede, 0x88dddddd, 0x89dddddd, 0x89dddddd, - 0x89dddddd, 0x8adddddd, 0x8adddddd, 0x8adddddd, 0x8adddddd, - 0x8adddddd, 0x8adddddd, 0x8adddddd, 0x8adddddd, 0x8adddddd, - 0x8adddddd, 0x89dddddd, 0x89dddddd, 0x89dddddd, 0x88dddddd, - 0x88dedede, 0x86dedede, 0x85dedede, 0x82dfdfdf, 0x7fe0e0e0, - 0x7be1e1e1, 0x77e2e2e2, 0x71e3e3e3, 0x6ae5e5e5, 0x62e7e7e7, - 0x5ae9e9e9, 0x51ebebeb, 0x48ededed, 0x3ef0f0f0, 0x35f2f2f2, - 0x2cf4f4f4, 0x23f6f6f6, 0x1cf8f8f8, 0x16fafafa, 0x10fbfbfb, - 0x0cfcfcfc, 0x0ffbfbfb, 0x14fafafa, 0x1bf8f8f8, 0x23f6f6f6, - 0x2cf4f4f4, 0x35f2f2f2, 0x40efefef, 0x4bededed, 0x56eaeaea, - 0x60e7e7e7, 0x6ae5e5e5, 0x74e2e2e2, 0x7ce0e0e0, 0x83dfdfdf, - 0x8adddddd, 0x8fdcdcdc, 0x93dbdbdb, 0x96dadada, 0x98d9d9d9, - 0x9ad9d9d9, 0x9bd9d9d9, 0x9cd8d8d8, 0x9dd8d8d8, 0x9dd8d8d8, - 0x9dd8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, - 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, - 0x9ed8d8d8, 0x9dd8d8d8, 0x9dd8d8d8, 0x9dd8d8d8, 0x9cd8d8d8, - 0x9bd9d9d9, 0x9ad9d9d9, 0x98d9d9d9, 0x96dadada, 0x93dbdbdb, - 0x8fdcdcdc, 0x8adddddd, 0x83dfdfdf, 0x7ce0e0e0, 0x74e2e2e2, - 0x6ae5e5e5, 0x60e7e7e7, 0x56eaeaea, 0x4bededed, 0x40efefef, - 0x35f2f2f2, 0x2cf4f4f4, 0x23f6f6f6, 0x1bf8f8f8, 0x14fafafa, - 0x0ffbfbfb, 0x13fafafa, 0x19f9f9f9, 0x21f7f7f7, 0x2af5f5f5, - 0x35f2f2f2, 0x40efefef, 0x4cececec, 0x58e9e9e9, 0x64e6e6e6, - 0x70e3e3e3, 0x7be1e1e1, 0x85dedede, 0x8edcdcdc, 0x96dadada, - 0x9cd8d8d8, 0xa2d7d7d7, 0xa6d6d6d6, 0xa9d5d5d5, 0xabd5d5d5, - 0xadd4d4d4, 0xaed4d4d4, 0xafd4d4d4, 0xb0d4d4d4, 0xb0d3d3d3, - 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, - 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, - 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d4d4d4, 0xafd4d4d4, - 0xaed4d4d4, 0xadd4d4d4, 0xabd5d5d5, 0xa9d5d5d5, 0xa6d6d6d6, - 0xa2d7d7d7, 0x9cd8d8d8, 0x96dadada, 0x8edcdcdc, 0x85dedede, - 0x7be1e1e1, 0x70e3e3e3, 0x64e6e6e6, 0x58e9e9e9, 0x4cececec, - 0x40efefef, 0x35f2f2f2, 0x2af5f5f5, 0x21f7f7f7, 0x19f9f9f9, - 0x13fafafa, 0x16f9f9f9, 0x1ef8f8f8, 0x27f5f5f5, 0x32f3f3f3, - 0x3ef0f0f0, 0x4bededed, 0x58e9e9e9, 0x66e6e6e6, 0x73e3e3e3, - 0x80dfdfdf, 0x8bdddddd, 0x96dadada, 0x9fd8d8d8, 0xa7d6d6d6, - 0xaed4d4d4, 0xb3d3d3d3, 0xb7d2d2d2, 0xbad1d1d1, 0xbdd0d0d0, - 0xbed0d0d0, 0xc0d0d0d0, 0xc0cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, - 0xc1cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, 0xc2cfcfcf, 0xc2cfcfcf, - 0xc2cfcfcf, 0xc2cfcfcf, 0xc2cfcfcf, 0xc2cfcfcf, 0xc1cfcfcf, - 0xc1cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, 0xc0cfcfcf, - 0xc0d0d0d0, 0xbed0d0d0, 0xbdd0d0d0, 0xbad1d1d1, 0xb7d2d2d2, - 0xb3d3d3d3, 0xaed4d4d4, 0xa7d6d6d6, 0x9fd8d8d8, 0x96dadada, - 0x8bdddddd, 0x80dfdfdf, 0x73e3e3e3, 0x66e6e6e6, 0x58e9e9e9, - 0x4bededed, 0x3ef0f0f0, 0x32f3f3f3, 0x27f5f5f5, 0x1ef8f8f8, - 0x16f9f9f9, 0x1bf8f8f8, 0x24f6f6f6, 0x2ef4f4f4, 0x3af1f1f1, - 0x47ededed, 0x56eaeaea, 0x64e6e6e6, 0x73e3e3e3, 0x81dfdfdf, - 0x8fdcdcdc, 0x9bd9d9d9, 0xa6d6d6d6, 0xafd4d4d4, 0xb7d2d2d2, - 0xbed0d0d0, 0xc3cfcfcf, 0xc7cecece, 0xcacdcdcd, 0xcccdcdcd, - 0xcecccccc, 0xcfcccccc, 0xcfcccccc, 0xd0cccccc, 0xd0cccccc, - 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, - 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, - 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xcfcccccc, - 0xcfcccccc, 0xcecccccc, 0xcccdcdcd, 0xcacdcdcd, 0xc7cecece, - 0xc3cfcfcf, 0xbed0d0d0, 0xb7d2d2d2, 0xafd4d4d4, 0xa6d6d6d6, - 0x9bd9d9d9, 0x8fdcdcdc, 0x81dfdfdf, 0x73e3e3e3, 0x64e6e6e6, - 0x56eaeaea, 0x47ededed, 0x3af1f1f1, 0x2ef4f4f4, 0x24f6f6f6, - 0x1bf8f8f8, 0x1ff7f7f7, 0x29f5f5f5, 0x35f2f2f2, 0x42efefef, - 0x51ebebeb, 0x60e7e7e7, 0x70e3e3e3, 0x80dfdfdf, 0x8fdcdcdc, - 0x9cd8d8d8, 0xa9d5d5d5, 0xb4d2d2d2, 0xbdd0d0d0, 0xc5cecece, - 0xcbcdcdcd, 0xd0cccccc, 0xd4cbcbcb, 0xd7cacaca, 0xd9c9c9c9, - 0xdac9c9c9, 0xdbc9c9c9, 0xdcc9c9c9, 0xdcc9c9c9, 0xdcc9c9c9, - 0xddc9c9c9, 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, - 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, - 0xddc8c8c8, 0xddc9c9c9, 0xdcc9c9c9, 0xdcc9c9c9, 0xdcc9c9c9, - 0xdbc9c9c9, 0xdac9c9c9, 0xd9c9c9c9, 0xd7cacaca, 0xd4cbcbcb, - 0xd0cccccc, 0xcbcdcdcd, 0xc5cecece, 0xbdd0d0d0, 0xb4d2d2d2, - 0xa9d5d5d5, 0x9cd8d8d8, 0x8fdcdcdc, 0x80dfdfdf, 0x70e3e3e3, - 0x60e7e7e7, 0x51ebebeb, 0x42efefef, 0x35f2f2f2, 0x29f5f5f5, - 0x1ff7f7f7, 0x23f6f6f6, 0x2ff4f4f4, 0x3bf0f0f0, 0x4aededed, - 0x5ae9e9e9, 0x6ae5e5e5, 0x7be0e0e0, 0x8bdcdcdc, 0x9bd9d9d9, - 0xa9d5d5d5, 0xb6d2d2d2, 0xc0cfcfcf, 0xcacdcdcd, 0xd1cbcbcb, - 0xd7cacaca, 0xdcc9c9c9, 0xdfc8c8c8, 0xe1c7c7c7, 0xe3c7c7c7, - 0xe5c7c7c7, 0xe5c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, - 0xe6c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, - 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, - 0xe7c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, - 0xe5c6c6c6, 0xe5c7c7c7, 0xe3c7c7c7, 0xe1c7c7c7, 0xdfc8c8c8, - 0xdcc9c9c9, 0xd7cacaca, 0xd1cbcbcb, 0xcacdcdcd, 0xc0cfcfcf, - 0xb6d2d2d2, 0xa9d5d5d5, 0x9bd9d9d9, 0x8bdcdcdc, 0x7be0e0e0, - 0x6ae5e5e5, 0x5ae9e9e9, 0x4aededed, 0x3bf0f0f0, 0x2ff4f4f4, - 0x23f6f6f6, 0x27f5f5f5, 0x34f2f2f2, 0x42efefef, 0x51ebebeb, - 0x62e7e7e7, 0x74e2e2e2, 0x85dedede, 0x96dadada, 0xa6d6d6d6, - 0xb4d2d2d2, 0xc1cfcfcf, 0xcbcdcdcd, 0xd4cbcbcb, 0xdbc9c9c9, - 0xe0c8c8c8, 0xe5c7c7c7, 0xe8c6c6c6, 0xeac5c5c5, 0xecc5c5c5, - 0xedc5c5c5, 0xedc4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, - 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, - 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, - 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, - 0xedc4c4c4, 0xedc5c5c5, 0xecc5c5c5, 0xeac5c5c5, 0xe8c6c6c6, - 0xe5c7c7c7, 0xe0c8c8c8, 0xdbc9c9c9, 0xd4cbcbcb, 0xcbcdcdcd, - 0xc1cfcfcf, 0xb4d2d2d2, 0xa6d6d6d6, 0x96dadada, 0x85dedede, - 0x74e2e2e2, 0x62e7e7e7, 0x51ebebeb, 0x42efefef, 0x34f2f2f2, - 0x27f5f5f5, 0x2bf4f4f4, 0x39f1f1f1, 0x47ededed, 0x58e9e9e9, - 0x6ae5e5e5, 0x7ce0e0e0, 0x8edcdcdc, 0x9fd8d8d8, 0xafd4d4d4, - 0xbdd0d0d0, 0xcacdcdcd, 0xd4cbcbcb, 0xdcc9c9c9, 0xe3c7c7c7, - 0xe8c6c6c6, 0xecc5c5c5, 0xefc4c4c4, 0xf0c4c4c4, 0xf2c3c3c3, - 0xf3c3c3c3, 0xf3c3c3c3, 0xf3c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, - 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, - 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, - 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf3c3c3c3, - 0xf3c3c3c3, 0xf3c3c3c3, 0xf2c3c3c3, 0xf0c4c4c4, 0xefc4c4c4, - 0xecc5c5c5, 0xe8c6c6c6, 0xe3c7c7c7, 0xdcc9c9c9, 0xd4cbcbcb, - 0xcacdcdcd, 0xbdd0d0d0, 0xafd4d4d4, 0x9fd8d8d8, 0x8edcdcdc, - 0x7ce0e0e0, 0x6ae5e5e5, 0x58e9e9e9, 0x47ededed, 0x39f1f1f1, - 0x2bf4f4f4, 0x2ff4f4f4, 0x3df0f0f0, 0x4dececec, 0x5ee8e8e8, - 0x71e3e3e3, 0x84dfdfdf, 0x96dadada, 0xa7d6d6d6, 0xb7d2d2d2, - 0xc5cecece, 0xd1cbcbcb, 0xdbc9c9c9, 0xe3c7c7c7, 0xe9c6c6c6, - 0xeec4c4c4, 0xf1c4c4c4, 0xf4c3c3c3, 0xf5c2c2c2, 0xf6c2c2c2, - 0xf7c2c2c2, 0xf7c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, - 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, - 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, - 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, - 0xf7c2c2c2, 0xf7c2c2c2, 0xf6c2c2c2, 0xf5c2c2c2, 0xf4c3c3c3, - 0xf1c4c4c4, 0xeec4c4c4, 0xe9c6c6c6, 0xe3c7c7c7, 0xdbc9c9c9, - 0xd1cbcbcb, 0xc5cecece, 0xb7d2d2d2, 0xa7d6d6d6, 0x96dadada, - 0x84dfdfdf, 0x71e3e3e3, 0x5ee8e8e8, 0x4dececec, 0x3df0f0f0, - 0x2ff4f4f4, 0x32f3f3f3, 0x41efefef, 0x51ebebeb, 0x63e6e6e6, - 0x77e2e2e2, 0x8adddddd, 0x9cd8d8d8, 0xaed4d4d4, 0xbdd0d0d0, - 0xcbcdcdcd, 0xd7cacaca, 0xe0c7c7c7, 0xe8c6c6c6, 0xeec4c4c4, - 0xf2c3c3c3, 0xf5c3c3c3, 0xf7c2c2c2, 0xf8c2c2c2, 0xf9c1c1c1, - 0xfac1c1c1, 0xfac1c1c1, 0xfac1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, - 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, - 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, - 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfac1c1c1, - 0xfac1c1c1, 0xfac1c1c1, 0xf9c1c1c1, 0xf8c2c2c2, 0xf7c2c2c2, - 0xf5c3c3c3, 0xf2c3c3c3, 0xeec4c4c4, 0xe8c6c6c6, 0xe0c7c7c7, - 0xd7cacaca, 0xcbcdcdcd, 0xbdd0d0d0, 0xaed4d4d4, 0x9cd8d8d8, - 0x8adddddd, 0x77e2e2e2, 0x63e6e6e6, 0x51ebebeb, 0x41efefef, - 0x32f3f3f3, 0x34f2f2f2, 0x44eeeeee, 0x55eaeaea, 0x68e5e5e5, - 0x7be1e1e1, 0x8fdcdcdc, 0xa1d7d7d7, 0xb3d3d3d3, 0xc2cfcfcf, - 0xd0cbcbcb, 0xdcc9c9c9, 0xe4c6c6c6, 0xecc5c5c5, 0xf1c4c4c4, - 0xf5c3c3c3, 0xf8c2c2c2, 0xfac1c1c1, 0xfac1c1c1, 0xfcc1c1c1, - 0xfcc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, - 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, - 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, - 0xfdc1c1c1, 0xfdc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, - 0xfcc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, 0xfac1c1c1, 0xfac1c1c1, - 0xf8c2c2c2, 0xf5c3c3c3, 0xf1c4c4c4, 0xecc5c5c5, 0xe4c6c6c6, - 0xdcc9c9c9, 0xd0cbcbcb, 0xc2cfcfcf, 0xb3d3d3d3, 0xa1d7d7d7, - 0x8fdcdcdc, 0x7be1e1e1, 0x68e5e5e5, 0x55eaeaea, 0x44eeeeee, - 0x34f2f2f2, 0x37f2f2f2, 0x47eeeeee, 0x58e9e9e9, 0x6be4e4e4, - 0x7fe0e0e0, 0x93dbdbdb, 0xa5d6d6d6, 0xb7d2d2d2, 0xc6cecece, - 0xd4cacaca, 0xdfc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf3c3c3c3, - 0xf7c2c2c2, 0xfac2c2c2, 0xfbc1c1c1, 0xfcc1c1c1, 0xfdc0c0c0, - 0xfdc0c0c0, 0xfdc0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc0c0c0, 0xfdc0c0c0, 0xfdc0c0c0, 0xfcc1c1c1, 0xfbc1c1c1, - 0xfac2c2c2, 0xf7c2c2c2, 0xf3c3c3c3, 0xeec4c4c4, 0xe7c6c6c6, - 0xdfc8c8c8, 0xd4cacaca, 0xc6cecece, 0xb7d2d2d2, 0xa5d6d6d6, - 0x93dbdbdb, 0x7fe0e0e0, 0x6be4e4e4, 0x58e9e9e9, 0x47eeeeee, - 0x37f2f2f2, 0x38f1f1f1, 0x49ededed, 0x5be9e9e9, 0x6ee4e4e4, - 0x82dfdfdf, 0x96dadada, 0xa9d5d5d5, 0xbbd1d1d1, 0xc9cecece, - 0xd7cacaca, 0xe2c7c7c7, 0xeac5c5c5, 0xf0c4c4c4, 0xf5c3c3c3, - 0xf9c2c2c2, 0xfbc1c1c1, 0xfcc0c0c0, 0xfdc0c0c0, 0xfec0c0c0, - 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfdc0c0c0, 0xfcc0c0c0, - 0xfbc1c1c1, 0xf9c2c2c2, 0xf5c3c3c3, 0xf0c4c4c4, 0xeac5c5c5, - 0xe2c7c7c7, 0xd7cacaca, 0xc9cecece, 0xbbd1d1d1, 0xa9d5d5d5, - 0x96dadada, 0x82dfdfdf, 0x6ee4e4e4, 0x5be9e9e9, 0x49ededed, - 0x38f1f1f1, 0x3af1f1f1, 0x4bededed, 0x5de8e8e8, 0x70e3e3e3, - 0x85dedede, 0x99d9d9d9, 0xabd4d4d4, 0xbdd0d0d0, 0xcccdcdcd, - 0xd9c9c9c9, 0xe4c7c7c7, 0xebc5c5c5, 0xf2c4c4c4, 0xf6c2c2c2, - 0xfac1c1c1, 0xfcc1c1c1, 0xfdc0c0c0, 0xfdc0c0c0, 0xfec0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfdc0c0c0, 0xfdc0c0c0, - 0xfcc1c1c1, 0xfac1c1c1, 0xf6c2c2c2, 0xf2c4c4c4, 0xebc5c5c5, - 0xe4c7c7c7, 0xd9c9c9c9, 0xcccdcdcd, 0xbdd0d0d0, 0xabd4d4d4, - 0x99d9d9d9, 0x85dedede, 0x70e3e3e3, 0x5de8e8e8, 0x4bededed, - 0x3af1f1f1, 0x3bf1f1f1, 0x4cededed, 0x5ee8e8e8, 0x72e3e3e3, - 0x87dedede, 0x9ad9d9d9, 0xadd4d4d4, 0xbfd0d0d0, 0xcdcdcdcd, - 0xdac9c9c9, 0xe5c7c7c7, 0xecc4c4c4, 0xf3c3c3c3, 0xf7c2c2c2, - 0xfac1c1c1, 0xfcc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfcc1c1c1, 0xfac1c1c1, 0xf7c2c2c2, 0xf3c3c3c3, 0xecc4c4c4, - 0xe5c7c7c7, 0xdac9c9c9, 0xcdcdcdcd, 0xbfd0d0d0, 0xadd4d4d4, - 0x9ad9d9d9, 0x87dedede, 0x72e3e3e3, 0x5ee8e8e8, 0x4cededed, - 0x3bf1f1f1, 0x3cf0f0f0, 0x4dececec, 0x5fe7e7e7, 0x73e3e3e3, - 0x88dedede, 0x9cd9d9d9, 0xaed4d4d4, 0xc0cfcfcf, 0xcecccccc, - 0xdbc8c8c8, 0xe6c6c6c6, 0xedc4c4c4, 0xf3c3c3c3, 0xf7c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf7c2c2c2, 0xf3c3c3c3, 0xedc4c4c4, - 0xe6c6c6c6, 0xdbc8c8c8, 0xcecccccc, 0xc0cfcfcf, 0xaed4d4d4, - 0x9cd9d9d9, 0x88dedede, 0x73e3e3e3, 0x5fe7e7e7, 0x4dececec, - 0x3cf0f0f0, 0x3cf0f0f0, 0x4eececec, 0x60e7e7e7, 0x74e2e2e2, - 0x89dddddd, 0x9dd8d8d8, 0xafd3d3d3, 0xc1cfcfcf, 0xcfcccccc, - 0xdcc8c8c8, 0xe6c6c6c6, 0xedc4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xedc4c4c4, - 0xe6c6c6c6, 0xdcc8c8c8, 0xcfcccccc, 0xc1cfcfcf, 0xafd3d3d3, - 0x9dd8d8d8, 0x89dddddd, 0x74e2e2e2, 0x60e7e7e7, 0x4eececec, - 0x3cf0f0f0, 0x3cf0f0f0, 0x4eececec, 0x60e7e7e7, 0x74e2e2e2, - 0x89dddddd, 0x9dd8d8d8, 0xafd3d3d3, 0xc1cfcfcf, 0xcfcccccc, - 0xdcc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, - 0xe7c6c6c6, 0xdcc8c8c8, 0xcfcccccc, 0xc1cfcfcf, 0xafd3d3d3, - 0x9dd8d8d8, 0x89dddddd, 0x74e2e2e2, 0x60e7e7e7, 0x4eececec, - 0x3cf0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, - 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, - 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, - 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, - 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, - 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, - 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, - 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, - 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, - 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, - 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, - 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, - 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, - 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, - 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, - 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, - 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, - 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, - 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, - 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, - 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, - 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, - 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, - 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, - 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, - 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, - 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, - 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, - 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, - 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, - 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, - 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, - 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, - 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, - 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, - 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, - 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, - 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, - 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, - 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, - 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, - 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, - 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, - 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, - 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, - 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, - 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, - 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, - 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, - 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, - 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, - 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, - 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, - 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, - 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, - 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, - 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, - 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, - 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, - 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, - 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, - 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, - 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, - 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, - 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, - 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, - 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, - 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, - 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, - 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, - 0x3df0f0f0, 0x3df0f0f0, 0x4fececec, 0x61e7e7e7, 0x75e2e2e2, - 0x8adddddd, 0x9ed8d8d8, 0xb0d3d3d3, 0xc2cfcfcf, 0xd0cccccc, - 0xddc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, - 0xe7c6c6c6, 0xddc8c8c8, 0xd0cccccc, 0xc2cfcfcf, 0xb0d3d3d3, - 0x9ed8d8d8, 0x8adddddd, 0x75e2e2e2, 0x61e7e7e7, 0x4fececec, - 0x3df0f0f0, 0x3cf0f0f0, 0x4eececec, 0x60e7e7e7, 0x74e2e2e2, - 0x89dddddd, 0x9dd8d8d8, 0xafd3d3d3, 0xc1cfcfcf, 0xcfcccccc, - 0xdcc8c8c8, 0xe7c6c6c6, 0xeec4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xeec4c4c4, - 0xe7c6c6c6, 0xdcc8c8c8, 0xcfcccccc, 0xc1cfcfcf, 0xafd3d3d3, - 0x9dd8d8d8, 0x89dddddd, 0x74e2e2e2, 0x60e7e7e7, 0x4eececec, - 0x3cf0f0f0, 0x3cf0f0f0, 0x4eececec, 0x60e7e7e7, 0x74e2e2e2, - 0x89dddddd, 0x9dd8d8d8, 0xafd3d3d3, 0xc1cfcfcf, 0xcfcccccc, - 0xdcc8c8c8, 0xe6c6c6c6, 0xedc4c4c4, 0xf4c3c3c3, 0xf8c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf8c2c2c2, 0xf4c3c3c3, 0xedc4c4c4, - 0xe6c6c6c6, 0xdcc8c8c8, 0xcfcccccc, 0xc1cfcfcf, 0xafd3d3d3, - 0x9dd8d8d8, 0x89dddddd, 0x74e2e2e2, 0x60e7e7e7, 0x4eececec, - 0x3cf0f0f0, 0x3cf0f0f0, 0x4dececec, 0x5fe8e8e8, 0x73e3e3e3, - 0x88dedede, 0x9cd9d9d9, 0xaed4d4d4, 0xc0d0d0d0, 0xcecccccc, - 0xdbc8c8c8, 0xe6c6c6c6, 0xedc4c4c4, 0xf3c3c3c3, 0xf7c2c2c2, - 0xfbc1c1c1, 0xfdc1c1c1, 0xfec0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfdc1c1c1, 0xfbc1c1c1, 0xf7c2c2c2, 0xf3c3c3c3, 0xedc4c4c4, - 0xe6c6c6c6, 0xdbc8c8c8, 0xcecccccc, 0xc0d0d0d0, 0xaed4d4d4, - 0x9cd9d9d9, 0x88dedede, 0x73e3e3e3, 0x5fe8e8e8, 0x4dececec, - 0x3cf0f0f0, 0x3bf1f1f1, 0x4cededed, 0x5ee8e8e8, 0x72e3e3e3, - 0x86dedede, 0x9ad9d9d9, 0xadd4d4d4, 0xbfd0d0d0, 0xcdcdcdcd, - 0xdac9c9c9, 0xe5c7c7c7, 0xecc4c4c4, 0xf2c3c3c3, 0xf7c2c2c2, - 0xfac1c1c1, 0xfcc1c1c1, 0xfdc0c0c0, 0xfec0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, - 0xffc0c0c0, 0xffc0c0c0, 0xffc0c0c0, 0xfec0c0c0, 0xfdc0c0c0, - 0xfcc1c1c1, 0xfac1c1c1, 0xf7c2c2c2, 0xf2c3c3c3, 0xecc4c4c4, - 0xe5c7c7c7, 0xdac9c9c9, 0xcdcdcdcd, 0xbfd0d0d0, 0xadd4d4d4, - 0x9ad9d9d9, 0x86dedede, 0x72e3e3e3, 0x5ee8e8e8, 0x4cededed, - 0x3bf1f1f1, 0x3af1f1f1, 0x4bededed, 0x5de8e8e8, 0x70e3e3e3, - 0x85dedede, 0x99d9d9d9, 0xabd4d4d4, 0xbdd0d0d0, 0xcbcdcdcd, - 0xd9c9c9c9, 0xe3c7c7c7, 0xebc5c5c5, 0xf1c4c4c4, 0xf6c3c3c3, - 0xf9c1c1c1, 0xfcc1c1c1, 0xfdc0c0c0, 0xfdc0c0c0, 0xfec0c0c0, - 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfdc0c0c0, 0xfdc0c0c0, - 0xfcc1c1c1, 0xf9c1c1c1, 0xf6c3c3c3, 0xf1c4c4c4, 0xebc5c5c5, - 0xe3c7c7c7, 0xd9c9c9c9, 0xcbcdcdcd, 0xbdd0d0d0, 0xabd4d4d4, - 0x99d9d9d9, 0x85dedede, 0x70e3e3e3, 0x5de8e8e8, 0x4bededed, - 0x3af1f1f1, 0x38f1f1f1, 0x49ededed, 0x5be9e9e9, 0x6ee4e4e4, - 0x82dfdfdf, 0x96dadada, 0xa8d5d5d5, 0xbad1d1d1, 0xc9cecece, - 0xd7cacaca, 0xe1c7c7c7, 0xe9c5c5c5, 0xf0c4c4c4, 0xf4c3c3c3, - 0xf8c2c2c2, 0xfac2c2c2, 0xfcc1c1c1, 0xfcc0c0c0, 0xfdc0c0c0, - 0xfdc0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, 0xfec0c0c0, - 0xfec0c0c0, 0xfdc0c0c0, 0xfdc0c0c0, 0xfcc0c0c0, 0xfcc1c1c1, - 0xfac2c2c2, 0xf8c2c2c2, 0xf4c3c3c3, 0xf0c4c4c4, 0xe9c5c5c5, - 0xe1c7c7c7, 0xd7cacaca, 0xc9cecece, 0xbad1d1d1, 0xa8d5d5d5, - 0x96dadada, 0x82dfdfdf, 0x6ee4e4e4, 0x5be9e9e9, 0x49ededed, - 0x38f1f1f1, 0x37f2f2f2, 0x47eeeeee, 0x58e9e9e9, 0x6be5e5e5, - 0x7fe0e0e0, 0x93dbdbdb, 0xa5d6d6d6, 0xb7d2d2d2, 0xc6cecece, - 0xd3cacaca, 0xdec8c8c8, 0xe7c6c6c6, 0xeec5c5c5, 0xf2c3c3c3, - 0xf6c2c2c2, 0xf9c2c2c2, 0xfac1c1c1, 0xfbc1c1c1, 0xfcc1c1c1, - 0xfcc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, 0xfdc1c1c1, - 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, - 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, - 0xfdc1c1c1, 0xfdc1c1c1, 0xfdc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, - 0xfcc1c1c1, 0xfcc1c1c1, 0xfcc1c1c1, 0xfbc1c1c1, 0xfac1c1c1, - 0xf9c2c2c2, 0xf6c2c2c2, 0xf2c3c3c3, 0xeec5c5c5, 0xe7c6c6c6, - 0xdec8c8c8, 0xd3cacaca, 0xc6cecece, 0xb7d2d2d2, 0xa5d6d6d6, - 0x93dbdbdb, 0x7fe0e0e0, 0x6be5e5e5, 0x58e9e9e9, 0x47eeeeee, - 0x37f2f2f2, 0x34f2f2f2, 0x44eeeeee, 0x55eaeaea, 0x67e5e5e5, - 0x7be1e1e1, 0x8edcdcdc, 0xa1d7d7d7, 0xb3d3d3d3, 0xc2cfcfcf, - 0xcfcccccc, 0xdbc9c9c9, 0xe3c7c7c7, 0xeac5c5c5, 0xf0c4c4c4, - 0xf3c3c3c3, 0xf6c3c3c3, 0xf8c2c2c2, 0xf9c1c1c1, 0xfac1c1c1, - 0xfac1c1c1, 0xfac1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, - 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, - 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, - 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, 0xfbc1c1c1, - 0xfac1c1c1, 0xfac1c1c1, 0xfac1c1c1, 0xf9c1c1c1, 0xf8c2c2c2, - 0xf6c3c3c3, 0xf3c3c3c3, 0xf0c4c4c4, 0xeac5c5c5, 0xe3c7c7c7, - 0xdbc9c9c9, 0xcfcccccc, 0xc2cfcfcf, 0xb3d3d3d3, 0xa1d7d7d7, - 0x8edcdcdc, 0x7be1e1e1, 0x67e5e5e5, 0x55eaeaea, 0x44eeeeee, - 0x34f2f2f2, 0x32f3f3f3, 0x41efefef, 0x51ebebeb, 0x63e7e7e7, - 0x76e2e2e2, 0x89dddddd, 0x9bd8d8d8, 0xadd4d4d4, 0xbcd1d1d1, - 0xcacdcdcd, 0xd5cacaca, 0xdec8c8c8, 0xe6c6c6c6, 0xebc5c5c5, - 0xf0c4c4c4, 0xf3c3c3c3, 0xf5c2c2c2, 0xf6c2c2c2, 0xf7c2c2c2, - 0xf7c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, - 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, - 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, - 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, 0xf8c2c2c2, - 0xf8c2c2c2, 0xf7c2c2c2, 0xf7c2c2c2, 0xf6c2c2c2, 0xf5c2c2c2, - 0xf3c3c3c3, 0xf0c4c4c4, 0xebc5c5c5, 0xe6c6c6c6, 0xdec8c8c8, - 0xd5cacaca, 0xcacdcdcd, 0xbcd1d1d1, 0xadd4d4d4, 0x9bd8d8d8, - 0x89dddddd, 0x76e2e2e2, 0x63e7e7e7, 0x51ebebeb, 0x41efefef, - 0x32f3f3f3, 0x2ef4f4f4, 0x3df0f0f0, 0x4cececec, 0x5ee8e8e8, - 0x70e3e3e3, 0x83dfdfdf, 0x94dadada, 0xa6d6d6d6, 0xb5d2d2d2, - 0xc3cfcfcf, 0xcfcccccc, 0xd8c9c9c9, 0xe0c8c8c8, 0xe6c6c6c6, - 0xeac5c5c5, 0xeec5c5c5, 0xf0c4c4c4, 0xf1c3c3c3, 0xf3c3c3c3, - 0xf3c3c3c3, 0xf3c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, - 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, - 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, - 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, 0xf4c3c3c3, - 0xf3c3c3c3, 0xf3c3c3c3, 0xf3c3c3c3, 0xf1c3c3c3, 0xf0c4c4c4, - 0xeec5c5c5, 0xeac5c5c5, 0xe6c6c6c6, 0xe0c8c8c8, 0xd8c9c9c9, - 0xcfcccccc, 0xc3cfcfcf, 0xb5d2d2d2, 0xa6d6d6d6, 0x94dadada, - 0x83dfdfdf, 0x70e3e3e3, 0x5ee8e8e8, 0x4cececec, 0x3df0f0f0, - 0x2ef4f4f4, 0x2bf4f4f4, 0x38f1f1f1, 0x47eeeeee, 0x57e9e9e9, - 0x69e5e5e5, 0x7be1e1e1, 0x8cdcdcdc, 0x9dd8d8d8, 0xadd4d4d4, - 0xbbd1d1d1, 0xc7cecece, 0xd0cbcbcb, 0xd8cacaca, 0xdfc8c8c8, - 0xe3c7c7c7, 0xe7c6c6c6, 0xeac5c5c5, 0xebc5c5c5, 0xedc5c5c5, - 0xedc4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, - 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, - 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, - 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, 0xeec4c4c4, - 0xeec4c4c4, 0xedc4c4c4, 0xedc5c5c5, 0xebc5c5c5, 0xeac5c5c5, - 0xe7c6c6c6, 0xe3c7c7c7, 0xdfc8c8c8, 0xd8cacaca, 0xd0cbcbcb, - 0xc7cecece, 0xbbd1d1d1, 0xadd4d4d4, 0x9dd8d8d8, 0x8cdcdcdc, - 0x7be1e1e1, 0x69e5e5e5, 0x57e9e9e9, 0x47eeeeee, 0x38f1f1f1, - 0x2bf4f4f4, 0x27f5f5f5, 0x33f2f2f2, 0x41efefef, 0x50ebebeb, - 0x61e7e7e7, 0x72e3e3e3, 0x83dedede, 0x94dadada, 0xa3d7d7d7, - 0xb0d3d3d3, 0xbcd0d0d0, 0xc6cecece, 0xcfcccccc, 0xd5cacaca, - 0xdac9c9c9, 0xdec8c8c8, 0xe1c7c7c7, 0xe3c7c7c7, 0xe4c7c7c7, - 0xe5c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, - 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, - 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, 0xe7c6c6c6, - 0xe7c6c6c6, 0xe7c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, 0xe6c6c6c6, - 0xe6c6c6c6, 0xe5c6c6c6, 0xe4c7c7c7, 0xe3c7c7c7, 0xe1c7c7c7, - 0xdec8c8c8, 0xdac9c9c9, 0xd5cacaca, 0xcfcccccc, 0xc6cecece, - 0xbcd0d0d0, 0xb0d3d3d3, 0xa3d7d7d7, 0x94dadada, 0x83dedede, - 0x72e3e3e3, 0x61e7e7e7, 0x50ebebeb, 0x41efefef, 0x33f2f2f2, - 0x27f5f5f5, 0x23f6f6f6, 0x2ef4f4f4, 0x3bf1f1f1, 0x49ededed, - 0x58e9e9e9, 0x68e5e5e5, 0x78e1e1e1, 0x88dddddd, 0x97dadada, - 0xa5d6d6d6, 0xb0d3d3d3, 0xbbd1d1d1, 0xc3cfcfcf, 0xcacdcdcd, - 0xcfcccccc, 0xd3cbcbcb, 0xd7cacaca, 0xd9c9c9c9, 0xdac9c9c9, - 0xdbc9c9c9, 0xdcc9c9c9, 0xdcc9c9c9, 0xdcc9c9c9, 0xddc9c9c9, - 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, - 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, 0xddc8c8c8, - 0xddc8c8c8, 0xddc8c8c8, 0xddc9c9c9, 0xdcc9c9c9, 0xdcc9c9c9, - 0xdcc9c9c9, 0xdbc9c9c9, 0xdac9c9c9, 0xd9c9c9c9, 0xd7cacaca, - 0xd3cbcbcb, 0xcfcccccc, 0xcacdcdcd, 0xc3cfcfcf, 0xbbd1d1d1, - 0xb0d3d3d3, 0xa5d6d6d6, 0x97dadada, 0x88dddddd, 0x78e1e1e1, - 0x68e5e5e5, 0x58e9e9e9, 0x49ededed, 0x3bf1f1f1, 0x2ef4f4f4, - 0x23f6f6f6, 0x1ef7f7f7, 0x28f5f5f5, 0x34f2f2f2, 0x41efefef, - 0x4fececec, 0x5ee8e8e8, 0x6de4e4e4, 0x7ce0e0e0, 0x8adddddd, - 0x97dadada, 0xa3d7d7d7, 0xadd4d4d4, 0xb5d2d2d2, 0xbcd1d1d1, - 0xc2cfcfcf, 0xc6cecece, 0xc9cdcdcd, 0xcccdcdcd, 0xcdcccccc, - 0xcecccccc, 0xcfcccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, - 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, - 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, - 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, 0xd0cccccc, - 0xcfcccccc, 0xcecccccc, 0xcdcccccc, 0xcccdcdcd, 0xc9cdcdcd, - 0xc6cecece, 0xc2cfcfcf, 0xbcd1d1d1, 0xb5d2d2d2, 0xadd4d4d4, - 0xa3d7d7d7, 0x97dadada, 0x8adddddd, 0x7ce0e0e0, 0x6de4e4e4, - 0x5ee8e8e8, 0x4fececec, 0x41efefef, 0x34f2f2f2, 0x28f5f5f5, - 0x1ef7f7f7, 0x1af9f9f9, 0x23f6f6f6, 0x2df4f4f4, 0x39f1f1f1, - 0x45eeeeee, 0x53ebebeb, 0x61e7e7e7, 0x6fe4e4e4, 0x7ce0e0e0, - 0x88dddddd, 0x93dbdbdb, 0x9dd8d8d8, 0xa6d6d6d6, 0xadd4d4d4, - 0xb2d3d3d3, 0xb7d2d2d2, 0xbad1d1d1, 0xbdd0d0d0, 0xbed0d0d0, - 0xbfd0d0d0, 0xc0cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, - 0xc1cfcfcf, 0xc1cfcfcf, 0xc2cfcfcf, 0xc2cfcfcf, 0xc2cfcfcf, - 0xc2cfcfcf, 0xc2cfcfcf, 0xc2cfcfcf, 0xc2cfcfcf, 0xc2cfcfcf, - 0xc1cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, 0xc1cfcfcf, - 0xc0cfcfcf, 0xbfd0d0d0, 0xbed0d0d0, 0xbdd0d0d0, 0xbad1d1d1, - 0xb7d2d2d2, 0xb2d3d3d3, 0xadd4d4d4, 0xa6d6d6d6, 0x9dd8d8d8, - 0x93dbdbdb, 0x88dddddd, 0x7ce0e0e0, 0x6fe4e4e4, 0x61e7e7e7, - 0x53ebebeb, 0x45eeeeee, 0x39f1f1f1, 0x2df4f4f4, 0x23f6f6f6, - 0x1af9f9f9, 0x16fafafa, 0x1df8f8f8, 0x26f6f6f6, 0x30f3f3f3, - 0x3cf0f0f0, 0x48ededed, 0x54eaeaea, 0x61e7e7e7, 0x6de4e4e4, - 0x79e1e1e1, 0x83dfdfdf, 0x8ddcdcdc, 0x95dadada, 0x9bd9d9d9, - 0xa1d7d7d7, 0xa5d6d6d6, 0xa9d5d5d5, 0xabd5d5d5, 0xadd4d4d4, - 0xaed4d4d4, 0xafd4d4d4, 0xb0d4d4d4, 0xb0d3d3d3, 0xb0d3d3d3, - 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, - 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, - 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d3d3d3, 0xb0d4d4d4, - 0xafd4d4d4, 0xaed4d4d4, 0xadd4d4d4, 0xabd5d5d5, 0xa9d5d5d5, - 0xa5d6d6d6, 0xa1d7d7d7, 0x9bd9d9d9, 0x95dadada, 0x8ddcdcdc, - 0x83dfdfdf, 0x79e1e1e1, 0x6de4e4e4, 0x61e7e7e7, 0x54eaeaea, - 0x48ededed, 0x3cf0f0f0, 0x30f3f3f3, 0x26f6f6f6, 0x1df8f8f8, - 0x16fafafa, 0x12fbfbfb, 0x18f9f9f9, 0x20f7f7f7, 0x28f5f5f5, - 0x32f3f3f3, 0x3df0f0f0, 0x48ededed, 0x53eaeaea, 0x5ee8e8e8, - 0x68e5e5e5, 0x72e3e3e3, 0x7be1e1e1, 0x82dfdfdf, 0x89dddddd, - 0x8edcdcdc, 0x93dbdbdb, 0x96dadada, 0x98d9d9d9, 0x9ad9d9d9, - 0x9bd9d9d9, 0x9cd8d8d8, 0x9dd8d8d8, 0x9dd8d8d8, 0x9dd8d8d8, - 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, - 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, 0x9ed8d8d8, - 0x9ed8d8d8, 0x9ed8d8d8, 0x9dd8d8d8, 0x9dd8d8d8, 0x9dd8d8d8, - 0x9cd8d8d8, 0x9bd9d9d9, 0x9ad9d9d9, 0x98d9d9d9, 0x96dadada, - 0x93dbdbdb, 0x8edcdcdc, 0x89dddddd, 0x82dfdfdf, 0x7be1e1e1, - 0x72e3e3e3, 0x68e5e5e5, 0x5ee8e8e8, 0x53eaeaea, 0x48ededed, - 0x3df0f0f0, 0x32f3f3f3, 0x28f5f5f5, 0x20f7f7f7, 0x18f9f9f9, - 0x12fbfbfb, 0x0efbfbfb, 0x14fafafa, 0x1af9f9f9, 0x21f7f7f7, - 0x29f5f5f5, 0x32f3f3f3, 0x3cf0f0f0, 0x45eeeeee, 0x4febebeb, - 0x58e9e9e9, 0x61e7e7e7, 0x69e5e5e5, 0x70e3e3e3, 0x76e2e2e2, - 0x7be1e1e1, 0x7fe0e0e0, 0x82dfdfdf, 0x85dedede, 0x86dedede, - 0x87dedede, 0x88dddddd, 0x89dddddd, 0x89dddddd, 0x89dddddd, - 0x8adddddd, 0x8adddddd, 0x8adddddd, 0x8adddddd, 0x8adddddd, - 0x8adddddd, 0x8adddddd, 0x8adddddd, 0x8adddddd, 0x8adddddd, - 0x8adddddd, 0x8adddddd, 0x89dddddd, 0x89dddddd, 0x89dddddd, - 0x88dddddd, 0x87dedede, 0x86dedede, 0x85dedede, 0x82dfdfdf, - 0x7fe0e0e0, 0x7be1e1e1, 0x76e2e2e2, 0x70e3e3e3, 0x69e5e5e5, - 0x61e7e7e7, 0x58e9e9e9, 0x4febebeb, 0x45eeeeee, 0x3cf0f0f0, - 0x32f3f3f3, 0x29f5f5f5, 0x21f7f7f7, 0x1af9f9f9, 0x14fafafa, - 0x0efbfbfb, 0x0bfcfcfc, 0x0ffbfbfb, 0x14fafafa, 0x1af8f8f8, - 0x21f7f7f7, 0x29f5f5f5, 0x30f3f3f3, 0x39f1f1f1, 0x41efefef, - 0x49ededed, 0x51ebebeb, 0x58e9e9e9, 0x5ee8e8e8, 0x63e6e6e6, - 0x68e5e5e5, 0x6be4e4e4, 0x6ee4e4e4, 0x70e3e3e3, 0x72e3e3e3, - 0x73e3e3e3, 0x74e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, - 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, - 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, - 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, 0x75e2e2e2, - 0x74e2e2e2, 0x73e3e3e3, 0x72e3e3e3, 0x70e3e3e3, 0x6ee4e4e4, - 0x6be4e4e4, 0x68e5e5e5, 0x63e6e6e6, 0x5ee8e8e8, 0x58e9e9e9, - 0x51ebebeb, 0x49ededed, 0x41efefef, 0x39f1f1f1, 0x30f3f3f3, - 0x29f5f5f5, 0x21f7f7f7, 0x1af8f8f8, 0x14fafafa, 0x0ffbfbfb, - 0x0bfcfcfc, 0x09fdfdfd, 0x0cfcfcfc, 0x10fbfbfb, 0x14fafafa, - 0x1af9f9f9, 0x20f7f7f7, 0x26f6f6f6, 0x2df4f4f4, 0x34f2f2f2, - 0x3bf0f0f0, 0x41efefef, 0x47ededed, 0x4cececec, 0x51ebebeb, - 0x55eaeaea, 0x58e9e9e9, 0x5be9e9e9, 0x5de8e8e8, 0x5ee8e8e8, - 0x5fe7e7e7, 0x60e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, - 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, - 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, - 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, 0x61e7e7e7, - 0x60e7e7e7, 0x5fe7e7e7, 0x5ee8e8e8, 0x5de8e8e8, 0x5be9e9e9, - 0x58e9e9e9, 0x55eaeaea, 0x51ebebeb, 0x4cececec, 0x47ededed, - 0x41efefef, 0x3bf0f0f0, 0x34f2f2f2, 0x2df4f4f4, 0x26f6f6f6, - 0x20f7f7f7, 0x1af9f9f9, 0x14fafafa, 0x10fbfbfb, 0x0cfcfcfc, - 0x09fdfdfd, 0x06fdfdfd, 0x09fdfdfd, 0x0cfcfcfc, 0x0ffbfbfb, - 0x14fafafa, 0x18f9f9f9, 0x1df8f8f8, 0x23f6f6f6, 0x28f5f5f5, - 0x2ef4f4f4, 0x33f2f2f2, 0x38f1f1f1, 0x3df0f0f0, 0x41efefef, - 0x44eeeeee, 0x47eeeeee, 0x49ededed, 0x4bededed, 0x4cececec, - 0x4dececec, 0x4dececec, 0x4eececec, 0x4eececec, 0x4eececec, - 0x4eececec, 0x4eececec, 0x4fececec, 0x4fececec, 0x4fececec, - 0x4fececec, 0x4fececec, 0x4fececec, 0x4fececec, 0x4fececec, - 0x4eececec, 0x4eececec, 0x4eececec, 0x4eececec, 0x4eececec, - 0x4dececec, 0x4dececec, 0x4cececec, 0x4bededed, 0x49ededed, - 0x47eeeeee, 0x44eeeeee, 0x41efefef, 0x3df0f0f0, 0x38f1f1f1, - 0x33f2f2f2, 0x2ef4f4f4, 0x28f5f5f5, 0x23f6f6f6, 0x1df8f8f8, - 0x18f9f9f9, 0x14fafafa, 0x0ffbfbfb, 0x0cfcfcfc, 0x09fdfdfd, - 0x06fdfdfd, }; - Image shadowImage; + int cornerSize = 20; + + boolean shadowEnabled = true; + Color outerKeyline, innerKeyline; + Color[] activeToolbar; + int[] activePercents; + Color[] inactiveToolbar; + int[] inactivePercents; + boolean active; + + private boolean drawPolyline = true; + public ShadowComposite(Composite parent, int style) { super(parent, style); - addPaintListener(new PaintListener() { + this.parent = this; + this.outerKeyline = new Color(getDisplay(), new RGB(240, 240, 240)); + addListener(SWT.Paint, new Listener() { + + public void handleEvent(Event event) { + onPaint(event); + } + }); + addListener(SWT.Dispose, new Listener() { - public void paintControl(PaintEvent e) { - Point size = getSize(); - Rectangle bodyRect = new Rectangle(0, 0, size.x, size.y); - drawTabBody(e.gc, bodyRect, 0); - drawTabHeader(e.gc, bodyRect, 0); + public void handleEvent(Event event) { + outerKeyline.dispose(); } }); + // addPaintListener(new PaintListener() { + // + // public void paintControl(PaintEvent e) { + // Point size = getSize(); + // Rectangle bodyRect = new Rectangle(0, 0, size.x, size.y); + // drawTabBody(e.gc, bodyRect, 0); + // drawTabHeader(e.gc, bodyRect, 0); + // } + // }); } - @Override public Rectangle getClientArea() { - Rectangle area = super.getClientArea(); - return new Rectangle(15, 15, area.width - 30, area.height - 30); + Rectangle trim = computeTrim(CTabFolderRenderer.PART_BODY, SWT.NONE, 0, 0, 0, 0); + // if (minimized) + // return new Rectangle(-trim.x, -trim.y, 0, 0); + Point size = getSize(); + int width = size.x - trim.width; + int height = size.y - trim.height; + return new Rectangle(-trim.x, -trim.y, width, height); + } + + private void onPaint(Event event) { + GC gc = event.gc; + gc.setAdvanced(true); + + Color gcBackground = gc.getBackground(); + Color gcForeground = gc.getForeground(); + + Point size = getSize(); + Rectangle bodyRect = new Rectangle(0, 0, size.x, size.y); + draw(CTabFolderRenderer.PART_BODY, SWT.BACKGROUND | SWT.FOREGROUND, bodyRect, gc); + + gc.setForeground(gcForeground); + gc.setBackground(gcBackground); + + draw(CTabFolderRenderer.PART_HEADER, SWT.BACKGROUND | SWT.FOREGROUND, bodyRect, gc); + + } + + @Override + public Rectangle computeTrim(int x, int y, int width, int height) { + return computeTrim(PART_BODY, SWT.NONE, x, y, width, height); } + protected Rectangle computeTrim(int part, int state, int x, int y, int width, int height) { + GC gc = new GC(parent); + gc.dispose(); + int borderTop = TOP_KEYLINE + OUTER_KEYLINE; + int borderBottom = INNER_KEYLINE + OUTER_KEYLINE; + int marginWidth = parent.marginWidth; + int marginHeight = parent.marginHeight; + int sideDropWidth = shadowEnabled ? SIDE_DROP_WIDTH : 0; + switch (part) { + case PART_BODY: + x = x - marginWidth - OUTER_KEYLINE - INNER_KEYLINE - sideDropWidth - (cornerSize / 2); + width = width + 2 * OUTER_KEYLINE + 2 * INNER_KEYLINE + 2 * marginWidth + 2 * sideDropWidth + cornerSize; + int tabHeight = parent.getTabHeight() + 1; // TODO: Figure out what + // to do about the +1 + // TODO: Fix + if (parent.getMinimized()) { + y = /* parent.onBottom ? y - borderTop : */y - tabHeight - borderTop - 5; + height = borderTop + borderBottom + tabHeight; + } else { + // y = tabFolder.onBottom ? y - marginHeight - highlight_margin + // - borderTop: y - marginHeight - highlight_header - tabHeight + // - borderTop; + + y = y - marginHeight - tabHeight - borderTop - (cornerSize / 4); + height = height + borderBottom + borderTop + 2 * marginHeight + tabHeight + cornerSize / 2 + cornerSize / 4 + (shadowEnabled ? BOTTOM_DROP_WIDTH : 0); + } + break; + case PART_HEADER: + x = x - (INNER_KEYLINE + OUTER_KEYLINE) - sideDropWidth; + width = width + 2 * (INNER_KEYLINE + OUTER_KEYLINE + sideDropWidth); + break; + case PART_BORDER: + x = x - INNER_KEYLINE - OUTER_KEYLINE - sideDropWidth - (cornerSize / 4); + width = width + 2 * (INNER_KEYLINE + OUTER_KEYLINE + sideDropWidth) + cornerSize / 2; + y = y - borderTop; + height = height + borderTop + borderBottom; + break; + // default: + // if (0 <= part && part < parent.getItemCount()) { + // x = x - ITEM_LEFT_MARGIN;// - (CORNER_SIZE/2); + // width = width + ITEM_LEFT_MARGIN + ITEM_RIGHT_MARGIN + 1; + // y = y - ITEM_TOP_MARGIN; + // height = height + ITEM_TOP_MARGIN + ITEM_BOTTOM_MARGIN; + // } + // break; + } + return new Rectangle(x, y, width, height); + } + // protected void dispose() { + // super.dispose(); + // } + + protected void draw(int part, int state, Rectangle bounds, GC gc) { + switch (part) { + case PART_BODY: + this.drawTabBody(gc, bounds, state); + return; + case PART_HEADER: + this.drawTabHeader(gc, bounds, state); + return; + // default: + // if (0 <= part && part < parent.getItemCount()) { + // if (bounds.width == 0 || bounds.height == 0) + // return; + // if ((state & SWT.SELECTED) != 0) { + // drawSelectedTab(part, gc, bounds, state); + // state &= ~SWT.BACKGROUND; + // super.draw(part, state, bounds, gc); + // } else { + // drawUnselectedTab(part, gc, bounds, state); + // if ((state & SWT.HOT) == 0 && !active) { + // gc.setAdvanced(true); + // gc.setAlpha(0x7f); + // state &= ~SWT.BACKGROUND; + // super.draw(part, state, bounds, gc); + // gc.setAdvanced(false); + // } else { + // state &= ~SWT.BACKGROUND; + // super.draw(part, state, bounds, gc); + // } + // } + // return; + // } + } + // super.draw(part, state, bounds, gc); + } void drawTabHeader(GC gc, Rectangle bounds, int state) { // gc.setClipping(bounds.x, bounds.y, bounds.width, @@ -801,14 +247,12 @@ void drawTabHeader(GC gc, Rectangle bounds, int state) { int[] points = new int[1024]; int index = 0; - int radius = CORNER_SIZE / 2; -// int marginWidth = parent.marginWidth; -// int marginHeight = parent.marginHeight; - int delta = INNER_KEYLINE + OUTER_KEYLINE + 2 * SIDE_DROP_WIDTH + 2 - * marginWidth; + int radius = cornerSize / 2; + int marginWidth = parent.marginWidth; + int marginHeight = parent.marginHeight; + int delta = INNER_KEYLINE + OUTER_KEYLINE + 2 * (shadowEnabled ? SIDE_DROP_WIDTH : 0) + 2 * marginWidth; int width = bounds.width - delta; - int height = bounds.height - INNER_KEYLINE - OUTER_KEYLINE - 2 - * marginHeight - BOTTOM_DROP_WIDTH; + int height = bounds.height - INNER_KEYLINE - OUTER_KEYLINE - 2 * marginHeight - (shadowEnabled ? BOTTOM_DROP_WIDTH : 0); int circX = bounds.x + delta / 2 + radius; int circY = bounds.y + radius; @@ -820,15 +264,15 @@ void drawTabHeader(GC gc, Rectangle bounds, int state) { region.intersect(clipping); gc.setClipping(region); -// int header = 3; // TODO: this needs to be added to computeTrim for -// // HEADER -// Rectangle trim = computeTrim(PART_HEADER, state, 0, 0, 0, 0); -// trim.width = bounds.width - trim.width; -// trim.height = (parent.getTabHeight() + 1 + header) - trim.height; -// trim.x = -trim.x; -// trim.y = -trim.y; -// -// draw(PART_BACKGROUND, SWT.NONE, trim, gc); + int header = 3; // TODO: this needs to be added to computeTrim for + // HEADER + Rectangle trim = computeTrim(PART_HEADER, state, 0, 0, 0, 0); + trim.width = bounds.width - trim.width; + trim.height = (parent.getTabHeight() + 1 + header) - trim.height; + trim.x = -trim.x; + trim.y = -trim.y; + + draw(PART_BACKGROUND, SWT.NONE, trim, gc); gc.setClipping(clipping); clipping.dispose(); @@ -838,18 +282,15 @@ void drawTabHeader(GC gc, Rectangle bounds, int state) { System.arraycopy(ltt, 0, points, index, ltt.length); index += ltt.length; - int[] lbb = drawCircle(circX + 1, circY + height - (radius * 2) - 2, - radius, LEFT_BOTTOM); + int[] lbb = drawCircle(circX + 1, circY + height - (radius * 2) - 2, radius, LEFT_BOTTOM); System.arraycopy(lbb, 0, points, index, lbb.length); index += lbb.length; - int[] rb = drawCircle(circX + width - (radius * 2) - 2, circY + height - - (radius * 2) - 2, radius, RIGHT_BOTTOM); + int[] rb = drawCircle(circX + width - (radius * 2) - 2, circY + height - (radius * 2) - 2, radius, RIGHT_BOTTOM); System.arraycopy(rb, 0, points, index, rb.length); index += rb.length; - int[] rt = drawCircle(circX + width - (radius * 2) - 2, circY + 1, - radius, RIGHT_TOP); + int[] rt = drawCircle(circX + width - (radius * 2) - 2, circY + 1, radius, RIGHT_TOP); System.arraycopy(rt, 0, points, index, rt.length); index += rt.length; points[index++] = points[0]; @@ -858,40 +299,25 @@ void drawTabHeader(GC gc, Rectangle bounds, int state) { int[] tempPoints = new int[index]; System.arraycopy(points, 0, tempPoints, 0, index); - // White Keyline - // gc.setAntialias(SWT.ON); - gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE)); - gc.drawPolyline(tempPoints); - - ltt = drawCircle(circX + 2, circY + 2, radius, LEFT_TOP); - System.arraycopy(ltt, 0, points, index, ltt.length); - gc.drawPolyline(ltt); - - rt = drawCircle(circX + width - (radius * 2) - 3, circY + 2, radius, - RIGHT_TOP); - System.arraycopy(rt, 0, points, index, rt.length); - gc.drawPolyline(rt); + if (outerKeyline == null) + outerKeyline = gc.getDevice().getSystemColor(SWT.COLOR_BLACK); - int rtLength = rt.length; - gc.drawLine(rt[rtLength - 2], rt[rtLength - 1], ltt[0], ltt[1]); + gc.setForeground(outerKeyline); - Color borderBlue = new Color(gc.getDevice(), 190, 216, 237); - gc.setForeground(borderBlue); - gc.drawPolyline(shape); - borderBlue.dispose(); + if (drawPolyline) { + gc.drawPolyline(shape); + } } void drawTabBody(GC gc, Rectangle bounds, int state) { int[] points = new int[1024]; int index = 0; - int radius = CORNER_SIZE / 2; -// int marginWidth = parent.marginWidth; -// int marginHeight = parent.marginHeight; - int delta = INNER_KEYLINE + OUTER_KEYLINE + 2 * SIDE_DROP_WIDTH + 2 - * marginWidth; + int radius = cornerSize / 2; + int marginWidth = parent.marginWidth; + int marginHeight = parent.marginHeight; + int delta = INNER_KEYLINE + OUTER_KEYLINE + 2 * (shadowEnabled ? SIDE_DROP_WIDTH : 0) + 2 * marginWidth; int width = bounds.width - delta; - int height = bounds.height - INNER_KEYLINE - OUTER_KEYLINE - 2 - * marginHeight - BOTTOM_DROP_WIDTH; + int height = Math.max(parent.getTabHeight() + INNER_KEYLINE + OUTER_KEYLINE + (shadowEnabled ? BOTTOM_DROP_WIDTH : 0), bounds.height - INNER_KEYLINE - OUTER_KEYLINE - 2 * marginHeight - (shadowEnabled ? BOTTOM_DROP_WIDTH : 0)); int circX = bounds.x + delta / 2 + radius; int circY = bounds.y + radius; @@ -902,18 +328,15 @@ void drawTabBody(GC gc, Rectangle bounds, int state) { System.arraycopy(ltt, 0, points, index, ltt.length); index += ltt.length; - int[] lbb = drawCircle(circX, circY + height - (radius * 2), radius, - LEFT_BOTTOM); + int[] lbb = drawCircle(circX, circY + height - (radius * 2), radius, LEFT_BOTTOM); System.arraycopy(lbb, 0, points, index, lbb.length); index += lbb.length; - int[] rb = drawCircle(circX + width - (radius * 2), circY + height - - (radius * 2), radius, RIGHT_BOTTOM); + int[] rb = drawCircle(circX + width - (radius * 2), circY + height - (radius * 2), radius, RIGHT_BOTTOM); System.arraycopy(rb, 0, points, index, rb.length); index += rb.length; - int[] rt = drawCircle(circX + width - (radius * 2), circY, radius, - RIGHT_TOP); + int[] rt = drawCircle(circX + width - (radius * 2), circY, radius, RIGHT_TOP); System.arraycopy(rt, 0, points, index, rt.length); index += rt.length; points[index++] = circX; @@ -928,25 +351,207 @@ void drawTabBody(GC gc, Rectangle bounds, int state) { Region r = new Region(); r.add(bounds); r.subtract(shape); - gc.setBackground(getParent().getBackground()); - Display display = getDisplay(); + gc.setBackground(parent.getParent().getBackground()); + Display display = parent.getDisplay(); Region clipping = new Region(); gc.getClipping(clipping); r.intersect(clipping); gc.setClipping(r); - Rectangle mappedBounds = display - .map(this, getParent(), bounds); - getParent().drawBackground(gc, bounds.x, bounds.y, bounds.width, - bounds.height, mappedBounds.x, mappedBounds.y); + Rectangle mappedBounds = display.map(parent, parent.getParent(), bounds); + parent.getParent().drawBackground(gc, bounds.x, bounds.y, bounds.width, bounds.height, mappedBounds.x, mappedBounds.y); // Shadow - drawShadow(display, bounds, gc); + if (shadowEnabled) + drawShadow(display, bounds, gc); gc.setClipping(clipping); clipping.dispose(); r.dispose(); } + // void drawSelectedTab(int itemIndex, GC gc, Rectangle bounds, int state) { + // int width = bounds.width; + // + // int[] points = new int[1024]; + // int index = 0; + // int radius = cornerSize / 2; + // int circX = bounds.x + radius; + // int circY = bounds.y - 1 + radius; + // int selectionX1, selectionY1, selectionX2, selectionY2; + // if (itemIndex == 0) { + // circX -= 1; + // points[index++] = circX - radius; + // points[index++] = bounds.y + bounds.height; + // + // points[index++] = selectionX1 = circX - radius; + // points[index++] = selectionY1 = bounds.y + bounds.height; + // } else { + // points[index++] = shadowEnabled ? SIDE_DROP_WIDTH : 0 + INNER_KEYLINE + + // OUTER_KEYLINE; + // points[index++] = bounds.y + bounds.height; + // + // points[index++] = selectionX1 = bounds.x; + // points[index++] = selectionY1 = bounds.y + bounds.height; + // } + // int[] ltt = drawCircle(circX, circY, radius, LEFT_TOP); + // for (int i = 0; i < ltt.length / 2; i += 2) { + // int tmp = ltt[i]; + // ltt[i] = ltt[ltt.length - i - 2]; + // ltt[ltt.length - i - 2] = tmp; + // tmp = ltt[i + 1]; + // ltt[i + 1] = ltt[ltt.length - i - 1]; + // ltt[ltt.length - i - 1] = tmp; + // } + // System.arraycopy(ltt, 0, points, index, ltt.length); + // index += ltt.length; + // + // int[] rt = drawCircle(circX + width - (radius * 2), circY, radius, + // RIGHT_TOP); + // for (int i = 0; i < rt.length / 2; i += 2) { + // int tmp = rt[i]; + // rt[i] = rt[rt.length - i - 2]; + // rt[rt.length - i - 2] = tmp; + // tmp = rt[i + 1]; + // rt[i + 1] = rt[rt.length - i - 1]; + // rt[rt.length - i - 1] = tmp; + // } + // System.arraycopy(rt, 0, points, index, rt.length); + // index += rt.length; + // + // points[index++] = selectionX2 = bounds.width + circX - radius; + // points[index++] = selectionY2 = bounds.y + bounds.height; + // + // points[index++] = parent.getSize().x - (shadowEnabled ? SIDE_DROP_WIDTH : + // 0 + INNER_KEYLINE + OUTER_KEYLINE); + // points[index++] = bounds.y + bounds.height; + // + // gc.setClipping(0, bounds.y, parent.getSize().x - (shadowEnabled ? + // SIDE_DROP_WIDTH : 0 + INNER_KEYLINE + OUTER_KEYLINE), bounds.y + + // bounds.height);// bounds.height + // // + + // // 4); + // Color selectionFillColor = + // gc.getDevice().getSystemColor(SWT.COLOR_WHITE); + // gc.setBackground(selectionFillColor); + // gc.setForeground(selectionFillColor); + // int[] tmpPoints = new int[index]; + // System.arraycopy(points, 0, tmpPoints, 0, index); + // gc.fillPolygon(tmpPoints); + // gc.drawLine(selectionX1, selectionY1, selectionX2, selectionY2); + // Color tempBorder = new Color(gc.getDevice(), 182, 188, 204); + // gc.setForeground(tempBorder); + // tempBorder.dispose(); + // if (active) + // gc.drawPolyline(tmpPoints); + // Rectangle rect = null; + // gc.setClipping(rect); + // + // if (outerKeyline == null) + // outerKeyline = gc.getDevice().getSystemColor(SWT.COLOR_BLACK); + // gc.setForeground(outerKeyline); + // gc.drawPolyline(shape); + // } + // + // void drawUnselectedTab(int itemIndex, GC gc, Rectangle bounds, int state) + // { + // if ((state & SWT.HOT) != 0) { + // int width = bounds.width; + // int[] points = new int[1024]; + // int[] inactive = new int[8]; + // int index = 0, inactive_index = 0; + // int radius = cornerSize / 2; + // int circX = bounds.x + radius; + // int circY = bounds.y - 1 + radius; + // + // int leftIndex = circX; + // if (itemIndex == 0) { + // if (parent.getSelectionIndex() != 0) + // leftIndex -= 1; + // points[index++] = leftIndex - radius; + // points[index++] = bounds.y + bounds.height; + // } else { + // points[index++] = bounds.x; + // points[index++] = bounds.y + bounds.height; + // } + // + // if (!active) { + // System.arraycopy(points, 0, inactive, 0, index); + // inactive_index += 2; + // } + // + // int[] ltt = drawCircle(leftIndex, circY, radius, LEFT_TOP); + // for (int i = 0; i < ltt.length / 2; i += 2) { + // int tmp = ltt[i]; + // ltt[i] = ltt[ltt.length - i - 2]; + // ltt[ltt.length - i - 2] = tmp; + // tmp = ltt[i + 1]; + // ltt[i + 1] = ltt[ltt.length - i - 1]; + // ltt[ltt.length - i - 1] = tmp; + // } + // System.arraycopy(ltt, 0, points, index, ltt.length); + // index += ltt.length; + // + // if (!active) { + // System.arraycopy(ltt, 0, inactive, inactive_index, 2); + // inactive_index += 2; + // } + // + // int rightIndex = circX - 1; + // int[] rt = drawCircle(rightIndex + width - (radius * 2), circY, radius, + // RIGHT_TOP); + // for (int i = 0; i < rt.length / 2; i += 2) { + // int tmp = rt[i]; + // rt[i] = rt[rt.length - i - 2]; + // rt[rt.length - i - 2] = tmp; + // tmp = rt[i + 1]; + // rt[i + 1] = rt[rt.length - i - 1]; + // rt[rt.length - i - 1] = tmp; + // } + // System.arraycopy(rt, 0, points, index, rt.length); + // index += rt.length; + // if (!active) { + // System.arraycopy(rt, rt.length - 4, inactive, inactive_index, 2); + // inactive[inactive_index] -= 1; + // inactive_index += 2; + // } + // + // points[index++] = bounds.width + rightIndex - radius; + // points[index++] = bounds.y + bounds.height; + // + // if (!active) { + // System.arraycopy(points, index - 2, inactive, inactive_index, 2); + // inactive[inactive_index] -= 1; + // inactive_index += 2; + // } + // + // gc.setClipping(points[0], bounds.y, parent.getSize().x - (shadowEnabled ? + // SIDE_DROP_WIDTH : 0 + INNER_KEYLINE + OUTER_KEYLINE), bounds.y + + // bounds.height);// bounds.height + // // + 4); + // gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE)); + // int[] tmpPoints = new int[index]; + // System.arraycopy(points, 0, tmpPoints, 0, index); + // gc.fillPolygon(tmpPoints); + // Color tempBorder = new Color(gc.getDevice(), 182, 188, 204); + // gc.setForeground(tempBorder); + // tempBorder.dispose(); + // if (active) { + // gc.drawPolyline(tmpPoints); + // } else { + // gc.drawLine(inactive[0], inactive[1], inactive[2], inactive[3]); + // gc.drawLine(inactive[4], inactive[5], inactive[6], inactive[7]); + // } + // + // Rectangle rect = null; + // gc.setClipping(rect); + // + // if (outerKeyline == null) + // outerKeyline = gc.getDevice().getSystemColor(SWT.COLOR_BLACK); + // // gc.setForeground(outerKeyline); + // // gc.drawPolyline(shape); + // } + // } + static int[] drawCircle(int xC, int yC, int r, int circlePart) { int x = 0, y = r, u = 1, v = 2 * r - 1, e = 0; int[] points = new int[1024]; @@ -1003,8 +608,7 @@ static int[] drawCircle(int xC, int yC, int r, int circlePart) { int[] newPointTableMirror = new int[length]; System.arraycopy(points, 0, newPointTable, 0, points.length); points = newPointTable; - System.arraycopy(pointsMirror, 0, newPointTableMirror, 0, - pointsMirror.length); + System.arraycopy(pointsMirror, 0, newPointTableMirror, 0, pointsMirror.length); pointsMirror = newPointTableMirror; } } @@ -1022,56 +626,52 @@ static int[] drawCircle(int xC, int yC, int r, int circlePart) { void drawShadow(final Display display, Rectangle bounds, GC gc) { if (shadowImage == null) createShadow(display); + int x = bounds.x; int y = bounds.y; int SIZE = shadowImage.getBounds().width / 3; + + int height = Math.max(bounds.height, SIZE * 2); + int width = Math.max(bounds.width, SIZE * 2); // top left - gc.drawImage(shadowImage, 0, 0, SIZE, SIZE, 0, 0, SIZE, 20); - int fillHeight = bounds.height - SIZE * 2; - int fillWidth = bounds.width + 5 - SIZE * 2; + gc.drawImage(shadowImage, 0, 0, SIZE, SIZE, 2, 10, SIZE, 20); + int fillHeight = height - SIZE * 2; + int fillWidth = width + 5 - SIZE * 2; int xFill = 0; for (int i = SIZE; i < fillHeight; i += SIZE) { xFill = i; - gc.drawImage(shadowImage, 0, SIZE, SIZE, SIZE, 0, i, SIZE, SIZE); + gc.drawImage(shadowImage, 0, SIZE, SIZE, SIZE, 2, i, SIZE, SIZE); } // Pad the rest of the shadow - gc.drawImage(shadowImage, 0, SIZE, SIZE, fillHeight - xFill, 0, xFill - + SIZE, SIZE, fillHeight - xFill); + gc.drawImage(shadowImage, 0, SIZE, SIZE, fillHeight - xFill, 2, xFill + SIZE, SIZE, fillHeight - xFill); // bl - gc.drawImage(shadowImage, 0, 40, 20, 20, 0, y + bounds.height - SIZE, - 20, 20); + gc.drawImage(shadowImage, 0, 40, 20, 20, 2, y + height - SIZE, 20, 20); + int yFill = 0; for (int i = SIZE; i <= fillWidth; i += SIZE) { yFill = i; - gc.drawImage(shadowImage, SIZE, SIZE * 2, SIZE, SIZE, i, y - + bounds.height - SIZE, SIZE, SIZE); + gc.drawImage(shadowImage, SIZE, SIZE * 2, SIZE, SIZE, i, y + height - SIZE, SIZE, SIZE); } // Pad the rest of the shadow - gc.drawImage(shadowImage, SIZE, SIZE * 2, fillWidth - yFill, SIZE, - yFill + SIZE, y + bounds.height - SIZE, fillWidth - yFill, SIZE); + gc.drawImage(shadowImage, SIZE, SIZE * 2, fillWidth - yFill, SIZE, yFill + SIZE, y + height - SIZE, fillWidth - yFill, SIZE); // br - gc.drawImage(shadowImage, SIZE * 2, SIZE * 2, SIZE, SIZE, x - + bounds.width - SIZE + 5, y + bounds.height - SIZE, SIZE, SIZE); + gc.drawImage(shadowImage, SIZE * 2, SIZE * 2, SIZE, SIZE, x + width - SIZE - 1, y + height - SIZE, SIZE, SIZE); // tr - gc.drawImage(shadowImage, SIZE * 2, 0, SIZE, SIZE, x + bounds.width - - SIZE + 5, y, SIZE, SIZE); + gc.drawImage(shadowImage, (SIZE * 2), 0, SIZE, SIZE, x + width - SIZE - 1, 10, SIZE, SIZE); xFill = 0; for (int i = SIZE; i < fillHeight; i += SIZE) { xFill = i; - gc.drawImage(shadowImage, SIZE * 2, SIZE, SIZE, SIZE, x - + bounds.width - SIZE + 5, i, SIZE, SIZE); + gc.drawImage(shadowImage, SIZE * 2, SIZE, SIZE, SIZE, x + width - SIZE - 1, i, SIZE, SIZE); } // Pad the rest of the shadow - gc.drawImage(shadowImage, SIZE * 2, SIZE, SIZE, fillHeight - xFill, x - + bounds.width - SIZE + 5, xFill + SIZE, SIZE, fillHeight - - xFill); + gc.drawImage(shadowImage, SIZE * 2, SIZE, SIZE, fillHeight - xFill, x + width - SIZE - 1, xFill + SIZE, SIZE, fillHeight - xFill); } void createShadow(final Display display) { @@ -1079,17 +679,17 @@ void createShadow(final Display display) { if (obj != null) { shadowImage = (Image) obj; } else { - ImageData data = new ImageData(60, 60, 32, new PaletteData( - 0xFF0000, 0xFF00, 0xFF)); - for (int y = 0, index = 0; y < 60; y++) { - for (int x = 0; x < 60; x++) { - data.setPixel(x, y, shadow[index] & 0xFFFFFF); - data.setAlpha(x, y, (shadow[index] >> 24) & 0xFF); - index++; - } - } - shadowImage = new Image(display, data); + ImageData data = new ImageData(60, 60, 32, new PaletteData(0xFF0000, 0xFF00, 0xFF)); + Image tmpImage = shadowImage = new Image(display, data); + GC gc = new GC(tmpImage); + Color shadowColor = new Color(display, new RGB(128, 128, 128)); + gc.setBackground(shadowColor); + drawTabBody(gc, new Rectangle(0, 0, 60, 60), SWT.None); + ImageData blured = blur(tmpImage, 5, 25); + shadowImage = new Image(display, blured); display.setData(E4_SHADOW_IMAGE, shadowImage); + tmpImage.dispose(); + shadowColor.dispose(); display.disposeExec(new Runnable() { public void run() { Object obj = display.getData(E4_SHADOW_IMAGE); @@ -1102,4 +702,176 @@ public void run() { }); } } + + public ImageData blur(Image src, int radius, int sigma) { + float[] kernel = create1DKernel(radius, sigma); + + ImageData imgPixels = src.getImageData(); + int width = imgPixels.width; + int height = imgPixels.height; + + int[] inPixels = new int[width * height]; + int[] outPixels = new int[width * height]; + int offset = 0; + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + RGB rgb = imgPixels.palette.getRGB(imgPixels.getPixel(x, y)); + if (rgb.red == 255 && rgb.green == 255 && rgb.blue == 255) { + inPixels[offset] = (rgb.red << 16) | (rgb.green << 8) | rgb.blue; + } else { + inPixels[offset] = (imgPixels.getAlpha(x, y) << 24) | (rgb.red << 16) | (rgb.green << 8) | rgb.blue; + } + offset++; + } + } + + convolve(kernel, inPixels, outPixels, width, height, true); + convolve(kernel, outPixels, inPixels, height, width, true); + + ImageData dst = new ImageData(imgPixels.width, imgPixels.height, 24, new PaletteData(0xff0000, 0xff00, 0xff)); + + dst.setPixels(0, 0, inPixels.length, inPixels, 0); + offset = 0; + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + if (inPixels[offset] == -1) { + dst.setAlpha(x, y, 0); + } else { + int a = (inPixels[offset] >> 24) & 0xff; + // if (a < 150) a = 0; + dst.setAlpha(x, y, a); + } + offset++; + } + } + return dst; + } + + private void convolve(float[] kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha) { + int kernelWidth = kernel.length; + int kernelMid = kernelWidth / 2; + for (int y = 0; y < height; y++) { + int index = y; + int currentLine = y * width; + for (int x = 0; x < width; x++) { + // do point + float a = 0, r = 0, g = 0, b = 0; + for (int k = -kernelMid; k <= kernelMid; k++) { + float val = kernel[k + kernelMid]; + int xcoord = x + k; + if (xcoord < 0) + xcoord = 0; + if (xcoord >= width) + xcoord = width - 1; + int pixel = inPixels[currentLine + xcoord]; + // float alp = ((pixel >> 24) & 0xff); + a += val * ((pixel >> 24) & 0xff); + r += val * (((pixel >> 16) & 0xff)); + g += val * (((pixel >> 8) & 0xff)); + b += val * (((pixel) & 0xff)); + } + int ia = alpha ? clamp((int) (a + 0.5)) : 0xff; + int ir = clamp((int) (r + 0.5)); + int ig = clamp((int) (g + 0.5)); + int ib = clamp((int) (b + 0.5)); + outPixels[index] = (ia << 24) | (ir << 16) | (ig << 8) | ib; + index += height; + } + } + + } + + private int clamp(int value) { + if (value > 255) + return 255; + if (value < 0) + return 0; + return value; + } + + private float[] create1DKernel(int radius, int sigma) { + // guideline: 3*sigma should be the radius + int size = radius * 2 + 1; + float[] kernel = new float[size]; + int radiusSquare = radius * radius; + float sigmaSquare = 2 * sigma * sigma; + float piSigma = 2 * (float) Math.PI * sigma; + float sqrtSigmaPi2 = (float) Math.sqrt(piSigma); + int start = size / 2; + int index = 0; + float total = 0; + for (int i = -start; i <= start; i++) { + float d = i * i; + if (d > radiusSquare) { + kernel[index] = 0; + } else { + kernel[index] = (float) Math.exp(-(d) / sigmaSquare) / sqrtSigmaPi2; + } + total += kernel[index]; + index++; + } + for (int i = 0; i < size; i++) { + kernel[i] /= total; + } + return kernel; + } + + @Inject + @Optional + public void setCornerRadius(@Named("radius") Integer radius) { + cornerSize = radius.intValue(); + parent.redraw(); + } + + @Inject + @Optional + public void setShadowVisible(@Named("shadowVisible") Boolean visible) { + this.shadowEnabled = visible.booleanValue(); + parent.redraw(); + } + + @Inject + @Optional + public void setOuterKeyline(@Named("outerKeyline") Color color) { + this.outerKeyline = color; + // TODO: HACK! Should be set based on pseudo-state. + // setActive(!(color.getRed() == 255 && color.getGreen() == 255 && + // color.getBlue() == 255)); + parent.redraw(); + } + + @Inject + @Optional + public void setInnerKeyline(@Named("innerKeyline") Color color) { + this.innerKeyline = color; + parent.redraw(); + } + + @Inject + @Optional + public void setActiveToolbarGradient(@Named("activeToolbarColors") Color[] color, @Named("activeToolbarPercents") int[] percents) { + activeToolbar = color; + activePercents = percents; + } + + @Inject + @Optional + public void setInactiveToolbarGradient(@Named("inactiveToolbarColors") Color[] color, @Named("inactiveToolbarPercents") int[] percents) { + inactiveToolbar = color; + inactivePercents = percents; + } + + // public void setActive(boolean active) { + // this.active = active; + // Control topRight = parent.getTopRight(); + // if (topRight != null) { + // if (active && toolbarActiveImage == null) + // createActiveToolbarImages(Display.getCurrent()); + // if (!active && toolbarInactiveImage == null) + // createInactiveToolbarImages(Display.getCurrent()); + // topRight.setBackgroundImage(active ? toolbarActiveImage : + // toolbarInactiveImage); + // parent.redraw(); + // } + // } } From 2022eb2f435e63644a4eb25f2432f8b2012dea49 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 27 Jun 2010 07:40:44 +0000 Subject: [PATCH 0162/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * align with changes in bug 284357 --- .../ReflectionContributionFactory.java | 167 +++++------------- 1 file changed, 43 insertions(+), 124 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java index 9e4ed7f352..6dca4eea44 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java @@ -1,12 +1,6 @@ package org.eclipse.e4.tools.compat.internal; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; import javax.inject.Inject; @@ -30,158 +24,76 @@ /** * Create the contribution factory. */ +@SuppressWarnings("restriction") public class ReflectionContributionFactory implements IContributionFactory { private IExtensionRegistry registry; private Map languages; - + @Inject private PackageAdmin packageAdmin; @Inject private Logger logger; - + /** * Create a reflection factory. * * @param registry * to read languages. */ - @Inject public ReflectionContributionFactory(IExtensionRegistry registry) { this.registry = registry; processLanguages(); } - public Object call(Object object, String uriString, String methodName, IEclipseContext context, - Object defaultValue) { - if (uriString != null) { - URI uri = new URI(uriString); - if (uri.segments.length > 3) { - String prefix = uri.segments[2]; - IContributionFactorySpi factory = (IContributionFactorySpi) languages.get(prefix); - return factory.call(object, methodName, context, defaultValue); - } - } - - Method targetMethod = null; - - Method[] methods = object.getClass().getMethods(); - - // Optimization: if there's only one method, use it. - if (methods.length == 1) { - targetMethod = methods[0]; - } else { - ArrayList toSort = new ArrayList(); - - for (int i = 0; i < methods.length; i++) { - Method method = methods[i]; - - // Filter out non-public constructors - if ((method.getModifiers() & Modifier.PUBLIC) != 0 - && method.getName().equals(methodName)) { - toSort.add(method); - } - } - - // Sort the methods by descending number of method - // arguments - Collections.sort(toSort, new Comparator() { - /* - * (non-Javadoc) - * - * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) - */ - public int compare(Method m1, Method m2) { - int l1 = m1.getParameterTypes().length; - int l2 = m2.getParameterTypes().length; - - return l1 - l2; - } - }); - - // Find the first satisfiable method - for (Iterator iter = toSort.iterator(); iter.hasNext() && targetMethod == null;) { - Method next = iter.next(); - - boolean satisfiable = true; - - Class[] params = next.getParameterTypes(); - for (int i = 0; i < params.length && satisfiable; i++) { - Class clazz = params[i]; - - if (!context.containsKey(clazz.getName()) - && !IEclipseContext.class.equals(clazz)) { - satisfiable = false; - } - } - - if (satisfiable) { - targetMethod = next; - } - } - } - - if (targetMethod == null) { - if (defaultValue != null) { - return defaultValue; - } - throw new RuntimeException( - "could not find satisfiable method " + methodName + " in class " + object.getClass()); //$NON-NLS-1$//$NON-NLS-2$ - } - - Class[] paramKeys = targetMethod.getParameterTypes(); - - try { - logger.debug("calling: " + methodName); - Object[] params = new Object[paramKeys.length]; - for (int i = 0; i < params.length; i++) { - if (IEclipseContext.class.equals(paramKeys[i])) { - params[i] = context; - } else { - params[i] = context.get(paramKeys[i].getName()); - } - } - - return targetMethod.invoke(object, params); - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } + public Object create(String uriString, IEclipseContext context, IEclipseContext staticContext) { + return doCreate(uriString, context, staticContext); } public Object create(String uriString, IEclipseContext context) { + return doCreate(uriString, context, null); + } + + private Object doCreate(String uriString, IEclipseContext context, IEclipseContext staticContext) { if (uriString == null) { return null; } - URI uri = new URI(uriString); + URI uri = URI.createURI(uriString); Bundle bundle = getBundle(uri); Object contribution; if (bundle != null) { - contribution = createFromBundle(bundle, context, uri); + contribution = createFromBundle(bundle, context, staticContext, uri); } else { contribution = null; - logger.error("Unable to retrive the bundle from the URI: "+ uriString); + logger.error("Unable to retrive the bundle from the URI: " //$NON-NLS-1$ + + uriString); } return contribution; } - protected Object createFromBundle(Bundle bundle, IEclipseContext context, URI uri) { + protected Object createFromBundle(Bundle bundle, IEclipseContext context, + IEclipseContext staticContext, URI uri) { Object contribution; - if (uri.segments.length > 3) { - String prefix = uri.segments[2]; + if (uri.segmentCount() > 3) { + String prefix = uri.segment(2); IContributionFactorySpi factory = (IContributionFactorySpi) languages.get(prefix); - StringBuffer resource = new StringBuffer(uri.segments[3]); - for (int i = 4; i < uri.segments.length; i++) { + StringBuffer resource = new StringBuffer(uri.segment(3)); + for (int i = 4; i < uri.segmentCount(); i++) { resource.append('/'); - resource.append(uri.segments[i]); + resource.append(uri.segment(i)); } contribution = factory.create(bundle, resource.toString(), context); } else { - String clazz = uri.segments[2]; + String clazz = uri.segment(2); try { Class targetClass = bundle.loadClass(clazz); - contribution = ContextInjectionFactory.make(targetClass, context); + if (staticContext == null) + contribution = ContextInjectionFactory.make(targetClass, context); + else + contribution = ContextInjectionFactory + .make(targetClass, context, staticContext); + if (contribution == null) { String message = "Unable to load class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ + bundle.getBundleId() + "'"; //$NON-NLS-1$ @@ -191,12 +103,12 @@ protected Object createFromBundle(Bundle bundle, IEclipseContext context, URI ur contribution = null; String message = "Unable to load class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ + bundle.getBundleId() + "'"; //$NON-NLS-1$ - logger.error(message); + logger.error(e,message); } catch (InjectionException e) { contribution = null; String message = "Unable to create class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ + bundle.getBundleId() + "'"; //$NON-NLS-1$ - logger.error(message); + logger.error(e, message); } } return contribution; @@ -221,6 +133,7 @@ protected void processLanguages() { } } + protected Bundle getBundle(URI platformURI) { return getBundleForName(platformURI.segments[1]); } @@ -248,19 +161,25 @@ public Bundle getBundleForName(String bundlename) { } return null; } - + static class URI { String[] segments; String uri; - private URI(String uriString) { + URI(String uriString) { segments = uriString.substring(uriString.indexOf('/')+1).split("/"); } - } + + public String segment(int i) { + return segments[i]; + } - public Object create(String uriString, IEclipseContext context, - IEclipseContext staticContext) { - // TODO Auto-generated method stub - return null; + public int segmentCount() { + return segments.length; + } + + static URI createURI(String uriString) { + return new URI(uriString); + } } } From d47225b0025f420833eeed1d86ca77349c60eb29 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 27 Jun 2010 08:10:04 +0000 Subject: [PATCH 0163/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fix incorrect drawing --- .../emf/ui/internal/ShadowComposite.java | 226 +----------------- 1 file changed, 4 insertions(+), 222 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ShadowComposite.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ShadowComposite.java index d6ec1ccaa3..8391c7a5bb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ShadowComposite.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ShadowComposite.java @@ -190,22 +190,10 @@ protected Rectangle computeTrim(int part, int state, int x, int y, int width, in y = y - borderTop; height = height + borderTop + borderBottom; break; - // default: - // if (0 <= part && part < parent.getItemCount()) { - // x = x - ITEM_LEFT_MARGIN;// - (CORNER_SIZE/2); - // width = width + ITEM_LEFT_MARGIN + ITEM_RIGHT_MARGIN + 1; - // y = y - ITEM_TOP_MARGIN; - // height = height + ITEM_TOP_MARGIN + ITEM_BOTTOM_MARGIN; - // } - // break; } return new Rectangle(x, y, width, height); } - // protected void dispose() { - // super.dispose(); - // } - protected void draw(int part, int state, Rectangle bounds, GC gc) { switch (part) { case PART_BODY: @@ -214,31 +202,7 @@ protected void draw(int part, int state, Rectangle bounds, GC gc) { case PART_HEADER: this.drawTabHeader(gc, bounds, state); return; - // default: - // if (0 <= part && part < parent.getItemCount()) { - // if (bounds.width == 0 || bounds.height == 0) - // return; - // if ((state & SWT.SELECTED) != 0) { - // drawSelectedTab(part, gc, bounds, state); - // state &= ~SWT.BACKGROUND; - // super.draw(part, state, bounds, gc); - // } else { - // drawUnselectedTab(part, gc, bounds, state); - // if ((state & SWT.HOT) == 0 && !active) { - // gc.setAdvanced(true); - // gc.setAlpha(0x7f); - // state &= ~SWT.BACKGROUND; - // super.draw(part, state, bounds, gc); - // gc.setAdvanced(false); - // } else { - // state &= ~SWT.BACKGROUND; - // super.draw(part, state, bounds, gc); - // } - // } - // return; - // } } - // super.draw(part, state, bounds, gc); } void drawTabHeader(GC gc, Rectangle bounds, int state) { @@ -344,13 +308,12 @@ void drawTabBody(GC gc, Rectangle bounds, int state) { int[] tempPoints = new int[index]; System.arraycopy(points, 0, tempPoints, 0, index); - shape = tempPoints; - gc.fillPolygon(shape); + gc.fillPolygon(tempPoints); // Fill in parent background for non-rectangular shape Region r = new Region(); r.add(bounds); - r.subtract(shape); + r.subtract(tempPoints); gc.setBackground(parent.getParent().getBackground()); Display display = parent.getDisplay(); Region clipping = new Region(); @@ -367,190 +330,9 @@ void drawTabBody(GC gc, Rectangle bounds, int state) { gc.setClipping(clipping); clipping.dispose(); r.dispose(); - } - // void drawSelectedTab(int itemIndex, GC gc, Rectangle bounds, int state) { - // int width = bounds.width; - // - // int[] points = new int[1024]; - // int index = 0; - // int radius = cornerSize / 2; - // int circX = bounds.x + radius; - // int circY = bounds.y - 1 + radius; - // int selectionX1, selectionY1, selectionX2, selectionY2; - // if (itemIndex == 0) { - // circX -= 1; - // points[index++] = circX - radius; - // points[index++] = bounds.y + bounds.height; - // - // points[index++] = selectionX1 = circX - radius; - // points[index++] = selectionY1 = bounds.y + bounds.height; - // } else { - // points[index++] = shadowEnabled ? SIDE_DROP_WIDTH : 0 + INNER_KEYLINE + - // OUTER_KEYLINE; - // points[index++] = bounds.y + bounds.height; - // - // points[index++] = selectionX1 = bounds.x; - // points[index++] = selectionY1 = bounds.y + bounds.height; - // } - // int[] ltt = drawCircle(circX, circY, radius, LEFT_TOP); - // for (int i = 0; i < ltt.length / 2; i += 2) { - // int tmp = ltt[i]; - // ltt[i] = ltt[ltt.length - i - 2]; - // ltt[ltt.length - i - 2] = tmp; - // tmp = ltt[i + 1]; - // ltt[i + 1] = ltt[ltt.length - i - 1]; - // ltt[ltt.length - i - 1] = tmp; - // } - // System.arraycopy(ltt, 0, points, index, ltt.length); - // index += ltt.length; - // - // int[] rt = drawCircle(circX + width - (radius * 2), circY, radius, - // RIGHT_TOP); - // for (int i = 0; i < rt.length / 2; i += 2) { - // int tmp = rt[i]; - // rt[i] = rt[rt.length - i - 2]; - // rt[rt.length - i - 2] = tmp; - // tmp = rt[i + 1]; - // rt[i + 1] = rt[rt.length - i - 1]; - // rt[rt.length - i - 1] = tmp; - // } - // System.arraycopy(rt, 0, points, index, rt.length); - // index += rt.length; - // - // points[index++] = selectionX2 = bounds.width + circX - radius; - // points[index++] = selectionY2 = bounds.y + bounds.height; - // - // points[index++] = parent.getSize().x - (shadowEnabled ? SIDE_DROP_WIDTH : - // 0 + INNER_KEYLINE + OUTER_KEYLINE); - // points[index++] = bounds.y + bounds.height; - // - // gc.setClipping(0, bounds.y, parent.getSize().x - (shadowEnabled ? - // SIDE_DROP_WIDTH : 0 + INNER_KEYLINE + OUTER_KEYLINE), bounds.y + - // bounds.height);// bounds.height - // // + - // // 4); - // Color selectionFillColor = - // gc.getDevice().getSystemColor(SWT.COLOR_WHITE); - // gc.setBackground(selectionFillColor); - // gc.setForeground(selectionFillColor); - // int[] tmpPoints = new int[index]; - // System.arraycopy(points, 0, tmpPoints, 0, index); - // gc.fillPolygon(tmpPoints); - // gc.drawLine(selectionX1, selectionY1, selectionX2, selectionY2); - // Color tempBorder = new Color(gc.getDevice(), 182, 188, 204); - // gc.setForeground(tempBorder); - // tempBorder.dispose(); - // if (active) - // gc.drawPolyline(tmpPoints); - // Rectangle rect = null; - // gc.setClipping(rect); - // - // if (outerKeyline == null) - // outerKeyline = gc.getDevice().getSystemColor(SWT.COLOR_BLACK); - // gc.setForeground(outerKeyline); - // gc.drawPolyline(shape); - // } - // - // void drawUnselectedTab(int itemIndex, GC gc, Rectangle bounds, int state) - // { - // if ((state & SWT.HOT) != 0) { - // int width = bounds.width; - // int[] points = new int[1024]; - // int[] inactive = new int[8]; - // int index = 0, inactive_index = 0; - // int radius = cornerSize / 2; - // int circX = bounds.x + radius; - // int circY = bounds.y - 1 + radius; - // - // int leftIndex = circX; - // if (itemIndex == 0) { - // if (parent.getSelectionIndex() != 0) - // leftIndex -= 1; - // points[index++] = leftIndex - radius; - // points[index++] = bounds.y + bounds.height; - // } else { - // points[index++] = bounds.x; - // points[index++] = bounds.y + bounds.height; - // } - // - // if (!active) { - // System.arraycopy(points, 0, inactive, 0, index); - // inactive_index += 2; - // } - // - // int[] ltt = drawCircle(leftIndex, circY, radius, LEFT_TOP); - // for (int i = 0; i < ltt.length / 2; i += 2) { - // int tmp = ltt[i]; - // ltt[i] = ltt[ltt.length - i - 2]; - // ltt[ltt.length - i - 2] = tmp; - // tmp = ltt[i + 1]; - // ltt[i + 1] = ltt[ltt.length - i - 1]; - // ltt[ltt.length - i - 1] = tmp; - // } - // System.arraycopy(ltt, 0, points, index, ltt.length); - // index += ltt.length; - // - // if (!active) { - // System.arraycopy(ltt, 0, inactive, inactive_index, 2); - // inactive_index += 2; - // } - // - // int rightIndex = circX - 1; - // int[] rt = drawCircle(rightIndex + width - (radius * 2), circY, radius, - // RIGHT_TOP); - // for (int i = 0; i < rt.length / 2; i += 2) { - // int tmp = rt[i]; - // rt[i] = rt[rt.length - i - 2]; - // rt[rt.length - i - 2] = tmp; - // tmp = rt[i + 1]; - // rt[i + 1] = rt[rt.length - i - 1]; - // rt[rt.length - i - 1] = tmp; - // } - // System.arraycopy(rt, 0, points, index, rt.length); - // index += rt.length; - // if (!active) { - // System.arraycopy(rt, rt.length - 4, inactive, inactive_index, 2); - // inactive[inactive_index] -= 1; - // inactive_index += 2; - // } - // - // points[index++] = bounds.width + rightIndex - radius; - // points[index++] = bounds.y + bounds.height; - // - // if (!active) { - // System.arraycopy(points, index - 2, inactive, inactive_index, 2); - // inactive[inactive_index] -= 1; - // inactive_index += 2; - // } - // - // gc.setClipping(points[0], bounds.y, parent.getSize().x - (shadowEnabled ? - // SIDE_DROP_WIDTH : 0 + INNER_KEYLINE + OUTER_KEYLINE), bounds.y + - // bounds.height);// bounds.height - // // + 4); - // gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE)); - // int[] tmpPoints = new int[index]; - // System.arraycopy(points, 0, tmpPoints, 0, index); - // gc.fillPolygon(tmpPoints); - // Color tempBorder = new Color(gc.getDevice(), 182, 188, 204); - // gc.setForeground(tempBorder); - // tempBorder.dispose(); - // if (active) { - // gc.drawPolyline(tmpPoints); - // } else { - // gc.drawLine(inactive[0], inactive[1], inactive[2], inactive[3]); - // gc.drawLine(inactive[4], inactive[5], inactive[6], inactive[7]); - // } - // - // Rectangle rect = null; - // gc.setClipping(rect); - // - // if (outerKeyline == null) - // outerKeyline = gc.getDevice().getSystemColor(SWT.COLOR_BLACK); - // // gc.setForeground(outerKeyline); - // // gc.drawPolyline(shape); - // } - // } + shape = tempPoints; + } static int[] drawCircle(int xC, int yC, int r, int circlePart) { int x = 0, y = r, u = 1, v = 2 * r - 1, e = 0; From 743b9a00d09d3237eeb006a3187eae15fabc580e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 28 Jun 2010 16:05:02 +0000 Subject: [PATCH 0164/1286] Bug 318143 - InjectionException when opening the WorkbenchModel Editor --- .../e4/tools/compat/internal/ReflectionContributionFactory.java | 1 + 1 file changed, 1 insertion(+) diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java index 6dca4eea44..5b61577cca 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java @@ -42,6 +42,7 @@ public class ReflectionContributionFactory implements IContributionFactory { * @param registry * to read languages. */ + @Inject public ReflectionContributionFactory(IExtensionRegistry registry) { this.registry = registry; processLanguages(); From 3efd1c1314d23a5d3b085903da7afecae6f965d7 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 28 Jun 2010 17:58:12 +0000 Subject: [PATCH 0165/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * some padding for the live editor From 6a93e7a078f579efcda252190964d5ca8d3680ff Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 28 Jun 2010 20:08:09 +0000 Subject: [PATCH 0166/1286] Bug 318236 - [CSS] WindowMargins and CTabRendering not applied without a theme --- .../e4/tools/compat/internal/ContextServiceFactory.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java index 55a4242a88..4db5af4305 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java @@ -35,6 +35,7 @@ import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; +import org.w3c.dom.css.CSSStyleDeclaration; @SuppressWarnings("restriction") public class ContextServiceFactory extends AbstractServiceFactory { @@ -89,6 +90,10 @@ public void setId(Object widget, String id) { public void style(Object widget) { engine.applyStyles((Widget) widget, true); } + + public CSSStyleDeclaration getStyle(Object widget) { + return engine.getStyle((Widget) widget); + } }); if( appContext.get(ILoggerProvider.class) == null ) { From 4868b3fadfe243690592e287ee346231fc8a0b87 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 29 Jun 2010 16:34:14 +0000 Subject: [PATCH 0167/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * use ALT+SHIFT+F4 for the workbench tooling From 8f9539bb7ff91d4ddf9366ce2be18575f0aadd82 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Wed, 30 Jun 2010 10:35:54 +0000 Subject: [PATCH 0168/1286] Change shortcut for Toms live editor to ALT+SHIFT+F9 From 2329e503b4a75de35210c9800ee02c3e703f725e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 3 Jul 2010 13:44:44 +0000 Subject: [PATCH 0169/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed copyright --- .../e4/tools/services/IDirtyProviderService.java | 10 ++++++++++ .../e4/tools/services/ISelectionProviderService.java | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IDirtyProviderService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IDirtyProviderService.java index 52dc193634..cdbd5489ed 100644 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IDirtyProviderService.java +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IDirtyProviderService.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.services; public interface IDirtyProviderService { diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/ISelectionProviderService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/ISelectionProviderService.java index e90d0f60bd..42b49e777b 100644 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/ISelectionProviderService.java +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/ISelectionProviderService.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.services; public interface ISelectionProviderService { From 1485926c4368316bae3fa420fffaff55742d46b0 Mon Sep 17 00:00:00 2001 From: Paul Webster Date: Mon, 5 Jul 2010 12:32:44 +0000 Subject: [PATCH 0170/1286] Performance improvement - "patch so that we only style once" from Bug 318633 - Part/editor switching is very slow Support API method addition --- .../e4/tools/compat/internal/ContextServiceFactory.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java index 4db5af4305..7e782fcaa1 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java @@ -94,6 +94,14 @@ public void style(Object widget) { public CSSStyleDeclaration getStyle(Object widget) { return engine.getStyle((Widget) widget); } + + public void setClassnameAndId(Object widget, String classname, + String id) { + ((Widget) widget).setData( + "org.eclipse.e4.ui.css.CssClassName", classname); //$NON-NLS-1$ + ((Widget) widget).setData("org.eclipse.e4.ui.css.id", id); //$NON-NLS-1$ + engine.applyStyles((Widget) widget, true); + } }); if( appContext.get(ILoggerProvider.class) == null ) { From 7e1a636834eb8af8387a93a8c8f21081b3fcbc0f Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 5 Jul 2010 12:40:32 +0000 Subject: [PATCH 0171/1286] Bug 308439 - Correct plugin for e4 wizards --- bundles/org.eclipse.e4.tools/.classpath | 7 + bundles/org.eclipse.e4.tools/.jetproperties | 4 + bundles/org.eclipse.e4.tools/.project | 34 + .../.settings/org.eclipse.jdt.core.prefs | 8 + .../org.eclipse.e4.tools/META-INF/MANIFEST.MF | 25 + bundles/org.eclipse.e4.tools/build.properties | 5 + .../icons/full/obj16/Part.gif | Bin 0 -> 342 bytes .../full/obj16/application_view_tile.png | Bin 0 -> 465 bytes .../icons/full/obj16/class_obj.gif | Bin 0 -> 586 bytes .../icons/full/obj16/plugin.png | Bin 0 -> 591 bytes .../icons/full/wizban/newclass_wiz.png | Bin 0 -> 7824 bytes .../editor3x/templates/HandlerTemplate.java | 50 ++ .../emf/editor3x/templates/PartTemplate.java | 89 +++ .../classes/templates/HandlerTemplate.java | 50 ++ .../classes/templates/PartTemplate.java | 89 +++ bundles/org.eclipse.e4.tools/plugin.xml | 58 ++ .../e4/internal/tools/ToolsPlugin.java | 117 ++++ .../wizards/classes/AbstractNewClassPage.java | 376 +++++++++++ .../classes/AbstractNewClassWizard.java | 144 +++++ .../classes/NewHandlerClassWizard.java | 133 ++++ .../wizards/classes/NewPartClassWizard.java | 255 ++++++++ .../classes/templates/HandlerTemplate.java | 50 ++ .../classes/templates/PartTemplate.java | 89 +++ .../model/BaseApplicationModelWizard.java | 187 ++++++ .../model/NewApplicationModelWizard.java | 27 + .../model/NewContributionModelWizard.java | 27 + .../tools/wizards/model/NewModelFilePage.java | 199 ++++++ .../wizards/project/E4NewProjectWizard.java | 606 ++++++++++++++++++ .../project/E4NewProjectWizardPage.java | 31 + .../project/NewApplicationWizardPage.java | 417 ++++++++++++ .../wizards/project/PluginContentPage.java | 363 +++++++++++ .../wizards/project/ResourceLocator.java | 52 ++ .../wizards/project/TemplateOperation.java | 401 ++++++++++++ .../templates/common/$projectName$.product | 79 +++ .../templates/common/icons/sample.gif | Bin 0 -> 983 bytes .../templates/common/icons/save_edit.gif | Bin 0 -> 639 bytes .../templates/css/default.css | 0 .../templates/handler.txtjet | 22 + .../templates/part.txtjet | 48 ++ .../templates/src/handlers/AboutHandler.java | 25 + .../templates/src/handlers/OpenHandler.java | 33 + .../templates/src/handlers/QuitHandler.java | 34 + .../templates/src/handlers/SaveHandler.java | 67 ++ 43 files changed, 4201 insertions(+) create mode 100644 bundles/org.eclipse.e4.tools/.classpath create mode 100644 bundles/org.eclipse.e4.tools/.jetproperties create mode 100644 bundles/org.eclipse.e4.tools/.project create mode 100644 bundles/org.eclipse.e4.tools/.settings/org.eclipse.jdt.core.prefs create mode 100644 bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF create mode 100644 bundles/org.eclipse.e4.tools/build.properties create mode 100644 bundles/org.eclipse.e4.tools/icons/full/obj16/Part.gif create mode 100644 bundles/org.eclipse.e4.tools/icons/full/obj16/application_view_tile.png create mode 100644 bundles/org.eclipse.e4.tools/icons/full/obj16/class_obj.gif create mode 100644 bundles/org.eclipse.e4.tools/icons/full/obj16/plugin.png create mode 100644 bundles/org.eclipse.e4.tools/icons/full/wizban/newclass_wiz.png create mode 100644 bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/emf/editor3x/templates/HandlerTemplate.java create mode 100644 bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/emf/editor3x/templates/PartTemplate.java create mode 100644 bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/internal/classes/templates/HandlerTemplate.java create mode 100644 bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/internal/classes/templates/PartTemplate.java create mode 100644 bundles/org.eclipse.e4.tools/plugin.xml create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/ToolsPlugin.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/HandlerTemplate.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/PartTemplate.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewContributionModelWizard.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizardPage.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/PluginContentPage.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/ResourceLocator.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/TemplateOperation.java create mode 100644 bundles/org.eclipse.e4.tools/templates/common/$projectName$.product create mode 100644 bundles/org.eclipse.e4.tools/templates/common/icons/sample.gif create mode 100644 bundles/org.eclipse.e4.tools/templates/common/icons/save_edit.gif create mode 100644 bundles/org.eclipse.e4.tools/templates/css/default.css create mode 100644 bundles/org.eclipse.e4.tools/templates/handler.txtjet create mode 100644 bundles/org.eclipse.e4.tools/templates/part.txtjet create mode 100644 bundles/org.eclipse.e4.tools/templates/src/handlers/AboutHandler.java create mode 100644 bundles/org.eclipse.e4.tools/templates/src/handlers/OpenHandler.java create mode 100644 bundles/org.eclipse.e4.tools/templates/src/handlers/QuitHandler.java create mode 100644 bundles/org.eclipse.e4.tools/templates/src/handlers/SaveHandler.java diff --git a/bundles/org.eclipse.e4.tools/.classpath b/bundles/org.eclipse.e4.tools/.classpath new file mode 100644 index 0000000000..64c5e31b7a --- /dev/null +++ b/bundles/org.eclipse.e4.tools/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/bundles/org.eclipse.e4.tools/.jetproperties b/bundles/org.eclipse.e4.tools/.jetproperties new file mode 100644 index 0000000000..2907c83a43 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/.jetproperties @@ -0,0 +1,4 @@ + + + templates src + diff --git a/bundles/org.eclipse.e4.tools/.project b/bundles/org.eclipse.e4.tools/.project new file mode 100644 index 0000000000..62db1d2d84 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/.project @@ -0,0 +1,34 @@ + + + org.eclipse.e4.tools + + + + + + org.eclipse.emf.codegen.JETBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.emf.codegen.jet.IJETNature + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/bundles/org.eclipse.e4.tools/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..259614444e --- /dev/null +++ b/bundles/org.eclipse.e4.tools/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Mon Jul 05 10:09:17 CEST 2010 +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/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..756afee3b2 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF @@ -0,0 +1,25 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Tools +Bundle-SymbolicName: org.eclipse.e4.tools;singleton:=true +Bundle-Version: 0.9.0.qualifier +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", + org.eclipse.pde.core;bundle-version="3.6.0", + org.eclipse.pde.ui;bundle-version="3.6.0", + org.eclipse.core.runtime;bundle-version="3.6.0", + org.eclipse.e4.ui.model.workbench;bundle-version="0.9.1", + org.eclipse.core.resources;bundle-version="3.6.0", + org.eclipse.jdt.core;bundle-version="3.6.0", + org.eclipse.jdt.launching;bundle-version="3.5.100", + org.eclipse.ui.ide;bundle-version="3.6.0", + org.eclipse.core.databinding;bundle-version="1.3.100", + org.eclipse.core.databinding.beans;bundle-version="1.2.100", + org.eclipse.jface.databinding;bundle-version="1.4.0", + org.eclipse.core.databinding.property;bundle-version="1.3.0", + org.eclipse.jdt.ui;bundle-version="3.6.0" +Bundle-ActivationPolicy: lazy +Bundle-Activator: org.eclipse.e4.internal.tools.ToolsPlugin +Export-Package: org.eclipse.e4.internal.tools.wizards.classes;x-internal:=true, + org.eclipse.e4.internal.tools.wizards.model;x-internal:=true, + org.eclipse.e4.internal.tools.wizards.project;x-internal:=true diff --git a/bundles/org.eclipse.e4.tools/build.properties b/bundles/org.eclipse.e4.tools/build.properties new file mode 100644 index 0000000000..e9863e281e --- /dev/null +++ b/bundles/org.eclipse.e4.tools/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml diff --git a/bundles/org.eclipse.e4.tools/icons/full/obj16/Part.gif b/bundles/org.eclipse.e4.tools/icons/full/obj16/Part.gif new file mode 100644 index 0000000000000000000000000000000000000000..610f58441a37376b23e26b89ccd311ebdac642b4 GIT binary patch literal 342 zcmZ?wbhEHb6krfwxXQrLG2_651qWuVII&>Ei4{98XasZ^L`<+qnBkDIpku)Shm08- z5fcm&CM?)-Az;RZhy^z?R^0HIaUo&FjfxF78g@LGaNxm(4?kY~`0?S#kHmP}#CXSw z9J9hStM($J%y`>|9HWLDv&2ZpX_fl@Mf!#DR{z0(fqFpkCkrD3gBpVl$ViZ%7}$y( zf>&-ZkdSC^KID{X<~y7w#A}E7wRtEQ4_ao$K@}3 z?wT|`e=e@9CRzJNu3H-P zO&@UpeyZQXi7jKe-Hk?r-sue;aDce_XqkvXP+W#F_*ot`jB?BS93Uw71|U^ZjLH`yP%FO7U<6!nLCG} z$SDlWRsX(Ohwq+z^!{nkw1lu( zDPc2HV&`P7KEHX-jYA>R6T@ewM9fTyo0E0x)!k_2wz@P-Sk|APSoeSzXn7Dfh!ClGm2|QYKe-7h)T#Q@$He9j?`9AQ4ux} zP&?5iq-<&#X{ezXX|J!t&@97aWMj6{+|Gn&T@xp-YRQ`y8=a5yFmmdtZYWsP+AXH8 bqq4{4!~q5-W`Qq@Pi$O#yuX);k--`O+yTtY literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools/icons/full/obj16/plugin.png b/bundles/org.eclipse.e4.tools/icons/full/obj16/plugin.png new file mode 100644 index 0000000000000000000000000000000000000000..6187b15aec001b7080b51a5f944f07591f26cc15 GIT binary patch literal 591 zcmV-V0eEcNHZMNv|IbJ-M`( zKwWL~opzjJe^WpCmV9E;(0&ut2;4va_(#>M8)>9$R5viQnf(Nkh~VM$y>J(jqb$cj z+nL1Nm|mV)Gm|9MnHf*7Ja4OEAQz__^LRKOLEwqpiGV^^A*T=#&inGm-62Xs;dnSp zKj&H9T*boh2i)W+(n27l!C)>fq|L%VB1i ziC4p;NwV_}ZjW7$LRW#(_bKF#hp=!IqNO26Z*w2+LEwx{PVnZ&Sn}T;mtzb$;qA*nT@@+ zV5uQ@iXDTPoTbV#FRr~z04|PPh`wXTNoCm9*tG&?e3+fYl>K6+&3|Cc$KOpL`ER+_ dcRl5U#9zn6ZO}GF002S=1^@s6A3-Z300009a7bBm000XU z000XU0RWnu7ytkYO=&|zP*7-ZbZ>KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-ePrx>>xFPTiH1=E+A$W$=bG8>s^ zm=Bn5Rah$aDtr}@$`X}2l~$F0mFKEdRdZE8)p@E5RI61Ft6o-prbbn>P~)iy)E2AN zsU20jsWz_8Qg>31P|s0cqrPALg8E|(vWA65poU1JRAaZs8I2(p#xiB`SVGovRs-uS zYnV-9TeA7=Om+qP8+I>yOjAR1s%ETak!GFdam@h^# z)@rS0t$wXH+Irf)+G6c;?H29p+V6F6oj{!|o%K3xI`?%6x;DB|x`n#ibhIR?(H}Q3Gzd138Ei2)WAMz7W9Vy`X}HnwgyEn!VS)>mv$8&{hQn>w4zwy3R}t;BYlZQm5)6pty=DfLrs+A-|>>;~;Q z_F?uV_HFjh9n2gO9o9Q^JA86v({H5aB!kjoO6 zc9$1ZZKsN-Zl8L~mE{`ly3)1N^`o1+o7}D0ZPeY&J;i;i`%NyJ8_8Y6J?}yE@b_5a zam?eLr<8@mESk|3$_SkmS{wQ>%qC18))9_|&j{ZT zes8AvOzF(F2#DZEY>2oYX&IRp`F#{ADl)1r>QS^)ba8a|EY_^#S^HO&t^Rgqwv=MZThqqEWH8 zxJo>d=ABlR_Bh=;eM9Tw|Ih34~oTE|= zX_mAr*D$vzw@+p(E0Yc6dFE}(8oqt`+R{gE3x4zjX+Sb3_cYE^= zgB=w+-tUy`ytONMS8KgRef4hA?t0j zufM;t32jm~jUGrkaOInTZ`zyfns>EuS}G30LFK_G-==(f<51|K&cocp&EJ`SxAh3? zNO>#LI=^+SEu(FqJ)ynt=!~PC9bO$rzPJB=?=j6w@a-(u02P7 zaQ)#(uUl{HW%tYNS3ItC^iAtK(eKlL`f9+{bJzISE?u8_z3;~C8@FyI-5j_jy7l;W z_U#vU3hqqYU3!mrul&B+{ptt$59)uk{;_4iZQ%G|z+lhASr6|H35TBkl>gI*;nGLU zN7W-nBaM%pA0HbH8olyl&XeJ%vZoWz%6?Y=dFykl=imL}`%BMQ{Mhgd`HRoLu6e2R za__6DuR6yg#~-}Tc|Gx_{H@O0eebyMy5GmWADJlpK>kqk(fVV@r_fLLKIeS?{4e)} z^ZO;zpECde00d`2O+f$vv5tKEQIh}w03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(` z>RI+y?e7jKeZ#YO-C6Rk-^K~#9!?3-zjUB`9bf8BR^`68f8iHfsgzQRQ=uw$99I|>Whtq$%CSV*imlBy6`3-{ zP!PcdTtt8XvCd#H%UkcexBHxYxNjZ?{VLkA_j|Zw$L@A1BNkuE7#Oq!A zu7&mc-#k$gp{%O0LV#)w)xsNn=3NErkN*6m6{Vo6HB|y*K$SA8RlvO2=ifE3{`;U{!%!O?3mYd5dja^02=AmvbdiawP$pOQ@t!Ghp;>v~|hC`pS3bV^!*^8X3(Y zk%OvXD6c*Du7&kKzkeza)w(LhSHUpG&;Vl9ch>eL1?zwP;8aDGssVcz4?}1TBPxV? z4((qOu)hAc3(-JLF~F;o6I#QV>f5tVmn5t|ePp2`O4VSjzRC(22#qmgs(Q|#ex+f3 z<432h2&0O|>ltg454|x_jOzKh=dUEJhyU($QIrv5hB4EtEqQ1RV=9=p@AG~Muti)YJ^cVg+k#ehXCuPcP{(KYxs4M_=anvBR7^c61qd82J2yU)X!- zjqde-9$U1cjH(igf{G#vqKXQLf~tnrm@!c`q9BsLFRRzCt>x_h{h(IO+d6Ns&OkE1 zamB7H8`s@*E90XZs1~ZkVUZ{ZvBnSt2EpOI!%0deDQV_NGf(O=mR3&j;&V^){8RhL z()25@2kkF^vJ|N@rm9v3oq07Zg}@lbRWWBETwqxD-GBXEz(cb;-!r@CeK)gda+cBZ zIOVv4!D5U(t5L-xn&Ii=G$GSAnRZFDjDBiJdWLpyndhE*lKnq@avAu|2fwiQE32RX z&f`lZg@y>It^#@$EX54MgYax9=NDG+HbMPv6h{x;_K)vwTz}(jY@go6cx8%0SjL)& zz(iQ`5)fesu!IAEX7F?j##pdI5cRNy7RD4Ao8G|GmJP+l`GtG0zHxMR?~hJ=>w8Zu z*MYjOiJf#%&@->Yz>I?lb@kj^sdfGHtM@o3W!-oG^$*p?Mm}@f$3MjOsrNEnyDWz? z0AvX0`!@6411xl3p_4AN+&h66!HXvohZ9F^E5t#8MtPE{kx8oMfIcfEiPCNrXm^`D z^Y=gF_<>_jUw7@l`6t`9exkXmlJ%5j4RxUO8s+=~loh^pP_@t8`mwv%wP`n_r70{S zfr+t1H2d=$ZSCV^`{!6nRN^V>g;^#lR}%*nqM!^wE1AQIqnXSx-#NtolY6PeqwLvy zBXPM$X=DK>HLkgR4}!nu$*2C{&$ey-#D`z+dj-~%jnR_GFDGO%ZvoV2tE1HiZu;mg zT({+BYVjC>DH56jDwZRypK)a6Daz4C8pUl?;t3*CAhZz%OJE|5$!{a-hs9}1;=26V z)Bm13XFp9bs*(nCxabJ2r5b&g^6cO3fAO2IR+d3yYs_e_9QXw(%cv5n zY6zI{&5U^%hYwtH&$aB>w1aY79@rm?7vZV7Kd0vsHdJq-UYMa^OGLIvWD7(#CNS~P zQmtA8MRAhhG^Le1PaKpOEpDXmyO^wwPc{=(4%1&LvhBtzXf5vj)L(t~)BFF?hyUck zHPLwx7}L=68AvHclt@HFRU%cwSBuHMNfQrkd;d1JOwBM_t`AM0myDmD_y(Oc;qs9? z7%R?F2}h_#qtv2t>d^%CXo6ZeMlG747L5g*eN zzQ$!Ev(vMaTsAt6B6(5e@#Ej1-A|Yuy@N_PN;#}k2^&1Xq{&F#!pfSM=1q0ib0KXP@@o( zF$4bd-IqAH^7ouhUg1>tWt?|33Nw_$QD#SOV5W8zhgY6v*TgM@j^w^v(ZMq{hzNo( zxpRVrmlr%kx!_PEkM;hbfRVt+buPFhJ zzI51sVlT6!H&KfxiEW8OP@xo5hM+R(@#yg{bF%XS)8$=Em3J^v*oISwmyF}>7x~V? z-zW1K<)}_Ms*_4@V9jLEK|xi>yu+!(Mux`h2uBWl|F?Hvec$iAm5zBK&H+h5{FE0LsZnlDudq-7|sN}Da+!1(BlJ$v;hOzfFn1A-APtKp(`=2Hz zu5Z1b9dcevPP8b3mGeB4w(AVR*{B@uDNe@JD+Z?tPWz<3$BT2%GgiKw(8h!&CNjC_ z3kFX0he!U1Mtm8!Z2FhPVRbOgaftdez|;}gkSoS+~{cMTs(}Bbn1tRSLi8pme=qcx_=kq*8)R6I3liz|qBo%sVElTd*d? znjo(S)60V^PcTv1j=_*gA5{Tz1MOGUGXOS(C@D@eoaE4)=4A*LPv$cEE~Qv0QkV!? zezv_+M5D}U*$a{K%RAPCHEYX;DE4HU;MI^NhEuI2s__^GJNOH+gDeBU$@T#@*RRQg zOUy6;RrLd4uLEmUg}PRaeKJXh%F42gB(;QfgY(Hw=NZvoCZ#tRhId8dpf;tiJyK0r z>2^qcA7etS$zvd6%pkd!9|xCzhN_TCk5sy(zBecdsqc~bgj5nzpO8tPRQhC+PQs=wFuDb$MjtfY;h0^<(VW=zh*`rk+?2B-x>s_X3cdn^m?l{$!R*so(@1s zZ&32rPBQvwf2b_y2dNp93w5loEO8_vn86G@b7h=lSj|w?Gi8{5GmIB6XR&vZT48jU z>|5>F+H6Cvt~6K8z+SBm*}nAX`+Nv{btGw@%w?p`;XL?@5|%pp10X1P&A`CHh5cx5 zu7|;-s3$O%UE{a##K~_nS)IuZykVFfRh4{ZDXU?@86%%cFSlU>SgG$0LyT6ZH&B+t z33xR~R~fl{=gA8JYdr)1WO~}u>NpbV)0I9>9EB*viRXCp&>GK{+aQ3OHhqlaE3Yuu zIZV$t>A4nN*P`cI^n9D1Yv#3IJ(t&s@6dDY+}`>20Ae0OG}~P=mwQAL2wpOz2Q!;K zICrtYI^?=SujlD$N=k+|eagiGU^uw&?65O#Fq{NWDXQ_2EAHd*!+%S&e>#WbR_MAW zUAHnUJ=dh`nrnbHNqmcB71SWsT4{C2vVnnj88#5IrVxdd0~gaU{Go4hZ_*JW$q0-^ z;si|$^>Ud<4}OQ+wtZ}1ocp9EA(V*Nmih3uf5E}UXZX(kZ?bd4dzq?D69&;>N+JWB z0f)mTfY4_Xgp565tn!sz;*) z-wl{()YyOM2#+8B8*ZKb2%$uzCL-`5hJeTx_*XZ6k?S{ph_65M0DBLAn?`wbuyP`# zE@P#;f~a!!^!qtD|L8E<7tQUUS5H4pSz77foFj9da>e9cbiP2Xx@F%*1M9&r?0xdS z`>#LbnlhU#T5L6gVuD+aiQ|A;rNsB1|5L8scvGHVCpar@9NGf!o4JSg&D_I$=O|Cl z{g}D-5mc4w%4Vjjo7ue~&tcvD<#F0cn>Y^9f$Bs(M~*HHhM>neN2y-Grw*B~vg7uD z{^N_v8v=hUhYP=x);fe8B`hU)il~HKK0U_M2afRN$G*tFzWv{=nfd2anm8yD+aiI9 zn5taHhqnFNI;oUAM!RbI{VaEnF&0*b!?4**Xf}H|=gFKy5z2M&a{-mg%=a22JKA!A zqKDT@WqgSf#bxP2a?0YZLn~dJq^NORv3ZJv3;TKS$Nz!FWNzU7nsod!?QEG=wnW=4 z(e*1NzCD}*^?Zx2U!k2X(#%e=xp4){oz^gn==6FVIkHTa(K*cHcY?& zdlz!|&blkodw+Byx#9MWr9et|G3xO)C1_;0r66Ac4lVUciRX^~od0+D|1w?Q#7Jcn z5tpZ9G#$?W`qCxwgU~>_^n5c97krCXmS5uO6F*^eq)6s7UOCjH*UNCu;habDY`&sG zc)UTpG_mj2n}6?Xt6{LNS&@FDm1oemz9RijU;*54`^G1=WjXiaU%Ts$Km4kQ3>R5t&Bl;7T4Ys~_1~9uu2&sG ze5WhY50s`xKD*)0o%H-1zJ8eI$&}Q$QFX(O9tML5v^puh#L?`eYj#=a>PidcQb-&H z)T%N4wy-eQ$2&p9fP@%IY}~MstFF9~rJo)rJ(2DE#7DpJxx8~17S@~YqS^bS6W`r^ z{n)HY!aY;7R}my*#6gY7RDO)UQO2)(1N19#r`d-oTM<7wUr<)XA%uLAb1tFEbTbt~zf z4YSu$j7N!sI+3jt*&30p6Nfdzpp-A!n;?(BjLl!0fPNP`EyLoRA!)~0sSw&akr^Sf zbwXQb*Y<1K^WK{|`IBd8y>jZn2k!XKpBruLXrJleg@yH&m%vXgXXBs$(g*)*RI7e! z=N%syWxGGDzxqmuC*r)RFdmE_H8EHK>jSt* zVZC(dSfC;WW6Vex#+$u!Q{MT8cWz9D%_4q-I6u9(d~Dkj&po{T<+;5~ZQ0G_WmhwG z*;OAGhK?4p`*QB81K zjcs{?Whb`n)b{!==sKsF%LRIIzu?ZEK7B3sXY{$!t_kKdWOp4FXi}&N={MhQ} z)2z$Ob9*^)`UMu6uW-8g3e}N~R7W-r&1RakS)BhlwbBIR^~;&va2;ExuP2Vm!_>bG zf+cLQWCFWrf?ydNEUO8Y!~~08?NTOoDanGRcHgdC2w3Y)q?;JyqB!=}SnHi%Hr|Z^ z)8b@7M2?8}BjTkdA`L`~L0GF?IeTZg>+(AzkO(Dcc2C(>cVYFBm^iF3dD9lb;4sD; zg99>SZ5Lzu#sil}v0Wb*7zUws+BF9j=(2Nn2g#R4J&k zBC5sxKQN`vRWDE$c4YGWnN|0jn#S9aGA4u1% zkuz%~9tEasttqb#2_1I)jP$)S_?3j7*#~+7p}gf3O(*dcFh#&H0Cf(#drc6S5|_wv z7OY<12S62csHk&kJPK{;T=#xn%*tv2!TA7X3?{sURCN}tB=serkPkg`&OfcY)KoQu zm1bfMrg1(Lb*ZZAjIs=)3gejb^JC30Fa^V-C{~rKy(Y&;(zo0t+0000rc|c@ literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/emf/editor3x/templates/HandlerTemplate.java b/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/emf/editor3x/templates/HandlerTemplate.java new file mode 100644 index 0000000000..e969a0930a --- /dev/null +++ b/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/emf/editor3x/templates/HandlerTemplate.java @@ -0,0 +1,50 @@ +package org.eclipse.e4.tools.emf.editor3x.templates; + +import org.eclipse.e4.tools.emf.editor3x.wizard.NewHandlerClassWizard.HandlerClass; + +public class HandlerTemplate +{ + protected static String nl; + public static synchronized HandlerTemplate create(String lineSeparator) + { + nl = lineSeparator; + HandlerTemplate result = new HandlerTemplate(); + nl = null; + return result; + } + + public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; + protected final String TEXT_1 = " " + NL + "package "; + protected final String TEXT_2 = ";" + NL + "" + NL + "import org.eclipse.e4.core.di.annotations.Execute;"; + protected final String TEXT_3 = NL + "import org.eclipse.e4.core.di.annotations.CanExecute;"; + protected final String TEXT_4 = NL + NL + "public class "; + protected final String TEXT_5 = " {" + NL + "\t@Execute" + NL + "\tpublic void "; + protected final String TEXT_6 = "() {" + NL + "\t\t//TODO Your code goes here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_7 = NL + "\t" + NL + "\t@CanExecute" + NL + "\tpublic boolean "; + protected final String TEXT_8 = "() {" + NL + "\t\t//TODO Your code goes here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_9 = "\t" + NL + "}"; + + public String generate(Object argument) + { + final StringBuffer stringBuffer = new StringBuffer(); + HandlerClass domainClass = (HandlerClass)argument; + stringBuffer.append(TEXT_1); + stringBuffer.append( domainClass.getPackageFragment().getElementName() ); + stringBuffer.append(TEXT_2); + if( domainClass.isUseCanExecute() ) { + stringBuffer.append(TEXT_3); + } + stringBuffer.append(TEXT_4); + stringBuffer.append( domainClass.getName() ); + stringBuffer.append(TEXT_5); + stringBuffer.append( domainClass.getExecuteMethodName() ); + stringBuffer.append(TEXT_6); + if( domainClass.isUseCanExecute() ) { + stringBuffer.append(TEXT_7); + stringBuffer.append( domainClass.getCanExecuteMethodName() ); + stringBuffer.append(TEXT_8); + } + stringBuffer.append(TEXT_9); + return stringBuffer.toString(); + } +} diff --git a/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/emf/editor3x/templates/PartTemplate.java b/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/emf/editor3x/templates/PartTemplate.java new file mode 100644 index 0000000000..3bcf847594 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/emf/editor3x/templates/PartTemplate.java @@ -0,0 +1,89 @@ +package org.eclipse.e4.tools.emf.editor3x.templates; + +import org.eclipse.e4.tools.emf.editor3x.wizard.NewPartClassWizard.PartClass; + +public class PartTemplate +{ + protected static String nl; + public static synchronized PartTemplate create(String lineSeparator) + { + nl = lineSeparator; + PartTemplate result = new PartTemplate(); + nl = null; + return result; + } + + public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; + protected final String TEXT_1 = " " + NL + "package "; + protected final String TEXT_2 = ";" + NL + "" + NL + "import javax.inject.Inject;"; + protected final String TEXT_3 = NL + "import javax.annotation.PostConstruct;"; + protected final String TEXT_4 = NL + "import javax.annotation.PreDestroy;"; + protected final String TEXT_5 = NL + "import org.eclipse.e4.ui.di.Focus;"; + protected final String TEXT_6 = NL + "import org.eclipse.e4.ui.di.Persist;"; + protected final String TEXT_7 = NL + NL + "public class "; + protected final String TEXT_8 = " {" + NL + "\t@Inject" + NL + "\tpublic "; + protected final String TEXT_9 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_10 = NL + "\t@PostConstruct" + NL + "\tpublic void "; + protected final String TEXT_11 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_12 = NL + "\t"; + protected final String TEXT_13 = NL + "\t@PreDestroy" + NL + "\tpublic void "; + protected final String TEXT_14 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_15 = NL + "\t"; + protected final String TEXT_16 = NL + "\t@Focus" + NL + "\tpublic void "; + protected final String TEXT_17 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_18 = NL + "\t"; + protected final String TEXT_19 = NL + "\t@Persist" + NL + "\tpublic void "; + protected final String TEXT_20 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_21 = NL + "}"; + + public String generate(Object argument) + { + final StringBuffer stringBuffer = new StringBuffer(); + PartClass domainClass = (PartClass)argument; + stringBuffer.append(TEXT_1); + stringBuffer.append( domainClass.getPackageFragment().getElementName() ); + stringBuffer.append(TEXT_2); + if( domainClass.isUsePostConstruct() ) { + stringBuffer.append(TEXT_3); + } + if( domainClass.isUsePredestroy() ) { + stringBuffer.append(TEXT_4); + } + if( domainClass.isUseFocus() ) { + stringBuffer.append(TEXT_5); + } + if( domainClass.isUsePersist() ) { + stringBuffer.append(TEXT_6); + } + stringBuffer.append(TEXT_7); + stringBuffer.append( domainClass.getName() ); + stringBuffer.append(TEXT_8); + stringBuffer.append( domainClass.getName() ); + stringBuffer.append(TEXT_9); + if( domainClass.isUsePostConstruct() ) { + stringBuffer.append(TEXT_10); + stringBuffer.append( domainClass.getPostConstructMethodName() ); + stringBuffer.append(TEXT_11); + } + stringBuffer.append(TEXT_12); + if( domainClass.isUsePredestroy() ) { + stringBuffer.append(TEXT_13); + stringBuffer.append( domainClass.getPreDestroyMethodName() ); + stringBuffer.append(TEXT_14); + } + stringBuffer.append(TEXT_15); + if( domainClass.isUseFocus() ) { + stringBuffer.append(TEXT_16); + stringBuffer.append( domainClass.getFocusMethodName() ); + stringBuffer.append(TEXT_17); + } + stringBuffer.append(TEXT_18); + if( domainClass.isUsePersist() ) { + stringBuffer.append(TEXT_19); + stringBuffer.append( domainClass.getPersistMethodName() ); + stringBuffer.append(TEXT_20); + } + stringBuffer.append(TEXT_21); + return stringBuffer.toString(); + } +} diff --git a/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/internal/classes/templates/HandlerTemplate.java b/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/internal/classes/templates/HandlerTemplate.java new file mode 100644 index 0000000000..711cdd745c --- /dev/null +++ b/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/internal/classes/templates/HandlerTemplate.java @@ -0,0 +1,50 @@ +package org.eclipse.e4.tools.internal.classes.templates; + +import org.eclipse.e4.tools.internal.classes.NewHandlerClassWizard.HandlerClass; + +public class HandlerTemplate +{ + protected static String nl; + public static synchronized HandlerTemplate create(String lineSeparator) + { + nl = lineSeparator; + HandlerTemplate result = new HandlerTemplate(); + nl = null; + return result; + } + + public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; + protected final String TEXT_1 = " " + NL + "package "; + protected final String TEXT_2 = ";" + NL + "" + NL + "import org.eclipse.e4.core.di.annotations.Execute;"; + protected final String TEXT_3 = NL + "import org.eclipse.e4.core.di.annotations.CanExecute;"; + protected final String TEXT_4 = NL + NL + "public class "; + protected final String TEXT_5 = " {" + NL + "\t@Execute" + NL + "\tpublic void "; + protected final String TEXT_6 = "() {" + NL + "\t\t//TODO Your code goes here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_7 = NL + "\t" + NL + "\t@CanExecute" + NL + "\tpublic boolean "; + protected final String TEXT_8 = "() {" + NL + "\t\t//TODO Your code goes here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_9 = "\t" + NL + "}"; + + public String generate(Object argument) + { + final StringBuffer stringBuffer = new StringBuffer(); + HandlerClass domainClass = (HandlerClass)argument; + stringBuffer.append(TEXT_1); + stringBuffer.append( domainClass.getPackageFragment().getElementName() ); + stringBuffer.append(TEXT_2); + if( domainClass.isUseCanExecute() ) { + stringBuffer.append(TEXT_3); + } + stringBuffer.append(TEXT_4); + stringBuffer.append( domainClass.getName() ); + stringBuffer.append(TEXT_5); + stringBuffer.append( domainClass.getExecuteMethodName() ); + stringBuffer.append(TEXT_6); + if( domainClass.isUseCanExecute() ) { + stringBuffer.append(TEXT_7); + stringBuffer.append( domainClass.getCanExecuteMethodName() ); + stringBuffer.append(TEXT_8); + } + stringBuffer.append(TEXT_9); + return stringBuffer.toString(); + } +} diff --git a/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/internal/classes/templates/PartTemplate.java b/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/internal/classes/templates/PartTemplate.java new file mode 100644 index 0000000000..d10a26816e --- /dev/null +++ b/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/internal/classes/templates/PartTemplate.java @@ -0,0 +1,89 @@ +package org.eclipse.e4.tools.internal.classes.templates; + +import org.eclipse.e4.tools.internal.classes.NewPartClassWizard.PartClass; + +public class PartTemplate +{ + protected static String nl; + public static synchronized PartTemplate create(String lineSeparator) + { + nl = lineSeparator; + PartTemplate result = new PartTemplate(); + nl = null; + return result; + } + + public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; + protected final String TEXT_1 = " " + NL + "package "; + protected final String TEXT_2 = ";" + NL + "" + NL + "import javax.inject.Inject;"; + protected final String TEXT_3 = NL + "import javax.annotation.PostConstruct;"; + protected final String TEXT_4 = NL + "import javax.annotation.PreDestroy;"; + protected final String TEXT_5 = NL + "import org.eclipse.e4.ui.di.Focus;"; + protected final String TEXT_6 = NL + "import org.eclipse.e4.ui.di.Persist;"; + protected final String TEXT_7 = NL + NL + "public class "; + protected final String TEXT_8 = " {" + NL + "\t@Inject" + NL + "\tpublic "; + protected final String TEXT_9 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_10 = NL + "\t@PostConstruct" + NL + "\tpublic void "; + protected final String TEXT_11 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_12 = NL + "\t"; + protected final String TEXT_13 = NL + "\t@PreDestroy" + NL + "\tpublic void "; + protected final String TEXT_14 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_15 = NL + "\t"; + protected final String TEXT_16 = NL + "\t@Focus" + NL + "\tpublic void "; + protected final String TEXT_17 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_18 = NL + "\t"; + protected final String TEXT_19 = NL + "\t@Persist" + NL + "\tpublic void "; + protected final String TEXT_20 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_21 = NL + "}"; + + public String generate(Object argument) + { + final StringBuffer stringBuffer = new StringBuffer(); + PartClass domainClass = (PartClass)argument; + stringBuffer.append(TEXT_1); + stringBuffer.append( domainClass.getPackageFragment().getElementName() ); + stringBuffer.append(TEXT_2); + if( domainClass.isUsePostConstruct() ) { + stringBuffer.append(TEXT_3); + } + if( domainClass.isUsePredestroy() ) { + stringBuffer.append(TEXT_4); + } + if( domainClass.isUseFocus() ) { + stringBuffer.append(TEXT_5); + } + if( domainClass.isUsePersist() ) { + stringBuffer.append(TEXT_6); + } + stringBuffer.append(TEXT_7); + stringBuffer.append( domainClass.getName() ); + stringBuffer.append(TEXT_8); + stringBuffer.append( domainClass.getName() ); + stringBuffer.append(TEXT_9); + if( domainClass.isUsePostConstruct() ) { + stringBuffer.append(TEXT_10); + stringBuffer.append( domainClass.getPostConstructMethodName() ); + stringBuffer.append(TEXT_11); + } + stringBuffer.append(TEXT_12); + if( domainClass.isUsePredestroy() ) { + stringBuffer.append(TEXT_13); + stringBuffer.append( domainClass.getPreDestroyMethodName() ); + stringBuffer.append(TEXT_14); + } + stringBuffer.append(TEXT_15); + if( domainClass.isUseFocus() ) { + stringBuffer.append(TEXT_16); + stringBuffer.append( domainClass.getFocusMethodName() ); + stringBuffer.append(TEXT_17); + } + stringBuffer.append(TEXT_18); + if( domainClass.isUsePersist() ) { + stringBuffer.append(TEXT_19); + stringBuffer.append( domainClass.getPersistMethodName() ); + stringBuffer.append(TEXT_20); + } + stringBuffer.append(TEXT_21); + return stringBuffer.toString(); + } +} diff --git a/bundles/org.eclipse.e4.tools/plugin.xml b/bundles/org.eclipse.e4.tools/plugin.xml new file mode 100644 index 0000000000..56fd224e4e --- /dev/null +++ b/bundles/org.eclipse.e4.tools/plugin.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/ToolsPlugin.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/ToolsPlugin.java new file mode 100644 index 0000000000..9f80ed6bfd --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/ToolsPlugin.java @@ -0,0 +1,117 @@ +package org.eclipse.e4.internal.tools; + +import java.net.URL; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.common.util.ResourceLocator; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +public class ToolsPlugin extends AbstractUIPlugin { + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.e4.tools"; //$NON-NLS-1$ + + private static ToolsPlugin plugin; + + private ResourceLocator resourceLocator; + + /* + * (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 ToolsPlugin getDefault() { + return plugin; + } + + public ResourceLocator getResourceLocator() { + if (resourceLocator == null) { + resourceLocator = new ResourceLocator() { + + public String getString(String key, Object[] substitutions, + boolean translate) { + return null; + } + + public String getString(String key, Object[] substitutions) { + return null; + } + + public String getString(String key, boolean translate) { + return null; + } + + public String getString(String key) { + return null; + } + + public Object getImage(String key) { + return null; + } + + public URL getBaseURL() { + return null; + } + }; + } + return resourceLocator; + } + + public static void log(IStatus status, int nesting, boolean appendLogger) { + getDefault().getLog().log(status); + } + + /** + * Log Throwable Error + */ + public static void logError(Throwable t) { + logError(t, 0, true); + } + + public static void logError(Throwable t, boolean appendLogger) { + logError(t, 0, appendLogger); + } + + public static void logError(Throwable t, int nesting) { + logError(t, nesting, true); + } + + public static void logError(Throwable t, int nesting, boolean appendLogger) { + log(newStatus(IStatus.ERROR, t.getMessage(), t), nesting, appendLogger); + } + + /** + * Create an IStatus + * + * @return a new IStatus + */ + public static IStatus newStatus(int severity, String message, + Throwable exception) { + return new Status(severity, PLUGIN_ID, 0, message, exception); + } +} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java new file mode 100644 index 0000000000..2452e1f963 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java @@ -0,0 +1,376 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.internal.tools.wizards.classes; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; + +import org.eclipse.core.databinding.Binding; +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.UpdateValueStrategy; +import org.eclipse.core.databinding.beans.BeanProperties; +import org.eclipse.core.databinding.conversion.Converter; +import org.eclipse.core.databinding.validation.IValidator; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jdt.core.IJavaElement; +import org.eclipse.jdt.core.IJavaModel; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.IPackageFragment; +import org.eclipse.jdt.core.IPackageFragmentRoot; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.internal.ui.JavaPlugin; +import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages; +import org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator; +import org.eclipse.jdt.internal.ui.wizards.TypedViewerFilter; +import org.eclipse.jdt.ui.JavaElementComparator; +import org.eclipse.jdt.ui.JavaElementLabelProvider; +import org.eclipse.jdt.ui.StandardJavaElementContentProvider; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.wizard.WizardPageSupport; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.jface.window.Window; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.dialogs.ElementListSelectionDialog; +import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; + +public abstract class AbstractNewClassPage extends WizardPage { + public static class JavaClass { + protected PropertyChangeSupport support = new PropertyChangeSupport(this); + + private IPackageFragmentRoot fragmentRoot; + private IPackageFragment packageFragment; + private String name; + + public JavaClass(IPackageFragmentRoot fragmentRoot) { + this.fragmentRoot = fragmentRoot; + } + + public IPackageFragmentRoot getFragmentRoot() { + return fragmentRoot; + } + + public void setFragmentRoot(IPackageFragmentRoot fragmentRoot) { + support.firePropertyChange("fragementRoot", this.fragmentRoot, this.fragmentRoot = fragmentRoot); + } + + public IPackageFragment getPackageFragment() { + return packageFragment; + } + + public void setPackageFragment(IPackageFragment packageFragment) { + support.firePropertyChange("packageFragment", this.packageFragment, this.packageFragment = packageFragment); + } + + public String getName() { + return name; + } + + public void setName(String name) { + support.firePropertyChange("name", this.name, this.name = name); + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + support.addPropertyChangeListener(listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + support.removePropertyChangeListener(listener); + } + } + + private JavaClass clazz; + private IPackageFragmentRoot froot; + private IWorkspaceRoot fWorkspaceRoot; + + protected AbstractNewClassPage(String pageName, String title, String description, IPackageFragmentRoot froot, IWorkspaceRoot fWorkspaceRoot) { + super(pageName); + this.froot = froot; + this.fWorkspaceRoot = fWorkspaceRoot; + + setTitle(title); + setDescription(description); + } + + public void createControl(Composite parent) { + final Image img = new Image(parent.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newclass_wiz.png")); + setImageDescriptor(ImageDescriptor.createFromImage(img)); + + parent.addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + img.dispose(); + setImageDescriptor(null); + } + }); + + parent = new Composite(parent, SWT.NULL); + parent.setLayoutData(new GridData(GridData.FILL_BOTH)); + parent.setLayout(new GridLayout(3, false)); + + clazz = createInstance(); + + DataBindingContext dbc = new DataBindingContext(); + WizardPageSupport.create(this, dbc); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Source folder"); + l.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false)); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + t.setEditable(false); + final Binding bd = dbc.bindValue( + WidgetProperties.text().observe(t), + BeanProperties.value("fragmentRoot").observe(clazz), + new UpdateValueStrategy(), + new UpdateValueStrategy().setConverter(new PackageFragmentRootToStringConverter()) + ); + + Button b = new Button(parent, SWT.PUSH); + b.setText("Browse ..."); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IPackageFragmentRoot root = choosePackageRoot(); + if( root != null ) { + clazz.setFragmentRoot(root); + } + bd.updateModelToTarget(); //TODO Find out why this is needed + } + }); + } + + { + Label l = new Label(parent, SWT.NONE); + l.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false)); + l.setText("Package"); + + Text t = new Text(parent, SWT.BORDER); + t.setEditable(false); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + final Binding bd = dbc.bindValue( + WidgetProperties.text().observe(t), + BeanProperties.value("packageFragment").observe(clazz), + new UpdateValueStrategy(), + new UpdateValueStrategy().setConverter(new PackageFragmentToStringConverter()) + ); + + Button b = new Button(parent, SWT.PUSH); + b.setText("Browse ..."); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IPackageFragment fragment = choosePackage(); + if( fragment != null ) { + clazz.setPackageFragment(fragment); + } + bd.updateModelToTarget(); //TODO Find out why this is needed + } + }); + } + + { + Label l = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); + l.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 3, 1)); + } + + { + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + Label l = new Label(parent, SWT.NONE); + l.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false)); + l.setText("Name"); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + dbc.bindValue(textProp.observe(t), BeanProperties.value("name", String.class).observe(clazz)); + + new Label(parent, SWT.NONE); + } + + { + Label l = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); + l.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 3, 1)); + } + + createFields(parent, dbc); + setControl(parent); + } + + private IPackageFragmentRoot choosePackageRoot() { + IJavaElement initElement= clazz.getFragmentRoot(); + Class[] acceptedClasses= new Class[] { IPackageFragmentRoot.class, IJavaProject.class }; + TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, false) { + public boolean isSelectedValid(Object element) { + try { + if (element instanceof IJavaProject) { + IJavaProject jproject= (IJavaProject)element; + IPath path= jproject.getProject().getFullPath(); + return (jproject.findPackageFragmentRoot(path) != null); + } else if (element instanceof IPackageFragmentRoot) { + return (((IPackageFragmentRoot)element).getKind() == IPackageFragmentRoot.K_SOURCE); + } + return true; + } catch (JavaModelException e) { + JavaPlugin.log(e.getStatus()); // just log, no UI in validation + } + return false; + } + }; + + acceptedClasses= new Class[] { IJavaModel.class, IPackageFragmentRoot.class, IJavaProject.class }; + ViewerFilter filter= new TypedViewerFilter(acceptedClasses) { + public boolean select(Viewer viewer, Object parent, Object element) { + if (element instanceof IPackageFragmentRoot) { + try { + return (((IPackageFragmentRoot)element).getKind() == IPackageFragmentRoot.K_SOURCE); + } catch (JavaModelException e) { + JavaPlugin.log(e.getStatus()); // just log, no UI in validation + return false; + } + } + return super.select(viewer, parent, element); + } + }; + + StandardJavaElementContentProvider provider= new StandardJavaElementContentProvider(); + ILabelProvider labelProvider= new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT); + ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), labelProvider, provider); + dialog.setValidator(validator); + dialog.setComparator(new JavaElementComparator()); + dialog.setTitle(NewWizardMessages.NewContainerWizardPage_ChooseSourceContainerDialog_title); + dialog.setMessage(NewWizardMessages.NewContainerWizardPage_ChooseSourceContainerDialog_description); + dialog.addFilter(filter); + dialog.setInput(JavaCore.create(fWorkspaceRoot)); + dialog.setInitialSelection(initElement); + dialog.setHelpAvailable(false); + + if (dialog.open() == Window.OK) { + Object element= dialog.getFirstResult(); + if (element instanceof IJavaProject) { + IJavaProject jproject= (IJavaProject)element; + return jproject.getPackageFragmentRoot(jproject.getProject()); + } else if (element instanceof IPackageFragmentRoot) { + return (IPackageFragmentRoot)element; + } + return null; + } + return null; + } + + private IPackageFragment choosePackage() { + IJavaElement[] packages= null; + try { + if (froot != null && froot.exists()) { + packages= froot.getChildren(); + } + } catch (JavaModelException e) { + e.printStackTrace(); + } + if (packages == null) { + packages= new IJavaElement[0]; + } + + ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT)); + dialog.setIgnoreCase(false); + dialog.setTitle("Choose Package"); + dialog.setMessage("Choose a Package"); + dialog.setEmptyListMessage("You need to select a package"); + dialog.setElements(packages); + dialog.setHelpAvailable(false); + + IPackageFragment pack= clazz.getPackageFragment(); + if (pack != null) { + dialog.setInitialSelections(new Object[] { pack }); + } + + if (dialog.open() == Window.OK) { + return (IPackageFragment) dialog.getFirstResult(); + } + return null; + } + + protected abstract void createFields(Composite parent, DataBindingContext dbc); + + protected abstract JavaClass createInstance(); + + public JavaClass getClazz() { + return clazz; + } + + static class ClassnameValidator implements IValidator { + + public IStatus validate(Object value) { + String name = value.toString(); + char[] ar = name.toCharArray(); + for (char c : ar) { + if (!Character.isJavaIdentifierPart(c)) { + return new Status(IStatus.ERROR, "", "'" + c + "' is not allowed in a Class-Name"); + } + } + + if (!Character.isJavaIdentifierStart(ar[0])) { + return new Status(IStatus.ERROR, "", "'" + ar[0] + "' is not allowed as the first character of a Class-Name"); + } + + return Status.OK_STATUS; + } + } + + static class PackageFragmentRootToStringConverter extends Converter { + + public PackageFragmentRootToStringConverter() { + super(IPackageFragmentRoot.class, String.class); + } + + public Object convert(Object fromObject) { + IPackageFragmentRoot f = (IPackageFragmentRoot) fromObject; + return f.getPath().makeRelative().toString(); + } + } + + static class PackageFragmentToStringConverter extends Converter { + + public PackageFragmentToStringConverter() { + super(IPackageFragment.class, String.class); + } + + public Object convert(Object fromObject) { + System.err.println(" =======================> Converting: " + fromObject); + if( fromObject == null ) { + return ""; + } + IPackageFragment f = (IPackageFragment) fromObject; + return f.getElementName(); + } + } +} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java new file mode 100644 index 0000000000..bb7178c10b --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java @@ -0,0 +1,144 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.internal.tools.wizards.classes; + +import java.io.ByteArrayInputStream; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.e4.internal.tools.wizards.classes.AbstractNewClassPage.JavaClass; +import org.eclipse.jdt.core.IJavaElement; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.IPackageFragment; +import org.eclipse.jdt.core.IPackageFragmentRoot; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IWorkbench; + +public abstract class AbstractNewClassWizard extends Wizard implements INewWizard { + protected IPackageFragmentRoot root; + protected IFile file; + + public void init(IWorkbench workbench, IStructuredSelection selection) { + root = getFragmentRoot(getInitialJavaElement(selection)); + System.err.println("Root: " + root); + } + + protected IJavaElement getInitialJavaElement(IStructuredSelection selection) { + IJavaElement jelem = null; + if (selection != null && !selection.isEmpty()) { + Object selectedElement = selection.getFirstElement(); + if (selectedElement instanceof IAdaptable) { + IAdaptable adaptable = (IAdaptable) selectedElement; + + jelem = (IJavaElement) adaptable.getAdapter(IJavaElement.class); + if (jelem == null || !jelem.exists()) { + jelem = null; + IResource resource = (IResource) adaptable + .getAdapter(IResource.class); + if (resource != null + && resource.getType() != IResource.ROOT) { + while (jelem == null + && resource.getType() != IResource.PROJECT) { + resource = resource.getParent(); + jelem = (IJavaElement) resource + .getAdapter(IJavaElement.class); + } + if (jelem == null) { + jelem = JavaCore.create(resource); // java project + } + } + } + } + } + + return jelem; + } + + protected IPackageFragmentRoot getFragmentRoot(IJavaElement elem) { + IPackageFragmentRoot initRoot = null; + if (elem != null) { + initRoot = (IPackageFragmentRoot) elem + .getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); + try { + if (initRoot == null + || initRoot.getKind() != IPackageFragmentRoot.K_SOURCE) { + IJavaProject jproject = elem.getJavaProject(); + if (jproject != null) { + initRoot = null; + if (jproject.exists()) { + IPackageFragmentRoot[] roots = jproject + .getPackageFragmentRoots(); + for (int i = 0; i < roots.length; i++) { + if (roots[i].getKind() == IPackageFragmentRoot.K_SOURCE) { + initRoot = roots[i]; + break; + } + } + } + if (initRoot == null) { + initRoot = jproject.getPackageFragmentRoot(jproject + .getResource()); + } + } + } + } catch (JavaModelException e) { + // TODO + e.printStackTrace(); + } + } + return initRoot; + } + + protected abstract String getContent(); + + public JavaClass getDomainClass() { + return ((AbstractNewClassPage) getPages()[0]).getClazz(); + } + + @Override + public boolean performFinish() { + JavaClass clazz = getDomainClass(); + String content = getContent(); + + IPackageFragment fragment = clazz.getPackageFragment(); + if (fragment != null) { + String cuName = clazz.getName() + ".java"; + IResource resource = fragment.getCompilationUnit(cuName) + .getResource(); + file = (IFile) resource; + try { + if (!file.exists()) { + file.create(new ByteArrayInputStream(content.getBytes()), + true, null); + } else { + file.setContents(new ByteArrayInputStream(content.getBytes()), + IFile.FORCE | IFile.KEEP_HISTORY, null); + } + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return true; + + } + + public IFile getFile() { + return file; + } +} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java new file mode 100644 index 0000000000..52009c9e0d --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java @@ -0,0 +1,133 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.internal.tools.wizards.classes; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.BeanProperties; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.e4.internal.tools.wizards.classes.AbstractNewClassPage.JavaClass; +import org.eclipse.e4.internal.tools.wizards.classes.templates.HandlerTemplate; +import org.eclipse.jdt.core.IPackageFragmentRoot; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class NewHandlerClassWizard extends AbstractNewClassWizard { + @Override + protected String getContent() { + HandlerTemplate template = new HandlerTemplate(); + return template.generate(getDomainClass()); + } + + @Override + public void addPages() { + addPage(new AbstractNewClassPage("Classinformation", + "New Handler", + "Create a new handler class", root, ResourcesPlugin.getWorkspace().getRoot()) { + + @Override + protected JavaClass createInstance() { + return new HandlerClass(root); + } + + @Override + protected void createFields(Composite parent, DataBindingContext dbc) { + IWidgetValueProperty textProp = WidgetProperties + .text(SWT.Modify); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Execute Method"); + l.setLayoutData(new GridData(GridData.END, GridData.CENTER, + false, false)); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + dbc.bindValue( + textProp.observe(t), + BeanProperties.value("executeMethodName").observe( + getClazz())); + + l = new Label(parent, SWT.NONE); + } + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Can-Execute Method"); + l.setLayoutData(new GridData(GridData.END, GridData.CENTER, + false, false)); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + dbc.bindValue(textProp.observe(t), + BeanProperties.value("canExecuteMethodName") + .observe(getClazz())); + dbc.bindValue( + WidgetProperties.enabled().observe(t), + BeanProperties.value("useCanExecute").observe( + getClazz())); + + Button b = new Button(parent, SWT.CHECK); + dbc.bindValue( + WidgetProperties.selection().observe(b), + BeanProperties.value("useCanExecute").observe( + getClazz())); + } + } + }); + } + + + + public static class HandlerClass extends JavaClass { + private String executeMethodName = "execute"; + private String canExecuteMethodName = "canExecute"; + private boolean useCanExecute = false; + + public HandlerClass(IPackageFragmentRoot root) { + super(root); + } + + public String getExecuteMethodName() { + return executeMethodName; + } + + public void setExecuteMethodName(String executeMethodName) { + support.firePropertyChange("executeMethodName", + this.executeMethodName, + this.executeMethodName = executeMethodName); + } + + public String getCanExecuteMethodName() { + return canExecuteMethodName; + } + + public void setCanExecuteMethodName(String canExecuteMethodName) { + support.firePropertyChange("canExecuteMethodName", + this.canExecuteMethodName, + this.canExecuteMethodName = canExecuteMethodName); + } + + public boolean isUseCanExecute() { + return useCanExecute; + } + + public void setUseCanExecute(boolean useCanExecute) { + support.firePropertyChange("useCanExecute", this.useCanExecute, + this.useCanExecute = useCanExecute); + } + } +} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java new file mode 100644 index 0000000000..35c70947d8 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java @@ -0,0 +1,255 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.internal.tools.wizards.classes; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.BeanProperties; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.e4.internal.tools.wizards.classes.AbstractNewClassPage.JavaClass; +import org.eclipse.e4.internal.tools.wizards.classes.templates.PartTemplate; +import org.eclipse.jdt.core.IPackageFragmentRoot; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class NewPartClassWizard extends AbstractNewClassWizard { + + @Override + public void addPages() { + addPage(new AbstractNewClassPage("Classinformation", "New Part", + "Create a new part class", root, ResourcesPlugin.getWorkspace() + .getRoot()) { + + @Override + protected void createFields(Composite parent, DataBindingContext dbc) { + IWidgetValueProperty textProp = WidgetProperties + .text(SWT.Modify); + IWidgetValueProperty enabledProp = WidgetProperties.enabled(); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("PostContruct Method"); + l.setLayoutData(new GridData(GridData.END, GridData.CENTER, + false, false)); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + dbc.bindValue(textProp.observe(t), + BeanProperties.value("postConstructMethodName") + .observe(getClazz())); + dbc.bindValue( + enabledProp.observe(t), + BeanProperties.value("usePostConstruct").observe( + getClazz())); + + Button b = new Button(parent, SWT.CHECK); + dbc.bindValue( + WidgetProperties.selection().observe(b), + BeanProperties.value("usePostConstruct").observe( + getClazz())); + } + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Predestroy Method"); + l.setLayoutData(new GridData(GridData.END, GridData.CENTER, + false, false)); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + dbc.bindValue(textProp.observe(t), + BeanProperties.value("preDestroyMethodName") + .observe(getClazz())); + dbc.bindValue( + enabledProp.observe(t), + BeanProperties.value("usePredestroy").observe( + getClazz())); + + Button b = new Button(parent, SWT.CHECK); + dbc.bindValue( + WidgetProperties.selection().observe(b), + BeanProperties.value("usePredestroy").observe( + getClazz())); + } + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Focus Method"); + l.setLayoutData(new GridData(GridData.END, GridData.CENTER, + false, false)); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + dbc.bindValue(textProp.observe(t), + BeanProperties.value("focusMethodName") + .observe(getClazz())); + dbc.bindValue( + enabledProp.observe(t), + BeanProperties.value("useFocus").observe( + getClazz())); + + Button b = new Button(parent, SWT.CHECK); + dbc.bindValue( + WidgetProperties.selection().observe(b), + BeanProperties.value("useFocus").observe( + getClazz())); + } + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Persist Method"); + l.setLayoutData(new GridData(GridData.END, GridData.CENTER, + false, false)); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + dbc.bindValue(textProp.observe(t), + BeanProperties.value("persistMethodName") + .observe(getClazz())); + dbc.bindValue( + enabledProp.observe(t), + BeanProperties.value("usePersist").observe( + getClazz())); + + Button b = new Button(parent, SWT.CHECK); + dbc.bindValue( + WidgetProperties.selection().observe(b), + BeanProperties.value("usePersist").observe( + getClazz())); + } + } + + @Override + protected JavaClass createInstance() { + return new PartClass(root); + } + + }); + } + + @Override + protected String getContent() { + PartTemplate template = new PartTemplate(); + return template.generate(getDomainClass()); + } + + public static class PartClass extends JavaClass { + private PropertyChangeSupport support = new PropertyChangeSupport(this); + + private boolean usePostConstruct; + private String postConstructMethodName = "postConstruct"; + + private boolean usePredestroy; + private String preDestroyMethodName = "preDestroy"; + + private boolean useFocus = true; + private String focusMethodName = "onFocus"; + + private boolean usePersist; + private String persistMethodName = "save"; + + public PartClass(IPackageFragmentRoot fragmentRoot) { + super(fragmentRoot); + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + support.addPropertyChangeListener(listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + support.removePropertyChangeListener(listener); + } + + public boolean isUsePostConstruct() { + return usePostConstruct; + } + + public void setUsePostConstruct(boolean usePostConstruct) { + support.firePropertyChange("usePostConstruct", + this.usePostConstruct, + this.usePostConstruct = usePostConstruct); + } + + public String getPostConstructMethodName() { + return postConstructMethodName; + } + + public void setPostConstructMethodName(String postConstructMethodName) { + support.firePropertyChange("postConstructMethodName", + this.postConstructMethodName, + this.postConstructMethodName = postConstructMethodName); + } + + public boolean isUsePredestroy() { + return usePredestroy; + } + + public void setUsePredestroy(boolean usePredestroy) { + support.firePropertyChange("usePredestroy", this.usePredestroy, + this.usePredestroy = usePredestroy); + } + + public String getPreDestroyMethodName() { + return preDestroyMethodName; + } + + public void setPreDestroyMethodName(String preDestroyMethodName) { + support.firePropertyChange("preDestroyMethodName", + this.preDestroyMethodName, + this.preDestroyMethodName = preDestroyMethodName); + } + + public boolean isUseFocus() { + return useFocus; + } + + public void setUseFocus(boolean useFocus) { + support.firePropertyChange("useFocus", this.useFocus, + this.useFocus = useFocus); + } + + public String getFocusMethodName() { + return focusMethodName; + } + + public void setFocusMethodName(String focusMethodName) { + support.firePropertyChange("focusMethodName", this.focusMethodName, + this.focusMethodName = focusMethodName); + } + + public boolean isUsePersist() { + return usePersist; + } + + public void setUsePersist(boolean usePersist) { + support.firePropertyChange("usePersist", this.usePersist, + this.usePersist = usePersist); + } + + public String getPersistMethodName() { + return persistMethodName; + } + + public void setPersistMethodName(String persistMethodName) { + support.firePropertyChange("persistMethodName", + this.persistMethodName, + this.persistMethodName = persistMethodName); + } + } +} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/HandlerTemplate.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/HandlerTemplate.java new file mode 100644 index 0000000000..ddf80d9149 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/HandlerTemplate.java @@ -0,0 +1,50 @@ +package org.eclipse.e4.internal.tools.wizards.classes.templates; + +import org.eclipse.e4.internal.tools.wizards.classes.NewHandlerClassWizard.HandlerClass; + +public class HandlerTemplate +{ + protected static String nl; + public static synchronized HandlerTemplate create(String lineSeparator) + { + nl = lineSeparator; + HandlerTemplate result = new HandlerTemplate(); + nl = null; + return result; + } + + public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; + protected final String TEXT_1 = " " + NL + "package "; + protected final String TEXT_2 = ";" + NL + "" + NL + "import org.eclipse.e4.core.di.annotations.Execute;"; + protected final String TEXT_3 = NL + "import org.eclipse.e4.core.di.annotations.CanExecute;"; + protected final String TEXT_4 = NL + NL + "public class "; + protected final String TEXT_5 = " {" + NL + "\t@Execute" + NL + "\tpublic void "; + protected final String TEXT_6 = "() {" + NL + "\t\t//TODO Your code goes here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_7 = NL + "\t" + NL + "\t@CanExecute" + NL + "\tpublic boolean "; + protected final String TEXT_8 = "() {" + NL + "\t\t//TODO Your code goes here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_9 = "\t" + NL + "}"; + + public String generate(Object argument) + { + final StringBuffer stringBuffer = new StringBuffer(); + HandlerClass domainClass = (HandlerClass)argument; + stringBuffer.append(TEXT_1); + stringBuffer.append( domainClass.getPackageFragment().getElementName() ); + stringBuffer.append(TEXT_2); + if( domainClass.isUseCanExecute() ) { + stringBuffer.append(TEXT_3); + } + stringBuffer.append(TEXT_4); + stringBuffer.append( domainClass.getName() ); + stringBuffer.append(TEXT_5); + stringBuffer.append( domainClass.getExecuteMethodName() ); + stringBuffer.append(TEXT_6); + if( domainClass.isUseCanExecute() ) { + stringBuffer.append(TEXT_7); + stringBuffer.append( domainClass.getCanExecuteMethodName() ); + stringBuffer.append(TEXT_8); + } + stringBuffer.append(TEXT_9); + return stringBuffer.toString(); + } +} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/PartTemplate.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/PartTemplate.java new file mode 100644 index 0000000000..7180c49822 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/PartTemplate.java @@ -0,0 +1,89 @@ +package org.eclipse.e4.internal.tools.wizards.classes.templates; + +import org.eclipse.e4.internal.tools.wizards.classes.NewPartClassWizard.PartClass; + +public class PartTemplate +{ + protected static String nl; + public static synchronized PartTemplate create(String lineSeparator) + { + nl = lineSeparator; + PartTemplate result = new PartTemplate(); + nl = null; + return result; + } + + public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; + protected final String TEXT_1 = " " + NL + "package "; + protected final String TEXT_2 = ";" + NL + "" + NL + "import javax.inject.Inject;"; + protected final String TEXT_3 = NL + "import javax.annotation.PostConstruct;"; + protected final String TEXT_4 = NL + "import javax.annotation.PreDestroy;"; + protected final String TEXT_5 = NL + "import org.eclipse.e4.ui.di.Focus;"; + protected final String TEXT_6 = NL + "import org.eclipse.e4.ui.di.Persist;"; + protected final String TEXT_7 = NL + NL + "public class "; + protected final String TEXT_8 = " {" + NL + "\t@Inject" + NL + "\tpublic "; + protected final String TEXT_9 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_10 = NL + "\t@PostConstruct" + NL + "\tpublic void "; + protected final String TEXT_11 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_12 = NL + "\t"; + protected final String TEXT_13 = NL + "\t@PreDestroy" + NL + "\tpublic void "; + protected final String TEXT_14 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_15 = NL + "\t"; + protected final String TEXT_16 = NL + "\t@Focus" + NL + "\tpublic void "; + protected final String TEXT_17 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_18 = NL + "\t"; + protected final String TEXT_19 = NL + "\t@Persist" + NL + "\tpublic void "; + protected final String TEXT_20 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_21 = NL + "}"; + + public String generate(Object argument) + { + final StringBuffer stringBuffer = new StringBuffer(); + PartClass domainClass = (PartClass)argument; + stringBuffer.append(TEXT_1); + stringBuffer.append( domainClass.getPackageFragment().getElementName() ); + stringBuffer.append(TEXT_2); + if( domainClass.isUsePostConstruct() ) { + stringBuffer.append(TEXT_3); + } + if( domainClass.isUsePredestroy() ) { + stringBuffer.append(TEXT_4); + } + if( domainClass.isUseFocus() ) { + stringBuffer.append(TEXT_5); + } + if( domainClass.isUsePersist() ) { + stringBuffer.append(TEXT_6); + } + stringBuffer.append(TEXT_7); + stringBuffer.append( domainClass.getName() ); + stringBuffer.append(TEXT_8); + stringBuffer.append( domainClass.getName() ); + stringBuffer.append(TEXT_9); + if( domainClass.isUsePostConstruct() ) { + stringBuffer.append(TEXT_10); + stringBuffer.append( domainClass.getPostConstructMethodName() ); + stringBuffer.append(TEXT_11); + } + stringBuffer.append(TEXT_12); + if( domainClass.isUsePredestroy() ) { + stringBuffer.append(TEXT_13); + stringBuffer.append( domainClass.getPreDestroyMethodName() ); + stringBuffer.append(TEXT_14); + } + stringBuffer.append(TEXT_15); + if( domainClass.isUseFocus() ) { + stringBuffer.append(TEXT_16); + stringBuffer.append( domainClass.getFocusMethodName() ); + stringBuffer.append(TEXT_17); + } + stringBuffer.append(TEXT_18); + if( domainClass.isUsePersist() ) { + stringBuffer.append(TEXT_19); + stringBuffer.append( domainClass.getPersistMethodName() ); + stringBuffer.append(TEXT_20); + } + stringBuffer.append(TEXT_21); + return stringBuffer.toString(); + } +} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java new file mode 100644 index 0000000000..0ec8559dd2 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java @@ -0,0 +1,187 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.internal.tools.wizards.model; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWizard; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.actions.WorkspaceModifyOperation; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.ISetSelectionTarget; + +public abstract class BaseApplicationModelWizard extends Wizard implements INewWizard { + private NewModelFilePage page; + private ISelection selection; + + protected IWorkbench workbench; + + /** + * Constructor for NewApplicationModelWizard. + */ + public BaseApplicationModelWizard() { + super(); + setNeedsProgressMonitor(true); + } + + /** + * Adding the page to the wizard. + */ + + public void addPages() { + page = new NewModelFilePage(selection,getDefaultFileName()); + addPage(page); + } + + public abstract String getDefaultFileName(); + + @Override + public boolean performFinish() { + try { + // Remember the file. + // + final IFile modelFile = getModelFile(); + + // Do the work within an operation. + // + WorkspaceModifyOperation operation = + new WorkspaceModifyOperation() { + @Override + protected void execute(IProgressMonitor progressMonitor) { + try { + // Create a resource set + // + ResourceSet resourceSet = new ResourceSetImpl(); + + // Get the URI of the model file. + // + URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); + + // Create a resource for this file. + // + Resource resource = resourceSet.createResource(fileURI); + + // Add the initial model object to the contents. + // + EObject rootObject = createInitialModel(); + if (rootObject != null) { + resource.getContents().add(rootObject); + } + + // Save the contents of the resource to the file system. + // + Map options = new HashMap(); + resource.save(options); + } + catch (Exception exception) { + throw new RuntimeException(exception); + } + finally { + progressMonitor.done(); + } + } + }; + + getContainer().run(false, false, operation); + + // Select the new file resource in the current view. + // + IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); + IWorkbenchPage page = workbenchWindow.getActivePage(); + final IWorkbenchPart activePart = page.getActivePart(); + if (activePart instanceof ISetSelectionTarget) { + final ISelection targetSelection = new StructuredSelection(modelFile); + getShell().getDisplay().asyncExec + (new Runnable() { + public void run() { + ((ISetSelectionTarget)activePart).selectReveal(targetSelection); + } + }); + } + + // Open an editor on the new file. + // + try { + page.openEditor + (new FileEditorInput(modelFile), + workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); + } + catch (PartInitException exception) { + MessageDialog.openError(workbenchWindow.getShell(), "Could not init editor", exception.getMessage()); //$NON-NLS-1$ + return false; + } + + return true; + } + catch (Exception exception) { + MessageDialog.openError(getShell(), "Error", exception.getMessage()); + return false; + } + } + + protected abstract EObject createInitialModel(); + + private IFile getModelFile() throws CoreException { + String containerName = page.getContainerName(); + String fileName = page.getFileName(); + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + IResource resource = root.findMember(new Path(containerName)); + if (!resource.exists() || !(resource instanceof IContainer)) { + throwCoreException("Container \"" + containerName + + "\" does not exist."); + } + IContainer container = (IContainer) resource; + return container.getFile(new Path(fileName)); + } + + private void throwCoreException(String message) throws CoreException { + IStatus status = new Status(IStatus.ERROR, + "org.eclipse.e4.tools.emf.editor3x", IStatus.OK, message, null); + throw new CoreException(status); + } + + /** + * We will accept the selection in the workbench to see if we can initialize + * from it. + * + * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) + */ + public void init(IWorkbench workbench, IStructuredSelection selection) { + this.workbench = workbench; + this.selection = selection; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java new file mode 100644 index 0000000000..c68662560b --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.internal.tools.wizards.model; + +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.emf.ecore.EObject; + + +public class NewApplicationModelWizard extends BaseApplicationModelWizard { + + @Override + public String getDefaultFileName() { + return "Application.e4xmi"; + } + + protected EObject createInitialModel() { + return (EObject) MApplicationFactory.INSTANCE.createApplication(); + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewContributionModelWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewContributionModelWizard.java new file mode 100644 index 0000000000..04d252f610 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewContributionModelWizard.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.internal.tools.wizards.model; + +import org.eclipse.e4.ui.model.fragment.MFragmentFactory; +import org.eclipse.emf.ecore.EObject; + + +public class NewContributionModelWizard extends BaseApplicationModelWizard { + + @Override + public String getDefaultFileName() { + return "fragment.e4xmi"; + } + + protected EObject createInitialModel() { + return (EObject) MFragmentFactory.INSTANCE.createModelFragments(); + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java new file mode 100644 index 0000000000..b0e8fc0cdf --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java @@ -0,0 +1,199 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.internal.tools.wizards.model; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.dialogs.IDialogPage; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.dialogs.ContainerSelectionDialog; + +/** + * The "New" wizard page allows setting the container for the new file as well + * as the file name. The page will only accept file name without the extension + * OR with the extension that matches the expected one (e4xmi). + */ + +public class NewModelFilePage extends WizardPage { + private Text containerText; + + private Text fileText; + + private ISelection selection; + + private String defaultFilename; + + /** + * Constructor for SampleNewWizardPage. + * + * @param pageName + */ + public NewModelFilePage(ISelection selection, String defaultFilename) { + super("wizardPage"); + setTitle("Multi-page Editor File"); + setDescription("This wizard creates a new file with *.e4xmi extension that can be opened by a multi-page editor."); + this.selection = selection; + this.defaultFilename = defaultFilename; + } + + /** + * @see IDialogPage#createControl(Composite) + */ + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(); + container.setLayout(layout); + layout.numColumns = 3; + layout.verticalSpacing = 9; + Label label = new Label(container, SWT.NULL); + label.setText("&Container:"); + + containerText = new Text(container, SWT.BORDER | SWT.SINGLE); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + containerText.setLayoutData(gd); + containerText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + dialogChanged(); + } + }); + + Button button = new Button(container, SWT.PUSH); + button.setText("Browse..."); + button.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + handleBrowse(); + } + }); + label = new Label(container, SWT.NULL); + label.setText("&File name:"); + + fileText = new Text(container, SWT.BORDER | SWT.SINGLE); + gd = new GridData(GridData.FILL_HORIZONTAL); + fileText.setLayoutData(gd); + fileText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + dialogChanged(); + } + }); + initialize(); + dialogChanged(); + setControl(container); + } + + /** + * Tests if the current workbench selection is a suitable container to use. + */ + + private void initialize() { + if (selection != null && selection.isEmpty() == false + && selection instanceof IStructuredSelection) { + IStructuredSelection ssel = (IStructuredSelection) selection; + if (ssel.size() > 1) + return; + Object obj = ssel.getFirstElement(); + if (obj instanceof IResource) { + IContainer container; + if (obj instanceof IContainer) + container = (IContainer) obj; + else + container = ((IResource) obj).getParent(); + containerText.setText(container.getFullPath().toString()); + } + } + fileText.setText(defaultFilename); + } + + /** + * Uses the standard container selection dialog to choose the new value for + * the container field. + */ + + private void handleBrowse() { + ContainerSelectionDialog dialog = new ContainerSelectionDialog( + getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, + "Select new file container"); + if (dialog.open() == ContainerSelectionDialog.OK) { + Object[] result = dialog.getResult(); + if (result.length == 1) { + containerText.setText(((Path) result[0]).toString()); + } + } + } + + /** + * Ensures that both text fields are set. + */ + + private void dialogChanged() { + IResource container = ResourcesPlugin.getWorkspace().getRoot() + .findMember(new Path(getContainerName())); + String fileName = getFileName(); + + if (getContainerName().length() == 0) { + updateStatus("File container must be specified"); + return; + } + if (container == null + || (container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) { + updateStatus("File container must exist"); + return; + } + if (!container.isAccessible()) { + updateStatus("Project must be writable"); + return; + } + if (fileName.length() == 0) { + updateStatus("File name must be specified"); + return; + } + if (fileName.replace('\\', '/').indexOf('/', 1) > 0) { + updateStatus("File name must be valid"); + return; + } + int dotLoc = fileName.lastIndexOf('.'); + if (dotLoc != -1) { + String ext = fileName.substring(dotLoc + 1); + if (ext.equalsIgnoreCase("e4xmi") == false) { + updateStatus("File extension must be \"e4xmi\""); + return; + } + } + updateStatus(null); + } + + private void updateStatus(String message) { + setErrorMessage(message); + setPageComplete(message == null); + } + + public String getContainerName() { + return containerText.getText(); + } + + public String getFileName() { + return fileText.getText(); + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java new file mode 100644 index 0000000000..85a29bf619 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java @@ -0,0 +1,606 @@ +/******************************************************************************* + * Copyright (c) 2006, 2010 Soyatec(http://www.soyatec.com) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Soyatec - initial API and implementation + *******************************************************************************/ +package org.eclipse.e4.internal.tools.wizards.project; + +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.net.URL; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.eclipse.e4.ui.model.application.MApplication; +import org.eclipse.e4.ui.model.application.MApplicationFactory; +import org.eclipse.e4.ui.model.application.commands.MBindingContext; +import org.eclipse.e4.ui.model.application.commands.MBindingTable; +import org.eclipse.e4.ui.model.application.commands.MCommand; +import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.commands.MKeyBinding; +import org.eclipse.e4.ui.model.application.ui.advanced.MAdvancedFactory; +import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; +import org.eclipse.e4.ui.model.application.ui.advanced.MPerspectiveStack; +import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; +import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer; +import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; +import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar; +import org.eclipse.e4.ui.model.application.ui.basic.MTrimmedWindow; +import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; +import org.eclipse.e4.ui.model.application.ui.menu.MHandledToolItem; +import org.eclipse.e4.ui.model.application.ui.menu.MMenu; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; +import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.ecore.xmi.XMLResource; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.IPackageFragment; +import org.eclipse.jdt.core.IPackageFragmentRoot; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.pde.core.plugin.IPluginBase; +import org.eclipse.pde.core.plugin.IPluginElement; +import org.eclipse.pde.core.plugin.IPluginExtension; +import org.eclipse.pde.core.plugin.IPluginImport; +import org.eclipse.pde.internal.core.ICoreConstants; +import org.eclipse.pde.internal.core.bundle.WorkspaceBundlePluginModel; +import org.eclipse.pde.internal.core.plugin.WorkspacePluginModelBase; +import org.eclipse.pde.internal.ui.PDEPlugin; +import org.eclipse.pde.internal.ui.PDEUIMessages; +import org.eclipse.pde.internal.ui.wizards.IProjectProvider; +import org.eclipse.pde.internal.ui.wizards.plugin.NewPluginProjectWizard; +import org.eclipse.pde.internal.ui.wizards.plugin.NewProjectCreationOperation; +import org.eclipse.pde.internal.ui.wizards.plugin.PluginFieldData; +import org.eclipse.ui.IWorkingSet; +import org.osgi.framework.Bundle; +import org.osgi.framework.Version; + +/** + * @author jin.liu (jin.liu@soyatec.com) + */ +public class E4NewProjectWizard extends NewPluginProjectWizard { + + private PluginFieldData fPluginData; + private NewApplicationWizardPage fApplicationPage; + private IProjectProvider fProjectProvider; + private PluginContentPage fContentPage; + + public E4NewProjectWizard() { + fPluginData = new PluginFieldData(); + } + + public void addPages() { + fMainPage = new E4NewProjectWizardPage( + "main", fPluginData, false, getSelection()); //$NON-NLS-1$ + fMainPage.setTitle(PDEUIMessages.NewProjectWizard_MainPage_title); + fMainPage.setDescription(PDEUIMessages.NewProjectWizard_MainPage_desc); + String pname = getDefaultValue(DEF_PROJECT_NAME); + if (pname != null) + fMainPage.setInitialProjectName(pname); + addPage(fMainPage); + + fProjectProvider = new IProjectProvider() { + public String getProjectName() { + return fMainPage.getProjectName(); + } + + public IProject getProject() { + return fMainPage.getProjectHandle(); + } + + public IPath getLocationPath() { + return fMainPage.getLocationPath(); + } + }; + + fContentPage = new PluginContentPage( + "page2", fProjectProvider, fMainPage, fPluginData); //$NON-NLS-1$ + + fApplicationPage = new NewApplicationWizardPage(fProjectProvider); + + addPage(fContentPage); + addPage(fApplicationPage); + } + + @SuppressWarnings("restriction") + public boolean performFinish() { + try { + fMainPage.updateData(); + fContentPage.updateData(); + IDialogSettings settings = getDialogSettings(); + if (settings != null) { + fMainPage.saveSettings(settings); + fContentPage.saveSettings(settings); + } + getContainer().run( + false, + true, + new NewProjectCreationOperation(fPluginData, + fProjectProvider, null) { + private WorkspacePluginModelBase model; + + @Override + protected void adjustManifests( + IProgressMonitor monitor, IProject project, + IPluginBase bundle) throws CoreException { + super.adjustManifests(monitor, project, bundle); + IPluginBase pluginBase = model.getPluginBase(); + String[] dependencyId = new String[] { + "javax.inject", + "org.eclipse.core.resources", + "org.eclipse.core.runtime", + "org.eclipse.swt", + "org.eclipse.core.databinding", + "org.eclipse.core.databinding.beans", + "org.eclipse.jface", + "org.eclipse.jface.databinding", + "org.eclipse.e4.ui.services", + "org.eclipse.e4.ui.workbench", + "org.eclipse.e4.core.services", + "org.eclipse.e4.core.di", + "org.eclipse.e4.core.contexts", + "org.eclipse.e4.ui.workbench.swt", + "org.eclipse.core.databinding.property", + "org.eclipse.e4.ui.css.core", + "org.w3c.css.sac", + "org.eclipse.e4.core.commands", + "org.eclipse.e4.ui.bindings" }; + for (String id : dependencyId) { + Bundle dependency = Platform.getBundle(id); + + IPluginImport iimport = model + .getPluginFactory().createImport(); + iimport.setId(id); + Version version = dependency.getVersion(); + String versionString = version.getMajor() + "." + + version.getMinor() + "." + + version.getMicro(); + iimport.setVersion(versionString); + pluginBase.add(iimport); + } + } + + @Override + protected void setPluginLibraries( + WorkspacePluginModelBase model) + throws CoreException { + this.model = model; + super.setPluginLibraries(model); + } + }); + + IWorkingSet[] workingSets = fMainPage.getSelectedWorkingSets(); + if (workingSets.length > 0) + getWorkbench().getWorkingSetManager().addToWorkingSets( + fProjectProvider.getProject(), workingSets); + + this.createProductsExtension(fProjectProvider.getProject()); + + this.createApplicationResources(fProjectProvider.getProject(), + new NullProgressMonitor()); + + return true; + } catch (InvocationTargetException e) { + PDEPlugin.logException(e); + } catch (InterruptedException e) { + } + return false; + } + + /** + * create products extension detail + * + * @param project + */ + @SuppressWarnings("restriction") + public void createProductsExtension(IProject project) { + Map map = fApplicationPage.getData(); + if (map == null + || map.get(NewApplicationWizardPage.PRODUCT_NAME) == null) + return; + + WorkspacePluginModelBase fmodel = new WorkspaceBundlePluginModel( + project.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR), + project.getFile(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR)); + IPluginExtension extension = fmodel.getFactory().createExtension(); + try { + String productName = map.get(NewApplicationWizardPage.PRODUCT_NAME); + String applicationName = map + .get(NewApplicationWizardPage.APPLICATION); + + String xmiPath = map + .get(NewApplicationWizardPage.APPLICATION_XMI_PROPERTY); + if (xmiPath != null) { + xmiPath = productName + "/" + xmiPath; + map.put(NewApplicationWizardPage.APPLICATION_XMI_PROPERTY, + xmiPath); + } + String cssValue = map + .get(NewApplicationWizardPage.APPLICATION_CSS_PROPERTY); + if (cssValue != null) { + cssValue = "platform:/plugin/" + productName + "/" + cssValue; + map.put(NewApplicationWizardPage.APPLICATION_CSS_PROPERTY, + cssValue); + } + + extension.setPoint("org.eclipse.core.runtime.products"); + extension.setId("product"); + IPluginElement productElement = fmodel.getFactory().createElement( + extension); + + productElement.setName("product"); + if (applicationName != null) { + productElement.setAttribute("application", applicationName); + } else { + productElement.setAttribute("application", + NewApplicationWizardPage.E4_APPLICATION); + } + productElement.setAttribute("name", productName); + + Set> set = map.entrySet(); + if (set != null) { + Iterator> it = set.iterator(); + if (it != null) { + while (it.hasNext()) { + Entry entry = it.next(); + String value = entry.getValue(); + if (value == null || value.trim().length() == 0) { + continue; + } + + if (entry.getKey().equals( + NewApplicationWizardPage.PRODUCT_NAME) + || entry.getKey().equals( + NewApplicationWizardPage.APPLICATION)) { + continue; + } + IPluginElement element = fmodel.getFactory() + .createElement(productElement); + element.setName("property"); + element.setAttribute("name", entry.getKey()); + element.setAttribute("value", value); + productElement.add(element); + } + } + } + extension.add(productElement); + fmodel.getPluginBase().add(extension); + fmodel.save(); + + } catch (CoreException e) { + PDEPlugin.logException(e); + } + } + + /** + * create products extension detail + * + * @param project + */ + @SuppressWarnings("restriction") + public void createApplicationResources(IProject project, + IProgressMonitor monitor) { + Map map = fApplicationPage.getData(); + if (map == null + || map.get(NewApplicationWizardPage.PRODUCT_NAME) == null) + return; + + String projectName = map.get(NewApplicationWizardPage.PRODUCT_NAME); + String xmiPath = map + .get(NewApplicationWizardPage.APPLICATION_XMI_PROPERTY); + + IJavaProject javaProject = JavaCore.create(project); + IPackageFragment fragment = null; + try { + for (IPackageFragment element : javaProject.getPackageFragments()) { + if (element.getKind() == IPackageFragmentRoot.K_SOURCE) { + fragment = element; + } + } + } catch (JavaModelException e1) { + e1.printStackTrace(); + } + + if (xmiPath != null && xmiPath.trim().length() > 0) { + // Create a resource set + // + ResourceSet resourceSet = new ResourceSetImpl(); + + // Get the URI of the model file. + // + URI fileURI = URI.createPlatformResourceURI(project.getName() + "/" + + xmiPath, true); + + // Create a resource for this file. + // + Resource resource = resourceSet.createResource(fileURI); + + MApplication application = MApplicationFactory.INSTANCE + .createApplication(); + + application.setElementId("org.eclipse.e4.ide.application"); + + MBindingContext rootContext = MCommandsFactory.INSTANCE.createBindingContext(); + rootContext.setElementId("org.eclipse.ui.contexts.dialogAndWindow"); + rootContext.setName("In Dialog and Windows"); + + MBindingContext childContext = MCommandsFactory.INSTANCE.createBindingContext(); + childContext.setElementId("org.eclipse.ui.contexts.window"); + childContext.setName("In Windows"); + rootContext.getChildren().add(childContext); + + childContext = MCommandsFactory.INSTANCE.createBindingContext(); + childContext.setElementId("org.eclipse.ui.contexts.dialog"); + childContext.setName("In Dialogs"); + rootContext.getChildren().add(childContext); + + application.setRootContext(rootContext); + application.getBindingContexts().add("org.eclipse.ui.contexts.dialogAndWindow"); + + resource.getContents().add((EObject) application); + + // Create Quit command + MCommand quitCommand = createCommand("quitCommand", "QuitHandler", + "Ctrl+Q", projectName, fragment, application); + + MCommand openCommand = createCommand("openCommand", "OpenHandler", + "Ctrl+O", projectName, fragment, application); + + MCommand saveCommand = createCommand("saveCommand", "SaveHandler", + "Ctrl+S", projectName, fragment, application); + + MCommand aboutCommand = createCommand("aboutCommand", + "AboutHandler", "Ctrl+A", projectName, fragment, + application); + + MTrimmedWindow mainWindow = MBasicFactory.INSTANCE.createTrimmedWindow(); + application.getChildren().add(mainWindow); + { + mainWindow.setLabel(projectName); + mainWindow.setWidth(500); + mainWindow.setHeight(400); + + // Menu + { + MMenu menu = MMenuFactory.INSTANCE.createMenu(); + mainWindow.setMainMenu(menu); + menu.setElementId("menu:org.eclipse.ui.main.menu"); + + MMenu fileMenuItem = MMenuFactory.INSTANCE + .createMenu(); + menu.getChildren().add(fileMenuItem); + fileMenuItem.setLabel("File"); + { + MHandledMenuItem menuItemOpen = MMenuFactory.INSTANCE + .createHandledMenuItem(); + fileMenuItem.getChildren().add(menuItemOpen); + menuItemOpen.setLabel("Open"); + menuItemOpen.setIconURI("platform:/plugin/" + + project.getName() + "/icons/sample.gif"); + menuItemOpen.setCommand(openCommand); + + MHandledMenuItem menuItemSave = MMenuFactory.INSTANCE + .createHandledMenuItem(); + fileMenuItem.getChildren().add(menuItemSave); + menuItemSave.setLabel("Save"); + menuItemSave.setIconURI("platform:/plugin/" + + project.getName() + "/icons/save_edit.gif"); + menuItemSave.setCommand(saveCommand); + + MHandledMenuItem menuItemQuit = MMenuFactory.INSTANCE + .createHandledMenuItem(); + fileMenuItem.getChildren().add(menuItemQuit); + menuItemQuit.setLabel("Quit"); + menuItemQuit.setCommand(quitCommand); + } + MMenu helpMenuItem = MMenuFactory.INSTANCE + .createMenu(); + menu.getChildren().add(helpMenuItem); + helpMenuItem.setLabel("Help"); + { + MHandledMenuItem menuItemAbout = MMenuFactory.INSTANCE + .createHandledMenuItem(); + helpMenuItem.getChildren().add(menuItemAbout); + menuItemAbout.setLabel("About"); + menuItemAbout.setCommand(aboutCommand); + } + } + + // PerspectiveStack + { + MPerspectiveStack perspectiveStack = MAdvancedFactory.INSTANCE + .createPerspectiveStack(); + mainWindow.getChildren().add(perspectiveStack); + + MPerspective perspective = MAdvancedFactory.INSTANCE + .createPerspective(); + perspectiveStack.getChildren().add(perspective); + { + // Part Container + MPartSashContainer partSashContainer = MBasicFactory.INSTANCE + .createPartSashContainer(); + perspective.getChildren().add(partSashContainer); + + MPartStack partStack = MBasicFactory.INSTANCE + .createPartStack(); + partSashContainer.getChildren().add(partStack); +// +// MPart part = MApplicationFactory.eINSTANCE.createPart(); +// partStack.getChildren().add(part); +// part.setLabel("Main"); + } + + // WindowTrim + { + MTrimBar trimBar = MBasicFactory.INSTANCE.createTrimBar(); + mainWindow.getTrimBars().add(trimBar); + + MToolBar toolBar = MMenuFactory.INSTANCE + .createToolBar(); + toolBar.setElementId("toolbar:org.eclipse.ui.main.toolbar"); + trimBar.getChildren().add(toolBar); + + MHandledToolItem toolItemOpen = MMenuFactory.INSTANCE + .createHandledToolItem(); + toolBar.getChildren().add(toolItemOpen); + toolItemOpen.setIconURI("platform:/plugin/" + + project.getName() + "/icons/sample.gif"); + toolItemOpen.setCommand(openCommand); + + MHandledToolItem toolItemSave = MMenuFactory.INSTANCE + .createHandledToolItem(); + toolBar.getChildren().add(toolItemSave); + toolItemSave.setIconURI("platform:/plugin/" + + project.getName() + "/icons/save_edit.gif"); + toolItemSave.setCommand(saveCommand); + } + } + } + Map options = new HashMap(); + options.put(XMLResource.OPTION_ENCODING, "UTF-8"); + try { + resource.save(options); + } catch (IOException e) { + PDEPlugin.logException(e); + } + } + + String cssPath = map + .get(NewApplicationWizardPage.APPLICATION_CSS_PROPERTY); + if (cssPath != null && cssPath.trim().length() > 0) { + IFile file = project.getFile(cssPath); + + try { + prepareFolder(file.getParent(), monitor); + + URL corePath = ResourceLocator + .getProjectTemplateFiles("css/default.css"); + file.create(corePath.openStream(), true, monitor); + } catch (Exception e) { + PDEPlugin.logException(e); + } + } + + // IFolder folder = project.getFolder("icons"); + // try { + // folder.create(true, true, monitor); + // Bundle bundle = Platform + // .getBundle("org.eclipse.e4.tools.ui.designer"); + // + // for (String fileName : new String[] { "sample.gif", "save_edit.gif" + // }) { + // URL sampleUrl = bundle.getEntry("resources/icons/" + fileName); + // sampleUrl = FileLocator.resolve(sampleUrl); + // InputStream inputStream = sampleUrl.openStream(); + // IFile file = folder.getFile(fileName); + // file.create(inputStream, true, monitor); + // } + // } catch (Exception e) { + // PDEPlugin.logException(e); + // } + + String template_id = "common"; + Set binaryExtentions = new HashSet(); + binaryExtentions.add(".gif"); + binaryExtentions.add(".png"); + + Map keys = new HashMap(); + keys.put("projectName", projectName); + keys.put("packageName", fragment.getElementName() + ".handlers"); + + try { + URL corePath = ResourceLocator.getProjectTemplateFiles(template_id); + IRunnableWithProgress op = new TemplateOperation(corePath, project, + keys, binaryExtentions); + getContainer().run(false, true, op); + } catch (Exception e) { + PDEPlugin.logException(e); + } + + try { + URL corePath = ResourceLocator.getProjectTemplateFiles("src"); + IRunnableWithProgress op = new TemplateOperation(corePath, + (IContainer) fragment.getResource(), keys, binaryExtentions); + getContainer().run(false, true, op); + } catch (Exception e) { + PDEPlugin.logException(e); + } + } + + private MCommand createCommand(String name, String className, + String keyBinding, String projectName, IPackageFragment fragment, + MApplication application) { + MCommand command = MCommandsFactory.INSTANCE.createCommand(); + command.setCommandName(name); + command.setElementId(projectName + "." + name); + application.getCommands().add(command); + { + // Create Quit handler for command + MHandler quitHandler =MCommandsFactory.INSTANCE + .createHandler(); + quitHandler.setCommand(command); + quitHandler.setContributionURI("platform:/plugin/" + projectName + "/" + + fragment.getElementName() + ".handlers." + className); + application.getHandlers().add(quitHandler); + + MKeyBinding binding = MCommandsFactory.INSTANCE + .createKeyBinding(); + binding.setKeySequence(keyBinding); + binding.setCommand(command); + List tables = application.getBindingTables(); + if (tables.size()==0) { + MBindingTable table = MCommandsFactory.INSTANCE.createBindingTable(); + table.setBindingContextId("org.eclipse.ui.contexts.dialogAndWindow"); + tables.add(table); + } + tables.get(0).getBindings().add(binding); + } + return command; + } + + private void prepareFolder(IContainer container, IProgressMonitor monitor) + throws CoreException { + IContainer parent = container.getParent(); + if (parent instanceof IFolder) { + prepareFolder((IFolder) parent, monitor); + } + if (!container.exists() && container instanceof IFolder) { + IFolder folder = (IFolder) container; + folder.create(true, true, monitor); + } + } + + public String getPluginId() { + return fPluginData.getId(); + } + + public String getPluginVersion() { + return fPluginData.getVersion(); + } +} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizardPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizardPage.java new file mode 100644 index 0000000000..72ae3d446e --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizardPage.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2006, 2010 Soyatec(http://www.soyatec.com) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Soyatec - initial API and implementation + *******************************************************************************/ +package org.eclipse.e4.internal.tools.wizards.project; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.pde.internal.ui.wizards.plugin.AbstractFieldData; +import org.eclipse.swt.widgets.Composite; + +public class E4NewProjectWizardPage extends org.eclipse.pde.internal.ui.wizards.plugin.NewProjectCreationPage { + + public E4NewProjectWizardPage(String pageName, AbstractFieldData data, boolean fragment, IStructuredSelection selection) { + super(pageName, data, fragment, selection); + } + + @Override + public void createControl(Composite parent) { + super.createControl(parent); + fOSGIButton.setSelection(true); + fEclipseButton.setEnabled(false); + fEclipseCombo.setEnabled(false); + } +} + diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java new file mode 100644 index 0000000000..14bc00b97e --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java @@ -0,0 +1,417 @@ +/******************************************************************************* + * Copyright (c) 2006, 2010 Soyatec (http://www.soyatec.com) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Soyatec - initial API and implementation + *******************************************************************************/ +package org.eclipse.e4.internal.tools.wizards.project; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.pde.internal.ui.wizards.IProjectProvider; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.events.VerifyEvent; +import org.eclipse.swt.events.VerifyListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.ColorDialog; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.branding.IProductConstants; + +/** + * @author jin.liu (jin.liu@soyatec.com) + */ +public class NewApplicationWizardPage extends WizardPage { + public static final String E4_APPLICATION = "org.eclipse.e4.ui.workbench.swt.E4Application"; + public static final String APPLICATION_XMI_PROPERTY = "applicationXMI"; + public static final String APPLICATION_CSS_PROPERTY = "applicationCSS"; + public static final String PRODUCT_NAME = "productName"; + public static final String APPLICATION = "application"; + + private final Map data; + + private IProject project; + private IProjectProvider projectProvider; + private Text proNameText; + private Text proApplicationText; + private Group propertyGroup; + + private PropertyData[] PROPERTIES; + + protected NewApplicationWizardPage(IProjectProvider projectProvider) { + super("New e4 Application Wizard Page"); + this.projectProvider = projectProvider; + data = new HashMap(); + setTitle("e4 Application"); + setMessage("Configure application with special values."); + } + + public IProject getProject() { + if (project == null && projectProvider != null) { + project = projectProvider.getProject(); + } + return project; + } + + public void setProject(IProject project) { + this.project = project; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets + * .Composite) + */ + public void createControl(Composite parent) { + Composite control = new Composite(parent, SWT.NONE); + control.setLayout(new GridLayout()); + + Group productGroup = createProductGroup(control); + productGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + propertyGroup = createPropertyGroup(control); + propertyGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + setControl(control); + } + + static class PropertyData { + private String name; + private String label; + + private String value; + private Class type; + private boolean editable; + + public PropertyData(String name, String label, String value, Class type, + boolean editable) { + this.name = name; + this.value = value; + this.label = label; + this.type = type; + this.editable = editable; + } + + public String getName() { + return name; + } + + public String getValue() { + return value; + } + + public Class getType() { + return type; + } + + public boolean isEditable() { + return editable; + } + + public String getLabel() { + return label; + } + } + + private Group createPropertyGroup(Composite control) { + Group group = new Group(control, SWT.NONE); + group.setText("Properties"); + + group.setLayout(new GridLayout(3, false)); + + return group; + } + + private void createPropertyItem(final Composite parent, + final PropertyData property) { + Label label = new Label(parent, SWT.NONE); + label.setText(property.getLabel()); + label.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_BLUE)); + label.setToolTipText("Property \"" + property.getName() + "\""); + + final Text valueText = new Text(parent, SWT.BORDER); + valueText.setText(property.getValue()); + GridData gridData = new GridData(GridData.FILL_HORIZONTAL); + valueText.setLayoutData(gridData); + if (!property.isEditable()) { + valueText.setEditable(false); + } + valueText.addListener(SWT.Modify, new Listener() { + public void handleEvent(Event event) { + handleTextEvent(property.getName(), valueText); + } + }); + + if (property.getType() == Color.class + || property.getType() == Rectangle.class) { + Button button = new Button(parent, SWT.PUSH); + button.setText("..."); + button.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent e) { + handleLinkEvent(property, valueText, parent.getShell()); + } + + public void widgetDefaultSelected(SelectionEvent e) { + } + }); + } + else { + new Label(parent, SWT.NONE); + } + data.put(property.getName(), property.getValue()); + } + + private void handleLinkEvent(PropertyData property, Text valueText, + Shell shell) { + if (property == null || valueText == null || valueText.isDisposed()) { + return; + } + if (property.getType() == Color.class) { + ColorDialog colorDialog = new ColorDialog(shell); + RGB selectRGB = colorDialog.open(); + if (selectRGB != null) { + valueText.setText((this.hexColorConvert(Integer + .toHexString(selectRGB.blue)) + + this.hexColorConvert(Integer + .toHexString(selectRGB.green)) + this + .hexColorConvert(Integer.toHexString(selectRGB.red))) + .toUpperCase()); + } + } else if (property.getType() == Rectangle.class) { + this.createRectDialog(shell, valueText).open(); + } + } + + /** + * exchange the color pattern of hex numeric + * + * @param number + * @return + */ + public String hexColorConvert(String color) { + if (color.length() == 1) { + return "0" + color; + } + return color; + } + + /** + * create Rect Set dialog + * + * @param parent + * @param valueText + * @return + */ + public Dialog createRectDialog(final Composite parent, final Text valueText) { + return new Dialog(parent.getShell()) { + Text xPointText, yPointText, widthText, heightText; + + @Override + protected Button createButton(Composite parent, int id, + String label, boolean defaultButton) { + return super.createButton(parent, id, label, defaultButton); + } + + @Override + protected Control createDialogArea(final Composite parent) { + Composite composite = (Composite) super + .createDialogArea(parent); + composite.getShell().setText("Set Rect"); + Group group = new Group(composite, SWT.NONE); + group.setText("Rect"); + GridLayout gridLayout = new GridLayout(); + gridLayout.numColumns = 4; + group.setLayout(gridLayout); + + Label xPointLabel = new Label(group, SWT.NONE); + xPointLabel.setText("X:"); + xPointText = new Text(group, SWT.BORDER); + VerifyListener verifyListener = createVerifyListener(parent + .getShell()); + xPointText.addVerifyListener(verifyListener); + Label yPointLabel = new Label(group, SWT.NONE); + yPointLabel.setText("Y:"); + yPointText = new Text(group, SWT.BORDER); + yPointText.addVerifyListener(verifyListener); + Label widthLabel = new Label(group, SWT.NONE); + widthLabel.setText("Width:"); + widthText = new Text(group, SWT.BORDER); + widthText.addVerifyListener(verifyListener); + Label heighttLabel = new Label(group, SWT.NONE); + heighttLabel.setText("Height:"); + heightText = new Text(group, SWT.BORDER); + heightText.addVerifyListener(verifyListener); + + return composite; + } + + @Override + protected void buttonPressed(int buttonId) { + if (IDialogConstants.OK_ID == buttonId) { + String xPoint = xPointText.getText(); + String yPoint = yPointText.getText(); + String width = widthText.getText(); + String height = heightText.getText(); + if (xPoint.length() == 0 || yPoint.length() == 0 + || width.length() == 0 || height.length() == 0) { + MessageDialog.openWarning(parent.getShell(), + "Input value empty", + "Value shoud not be empty!"); + } else { + valueText.setText(xPoint + "," + yPoint + "," + width + + "," + height); + okPressed(); + } + } else if (IDialogConstants.CANCEL_ID == buttonId) { + cancelPressed(); + } + } + }; + } + + /** + * create verify Listener + * + * @param shell + * @return + */ + public VerifyListener createVerifyListener(final Shell shell) { + return new VerifyListener() { + public void verifyText(VerifyEvent e) { + char c = e.character; + if ("0123456789".indexOf(c) == -1) { + e.doit = false; + MessageDialog.openWarning(shell, "Input value error", + "Only numeric is allowed!"); + return; + } + } + }; + } + + private void handleTextEvent(String property, Text valueText) { + if (property == null || valueText == null || valueText.isDisposed()) { + return; + } + String value = valueText.getText(); + if (value.equals("")) { + value = null; + } + data.put(property, value); + } + + private Group createProductGroup(Composite control) { + Group proGroup = new Group(control, SWT.NONE); + proGroup.setText("Product"); + + proGroup.setLayout(new GridLayout(2, false)); + + Label proNameLabel = new Label(proGroup, SWT.NONE); + proNameLabel.setText("Name:*"); + + proNameText = new Text(proGroup, SWT.BORDER); + proNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + proNameText.addListener(SWT.Modify, new Listener() { + public void handleEvent(Event event) { + handleTextEvent(PRODUCT_NAME, proNameText); + } + }); + + Label proApplicationLabel = new Label(proGroup, SWT.NONE); + proApplicationLabel.setText("Application:"); + + proApplicationText = new Text(proGroup, SWT.BORDER); + proApplicationText + .setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + proApplicationText.addListener(SWT.Modify, new Listener() { + public void handleEvent(Event event) { + handleTextEvent(APPLICATION, proApplicationText); + } + }); + return proGroup; + } + + protected PropertyData[] getPropertyData() { + if (PROPERTIES == null) { + PROPERTIES = new PropertyData[] { + new PropertyData(IProductConstants.APP_NAME, "Application Name:", + projectProvider.getProjectName(), String.class, + true), + new PropertyData(APPLICATION_XMI_PROPERTY, "Application UI:", + "Application.e4xmi", String.class, true), + new PropertyData(APPLICATION_CSS_PROPERTY, "CSS Style:", + "css/default.css", String.class, true), + new PropertyData(IProductConstants.ABOUT_TEXT, "About Message:", "", + String.class, true), + new PropertyData( + IProductConstants.STARTUP_FOREGROUND_COLOR, "Startup Foreground:", "", + Color.class, false), + new PropertyData(IProductConstants.STARTUP_MESSAGE_RECT, "Startup Message Region:", + "", Rectangle.class, false), + new PropertyData(IProductConstants.STARTUP_PROGRESS_RECT, "Startup Progress Region:", + "", Rectangle.class, false), + new PropertyData( + IProductConstants.PREFERENCE_CUSTOMIZATION, "Preference Customization:", "", + String.class, true) }; // plugin_customization.ini + } + return PROPERTIES; + } + + @Override + public void setVisible(boolean visible) { + if (visible && PROPERTIES == null) { + proNameText.setText(projectProvider.getProjectName()); + + proApplicationText.setText(E4_APPLICATION); + + for (PropertyData property : getPropertyData()) { + createPropertyItem(propertyGroup, property); + } + propertyGroup.getParent().layout(); + } + super.setVisible(visible); + } + + /** + * @return the data + */ + public Map getData() { + if (PROPERTIES == null) { + for (PropertyData property : getPropertyData()) { + data.put(property.getName(), property.getValue()); + } + + data.put(PRODUCT_NAME, projectProvider.getProjectName()); + data.put(APPLICATION, E4_APPLICATION); + } + Map map = new HashMap(); + map.putAll(data); + return map; + } +} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/PluginContentPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/PluginContentPage.java new file mode 100644 index 0000000000..6fb9ae3f8b --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/PluginContentPage.java @@ -0,0 +1,363 @@ +/******************************************************************************* + * Copyright (c) 2000, 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Soyatec - port to e4 + *******************************************************************************/ +package org.eclipse.e4.internal.tools.wizards.project; + +import java.util.Locale; +import java.util.TreeSet; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jdt.core.JavaConventions; +import org.eclipse.jdt.launching.IVMInstall; +import org.eclipse.jdt.launching.JavaRuntime; +import org.eclipse.jdt.launching.environments.IExecutionEnvironment; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.pde.internal.core.util.PDEJavaHelper; +import org.eclipse.pde.internal.core.util.VMUtil; +import org.eclipse.pde.internal.ui.IHelpContextIds; +import org.eclipse.pde.internal.ui.PDEUIMessages; +import org.eclipse.pde.internal.ui.SWTFactory; +import org.eclipse.pde.internal.ui.wizards.IProjectProvider; +import org.eclipse.pde.internal.ui.wizards.plugin.AbstractFieldData; +import org.eclipse.pde.internal.ui.wizards.plugin.ContentPage; +import org.eclipse.pde.internal.ui.wizards.plugin.NewProjectCreationPage; +import org.eclipse.pde.internal.ui.wizards.plugin.PluginFieldData; +import org.eclipse.pde.internal.ui.wizards.plugin.TemplateListSelectionPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.dialogs.PreferencesUtil; + +/** + * Content wizard page for the New Plugin Project wizard (page 2) + */ +public class PluginContentPage extends ContentPage { + private Text fClassText; + protected Button fGenerateActivator; + protected Button fUIPlugin; + private Label fClassLabel; + private Label fEELabel; + private Button fExeEnvButton; + private Combo fEEChoice; + + /** + * Button to enable API analysis for the project during project creation + */ + private Button fApiAnalysisButton; + + /** + * Dialog settings constants + */ + private final static String S_GENERATE_ACTIVATOR = "generateActivator"; //$NON-NLS-1$ + private final static String S_UI_PLUGIN = "uiPlugin"; //$NON-NLS-1$ + private final static String S_RCP_PLUGIN = "rcpPlugin"; //$NON-NLS-1$ + private final static String S_API_ANALYSIS = "apiAnalysis"; //$NON-NLS-1$ + + protected final static int P_CLASS_GROUP = 2; + private final static String NO_EXECUTION_ENVIRONMENT = PDEUIMessages.PluginContentPage_noEE; + + /** + * default tText modify listener + */ + private ModifyListener classListener = new ModifyListener() { + public void modifyText(ModifyEvent e) { + if (fInitialized) + fChangedGroups |= P_CLASS_GROUP; + validatePage(); + } + }; + + /** + * Constructor + * @param pageName + * @param provider + * @param page + * @param data + */ + public PluginContentPage(String pageName, IProjectProvider provider, NewProjectCreationPage page, AbstractFieldData data) { + super(pageName, provider, page, data); + setTitle(PDEUIMessages.ContentPage_title); + setDescription(PDEUIMessages.ContentPage_desc); + } + + /* (non-Javadoc) + * @see org.eclipse.pde.internal.ui.wizards.plugin.ContentPage#createControl(org.eclipse.swt.widgets.Composite) + */ + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NONE); + container.setLayout(new GridLayout()); + + createPluginPropertiesGroup(container); + createPluginClassGroup(container); + + Dialog.applyDialogFont(container); + setControl(container); + PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.NEW_PROJECT_REQUIRED_DATA); + } + + /** + * Creates all of the plugin properties widgets + * @param container + */ + private void createPluginPropertiesGroup(Composite container) { + Group propertiesGroup = SWTFactory.createGroup(container, PDEUIMessages.ContentPage_pGroup, 3, 1, GridData.FILL_HORIZONTAL); + + Label label = new Label(propertiesGroup, SWT.NONE); + label.setText(PDEUIMessages.ContentPage_pid); + fIdText = createText(propertiesGroup, propertiesListener, 2); + + label = new Label(propertiesGroup, SWT.NONE); + label.setText(PDEUIMessages.ContentPage_pversion); + fVersionText = createText(propertiesGroup, propertiesListener, 2); + + label = new Label(propertiesGroup, SWT.NONE); + label.setText(PDEUIMessages.ContentPage_pname); + fNameText = createText(propertiesGroup, propertiesListener, 2); + + label = new Label(propertiesGroup, SWT.NONE); + label.setText(PDEUIMessages.ContentPage_pprovider); + fProviderText = createText(propertiesGroup, propertiesListener, 2); + + createExecutionEnvironmentControls(propertiesGroup); + } + + /** + * Creates all of the EE widgets + * @param container + */ + private void createExecutionEnvironmentControls(Composite container) { + // Create label + fEELabel = new Label(container, SWT.NONE); + fEELabel.setText(PDEUIMessages.NewProjectCreationPage_executionEnvironments_label); + + // Create combo + fEEChoice = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER); + fEEChoice.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + // Gather EEs + IExecutionEnvironment[] exeEnvs = VMUtil.getExecutionEnvironments(); + TreeSet availableEEs = new TreeSet(); + for (int i = 0; i < exeEnvs.length; i++) { + availableEEs.add(exeEnvs[i].getId()); + } + availableEEs.add(NO_EXECUTION_ENVIRONMENT); + + // Set data + fEEChoice.setItems((String[]) availableEEs.toArray(new String[availableEEs.size() - 1])); + fEEChoice.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + validatePage(); + } + }); + + // Set default EE based on strict match to default VM + IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall(); + String[] EEChoices = fEEChoice.getItems(); + for (int i = 0; i < EEChoices.length; i++) { + if (!EEChoices[i].equals(NO_EXECUTION_ENVIRONMENT)) { + if (VMUtil.getExecutionEnvironment(EEChoices[i]).isStrictlyCompatible(defaultVM)) { + fEEChoice.select(i); + break; + } + } + } + + // Create button + fExeEnvButton = new Button(container, SWT.PUSH); + fExeEnvButton.setLayoutData(new GridData()); + fExeEnvButton.setText(PDEUIMessages.NewProjectCreationPage_environmentsButton); + fExeEnvButton.addListener(SWT.Selection, new Listener() { + public void handleEvent(Event event) { + PreferencesUtil.createPreferenceDialogOn(getShell(), "org.eclipse.jdt.debug.ui.jreProfiles", //$NON-NLS-1$ + new String[] {"org.eclipse.jdt.debug.ui.jreProfiles"}, null).open(); //$NON-NLS-1$ + } + }); + } + + /** + * Creates all of the plugin options widgets + * @param container + */ + protected void createPluginClassGroup(Composite container) { + Group classGroup = SWTFactory.createGroup(container, PDEUIMessages.ContentPage_pClassGroup, 2, 1, GridData.FILL_HORIZONTAL); + + IDialogSettings settings = getDialogSettings(); + + fGenerateActivator = SWTFactory.createCheckButton(classGroup, PDEUIMessages.ContentPage_generate, null, (settings != null) ? !settings.getBoolean(S_GENERATE_ACTIVATOR) : true, 2); + fGenerateActivator.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + fClassLabel.setEnabled(fGenerateActivator.getSelection()); + fClassText.setEnabled(fGenerateActivator.getSelection()); + updateData(); + validatePage(); + } + }); + + fClassLabel = new Label(classGroup, SWT.NONE); + fClassLabel.setText(PDEUIMessages.ContentPage_classname); + GridData gd = new GridData(); + gd.horizontalIndent = 20; + fClassLabel.setLayoutData(gd); + fClassText = createText(classGroup, classListener); + + fUIPlugin = SWTFactory.createCheckButton(classGroup, PDEUIMessages.ContentPage_uicontribution, null, (settings != null) ? !settings.getBoolean(S_UI_PLUGIN) : true, 2); + fUIPlugin.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + updateData(); + validatePage(); + } + }); + + fApiAnalysisButton = SWTFactory.createCheckButton(classGroup, PDEUIMessages.PluginContentPage_enable_api_analysis, null, false, 2); + fApiAnalysisButton.setSelection((settings != null) ? settings.getBoolean(S_API_ANALYSIS) : false); + fApiAnalysisButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + updateData(); + validatePage(); + } + }); + } + + /* (non-Javadoc) + * @see org.eclipse.pde.internal.ui.wizards.plugin.ContentPage#updateData() + */ + public void updateData() { + super.updateData(); + PluginFieldData data = (PluginFieldData) fData; + data.setClassname(fClassText.getText().trim()); + data.setUIPlugin(fUIPlugin.getSelection()); + data.setDoGenerateClass(fGenerateActivator.getSelection()); + data.setRCPApplicationPlugin(!fData.isSimple() && !isPureOSGi()); + data.setEnableAPITooling(fApiAnalysisButton.getSelection()); + if (fEEChoice.isEnabled() && !fEEChoice.getText().equals(NO_EXECUTION_ENVIRONMENT)) { + fData.setExecutionEnvironment(fEEChoice.getText().trim()); + } else { + fData.setExecutionEnvironment(null); + } + } + + /* (non-Javadoc) + * @see org.eclipse.pde.internal.ui.wizards.plugin.ContentPage#setVisible(boolean) + */ + public void setVisible(boolean visible) { + if (visible) { + fMainPage.updateData(); + fGenerateActivator.setSelection(!fData.isSimple()); + fGenerateActivator.setEnabled(!fData.isSimple()); + fClassLabel.setEnabled(!fData.isSimple() && fGenerateActivator.getSelection()); + fClassText.setEnabled(!fData.isSimple() && fGenerateActivator.getSelection()); + boolean wasUIPluginEnabled = fUIPlugin.isEnabled(); + fUIPlugin.setEnabled(!fData.isSimple() && !isPureOSGi()); + // if fUIPlugin is disabled, set selection to false + if (!fUIPlugin.isEnabled()) { + fUIPlugin.setSelection(false); + } + // if the fUIPlugin was disabled and is now enabled, then set the selection to true + else if (!wasUIPluginEnabled) { + fUIPlugin.setSelection(true); + } + + // plugin class group + if (((fChangedGroups & P_CLASS_GROUP) == 0)) { + int oldfChanged = fChangedGroups; + fClassText.setText(computeId().replaceAll("-", "_").toLowerCase(Locale.ENGLISH) + ".Activator"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + fChangedGroups = oldfChanged; + } + + boolean allowEESelection = !fData.isSimple() && fData.hasBundleStructure(); + fEELabel.setEnabled(allowEESelection); + fEEChoice.setEnabled(allowEESelection); + fExeEnvButton.setEnabled(allowEESelection); + // API tooling only works for osgi bundles with java natures + fApiAnalysisButton.setEnabled(allowEESelection); + if (allowEESelection && getDialogSettings() != null) { + fApiAnalysisButton.setSelection(getDialogSettings().getBoolean(S_API_ANALYSIS)); + } else { + fApiAnalysisButton.setSelection(false); + } + } + super.setVisible(visible); + } + + /** + * @return if the field data is using the OSGi framework + */ + private boolean isPureOSGi() { + return ((PluginFieldData) fData).getOSGiFramework() != null; + } + + /* (non-Javadoc) + * @see org.eclipse.pde.internal.ui.wizards.plugin.ContentPage#validatePage() + */ + protected void validatePage() { + String errorMessage = validateProperties(); + if (errorMessage == null && fGenerateActivator.getSelection()) { + IStatus status = JavaConventions.validateJavaTypeName(fClassText.getText().trim(), PDEJavaHelper.getJavaSourceLevel(null), PDEJavaHelper.getJavaComplianceLevel(null)); + if (status.getSeverity() == IStatus.ERROR) { + errorMessage = status.getMessage(); + } else if (status.getSeverity() == IStatus.WARNING) { + setMessage(status.getMessage(), IMessageProvider.WARNING); + } + } + if (errorMessage == null) { + String eeid = fEEChoice.getText(); + if (fEEChoice.isEnabled()) { + IExecutionEnvironment ee = VMUtil.getExecutionEnvironment(eeid); + if (ee != null && ee.getCompatibleVMs().length == 0) { + errorMessage = PDEUIMessages.NewProjectCreationPage_invalidEE; + } + } + } + setErrorMessage(errorMessage); + setPageComplete(errorMessage == null); + } + + /** + * Saves the current state of widgets of interest in the dialog settings for the wizard + * @param settings + */ + public void saveSettings(IDialogSettings settings) { + settings.put(S_GENERATE_ACTIVATOR, !fGenerateActivator.getSelection()); + if (fUIPlugin.isEnabled()) { + settings.put(S_UI_PLUGIN, !fUIPlugin.getSelection()); + } + if (fApiAnalysisButton.isEnabled()) { + settings.put(S_API_ANALYSIS, fApiAnalysisButton.getSelection()); + } + settings.put(S_RCP_PLUGIN, true); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage() + */ + public boolean canFlipToNextPage() { + if (getNextPage() instanceof TemplateListSelectionPage) { + TemplateListSelectionPage templatePage = (TemplateListSelectionPage) getNextPage(); + return super.canFlipToNextPage() && templatePage.isAnyTemplateAvailable(); + } + return super.canFlipToNextPage(); + } +} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/ResourceLocator.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/ResourceLocator.java new file mode 100644 index 0000000000..1e2c5e29ff --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/ResourceLocator.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2006, 2010 Soyatec (http://www.soyatec.com) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Soyatec - initial API and implementation + *******************************************************************************/ +package org.eclipse.e4.internal.tools.wizards.project; + +import java.io.IOException; +import java.net.URL; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.Plugin; +import org.eclipse.e4.internal.tools.ToolsPlugin; + +public class ResourceLocator { + private static final String TEMPLATE_FOLDER = "templates"; + + private static ResourceLocator instance = new ResourceLocator(); + + private ResourceLocator() { + } + + public static ResourceLocator getInstance() { + return instance; + } + + public static URL getProjectTemplateFiles(String folder) + throws IOException { + Plugin plugin = getResorucePlugin(); + URL installURL = plugin.getBundle().getEntry( + "/" + TEMPLATE_FOLDER + "/" + folder); + // FileLocator.toFileURL(installURL); + URL corePath = FileLocator.resolve(installURL); + return corePath; + } + + public static URL getFile(String relativePath) throws IOException { + Plugin plugin = getResorucePlugin(); + URL installURL = plugin.getBundle().getEntry(relativePath); + URL corePath = FileLocator.resolve(installURL); + return corePath; + } + + public static Plugin getResorucePlugin() { + return ToolsPlugin.getDefault(); + } +} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/TemplateOperation.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/TemplateOperation.java new file mode 100644 index 0000000000..3546db5726 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/TemplateOperation.java @@ -0,0 +1,401 @@ +/******************************************************************************* + * Copyright (c) 2006, 2010 Soyatec (http://www.soyatec.com) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Soyatec - initial API and implementation + *******************************************************************************/ +package org.eclipse.e4.internal.tools.wizards.project; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.InvocationTargetException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.zip.ZipEntry; +import java.util.zip.ZipException; +import java.util.zip.ZipFile; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.e4.internal.tools.ToolsPlugin; +import org.eclipse.pde.internal.ui.PDEUIMessages; +import org.eclipse.pde.ui.templates.IVariableProvider; +import org.eclipse.ui.actions.WorkspaceModifyOperation; + +public class TemplateOperation extends WorkspaceModifyOperation implements + IVariableProvider { + + private final URL templateDirectory; + private final IContainer target; + private final Map keys; + private final Set binaryExtentions; + + public TemplateOperation(URL source, IContainer target, + Map keys, Set binaryExtentions) { + templateDirectory = source; + this.binaryExtentions = binaryExtentions; + this.target = target; + this.keys = keys; + } + + @Override + protected void execute(IProgressMonitor monitor) throws CoreException, + InvocationTargetException, InterruptedException { + monitor.setTaskName(PDEUIMessages.AbstractTemplateSection_generating); + + if ("jar".equals(templateDirectory.getProtocol())) { //$NON-NLS-1$ + String file = templateDirectory.getFile(); + int exclamation = file.indexOf('!'); + if (exclamation < 0) + return; + URL fileUrl = null; + try { + fileUrl = new URL(file.substring(0, exclamation)); + } catch (MalformedURLException mue) { + ToolsPlugin.logError(mue); + return; + } + File pluginJar = new File(fileUrl.getFile()); + if (!pluginJar.exists()) + return; + String templateDirectory = file.substring(exclamation + 1); // "/some/path/" + IPath path = new Path(templateDirectory); + ZipFile zipFile = null; + try { + zipFile = new ZipFile(pluginJar); + generateFiles(zipFile, path, target, monitor); + } catch (ZipException ze) { + } catch (IOException ioe) { + } finally { + if (zipFile != null) { + try { + zipFile.close(); + } catch (IOException e) { + } + } + } + } else if ("file".equals(templateDirectory.getProtocol())) { //$NON-NLS-1$ + File directory = new File(templateDirectory.getFile()); + if (!directory.exists()) + return; + generateFiles(directory, target, true, monitor); + } + } + + private void generateFiles(File src, IContainer dst, boolean firstLevel, + IProgressMonitor monitor) throws CoreException { + File[] members = src.listFiles(); + + for (int i = 0; i < members.length; i++) { + File member = members[i]; + String name = member.getName(); + if (member.isDirectory()) { + if (".svn".equals(name) || "cvs".equalsIgnoreCase(name)) + continue; + IContainer dstContainer = null; + + if (dstContainer == null) { + String folderName = getProcessedString(name, name); + dstContainer = dst.getFolder(new Path(folderName)); + } + if (dstContainer != null && !dstContainer.exists()) + ((IFolder) dstContainer).create(true, true, monitor); + generateFiles(member, dstContainer, false, monitor); + } else { + InputStream in = null; + try { + in = new FileInputStream(member); + copyFile(name, in, dst, monitor); + } catch (IOException ioe) { + } finally { + if (in != null) + try { + in.close(); + } catch (IOException ioe2) { + } + } + } + } + } + + /** + * + * + * @param zipFile + * @param path + * @param dst + * @param monitor + * @throws CoreException + */ + private void generateFiles(ZipFile zipFile, IPath path, IContainer dst, + IProgressMonitor monitor) throws CoreException { + int pathLength = path.segmentCount(); + // Immidiate children + Map childZipEntries = new HashMap(); // "dir/" or "dir/file.java" + + for (Enumeration zipEntries = zipFile.entries(); zipEntries + .hasMoreElements();) { + ZipEntry zipEntry = (ZipEntry) zipEntries.nextElement(); + IPath entryPath = new Path(zipEntry.getName()); + if (entryPath.segmentCount() <= pathLength) { + // ancestor or current directory + continue; + } + if (!path.isPrefixOf(entryPath)) { + // not a descendant + continue; + } + if (entryPath.segmentCount() == pathLength + 1) { + childZipEntries.put(zipEntry.getName(), zipEntry); + } else { + String name = entryPath.uptoSegment(pathLength + 1) + .addTrailingSeparator().toString(); + if (!childZipEntries.containsKey(name)) { + ZipEntry dirEntry = new ZipEntry(name); + childZipEntries.put(name, dirEntry); + } + } + } + + for (Iterator it = childZipEntries.values().iterator(); it.hasNext();) { + ZipEntry zipEnry = (ZipEntry) it.next(); + String name = new Path(zipEnry.getName()).lastSegment().toString(); + if (zipEnry.isDirectory()) { + IContainer dstContainer = null; + + if (dstContainer == null) { + String folderName = getProcessedString(name, name); + dstContainer = dst.getFolder(new Path(folderName)); + } + if (dstContainer != null && !dstContainer.exists()) + ((IFolder) dstContainer).create(true, true, monitor); + generateFiles(zipFile, path.append(name), dstContainer, monitor); + } else { + InputStream in = null; + try { + in = zipFile.getInputStream(zipEnry); + copyFile(name, in, dst, monitor); + } catch (IOException ioe) { + } finally { + if (in != null) + try { + in.close(); + } catch (IOException ioe2) { + } + } + } + } + } + + private void copyFile(String fileName, InputStream input, IContainer dst, + IProgressMonitor monitor) throws CoreException { + String targetFileName = getProcessedString(fileName, fileName); + + monitor.subTask(targetFileName); + IFile dstFile = dst.getFile(new Path(targetFileName)); + + try { + InputStream stream = isBinary(fileName) ? input + : getProcessedStream(fileName, input); + if (dstFile.exists()) { + dstFile.setContents(stream, true, true, monitor); + } else { + dstFile.create(stream, true, monitor); + } + stream.close(); + + } catch (IOException e) { + } + } + + protected void copyFile(String fileName, InputStream input, IContainer dst, + final String destPath, IProgressMonitor monitor) + throws CoreException { + String targetFileName = null; + if (destPath == null) { + targetFileName = getProcessedString(fileName, fileName); + } else { + targetFileName = destPath; + } + + monitor.subTask(targetFileName); + IFile dstFile = dst.getFile(new Path(targetFileName)); + + try { + InputStream stream = isBinary(fileName) ? input + : getProcessedStream(fileName, input); + if (dstFile.exists()) { + dstFile.setContents(stream, true, true, monitor); + } else { + dstFile.create(stream, true, monitor); + } + stream.close(); + + } catch (IOException e) { + } + } + + /** + * + * @param fileName + * @param input + * @param dst + * @param basePath + * @param monitor + * @throws CoreException + */ + public void copyFile(String fileName, InputStream input, IContainer dst, + final String basePath, final String destName, + IProgressMonitor monitor) throws CoreException { + if (basePath == null || basePath.equals("")) { + copyFile(fileName, input, dst, monitor); + } + + String targetFileName = destName == null ? getProcessedString(fileName, + fileName) : destName; + + monitor.subTask(targetFileName); + IFile dstFile = dst.getFile(new Path(basePath + targetFileName)); + + try { + InputStream stream = isBinary(fileName) ? input + : getProcessedStream(fileName, input); + if (dstFile.exists()) { + dstFile.setContents(stream, true, true, monitor); + } else { + dstFile.create(stream, true, monitor); + } + stream.close(); + + } catch (IOException e) { + } + } + + private boolean isBinary(String fileName) { + if (binaryExtentions == null) { + return false; + } + + String ext = getfileExtention(fileName); + if (ext == null) + return false; + return binaryExtentions.contains(ext); + } + + private String getfileExtention(String name) { + int indexOf = name.lastIndexOf('.'); + if (indexOf == -1) + return null; + return name.substring(indexOf); + } + + private InputStream getProcessedStream(String fileName, InputStream stream) + throws IOException, CoreException { + InputStreamReader reader = new InputStreamReader(stream); + int bufsize = 1024; + char[] cbuffer = new char[bufsize]; + int read = 0; + StringBuffer keyBuffer = new StringBuffer(); + StringBuffer outBuffer = new StringBuffer(); + + boolean replacementMode = false; + boolean almostReplacementMode = false; + boolean escape = false; + while (read != -1) { + read = reader.read(cbuffer); + for (int i = 0; i < read; i++) { + char c = cbuffer[i]; + + if (escape) { + StringBuffer buf = outBuffer; + buf.append(c); + escape = false; + continue; + } + + if (c == '@') { + if (replacementMode && almostReplacementMode) { + almostReplacementMode = false; + } else if (replacementMode) { + replacementMode = false; + String key = keyBuffer.toString(); + String value = key.length() == 0 ? "@@" //$NON-NLS-1$ + : getReplacementString(key); + outBuffer.append(value); + keyBuffer.delete(0, keyBuffer.length()); + } else if (almostReplacementMode) { + replacementMode = true; + } else { + almostReplacementMode = true; + } + } else { + if (replacementMode) + keyBuffer.append(c); + else { + if (almostReplacementMode) + outBuffer.append('@'); + outBuffer.append(c); + almostReplacementMode = false; + } + } + } + } + return new ByteArrayInputStream(outBuffer.toString().getBytes()); + // return new + // ByteArrayInputStream(outBuffer.toString().getBytes(project. + // getDefaultCharset())); + } + + private String getProcessedString(String fileName, String source) { + if (source.indexOf('$') == -1) + return source; + int loc = -1; + StringBuffer buffer = new StringBuffer(); + boolean replacementMode = false; + for (int i = 0; i < source.length(); i++) { + char c = source.charAt(i); + if (c == '$') { + if (replacementMode) { + String key = source.substring(loc, i); + String value = key.length() == 0 ? "$" : getReplacementString(key); //$NON-NLS-1$ + buffer.append(value); + replacementMode = false; + } else { + replacementMode = true; + loc = i + 1; + continue; + } + } else if (!replacementMode) + buffer.append(c); + } + return buffer.toString(); + } + + public String getReplacementString(String key) { + String result = keys.get(key); + return result != null ? result : key; + } + + public Object getValue(String variable) { + return getReplacementString(variable); + } + +} diff --git a/bundles/org.eclipse.e4.tools/templates/common/$projectName$.product b/bundles/org.eclipse.e4.tools/templates/common/$projectName$.product new file mode 100644 index 0000000000..d91c3d09e2 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/templates/common/$projectName$.product @@ -0,0 +1,79 @@ + + + + + + + + + + -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bundles/org.eclipse.e4.tools/templates/common/icons/sample.gif b/bundles/org.eclipse.e4.tools/templates/common/icons/sample.gif new file mode 100644 index 0000000000000000000000000000000000000000..34fb3c9d8cb7d489681b7f7aee4bdcd7eaf53610 GIT binary patch literal 983 zcmZ?wbhEHb6krfw_|CxKYUg-n!?izO{@9*?jxd%4aX0yzy`dymabz zw#(eg=y~&N&n)dZv2xzduG}5lraiApo3(c4*{Ylg5#|$JO_EEZ<^|a2`Z*=9ns7DV zy=TR&gYw*7f%auV?ip3tvjRPmcdoho{K?x$_vR?C#t5&<;~V}S*>OMCr>h}%%bLZ9 zmo3`hYEwTICo-TTCZwgTsC&VjZRgJ1eE#fBa^%9R zmmfWS@;bnyJ27HWY}kxYzv(Hl>yu;FCPlAEh+34Muq-8Rb6C)<8qA3{r2e5 z`$vyngh#H=FWlqqvnapfc5%(!sQ4v?r7J61-&eJNEN^;KTK}T7{#i-gJh%G*9vcYdwv_*~xdw!Gz4Va?T!sXyyF@8?w<>X`X=#j%uHV4GRvj@+tE@ zQ%F!a)GKcn^~8abN>4la1UNXVL;{ZWi)lEwyeatDu%Lr6;aASiLrXXW zQm#6w~t;=?ud9vy7?cE^q z*1q%4_Md-x_|o&km!6%t_VVPl7w2!kK6mTY)%$O+-hXrZ@w-PaKBPA<&u(2-(6RIc zNcPq9H=oX5zOnP@<=ao*J$&)u*_+SB-Al@Q7r*)NC8Bg+ zz;2_n+r|KMbN2{G6a4_&{kGN)4gvc5juAGR#sRMOu1@w&t^vlzRuN`KMgigX?uQ4k zYgk5@s;SFPcrC52W*VWRCnlyRuKMMRsEVpigru?tONzsU2OVNcZfg!)N^s&3;9>A! zDQIQv=+@exGeO}YGc&uwQjf$B2b)>gB6wUn7Bn7go*uf&AmXGW<1{9LBBLK|i +<% HandlerClass domainClass = (HandlerClass)argument; %> +package <%= domainClass.getPackageFragment().getElementName() %>; + +import org.eclipse.e4.core.di.annotations.Execute; +<% if( domainClass.isUseCanExecute() ) { %> +import org.eclipse.e4.core.di.annotations.CanExecute; +<% } %> + +public class <%= domainClass.getName() %> { + @Execute + public void <%= domainClass.getExecuteMethodName() %>() { + //TODO Your code goes here + } + <% if( domainClass.isUseCanExecute() ) { %> + + @CanExecute + public boolean <%= domainClass.getCanExecuteMethodName() %>() { + //TODO Your code goes here + } + <% } %> +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/templates/part.txtjet b/bundles/org.eclipse.e4.tools/templates/part.txtjet new file mode 100644 index 0000000000..03a2b1b668 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/templates/part.txtjet @@ -0,0 +1,48 @@ +<%@ jet package="org.eclipse.e4.internal.tools.wizards.classes.templates" class="PartTemplate" imports="org.eclipse.e4.internal.tools.wizards.classes.NewPartClassWizard.PartClass" %> +<% PartClass domainClass = (PartClass)argument; %> +package <%= domainClass.getPackageFragment().getElementName() %>; + +import javax.inject.Inject; +<% if( domainClass.isUsePostConstruct() ) { %> +import javax.annotation.PostConstruct; +<% } %> +<% if( domainClass.isUsePredestroy() ) { %> +import javax.annotation.PreDestroy; +<% } %> +<% if( domainClass.isUseFocus() ) { %> +import org.eclipse.e4.ui.di.Focus; +<% } %> +<% if( domainClass.isUsePersist() ) { %> +import org.eclipse.e4.ui.di.Persist; +<% } %> + +public class <%= domainClass.getName() %> { + @Inject + public <%= domainClass.getName() %>() { + //TODO Your code here + } + <% if( domainClass.isUsePostConstruct() ) { %> + @PostConstruct + public void <%= domainClass.getPostConstructMethodName() %>() { + //TODO Your code here + } + <% } %> + <% if( domainClass.isUsePredestroy() ) { %> + @PreDestroy + public void <%= domainClass.getPreDestroyMethodName() %>() { + //TODO Your code here + } + <% } %> + <% if( domainClass.isUseFocus() ) { %> + @Focus + public void <%= domainClass.getFocusMethodName() %>() { + //TODO Your code here + } + <% } %> + <% if( domainClass.isUsePersist() ) { %> + @Persist + public void <%= domainClass.getPersistMethodName() %>() { + //TODO Your code here + } + <% } %> +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/templates/src/handlers/AboutHandler.java b/bundles/org.eclipse.e4.tools/templates/src/handlers/AboutHandler.java new file mode 100644 index 0000000000..c9f6a86afd --- /dev/null +++ b/bundles/org.eclipse.e4.tools/templates/src/handlers/AboutHandler.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package @@packageName@@; + +import javax.inject.Named; + +import org.eclipse.e4.core.di.annotations.Execute; +import org.eclipse.e4.ui.services.IServiceConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Shell; + +public class AboutHandler { + @Execute + public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell) { + MessageDialog.openInformation(shell, "About", "e4 Application example."); + } +} diff --git a/bundles/org.eclipse.e4.tools/templates/src/handlers/OpenHandler.java b/bundles/org.eclipse.e4.tools/templates/src/handlers/OpenHandler.java new file mode 100644 index 0000000000..46d423cec2 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/templates/src/handlers/OpenHandler.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package @@packageName@@; + +import java.lang.reflect.InvocationTargetException; + +import javax.inject.Named; + +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.core.di.annotations.Execute; +import org.eclipse.e4.ui.services.IServiceConstants; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Shell; + +public class OpenHandler { + + @Execute + public void execute( + IEclipseContext context, + @Named(IServiceConstants.ACTIVE_SHELL) Shell shell) + throws InvocationTargetException, InterruptedException { + FileDialog dialog = new FileDialog(shell); + dialog.open(); + } +} diff --git a/bundles/org.eclipse.e4.tools/templates/src/handlers/QuitHandler.java b/bundles/org.eclipse.e4.tools/templates/src/handlers/QuitHandler.java new file mode 100644 index 0000000000..0c1337bb1e --- /dev/null +++ b/bundles/org.eclipse.e4.tools/templates/src/handlers/QuitHandler.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package @@packageName@@; + +import java.lang.reflect.InvocationTargetException; + +import javax.inject.Named; + +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.core.di.annotations.Execute; +import org.eclipse.e4.ui.services.IServiceConstants; +import org.eclipse.e4.ui.workbench.IWorkbench; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Shell; + +public class QuitHandler { + @Execute + public void execute(IWorkbench workbench, IEclipseContext context, + @Named(IServiceConstants.ACTIVE_SHELL) Shell shell) + throws InvocationTargetException, InterruptedException { + if (MessageDialog.openConfirm(shell, "Confirmation", + "Do you want to exit?")) { + workbench.close(); + } + } +} diff --git a/bundles/org.eclipse.e4.tools/templates/src/handlers/SaveHandler.java b/bundles/org.eclipse.e4.tools/templates/src/handlers/SaveHandler.java new file mode 100644 index 0000000000..c1e49cdf9a --- /dev/null +++ b/bundles/org.eclipse.e4.tools/templates/src/handlers/SaveHandler.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package @@packageName@@; + +import java.lang.reflect.InvocationTargetException; + +import javax.inject.Named; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.e4.core.contexts.ContextInjectionFactory; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.core.di.IDisposable; +import org.eclipse.e4.core.di.annotations.Execute; +import org.eclipse.e4.core.di.annotations.CanExecute; +import org.eclipse.e4.ui.model.application.MContribution; +import org.eclipse.e4.ui.model.application.ui.MDirtyable; +import org.eclipse.e4.ui.services.IServiceConstants; +//import org.eclipse.e4.ui.workbench.Persist; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.widgets.Shell; + +public class SaveHandler { + @CanExecute + public boolean canExecute( + @Named(IServiceConstants.ACTIVE_PART) MDirtyable dirtyable) { + if (dirtyable == null) { + return false; + } + return dirtyable.isDirty(); + } + + @Execute + public void execute( + IEclipseContext context, + @Named(IServiceConstants.ACTIVE_SHELL) Shell shell, + @Named(IServiceConstants.ACTIVE_PART) final MContribution contribution) + throws InvocationTargetException, InterruptedException { + final IEclipseContext pmContext = context.createChild(); + + ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell); + dialog.open(); + dialog.run(true, true, new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) + throws InvocationTargetException, InterruptedException { + pmContext.set(IProgressMonitor.class.getName(), monitor); + if (contribution != null) { + Object clientObject = contribution.getObject(); +// ContextInjectionFactory.invoke(clientObject, Persist.class, //$NON-NLS-1$ +// pmContext, null); + } + } + }); + + if (pmContext instanceof IDisposable) { + ((IDisposable) pmContext).dispose(); + } + } +} From 46c923d851484c84540c3475f6a6baa4af0d96d8 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 5 Jul 2010 12:53:06 +0000 Subject: [PATCH 0172/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling --- .../compat/internal/ClipboardServiceImpl.java | 37 ++ .../internal/ContextServiceFactory.java | 6 +- .../e4/tools/compat/internal/CopyAction.java} | 25 +- .../e4/tools/compat/internal/CutAction.java} | 25 +- .../e4/tools/compat/internal/PartHelper.java | 11 +- .../e4/tools/compat/internal/PasteAction.java | 27 ++ .../e4/tools/compat/parts/DIEditorPart.java | 36 ++ .../META-INF/MANIFEST.MF | 5 +- .../icons/full/obj16/plugin.png | Bin 591 -> 0 bytes .../plugin.xml | 33 +- .../emf/editor3x/E4WorkbenchModelEditor.java | 46 +- .../extension/HandlerContributionEditor.java | 101 +++++ .../extension/PartContributionEditor.java | 87 ++++ .../wizard/BaseApplicationModelWizard.java | 187 -------- .../emf/editor3x/wizard/NewModelFilePage.java | 199 --------- .../META-INF/MANIFEST.MF | 3 +- .../org.eclipse.e4.tools.emf.ui.editors.exsd | 16 + .../ui/common/IContributionClassCreator.java | 13 + .../tools/emf/ui/common/MemoryTransfer.java | 63 +++ .../emf/ui/internal/common/ModelEditor.java | 409 +++++++++++++++--- .../emf/ui/internal/common/VirtualEntry.java | 22 +- .../component/DirectMenuItemEditor.java | 22 +- .../component/DirectToolItemEditor.java | 34 +- .../common/component/HandlerEditor.java | 21 +- .../internal/common/component/PartEditor.java | 21 +- .../e4/tools/services/IClipboardService.java | 26 ++ 26 files changed, 945 insertions(+), 530 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ClipboardServiceImpl.java rename bundles/{org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewContributionModelWizard.java => org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/CopyAction.java} (59%) rename bundles/{org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewApplicationModelWizard.java => org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/CutAction.java} (58%) create mode 100644 bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PasteAction.java delete mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/plugin.png create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java delete mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/BaseApplicationModelWizard.java delete mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewModelFilePage.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IContributionClassCreator.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/MemoryTransfer.java create mode 100644 bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IClipboardService.java diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ClipboardServiceImpl.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ClipboardServiceImpl.java new file mode 100644 index 0000000000..bd163fe044 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ClipboardServiceImpl.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.compat.internal; + +import org.eclipse.e4.tools.services.IClipboardService; + +public class ClipboardServiceImpl implements IClipboardService { + private Handler handler; + + public void copy() { + if( handler != null ) { + handler.copy(); + } + } + + public void paste() { + if( handler != null ) { + handler.paste(); + } + } + + public void setHandler(Handler handler) { + this.handler = handler; + } + + public void cut() { + this.handler.cut(); + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java index 7e782fcaa1..632d0fbe2d 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java @@ -16,6 +16,7 @@ import org.eclipse.e4.core.services.contributions.IContributionFactory; import org.eclipse.e4.core.services.log.ILoggerProvider; import org.eclipse.e4.core.services.log.Logger; +import org.eclipse.e4.tools.services.IClipboardService; import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; import org.eclipse.e4.ui.css.swt.theme.IThemeManager; import org.eclipse.e4.ui.services.IServiceConstants; @@ -52,10 +53,6 @@ public Object create(@SuppressWarnings("rawtypes") Class serviceInterface, IServ final IWorkbenchWindow window = wls.getWorkbenchWindow(); final IWorkbenchPartSite site = wls.getPartSite(); -// System.err.println("The locator: " + locator); -// System.err.println(" Window: " + window); -// System.err.println(" Site: " + site); - Object o = parentLocator.getService(serviceInterface); // This happens when we run in plain 3.x @@ -67,6 +64,7 @@ public Object create(@SuppressWarnings("rawtypes") Class serviceInterface, IServ final IEclipseContext appContext = serviceContext.createChild("WorkbenchContext"); //$NON-NLS-1$ appContext.set(Logger.class, new WorkbenchLogger()); + appContext.set(IClipboardService.class, new ClipboardServiceImpl()); IContributionFactory contributionFactory = ContextInjectionFactory.make(ReflectionContributionFactory.class, appContext); appContext.set(IContributionFactory.class.getName(),contributionFactory); diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewContributionModelWizard.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/CopyAction.java similarity index 59% rename from bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewContributionModelWizard.java rename to bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/CopyAction.java index 20b95dd2a8..a6493fee25 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewContributionModelWizard.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/CopyAction.java @@ -8,20 +8,21 @@ * Contributors: * Tom Schindl - initial API and implementation ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x.wizard; +package org.eclipse.e4.tools.compat.internal; -import org.eclipse.e4.ui.model.fragment.MFragmentFactory; -import org.eclipse.emf.ecore.EObject; +import org.eclipse.e4.tools.services.IClipboardService; +import org.eclipse.jface.action.Action; - -public class NewContributionModelWizard extends BaseApplicationModelWizard { - - @Override - public String getDefaultFileName() { - return "fragment.e4xmi"; +public class CopyAction extends Action { + private IClipboardService service; + + public CopyAction(IClipboardService service) { + super("Copy"); + this.service = service; } - protected EObject createInitialModel() { - return (EObject) MFragmentFactory.INSTANCE.createModelFragments(); + @Override + public void run() { + service.copy(); } -} \ No newline at end of file +} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewApplicationModelWizard.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/CutAction.java similarity index 58% rename from bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewApplicationModelWizard.java rename to bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/CutAction.java index ed161a7e7c..02a0c9dd35 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewApplicationModelWizard.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/CutAction.java @@ -8,20 +8,21 @@ * Contributors: * Tom Schindl - initial API and implementation ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x.wizard; +package org.eclipse.e4.tools.compat.internal; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.emf.ecore.EObject; +import org.eclipse.e4.tools.services.IClipboardService; +import org.eclipse.jface.action.Action; - -public class NewApplicationModelWizard extends BaseApplicationModelWizard { - - @Override - public String getDefaultFileName() { - return "Application.e4xmi"; +public class CutAction extends Action { + private IClipboardService service; + + public CutAction(IClipboardService service) { + super("Cut"); + this.service = service; } - protected EObject createInitialModel() { - return (EObject) MApplicationFactory.INSTANCE.createApplication(); + @Override + public void run() { + service.cut(); } -} \ No newline at end of file +} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java index 58484ff459..5c74bc6456 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java @@ -15,6 +15,7 @@ import org.eclipse.core.runtime.ListenerList; import org.eclipse.e4.core.contexts.ContextInjectionFactory; import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.tools.services.IClipboardService; import org.eclipse.e4.ui.services.IStylingEngine; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; @@ -34,13 +35,19 @@ public static IEclipseContext createPartContext(WorkbenchPart part) throws PartI IEclipseContext parentContext = (IEclipseContext) site.getService(IEclipseContext.class); // Check if running in 4.x - if( parentContext.get("org.eclipse.e4.workbench.ui.IPresentationEngine") != null ) { + if( parentContext.get("org.eclipse.e4.ui.workbench.IPresentationEngine") != null ) { // Hack to get the MPart-Context try { Class clazz = Util.getBundle("org.eclipse.e4.ui.model.workbench").loadClass("org.eclipse.e4.ui.model.application.ui.basic.MPart"); Object instance = site.getService(clazz); Method m = clazz.getMethod("getContext", new Class[0]); - return (IEclipseContext) m.invoke(instance); + IEclipseContext ctx = (IEclipseContext) m.invoke(instance); + IEclipseContext rv = ctx; + while( ctx.getParent() != null ) { + ctx = ctx.getParent(); + } + ctx.set(IClipboardService.class, new ClipboardServiceImpl()); + return rv; } catch (Exception e) { throw new PartInitException("Could not create context",e); } diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PasteAction.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PasteAction.java new file mode 100644 index 0000000000..9e3b40a229 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PasteAction.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.compat.internal; + +import org.eclipse.e4.tools.services.IClipboardService; +import org.eclipse.jface.action.Action; + +public class PasteAction extends Action { + private IClipboardService service; + public PasteAction(IClipboardService service) { + super("Paste"); + this.service = service; + } + + @Override + public void run() { + service.paste(); + } +} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java index dc711b9e3c..f1f6838d43 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java @@ -14,15 +14,21 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.e4.core.contexts.ContextInjectionFactory; import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.tools.compat.internal.CopyAction; +import org.eclipse.e4.tools.compat.internal.CutAction; import org.eclipse.e4.tools.compat.internal.PartHelper; +import org.eclipse.e4.tools.compat.internal.PasteAction; +import org.eclipse.e4.tools.services.IClipboardService; import org.eclipse.e4.tools.services.IDirtyProviderService; import org.eclipse.e4.ui.di.Focus; import org.eclipse.e4.ui.di.Persist; +import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorSite; import org.eclipse.ui.PartInitException; +import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.part.EditorPart; public abstract class DIEditorPart extends EditorPart implements IDirtyProviderService { @@ -31,8 +37,20 @@ public abstract class DIEditorPart extends EditorPart implements IDirtyProvid private Class clazz; private boolean dirtyState; + private int features; + + protected static final int COPY = 1; + protected static final int PASTE = 1 << 1; + protected static final int CUT = 1 << 2; + + public DIEditorPart(Class clazz) { + this(clazz, SWT.NONE); + } + + public DIEditorPart(Class clazz, int features) { this.clazz = clazz; + this.features = features; } @Override @@ -72,12 +90,30 @@ public void init(IEditorSite site, IEditorInput input) @Override public void createPartControl(Composite parent) { component = PartHelper.creatComponent(parent, context, clazz, this); + makeActions(); } public C getComponent() { return component; } + protected void makeActions() { + if( (features & COPY) == COPY ) { + IClipboardService clipboard = context.get(IClipboardService.class); + getEditorSite().getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(), new CopyAction(clipboard)); + } + + if( (features & PASTE) == PASTE ) { + IClipboardService clipboard = context.get(IClipboardService.class); + getEditorSite().getActionBars().setGlobalActionHandler(ActionFactory.PASTE.getId(), new PasteAction(clipboard)); + } + + if( (features & CUT) == CUT ) { + IClipboardService clipboard = context.get(IClipboardService.class); + getEditorSite().getActionBars().setGlobalActionHandler(ActionFactory.CUT.getId(), new CutAction(clipboard)); + } + } + public void setDirtyState(boolean dirtyState) { if( dirtyState != this.dirtyState ) { this.dirtyState = dirtyState; diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index e69d0595b5..33eead93a8 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -24,7 +24,8 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.emf.edit;bundle-version="2.6.0", org.eclipse.e4.ui.services;bundle-version="0.9.1", org.eclipse.e4.tools.compat;bundle-version="1.0.0", - org.eclipse.e4.tools.services;bundle-version="1.0.0" + org.eclipse.e4.tools.services;bundle-version="1.0.0", + org.eclipse.e4.tools;bundle-version="0.9.0", + org.eclipse.jdt.ui;bundle-version="3.6.0" Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/xmiresourcecontextfunction.xml, OSGI-INF/projectfunction.xml Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.e4.tools.emf.editor3x.wizard;x-internal:=true diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/plugin.png b/bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/plugin.png deleted file mode 100644 index 6187b15aec001b7080b51a5f944f07591f26cc15..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 591 zcmV-V0eEcNHZMNv|IbJ-M`( zKwWL~opzjJe^WpCmV9E;(0&ut2;4va_(#>M8)>9$R5viQnf(Nkh~VM$y>J(jqb$cj z+nL1Nm|mV)Gm|9MnHf*7Ja4OEAQz__^LRKOLEwqpiGV^^A*T=#&inGm-62Xs;dnSp zKj&H9T*boh2i)W+(n27l!C)>fq|L%VB1i ziC4p;NwV_}ZjW7$LRW#(_bKF#hp=!IqNO26Z*w2+LEwx{PVnZ&Sn}T;mtzb$;qA*nT@@+ zV5uQ@iXDTPoTbV#FRr~z04|PPh`wXTNoCm9*tG&?e3+fYl>K6+&3|Cc$KOpL`ER+_ dcRl5U#9zn6ZO}GF - - - - - - - - + point="org.eclipse.e4.tools.emf.ui.editors"> + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java index 3484bed566..726842fae1 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java @@ -11,12 +11,54 @@ package org.eclipse.e4.tools.emf.editor3x; import org.eclipse.e4.tools.compat.parts.DIEditorPart; +import org.eclipse.e4.tools.emf.ui.common.IModelResource.ModelListener; import org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.actions.ActionFactory; @SuppressWarnings("restriction") -public class E4WorkbenchModelEditor extends DIEditorPart { +public class E4WorkbenchModelEditor extends + DIEditorPart { + private UndoAction undoAction; + private RedoAction redoAction; + + private ModelListener listener = new ModelListener() { + + public void dirtyChanged() { + firePropertyChange(PROP_DIRTY); + } + + public void commandStackChanged() { + + } + }; public E4WorkbenchModelEditor() { - super(ApplicationModelEditor.class); + super(ApplicationModelEditor.class, COPY|CUT|PASTE); + } + + protected void makeActions() { + super.makeActions(); + undoAction = new UndoAction(getComponent().getModelProvider()); + redoAction = new RedoAction(getComponent().getModelProvider()); + + getEditorSite().getActionBars().setGlobalActionHandler( + ActionFactory.UNDO.getId(), undoAction); + getEditorSite().getActionBars().setGlobalActionHandler( + ActionFactory.REDO.getId(), redoAction); + } + + @Override + public void dispose() { + if (undoAction != null) + undoAction.dispose(); + + if (redoAction != null) + redoAction.dispose(); + + if (listener != null && getComponent().getModelProvider() != null) + getComponent().getModelProvider().removeModelListener(listener); + + super.dispose(); } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java new file mode 100644 index 0000000000..b2bc2a31b9 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java @@ -0,0 +1,101 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.editor3x.extension; + +import java.net.URL; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.e4.internal.tools.wizards.classes.NewHandlerClassWizard; +import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; +import org.eclipse.e4.ui.model.application.MContribution; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jdt.core.ICompilationUnit; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.IType; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.internal.ui.JavaPlugin; +import org.eclipse.jdt.ui.JavaUI; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; + +public class HandlerContributionEditor implements IContributionClassCreator { + + public void createOpen(MContribution contribution, EditingDomain domain, IProject project, Shell shell) { + if( contribution.getContributionURI() == null || contribution.getContributionURI().trim().length() == 0 ) { + NewHandlerClassWizard wizard = new NewHandlerClassWizard(); + wizard.init( null, new StructuredSelection(project)); + WizardDialog dialog = new WizardDialog(shell, wizard); + if( dialog.open() == WizardDialog.OK ) { + IFile f = wizard.getFile(); + ICompilationUnit el = JavaCore.createCompilationUnitFrom(f); + try { + String packageName = el.getPackageDeclarations()[0].getElementName(); + String className = wizard.getDomainClass().getName(); + Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "platform:/plugin/" + f.getProject().getName() + "/" + packageName+"."+className); + if( cmd.canExecute() ) { + domain.getCommandStack().execute(cmd); + } + el.open(null); + } catch (JavaModelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } else { + URI uri = URI.createURI(contribution.getContributionURI()); + IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(uri.segment(1)); + //TODO If this is not a WS-Resource we need to open differently + if( p != null ) { + IJavaProject jp = JavaCore.create(p); + try { + IType t = jp.findType(uri.segment(2)); + JavaUI.openInEditor(t); + } catch (JavaModelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (PartInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + } + + public boolean isSupported(EClass element) { + return + isTypeOrSuper(CommandsPackageImpl.Literals.HANDLER,element) + || + isTypeOrSuper(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, element) + || + isTypeOrSuper(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, element); + } + + private boolean isTypeOrSuper(EClass eClass, EClass element) { + return eClass.equals(element) || element.getEAllSuperTypes().contains(eClass); + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java new file mode 100644 index 0000000000..65195eacc6 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java @@ -0,0 +1,87 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.editor3x.extension; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.e4.internal.tools.wizards.classes.NewPartClassWizard; +import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; +import org.eclipse.e4.ui.model.application.MContribution; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jdt.core.ICompilationUnit; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.IType; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.ui.JavaUI; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PartInitException; + +public class PartContributionEditor implements IContributionClassCreator { + + public void createOpen(MContribution contribution, EditingDomain domain, + IProject project, Shell shell) { + if( contribution.getContributionURI() == null || contribution.getContributionURI().trim().length() == 0 ) { + NewPartClassWizard wizard = new NewPartClassWizard(); + wizard.init( null, new StructuredSelection(project)); + WizardDialog dialog = new WizardDialog(shell, wizard); + if( dialog.open() == WizardDialog.OK ) { + IFile f = wizard.getFile(); + ICompilationUnit el = JavaCore.createCompilationUnitFrom(f); + try { + String packageName = el.getPackageDeclarations()[0].getElementName(); + String className = wizard.getDomainClass().getName(); + Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "platform:/plugin/" + f.getProject().getName() + "/" + packageName+"."+className); + if( cmd.canExecute() ) { + domain.getCommandStack().execute(cmd); + } + el.open(null); + } catch (JavaModelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } else { + URI uri = URI.createURI(contribution.getContributionURI()); + IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(uri.segment(1)); + //TODO If this is not a WS-Resource we need to open differently + if( p != null ) { + IJavaProject jp = JavaCore.create(p); + try { + IType t = jp.findType(uri.segment(2)); + JavaUI.openInEditor(t); + } catch (JavaModelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (PartInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + } + + public boolean isSupported(EClass element) { + return BasicPackageImpl.Literals.PART == element + || element.getEAllSuperTypes().contains( + BasicPackageImpl.Literals.PART); + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/BaseApplicationModelWizard.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/BaseApplicationModelWizard.java deleted file mode 100644 index 27d175bfab..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/BaseApplicationModelWizard.java +++ /dev/null @@ -1,187 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x.wizard; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWizard; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - -public abstract class BaseApplicationModelWizard extends Wizard implements INewWizard { - private NewModelFilePage page; - private ISelection selection; - - protected IWorkbench workbench; - - /** - * Constructor for NewApplicationModelWizard. - */ - public BaseApplicationModelWizard() { - super(); - setNeedsProgressMonitor(true); - } - - /** - * Adding the page to the wizard. - */ - - public void addPages() { - page = new NewModelFilePage(selection,getDefaultFileName()); - addPage(page); - } - - public abstract String getDefaultFileName(); - - @Override - public boolean performFinish() { - try { - // Remember the file. - // - final IFile modelFile = getModelFile(); - - // Do the work within an operation. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - @Override - protected void execute(IProgressMonitor progressMonitor) { - try { - // Create a resource set - // - ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - // - URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); - - // Create a resource for this file. - // - Resource resource = resourceSet.createResource(fileURI); - - // Add the initial model object to the contents. - // - EObject rootObject = createInitialModel(); - if (rootObject != null) { - resource.getContents().add(rootObject); - } - - // Save the contents of the resource to the file system. - // - Map options = new HashMap(); - resource.save(options); - } - catch (Exception exception) { - throw new RuntimeException(exception); - } - finally { - progressMonitor.done(); - } - } - }; - - getContainer().run(false, false, operation); - - // Select the new file resource in the current view. - // - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IWorkbenchPage page = workbenchWindow.getActivePage(); - final IWorkbenchPart activePart = page.getActivePart(); - if (activePart instanceof ISetSelectionTarget) { - final ISelection targetSelection = new StructuredSelection(modelFile); - getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - ((ISetSelectionTarget)activePart).selectReveal(targetSelection); - } - }); - } - - // Open an editor on the new file. - // - try { - page.openEditor - (new FileEditorInput(modelFile), - workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); - } - catch (PartInitException exception) { - MessageDialog.openError(workbenchWindow.getShell(), "Could not init editor", exception.getMessage()); //$NON-NLS-1$ - return false; - } - - return true; - } - catch (Exception exception) { - MessageDialog.openError(getShell(), "Error", exception.getMessage()); - return false; - } - } - - protected abstract EObject createInitialModel(); - - private IFile getModelFile() throws CoreException { - String containerName = page.getContainerName(); - String fileName = page.getFileName(); - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IResource resource = root.findMember(new Path(containerName)); - if (!resource.exists() || !(resource instanceof IContainer)) { - throwCoreException("Container \"" + containerName - + "\" does not exist."); - } - IContainer container = (IContainer) resource; - return container.getFile(new Path(fileName)); - } - - private void throwCoreException(String message) throws CoreException { - IStatus status = new Status(IStatus.ERROR, - "org.eclipse.e4.tools.emf.editor3x", IStatus.OK, message, null); - throw new CoreException(status); - } - - /** - * We will accept the selection in the workbench to see if we can initialize - * from it. - * - * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewModelFilePage.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewModelFilePage.java deleted file mode 100644 index 90154bad5a..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewModelFilePage.java +++ /dev/null @@ -1,199 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x.wizard; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.dialogs.IDialogPage; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.ContainerSelectionDialog; - -/** - * The "New" wizard page allows setting the container for the new file as well - * as the file name. The page will only accept file name without the extension - * OR with the extension that matches the expected one (e4xmi). - */ - -public class NewModelFilePage extends WizardPage { - private Text containerText; - - private Text fileText; - - private ISelection selection; - - private String defaultFilename; - - /** - * Constructor for SampleNewWizardPage. - * - * @param pageName - */ - public NewModelFilePage(ISelection selection, String defaultFilename) { - super("wizardPage"); - setTitle("Multi-page Editor File"); - setDescription("This wizard creates a new file with *.e4xmi extension that can be opened by a multi-page editor."); - this.selection = selection; - this.defaultFilename = defaultFilename; - } - - /** - * @see IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite container = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - container.setLayout(layout); - layout.numColumns = 3; - layout.verticalSpacing = 9; - Label label = new Label(container, SWT.NULL); - label.setText("&Container:"); - - containerText = new Text(container, SWT.BORDER | SWT.SINGLE); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - containerText.setLayoutData(gd); - containerText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - - Button button = new Button(container, SWT.PUSH); - button.setText("Browse..."); - button.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - handleBrowse(); - } - }); - label = new Label(container, SWT.NULL); - label.setText("&File name:"); - - fileText = new Text(container, SWT.BORDER | SWT.SINGLE); - gd = new GridData(GridData.FILL_HORIZONTAL); - fileText.setLayoutData(gd); - fileText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - initialize(); - dialogChanged(); - setControl(container); - } - - /** - * Tests if the current workbench selection is a suitable container to use. - */ - - private void initialize() { - if (selection != null && selection.isEmpty() == false - && selection instanceof IStructuredSelection) { - IStructuredSelection ssel = (IStructuredSelection) selection; - if (ssel.size() > 1) - return; - Object obj = ssel.getFirstElement(); - if (obj instanceof IResource) { - IContainer container; - if (obj instanceof IContainer) - container = (IContainer) obj; - else - container = ((IResource) obj).getParent(); - containerText.setText(container.getFullPath().toString()); - } - } - fileText.setText(defaultFilename); - } - - /** - * Uses the standard container selection dialog to choose the new value for - * the container field. - */ - - private void handleBrowse() { - ContainerSelectionDialog dialog = new ContainerSelectionDialog( - getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, - "Select new file container"); - if (dialog.open() == ContainerSelectionDialog.OK) { - Object[] result = dialog.getResult(); - if (result.length == 1) { - containerText.setText(((Path) result[0]).toString()); - } - } - } - - /** - * Ensures that both text fields are set. - */ - - private void dialogChanged() { - IResource container = ResourcesPlugin.getWorkspace().getRoot() - .findMember(new Path(getContainerName())); - String fileName = getFileName(); - - if (getContainerName().length() == 0) { - updateStatus("File container must be specified"); - return; - } - if (container == null - || (container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) { - updateStatus("File container must exist"); - return; - } - if (!container.isAccessible()) { - updateStatus("Project must be writable"); - return; - } - if (fileName.length() == 0) { - updateStatus("File name must be specified"); - return; - } - if (fileName.replace('\\', '/').indexOf('/', 1) > 0) { - updateStatus("File name must be valid"); - return; - } - int dotLoc = fileName.lastIndexOf('.'); - if (dotLoc != -1) { - String ext = fileName.substring(dotLoc + 1); - if (ext.equalsIgnoreCase("e4xmi") == false) { - updateStatus("File extension must be \"e4xmi\""); - return; - } - } - updateStatus(null); - } - - private void updateStatus(String message) { - setErrorMessage(message); - setPageComplete(message == null); - } - - public String getContainerName() { - return containerText.getText(); - } - - public String getFileName() { - return fileText.getText(); - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index bd341a4098..49f07ca6d0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -26,7 +26,8 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.equinox.registry;bundle-version="3.5.0", org.eclipse.e4.core.contexts;bundle-version="0.9.0", org.eclipse.e4.ui.di;bundle-version="0.9.0", - javax.annotation;bundle-version="1.0.0" + javax.annotation;bundle-version="1.0.0", + org.eclipse.e4.tools.services;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Import-Package: javax.inject;version="1.0.0", org.eclipse.core.runtime.jobs, diff --git a/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd b/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd index 57b8c96b0d..471aa2881a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd +++ b/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd @@ -21,6 +21,7 @@ + @@ -101,6 +102,21 @@ + + + + + + + + + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IContributionClassCreator.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IContributionClassCreator.java new file mode 100644 index 0000000000..d60729a6bc --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IContributionClassCreator.java @@ -0,0 +1,13 @@ +package org.eclipse.e4.tools.emf.ui.common; + +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.ui.model.application.MContribution; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.widgets.Shell; + +public interface IContributionClassCreator { + public boolean isSupported(EClass element); + + public void createOpen(MContribution contribution, EditingDomain domain, IProject project, Shell shell); +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/MemoryTransfer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/MemoryTransfer.java new file mode 100644 index 0000000000..4e378b5ccd --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/MemoryTransfer.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.common; + +import java.util.UUID; +import org.eclipse.swt.dnd.ByteArrayTransfer; +import org.eclipse.swt.dnd.TransferData; + +public class MemoryTransfer extends ByteArrayTransfer { + private static final String NAME = MemoryTransfer.class.getName() + ".tranfername"; //$NON-NLS-1$ + + private static final int ID = registerType(NAME); + + private static MemoryTransfer INSTANCE; + + private String uid; + + private Object object; + + public static MemoryTransfer getInstance() { + if (INSTANCE == null) { + INSTANCE = new MemoryTransfer(); + } + return INSTANCE; + } + + @Override + protected int[] getTypeIds() { + return new int[] { ID }; + } + + @Override + protected String[] getTypeNames() { + return new String[] { NAME }; + } + + public void javaToNative(Object object, TransferData transferData) { + this.uid = UUID.randomUUID().toString(); + this.object = object; + if (transferData != null) { + super.javaToNative(uid.getBytes(), transferData); + } + } + + public Object nativeToJava(TransferData transferData) { + byte[] bytes = (byte[]) super.nativeToJava(transferData); + if (bytes == null) + return null; + + if (new String(bytes).equals(uid)) { + return object; + } + return null; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 23b38b7d2d..4a889e3223 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -10,22 +10,11 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; - -import org.eclipse.swt.widgets.TreeItem; - -import javax.annotation.PostConstruct; - -import org.eclipse.e4.ui.internal.workbench.E4XMIResource; - -import org.eclipse.e4.ui.model.application.ui.basic.MPart; - import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.annotation.PreDestroy; import javax.inject.Inject; import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -36,6 +25,7 @@ import org.eclipse.core.databinding.observable.set.ISetChangeListener; import org.eclipse.core.databinding.observable.set.SetChangeEvent; import org.eclipse.core.databinding.observable.set.WritableSet; +import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; @@ -46,11 +36,14 @@ import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.core.services.contributions.IContributionFactory; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.common.IEditorDescriptor; import org.eclipse.e4.tools.emf.ui.common.IEditorFeature; import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.ISelectionProviderService; +import org.eclipse.e4.tools.emf.ui.common.MemoryTransfer; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ShadowComposite; import org.eclipse.e4.tools.emf.ui.internal.common.component.AddonsEditor; @@ -99,20 +92,36 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowSharedElementsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor; +import org.eclipse.e4.tools.services.IClipboardService; +import org.eclipse.e4.tools.services.IClipboardService.Handler; import org.eclipse.e4.ui.di.Focus; import org.eclipse.e4.ui.di.Persist; +import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.e4.ui.model.fragment.MModelFragments; import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; +import org.eclipse.e4.ui.model.internal.ModelUtils; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFProperty; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.CommandParameter; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; @@ -124,10 +133,17 @@ import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerDropAdapter; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.SashForm; import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.DragSourceAdapter; +import org.eclipse.swt.dnd.DragSourceEvent; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.dnd.TransferData; import org.eclipse.swt.events.ControlAdapter; import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.graphics.Rectangle; @@ -136,6 +152,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.TreeItem; public class ModelEditor { private static final String CSS_CLASS_KEY = "org.eclipse.e4.ui.css.CssClassName"; //$NON-NLS-1$ @@ -161,9 +178,7 @@ public class ModelEditor { private Map virtualEditors = new HashMap(); private List labelFeaturePaths = new ArrayList(); private List editorFeatures = new ArrayList(); - - // private List editors = new - // ArrayList(); + private List contributionCreator = new ArrayList(); private TreeViewer viewer; private IModelResource modelProvider; @@ -171,11 +186,12 @@ public class ModelEditor { private ISelectionProviderService selectionService; private IEclipseContext context; private boolean fragment; + private Handler clipboardHandler; @Inject @Optional - private MPart editorPart; - + private IClipboardService clipboardService; + public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project) { this.modelProvider = modelProvider; this.project = project; @@ -188,9 +204,10 @@ public ModelEditor(Composite composite, IEclipseContext context, IModelResource registerContributedEditors(); registerContributedVirtualEditors(); loadEditorFeatures(); + loadContributionCreators(); fragment = modelProvider.getRoot().get(0) instanceof MModelFragments; - + SashForm form = new SashForm(composite, SWT.HORIZONTAL); form.setBackground(form.getDisplay().getSystemColor(SWT.COLOR_WHITE)); @@ -224,7 +241,7 @@ public ModelEditor(Composite composite, IEclipseContext context, IModelResource final Label textLabel = new Label(headerContainer, SWT.NONE); textLabel.setData(CSS_CLASS_KEY, "sectionHeader"); //$NON-NLS-1$ textLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - + final ScrolledComposite scrolling = new ScrolledComposite(editingArea, SWT.H_SCROLL | SWT.V_SCROLL); scrolling.setBackgroundMode(SWT.INHERIT_DEFAULT); scrolling.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ @@ -239,7 +256,7 @@ public ModelEditor(Composite composite, IEclipseContext context, IModelResource scrolling.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { Rectangle r = scrolling.getClientArea(); - scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); + scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); } }); @@ -278,7 +295,7 @@ public void selectionChanged(SelectionChangedEvent event) { Rectangle r = scrolling.getClientArea(); scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); scrolling.setOrigin(0, 0); - scrolling.layout(true,true); + scrolling.layout(true, true); if (selectionService != null) { selectionService.setSelection(s.getFirstElement()); @@ -320,6 +337,33 @@ public void menuAboutToShow(IMenuManager manager) { viewer.getControl().setMenu(mgr.createContextMenu(viewer.getControl())); } + private void loadContributionCreators() { + IExtensionRegistry registry = RegistryFactory.getRegistry(); + IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ + + for (IConfigurationElement el : extPoint.getConfigurationElements()) { + if (!"contributionClassCreator".equals(el.getName())) { //$NON-NLS-1$ + continue; + } + + try { + contributionCreator.add((IContributionClassCreator) el.createExecutableExtension("class")); //$NON-NLS-1$ + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + public IContributionClassCreator getContributionCreator(EClass eClass) { + for (IContributionClassCreator c : contributionCreator) { + if (c.isSupported(eClass)) { + return c; + } + } + return null; + } + private void loadEditorFeatures() { IExtensionRegistry registry = RegistryFactory.getRegistry(); IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ @@ -328,7 +372,7 @@ private void loadEditorFeatures() { if (!"editorfeature".equals(el.getName())) { //$NON-NLS-1$ continue; } - + try { editorFeatures.add((IEditorFeature) el.createExecutableExtension("class")); //$NON-NLS-1$ } catch (CoreException e) { @@ -337,22 +381,22 @@ private void loadEditorFeatures() { } } } - + public boolean isModelFragment() { return fragment; } - + public boolean isLiveModel() { - return ! modelProvider.isSaveable(); + return !modelProvider.isSaveable(); } - + public List getFeatureClasses(EClass eClass, EStructuralFeature feature) { List list = new ArrayList(); - - for( IEditorFeature f : editorFeatures ) { + + for (IEditorFeature f : editorFeatures) { list.addAll(f.getFeatureClasses(eClass, feature)); } - + return list; } @@ -366,12 +410,6 @@ public void setSelectionService(@Optional ISelectionProviderService selectionSer } } - // @Inject - // public void updateSelection(@Optional @Named(IServiceConstants.SELECTION) - // Object selection ) { - // System.err.println("The selection: " + selection); - // } - private TreeViewer createTreeViewerArea(Composite parent) { parent = new Composite(parent, SWT.NONE); parent.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ @@ -418,6 +456,26 @@ public void handleMapChange(MapChangeEvent event) { viewer.setInput(modelProvider.getRoot()); viewer.expandToLevel(2); + // ViewerDropAdapter adapter = new ViewerDropAdapter(viewer) { + // + // @Override + // public boolean validateDrop(Object target, int operation, + // TransferData transferType) { + // // TODO Auto-generated method stub + // return false; + // } + // + // @Override + // public boolean performDrop(Object data) { + // // TODO Auto-generated method stub + // return false; + // } + // }; + // adapter.setFeedbackEnabled(true); + + int ops = DND.DROP_MOVE; + viewer.addDragSupport(ops, new Transfer[] { MemoryTransfer.getInstance() }, new DragListener(viewer)); + viewer.addDropSupport(ops, new Transfer[] { MemoryTransfer.getInstance() }, new DropListener(viewer, modelProvider.getEditingDomain())); return viewer; } @@ -454,7 +512,7 @@ private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_WINDOW_SHARED_ELEMENTS, new VWindowSharedElementsEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_MODEL_FRAGEMENTS, new VModelFragmentsEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_MODEL_IMPORTS, new VModelImportsEditor(modelProvider.getEditingDomain(), this)); - + } private void registerVirtualEditor(String id, AbstractComponentEditor editor) { @@ -488,12 +546,12 @@ private void registerContributedEditors() { } private void registerDefaultEditors() { - registerEditor(ApplicationPackageImpl.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain(),this)); - registerEditor(ApplicationPackageImpl.Literals.ADDON, new AddonsEditor(modelProvider.getEditingDomain(),this, project)); + registerEditor(ApplicationPackageImpl.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain(), this)); + registerEditor(ApplicationPackageImpl.Literals.ADDON, new AddonsEditor(modelProvider.getEditingDomain(), this, project)); - registerEditor(CommandsPackageImpl.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(),this, modelProvider)); - registerEditor(CommandsPackageImpl.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain(),this, modelProvider, project)); - registerEditor(CommandsPackageImpl.Literals.COMMAND, new CommandEditor(modelProvider.getEditingDomain(),this)); + registerEditor(CommandsPackageImpl.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(), this, modelProvider)); + registerEditor(CommandsPackageImpl.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain(), this, modelProvider, project)); + registerEditor(CommandsPackageImpl.Literals.COMMAND, new CommandEditor(modelProvider.getEditingDomain(), this)); registerEditor(CommandsPackageImpl.Literals.BINDING_TABLE, new BindingTableEditor(modelProvider.getEditingDomain(), this)); registerEditor(MenuPackageImpl.Literals.TOOL_BAR, new ToolBarEditor(modelProvider.getEditingDomain(), this)); @@ -506,11 +564,10 @@ private void registerDefaultEditors() { registerEditor(MenuPackageImpl.Literals.MENU_SEPARATOR, new MenuSeparatorEditor(modelProvider.getEditingDomain(), this)); registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), this, project, modelProvider)); registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this, project)); - registerEditor(MenuPackageImpl.Literals.MENU_CONTRIBUTION, new MenuContributionEditor(modelProvider.getEditingDomain(),project, this)); - registerEditor(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION, new ToolBarContributionEditor(modelProvider.getEditingDomain(),project, this)); - registerEditor(MenuPackageImpl.Literals.TRIM_CONTRIBUTION, new TrimContributionEditor(modelProvider.getEditingDomain(),project, this)); - - + registerEditor(MenuPackageImpl.Literals.MENU_CONTRIBUTION, new MenuContributionEditor(modelProvider.getEditingDomain(), project, this)); + registerEditor(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION, new ToolBarContributionEditor(modelProvider.getEditingDomain(), project, this)); + registerEditor(MenuPackageImpl.Literals.TRIM_CONTRIBUTION, new TrimContributionEditor(modelProvider.getEditingDomain(), project, this)); + registerEditor(BasicPackageImpl.Literals.PART, new PartEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(BasicPackageImpl.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(BasicPackageImpl.Literals.TRIMMED_WINDOW, new TrimmedWindowEditor(modelProvider.getEditingDomain(), this, project)); @@ -523,10 +580,10 @@ private void registerDefaultEditors() { registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, new PerspectiveStackEditor(modelProvider.getEditingDomain(), this)); registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE, new PerspectiveEditor(modelProvider.getEditingDomain(), project, this)); - registerEditor(AdvancedPackageImpl.Literals.PLACEHOLDER, new PlaceholderEditor(modelProvider.getEditingDomain(),this,modelProvider)); - + registerEditor(AdvancedPackageImpl.Literals.PLACEHOLDER, new PlaceholderEditor(modelProvider.getEditingDomain(), this, modelProvider)); + registerEditor(FragmentPackageImpl.Literals.MODEL_FRAGMENTS, new ModelFragmentsEditor(modelProvider.getEditingDomain(), this)); - registerEditor(FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT, new StringModelFragment(modelProvider.getEditingDomain(),this)); + registerEditor(FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT, new StringModelFragment(modelProvider.getEditingDomain(), this)); } public void registerEditor(EClass eClass, AbstractComponentEditor editor) { @@ -563,10 +620,10 @@ private boolean equalsPaths(FeaturePath p1, FeaturePath p2) { public AbstractComponentEditor getEditor(EClass eClass) { AbstractComponentEditor editor = editorMap.get(eClass); - if( editor == null ) { - for( EClass cl : eClass.getESuperTypes() ) { + if (editor == null) { + for (EClass cl : eClass.getESuperTypes()) { editor = getEditor(cl); - if( editor != null ) { + if (editor != null) { return editor; } } @@ -583,14 +640,89 @@ public void doSave(@Optional IProgressMonitor monitor) { @Focus public void setFocus() { + if (clipboardHandler == null) { + clipboardHandler = new ClipboardHandler(); + } + clipboardService.setHandler(clipboardHandler); viewer.getControl().setFocus(); } - private static class TreeStructureAdvisorImpl extends TreeStructureAdvisor { + public IModelResource getModelProvider() { + return modelProvider; + } + + class ClipboardHandler implements Handler { + + public void paste() { + Clipboard clip = new Clipboard(viewer.getControl().getDisplay()); + Object o = clip.getContents(MemoryTransfer.getInstance()); + clip.dispose(); + if (o == null) { + return; + } + + Object parent = ((IStructuredSelection) viewer.getSelection()).getFirstElement(); + + EStructuralFeature feature = null; + EObject container = null; + if (parent instanceof VirtualEntry) { + VirtualEntry v = (VirtualEntry) parent; + feature = ((IEMFProperty) v.getProperty()).getStructuralFeature(); + container = (EObject) v.getOriginalParent(); + } else { + if (parent instanceof MElementContainer) { + feature = UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN; + container = (EObject) parent; + } else if (parent instanceof EObject) { + container = (EObject) parent; + EClass eClass = container.eClass(); + + for (EStructuralFeature f : eClass.getEAllStructuralFeatures()) { + if (ModelUtils.getTypeArgument(eClass, f.getEGenericType()).isInstance(o)) { + feature = f; + break; + } + } + } + } + + if (feature != null && container != null) { + Command cmd = AddCommand.create(getModelProvider().getEditingDomain(), container, feature, o); + if (cmd.canExecute()) { + getModelProvider().getEditingDomain().getCommandStack().execute(cmd); + } + } + } + + public void copy() { + Object o = ((IStructuredSelection) viewer.getSelection()).getFirstElement(); + if (o != null && o instanceof EObject) { + Clipboard clip = new Clipboard(viewer.getControl().getDisplay()); + clip.setContents(new Object[] { EcoreUtil.copy((EObject) o) }, new Transfer[] { MemoryTransfer.getInstance() }); + clip.dispose(); + } + } + + public void cut() { + Object o = ((IStructuredSelection) viewer.getSelection()).getFirstElement(); + if (o != null && o instanceof EObject) { + Clipboard clip = new Clipboard(viewer.getControl().getDisplay()); + clip.setContents(new Object[] { o }, new Transfer[] { MemoryTransfer.getInstance() }); + clip.dispose(); + EObject eObj = (EObject) o; + Command cmd = RemoveCommand.create(getModelProvider().getEditingDomain(), eObj.eContainer(), eObj.eContainingFeature(), eObj); + if (cmd.canExecute()) { + getModelProvider().getEditingDomain().getCommandStack().execute(cmd); + } + } + } + } + + static class TreeStructureAdvisorImpl extends TreeStructureAdvisor { } - private class ObservableFactoryImpl implements IObservableFactory { + class ObservableFactoryImpl implements IObservableFactory { public IObservable createObservable(Object target) { if (target instanceof IObservableList) { @@ -607,4 +739,173 @@ public IObservable createObservable(Object target) { return null; } } + + static class DragListener extends DragSourceAdapter { + private final TreeViewer viewer; + + public DragListener(TreeViewer viewer) { + this.viewer = viewer; + } + + @Override + public void dragStart(DragSourceEvent event) { + IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); + event.doit = !selection.isEmpty() && selection.getFirstElement() instanceof MApplicationElement; + } + + @Override + public void dragSetData(DragSourceEvent event) { + IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); + Object o = selection.getFirstElement(); + event.data = o; + } + } + + static class DropListener extends ViewerDropAdapter { + private EditingDomain domain; + + protected DropListener(Viewer viewer, EditingDomain domain) { + super(viewer); + this.domain = domain; + } + + @Override + public boolean performDrop(Object data) { + if (getCurrentLocation() == LOCATION_ON) { + EStructuralFeature feature = null; + EObject parent = null; + if (getCurrentTarget() instanceof MElementContainer) { + feature = UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN; + parent = (EObject) getCurrentTarget(); + } else if (getCurrentTarget() instanceof VirtualEntry) { + VirtualEntry entry = (VirtualEntry) getCurrentTarget(); + IListProperty prop = entry.getProperty(); + if (prop instanceof IEMFProperty) { + feature = ((IEMFProperty) prop).getStructuralFeature(); + parent = (EObject) entry.getOriginalParent(); + + } + } else if (getCurrentTarget() instanceof EObject) { + parent = (EObject) getCurrentTarget(); + for (EStructuralFeature f : parent.eClass().getEAllStructuralFeatures()) { + EClassifier cl = ModelUtils.getTypeArgument(parent.eClass(), f.getEGenericType()); + if (cl.isInstance(data)) { + feature = f; + break; + } + } + } + + if (feature != null && parent != null) { + Command cmd = AddCommand.create(domain, parent, feature, data); + if (cmd.canExecute()) { + domain.getCommandStack().execute(cmd); + } + } + } else if (getCurrentLocation() == LOCATION_AFTER || getCurrentLocation() == LOCATION_BEFORE) { + EStructuralFeature feature = null; + EObject parent = null; + + TreeItem item = (TreeItem) getCurrentEvent().item; + if (item != null) { + TreeItem parentItem = item.getParentItem(); + if (item != null) { + if (parentItem.getData() instanceof VirtualEntry) { + VirtualEntry vE = (VirtualEntry) parentItem.getData(); + parent = (EObject) vE.getOriginalParent(); + feature = ((IEMFProperty) vE.getProperty()).getStructuralFeature(); + } else if (parentItem.getData() instanceof MElementContainer) { + parent = (EObject) parentItem.getData(); + feature = UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN; + } else if (parentItem.getData() instanceof EObject) { + parent = (EObject) parentItem.getData(); + for (EStructuralFeature f : parent.eClass().getEAllStructuralFeatures()) { + EClassifier cl = ModelUtils.getTypeArgument(parent.eClass(), f.getEGenericType()); + if (cl.isInstance(data)) { + feature = f; + break; + } + } + } + } + } + + if (feature != null && parent != null) { + List list = (List) parent.eGet(feature); + int index = list.indexOf(getCurrentTarget()); + + if (index >= list.size()) { + index = CommandParameter.NO_INDEX; + } + + if (parent == ((EObject) data).eContainer()) { + Command cmd = MoveCommand.create(domain, parent, feature, data, index); + if (cmd.canExecute()) { + domain.getCommandStack().execute(cmd); + } + } else { + Command cmd = AddCommand.create(domain, parent, feature, data, index); + if (cmd.canExecute()) { + domain.getCommandStack().execute(cmd); + } + } + } + } + + return false; + } + + @Override + public boolean validateDrop(Object target, int operation, TransferData transferType) { + boolean rv = false; + if (getSelectedObject() instanceof MApplicationElement) { + if (getCurrentLocation() == LOCATION_ON) { + rv = isValidDrop(target, (MApplicationElement) getSelectedObject(), false); + } else if (getCurrentLocation() == LOCATION_AFTER || getCurrentLocation() == LOCATION_BEFORE) { + TreeItem item = (TreeItem) getCurrentEvent().item; + if (item != null) { + item = item.getParentItem(); + if (item != null) { + rv = isValidDrop(item.getData(), (MApplicationElement) getSelectedObject(), true); + } + } + } + } + + return rv; + } + + private boolean isValidDrop(Object target, MApplicationElement instance, boolean isIndex) { + if (target instanceof MElementContainer) { + MElementContainer container = (MElementContainer) target; + + if (isIndex || !container.getChildren().contains(instance)) { + EClassifier classifier = ModelUtils.getTypeArgument(((EObject) container).eClass(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN.getEGenericType()); + return classifier.isInstance(instance); + } + } else if (target instanceof VirtualEntry) { + VirtualEntry vTarget = (VirtualEntry) target; + if (isIndex || !vTarget.getList().contains(instance)) { + if (vTarget.getProperty() instanceof IEMFProperty) { + EStructuralFeature feature = ((IEMFProperty) vTarget.getProperty()).getStructuralFeature(); + EObject parent = (EObject) vTarget.getOriginalParent(); + EClassifier classifier = ModelUtils.getTypeArgument(parent.eClass(), feature.getEGenericType()); + return classifier.isInstance(instance); + } + + } + } else if (target instanceof EObject) { + EObject eObj = (EObject) target; + for (EStructuralFeature f : eObj.eClass().getEAllStructuralFeatures()) { + EClassifier cl = ModelUtils.getTypeArgument(eObj.eClass(), f.getEGenericType()); + if (cl.isInstance(instance)) { + return true; + } + } + } + + return false; + } + } + } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java index 84d6af1a45..575102da79 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java @@ -10,12 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; -import org.eclipse.core.databinding.observable.DisposeEvent; -import org.eclipse.core.databinding.observable.IDisposeListener; - -import org.eclipse.core.databinding.observable.DisposeEvent; -import org.eclipse.core.databinding.observable.IDisposeListener; - import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.Diffs; @@ -31,11 +25,13 @@ public abstract class VirtualEntry { private Object originalParent; private String label; private IObservableList list; + private IListProperty property; public VirtualEntry(String id, IListProperty property, Object originalParent, String label) { this.id = id; this.originalParent = originalParent; this.label = label; + this.property = property; this.list = new WritableList(); final IObservableList origList = property.observe(originalParent); list.addAll(cleanedList(origList)); @@ -43,23 +39,27 @@ public VirtualEntry(String id, IListProperty property, Object originalParent, St final IListChangeListener listener = new IListChangeListener() { public void handleListChange(ListChangeEvent event) { - if( ! VirtualEntry.this.list.isDisposed() ) { + if (!VirtualEntry.this.list.isDisposed()) { List clean = cleanedList(event.getObservableList()); ListDiff diff = Diffs.computeListDiff(VirtualEntry.this.list, clean); - diff.applyTo(VirtualEntry.this.list); + diff.applyTo(VirtualEntry.this.list); } } }; - + origList.addListChangeListener(listener); } + public IListProperty getProperty() { + return property; + } + @SuppressWarnings("unchecked") private List cleanedList(IObservableList list) { List l = new ArrayList(list.size()); - for( Object o : list ) { - if( accepted((M) o) ) { + for (Object o : list) { + if (accepted((M) o)) { l.add(o); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index 45998f7875..436c59b0a6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -14,11 +14,13 @@ import java.net.URL; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; @@ -33,6 +35,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Link; import org.eclipse.swt.widgets.Text; public class DirectMenuItemEditor extends MenuItemEditor { @@ -72,9 +75,22 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con // ------------------------------------------------------------ { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.DirectMenuItemEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + final IContributionClassCreator c = getEditor().getContributionCreator(MenuPackageImpl.Literals.DIRECT_MENU_ITEM); + if (project != null && c != null) { + final Link l = new Link(parent, SWT.NONE); + l.setText("" + Messages.DirectMenuItemEditor_ClassURI + ""); //$NON-NLS-1$//$NON-NLS-2$ + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + l.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project, l.getShell()); + } + }); + } else { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.DirectMenuItemEditor_ClassURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + } Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index 43f64ed338..13adde111b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -10,16 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; @@ -34,13 +35,14 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Link; import org.eclipse.swt.widgets.Text; public class DirectToolItemEditor extends ToolItemEditor { private Image image; public DirectToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain,editor, project); + super(editingDomain, editor, project); } @Override @@ -57,27 +59,39 @@ public Image getImage(Object element, Display display) { return image; } - @Override protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, WritableValue master) { IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.DirectToolItemEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + final IContributionClassCreator c = getEditor().getContributionCreator(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM); + if (project != null && c != null) { + final Link l = new Link(parent, SWT.NONE); + l.setText("" + Messages.DirectMenuItemEditor_ClassURI + ""); //$NON-NLS-1$//$NON-NLS-2$ + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + l.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project, l.getShell()); + } + }); + } else { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.DirectToolItemEditor_ClassURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + } Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value( getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); - final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.DirectToolItemEditor_Find); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); dialog.open(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 6788e92afe..4caa6b8315 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -16,6 +16,7 @@ import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -45,6 +46,7 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Link; import org.eclipse.swt.widgets.Text; public class HandlerEditor extends AbstractComponentEditor { @@ -167,9 +169,22 @@ public void widgetSelected(SelectionEvent e) { // ------------------------------------------------------------ { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.HandlerEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + final IContributionClassCreator c = getEditor().getContributionCreator(CommandsPackageImpl.Literals.HANDLER); + if (project != null && c != null) { + final Link l = new Link(parent, SWT.NONE); + l.setText("" + Messages.HandlerEditor_ClassURI + ""); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + l.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project, l.getShell()); + } + }); + } else { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.HandlerEditor_ClassURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + } Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 00e32c6653..01f8d314df 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -22,6 +22,7 @@ import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -67,6 +68,7 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Link; import org.eclipse.swt.widgets.Text; public class PartEditor extends AbstractComponentEditor { @@ -237,9 +239,22 @@ public void widgetSelected(SelectionEvent e) { // ------------------------------------------------------------ { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + final IContributionClassCreator c = getEditor().getContributionCreator(BasicPackageImpl.Literals.PART); + if (project != null && c != null) { + final Link l = new Link(parent, SWT.NONE); + l.setText("" + Messages.PartEditor_ClassURI + ""); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + l.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project, l.getShell()); + } + }); + } else { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.PartEditor_ClassURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + } Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IClipboardService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IClipboardService.java new file mode 100644 index 0000000000..2f1f796afe --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IClipboardService.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.services; + +public interface IClipboardService { + public void copy(); + public void paste(); + public void cut(); + public void setHandler(Handler handler); + + public interface Handler { + public void paste(); + public void copy(); + public void cut(); +// public boolean canCopy(); +// public boolean canPaste(); + } +} From 76696fd31ef47d2ce1ab1050b2a2fb64d17a8426 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 5 Jul 2010 12:57:57 +0000 Subject: [PATCH 0173/1286] Bug 308439 - Correct plugin for e4 wizards * adding new bundle --- features/org.eclipse.e4.core.tools.feature/feature.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/features/org.eclipse.e4.core.tools.feature/feature.xml b/features/org.eclipse.e4.core.tools.feature/feature.xml index 0106e2cb24..1ce569e119 100644 --- a/features/org.eclipse.e4.core.tools.feature/feature.xml +++ b/features/org.eclipse.e4.core.tools.feature/feature.xml @@ -52,4 +52,11 @@ version="0.0.0" unpack="false"/> + + From 77f0868b5ea3e9df95144e9e2c6e163cc6c37a02 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 5 Jul 2010 13:26:48 +0000 Subject: [PATCH 0174/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * open the created class immediately --- .../emf/editor3x/extension/HandlerContributionEditor.java | 1 - .../emf/editor3x/extension/PartContributionEditor.java | 1 - .../tools/wizards/classes/AbstractNewClassWizard.java | 6 ++++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java index b2bc2a31b9..e90faa7331 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java @@ -60,7 +60,6 @@ public void createOpen(MContribution contribution, EditingDomain domain, IProjec if( cmd.canExecute() ) { domain.getCommandStack().execute(cmd); } - el.open(null); } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java index 65195eacc6..154e887df0 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java @@ -52,7 +52,6 @@ public void createOpen(MContribution contribution, EditingDomain domain, if( cmd.canExecute() ) { domain.getCommandStack().execute(cmd); } - el.open(null); } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java index bb7178c10b..2aae8de99a 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java @@ -17,6 +17,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.e4.internal.tools.wizards.classes.AbstractNewClassPage.JavaClass; +import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageFragment; @@ -117,8 +118,8 @@ public boolean performFinish() { IPackageFragment fragment = clazz.getPackageFragment(); if (fragment != null) { String cuName = clazz.getName() + ".java"; - IResource resource = fragment.getCompilationUnit(cuName) - .getResource(); + ICompilationUnit unit = fragment.getCompilationUnit(cuName); + IResource resource = unit.getResource(); file = (IFile) resource; try { if (!file.exists()) { @@ -128,6 +129,7 @@ public boolean performFinish() { file.setContents(new ByteArrayInputStream(content.getBytes()), IFile.FORCE | IFile.KEEP_HISTORY, null); } + unit.open(null); } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); From d61a0165f9c40106909cfb2ea6a620bcf7be6648 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 5 Jul 2010 17:05:15 +0000 Subject: [PATCH 0175/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * align with other workbench wizards where labels are positioned to the right --- .../tools/wizards/classes/AbstractNewClassPage.java | 3 --- .../tools/wizards/classes/NewHandlerClassWizard.java | 4 ---- .../tools/wizards/classes/NewPartClassWizard.java | 8 -------- 3 files changed, 15 deletions(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java index 2452e1f963..37ab73c963 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java @@ -143,7 +143,6 @@ public void widgetDisposed(DisposeEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText("Source folder"); - l.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -171,7 +170,6 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); - l.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false)); l.setText("Package"); Text t = new Text(parent, SWT.BORDER); @@ -207,7 +205,6 @@ public void widgetSelected(SelectionEvent e) { IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); Label l = new Label(parent, SWT.NONE); - l.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false)); l.setText("Name"); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java index 52009c9e0d..4fc4f47930 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java @@ -51,8 +51,6 @@ protected void createFields(Composite parent, DataBindingContext dbc) { { Label l = new Label(parent, SWT.NONE); l.setText("Execute Method"); - l.setLayoutData(new GridData(GridData.END, GridData.CENTER, - false, false)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -67,8 +65,6 @@ protected void createFields(Composite parent, DataBindingContext dbc) { { Label l = new Label(parent, SWT.NONE); l.setText("Can-Execute Method"); - l.setLayoutData(new GridData(GridData.END, GridData.CENTER, - false, false)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java index 35c70947d8..d33ffbdc7e 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java @@ -45,8 +45,6 @@ protected void createFields(Composite parent, DataBindingContext dbc) { { Label l = new Label(parent, SWT.NONE); l.setText("PostContruct Method"); - l.setLayoutData(new GridData(GridData.END, GridData.CENTER, - false, false)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -68,8 +66,6 @@ protected void createFields(Composite parent, DataBindingContext dbc) { { Label l = new Label(parent, SWT.NONE); l.setText("Predestroy Method"); - l.setLayoutData(new GridData(GridData.END, GridData.CENTER, - false, false)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -91,8 +87,6 @@ protected void createFields(Composite parent, DataBindingContext dbc) { { Label l = new Label(parent, SWT.NONE); l.setText("Focus Method"); - l.setLayoutData(new GridData(GridData.END, GridData.CENTER, - false, false)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -114,8 +108,6 @@ protected void createFields(Composite parent, DataBindingContext dbc) { { Label l = new Label(parent, SWT.NONE); l.setText("Persist Method"); - l.setLayoutData(new GridData(GridData.END, GridData.CENTER, - false, false)); Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); From 6cbad75f1859b4af3a6f65f1d09c3798320baa82 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 5 Jul 2010 17:46:22 +0000 Subject: [PATCH 0176/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * removed unneeded code --- .../ui/internal/common/component/MenuContributionEditor.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index 8593eb2718..0be1b71242 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -70,7 +70,6 @@ public class MenuContributionEditor extends AbstractComponentEditor { private Composite composite; private Image image; private EMFDataBindingContext context; - private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; @@ -89,7 +88,6 @@ public Struct(String label, EClass eClass, boolean separator) { public MenuContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { super(editingDomain, editor); - this.project = project; } @Override From 4667478f703b792d431df8d745cae15505989c98 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 5 Jul 2010 18:11:10 +0000 Subject: [PATCH 0177/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * added better binding context handling --- .../full/modelelements/BindingContext.gif | Bin 0 -> 596 bytes .../emf/ui/internal/common/ModelEditor.java | 2 + .../common/component/ApplicationEditor.java | 81 +++++- .../component/BindingContextEditor.java | 274 ++++++++++++++++++ .../common/component/ControlFactory.java | 13 + .../virtual/VBindingTableEditor.java | 270 +---------------- 6 files changed, 373 insertions(+), 267 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingContext.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingContext.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingContext.gif new file mode 100644 index 0000000000000000000000000000000000000000..50445d99b8bdd3b440f82a5bf2c706251a699db8 GIT binary patch literal 596 zcmZ?wbhEHb6krfwc*Xz%|NsC0@Zrac7atCs_~078sG?y;L&t&xCvId^OekoWp%Ktw z5HZ0bVTMD-0*8zl8W9r=5+)Q(*l^;)jR!A21kAV)vEW9=iW?p?E+nkDQL*7h!;S|N z4m`L3H1Nld4?lhgWw;1uxQS%C$rSpDWxGq{xJ%}ED3%4v6nM$xdMK3#s#FGR)P|{5 z2dh^Fdo54#S&{0$GA(djdd9ZIoSjMY&h#w4(3co*n;7p{kz-bvX4PI~lo@Z^kYm)4 zW0n}{IIU8@zev9@-U{douy2MKq4<-9k%7UPK?me+P@FKZZ)|X8DZe(OV!K$opU}&V_=xlwAb+ekWiK?cYwX@xo%}R(ModelEditor.VIRTUAL_ADDONS, APPLICATION__ADDONS, element, Messages.ApplicationEditor_Addons) { @Override @@ -195,6 +248,30 @@ protected boolean accepted(Object o) { } }); + MApplication application = (MApplication) element; + if (application.getRootContext() != null) { + list.add(0, application.getRootContext()); + } + + BINDING_TABLE_CONTAINER__ROOT_CONTEXT.observe(element).addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + if (event.diff.getOldValue() != null) { + list.remove(event.diff.getOldValue()); + if (getMaster().getValue() == element) { + createRemoveRootContext.setSelection(false); + } + } + + if (event.diff.getNewValue() != null) { + list.add(0, event.diff.getNewValue()); + if (getMaster().getValue() == element) { + createRemoveRootContext.setSelection(true); + } + } + } + }); + return list; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java new file mode 100644 index 0000000000..506f378725 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java @@ -0,0 +1,274 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.commands.MBindingContext; +import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class BindingContextEditor extends AbstractComponentEditor { + private Composite composite; + private Image image; + private EMFDataBindingContext context; + + private EStackLayout stackLayout; + private IListProperty BINDING_CONTEXT__CHILDREN = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN); + + public BindingContextEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain, editor); + } + + @Override + public Image getImage(Object element, Display display) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingContext.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "Binding Context"; + } + + @Override + public String getDetailLabel(Object element) { + MBindingContext context = (MBindingContext) element; + if (context.getName() != null && context.getName().trim().length() > 0) { + return context.getName().trim(); + } else if (context.getElementId() != null && context.getElementId().trim().length() > 0) { + return context.getElementId().trim(); + } + return null; + } + + @Override + public String getDescription(Object element) { + return "Binding Context Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new EStackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } + } + + if (getEditor().isModelFragment()) { + Control topControl; + if (Util.isImport((EObject) object)) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if (stackLayout.topControl != topControl) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + if (isImport) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + + ControlFactory.createTextField(parent, "Id", master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); + ControlFactory.createTextField(parent, "Name", master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME)); + ControlFactory.createTextField(parent, "Description", master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_CONTEXT__DESCRIPTION)); + + Label l = new Label(parent, SWT.NONE); + l.setText("Childcontexts"); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); + + final TableViewer viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + + IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN); + viewer.setInput(prop.observeDetail(master)); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MBindingContext container = (MBindingContext) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MBindingContext container = (MBindingContext) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if (idx < container.getChildren().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MBindingContext eObject = MCommandsFactory.INSTANCE.createBindingContext(); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(eObject); + + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove ..."); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN, keybinding); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return BINDING_CONTEXT__CHILDREN.observe(element); + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 7c12c0b296..eda2300136 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -64,6 +64,19 @@ import org.eclipse.swt.widgets.Text; public class ControlFactory { + public static void createTextField(Composite parent, String label, IObservableValue master, EMFDataBindingContext context, IWidgetValueProperty textProp, IEMFEditValueProperty modelProp) { + Label l = new Label(parent, SWT.NONE); + l.setText(label); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), modelProp.observeDetail(master)); + + } + public static void createFindImport(Composite parent, final AbstractComponentEditor editor, EMFDataBindingContext context) { IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index aec316a1aa..7d66ce41f6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -10,57 +10,35 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.commands.MBindingContext; import org.eclipse.e4.ui.model.application.commands.MBindingTable; import org.eclipse.e4.ui.model.application.commands.MBindingTableContainer; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CompoundCommand; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.IEMFValueProperty; -import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider; import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ColumnViewerEditor; -import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; -import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; -import org.eclipse.jface.viewers.EditingSupport; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.TreeViewerColumn; -import org.eclipse.jface.viewers.TreeViewerEditor; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -78,7 +56,7 @@ public class VBindingTableEditor extends AbstractComponentEditor { private TreeViewer contextsViewer; public VBindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override @@ -117,244 +95,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VBindingTableEditor_Contexts); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - contextsViewer = new TreeViewer(parent); - ObservableListTreeContentProvider pv = new ObservableListTreeContentProvider(new ObservableFactoryImpl(), new TreeStructureAdvisorImpl()); - contextsViewer.setContentProvider(pv); - contextsViewer.getTree().setHeaderVisible(true); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 200; - contextsViewer.getControl().setLayoutData(gd); - - final WritableList list = new WritableList(); - - IEMFValueProperty listProp = EMFProperties.value(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT); - IObservableValue val = listProp.observeDetail(getMaster()); - val.addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - list.clear(); - MBindingContext ctx = (MBindingContext) event.getObservableValue().getValue(); - if( ctx != null ) { - list.add(ctx); - } - } - }); - - - contextsViewer.setInput(list); - - - { - IEMFValueProperty prop = EMFProperties.value(CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME); - - TreeViewerColumn column = new TreeViewerColumn(contextsViewer, SWT.NONE); - column.getColumn().setText(Messages.VBindingTableEditor_Name); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(pv.getKnownElements()))); - column.setEditingSupport(new EditingSupport(contextsViewer) { - private TextCellEditor editor = new TextCellEditor(contextsViewer.getTree()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME, value); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - MBindingContext ctx = (MBindingContext) element; - return ctx.getName() != null ? ctx.getName() : ""; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return editor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - { - IEMFValueProperty prop = EMFProperties.value(CommandsPackageImpl.Literals.BINDING_CONTEXT__DESCRIPTION); - - TreeViewerColumn column = new TreeViewerColumn(contextsViewer, SWT.NONE); - column.getColumn().setText(Messages.VBindingTableEditor_LabelDescription); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(pv.getKnownElements()))); - column.setEditingSupport(new EditingSupport(contextsViewer) { - private TextCellEditor editor = new TextCellEditor(contextsViewer.getTree()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.BINDING_CONTEXT__DESCRIPTION, value); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - MBindingContext ctx = (MBindingContext) element; - return ctx.getDescription() != null ? ctx.getDescription() : ""; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return editor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - { - IEMFValueProperty prop = EMFProperties.value(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - TreeViewerColumn column = new TreeViewerColumn(contextsViewer, SWT.NONE); - column.getColumn().setText(Messages.VBindingTableEditor_Id); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(pv.getKnownElements()))); - column.setEditingSupport(new EditingSupport(contextsViewer) { - private TextCellEditor editor = new TextCellEditor(contextsViewer.getTree()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, value); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - MBindingContext ctx = (MBindingContext) element; - return ctx.getElementId() != null ? ctx.getElementId() : ""; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return editor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(contextsViewer) { - @Override - protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { - boolean singleSelect = ((IStructuredSelection)contextsViewer.getSelection()).size() == 1; - boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent)event.sourceEvent).button == 1; - - return singleSelect && (isLeftDoubleMouseSelect - || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC - || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); - } - }; - TreeViewerEditor.create(contextsViewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.KEEP_EDITOR_ON_DOUBLE_CLICK); - - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.VBindingTableEditor_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.VBindingTableEditor_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.VBindingTableEditor_Add); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - IStructuredSelection s = (IStructuredSelection) contextsViewer.getSelection(); - MBindingContext context = MCommandsFactory.INSTANCE.createBindingContext(); - MBindingContext parentContext = null; - - if( ! s.isEmpty() ) { - parentContext = (MBindingContext) s.getFirstElement(); - Command cmd = AddCommand.create(getEditingDomain(), parentContext, CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN, context); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - contextsViewer.setSelection(new StructuredSelection(context)); - } - } else if( s.isEmpty() && ((MBindingTableContainer)getMaster().getValue()).getRootContext() == null ) { - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT, context); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - contextsViewer.setSelection(new StructuredSelection(context)); - } - } - - - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.VBindingTableEditor_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - IStructuredSelection s = (IStructuredSelection) contextsViewer.getSelection(); - if( ! s.isEmpty() ) { - List commands = new ArrayList(); - - for( Object o : s.toArray() ) { - MBindingContext ctx = (MBindingContext) o; - EObject owner = ((EObject)ctx).eContainer(); - if( owner instanceof MBindingTableContainer ) { - Command cmd = SetCommand.create(getEditingDomain(), owner, CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT, null); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - return; - } - } else { - commands.add(RemoveCommand.create(getEditingDomain(), owner, CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN, ctx)); - } - } - - CompoundCommand cmd = new CompoundCommand(commands); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - { Label l = new Label(parent, SWT.NONE); l.setText("Binding Tables"); @@ -477,16 +217,16 @@ public IObservableList getChildList(Object element) { private static class ObservableFactoryImpl implements IObservableFactory { private IEMFListProperty prop = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN); - + public IObservable createObservable(Object target) { - if( target instanceof IObservableList ) { + if (target instanceof IObservableList) { return (IObservable) target; } return prop.observe(target); } } - + private static class TreeStructureAdvisorImpl extends TreeStructureAdvisor { - + } } From f0cca7a923f555ea4bb3e83a618c7d928ef8fa48 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 5 Jul 2010 19:18:48 +0000 Subject: [PATCH 0178/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * cleaning up translations --- .../e4/tools/emf/ui/internal/Messages.java | 91 +------------- .../tools/emf/ui/internal/Messages.properties | 93 ++------------- .../common/component/BindingTableEditor.java | 8 +- .../common/component/CommandEditor.java | 8 +- .../common/component/ControlFactory.java | 8 +- .../component/HandledMenuItemEditor.java | 13 +- .../component/HandledToolItemEditor.java | 11 +- .../common/component/KeyBindingEditor.java | 8 +- .../component/MenuContributionEditor.java | 6 +- .../internal/common/component/MenuEditor.java | 6 +- .../component/ModelFragmentsEditor.java | 77 ++++++------ .../component/PartDescriptorEditor.java | 6 +- .../internal/common/component/PartEditor.java | 6 +- .../component/PartSashContainerEditor.java | 6 +- .../common/component/PartStackEditor.java | 6 +- .../common/component/PerspectiveEditor.java | 6 +- .../component/PerspectiveStackEditor.java | 8 +- .../common/component/StringModelFragment.java | 112 +++++++----------- .../component/ToolBarContributionEditor.java | 6 +- .../common/component/ToolBarEditor.java | 6 +- 20 files changed, 151 insertions(+), 340 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 1460779f1c..562e7a2ffb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -13,6 +13,12 @@ import org.eclipse.osgi.util.NLS; public class Messages { + public static String ModelTooling_Common_Up; + public static String ModelTooling_Common_Down; + public static String ModelTooling_Common_AddEllipsis; + public static String ModelTooling_Common_Add; + public static String ModelTooling_Common_Remove; + public static String AbstractCommandSelectionDialog_Label_CommandId; public static String ApplicationEditor_Label; @@ -36,10 +42,6 @@ public class Messages { public static String BindingTableEditor_Keybindings; public static String BindingTableEditor_KeySequence; public static String BindingTableEditor_Command; - public static String BindingTableEditor_Up; - public static String BindingTableEditor_Down; - public static String BindingTableEditor_Add; - public static String BindingTableEditor_Remove; public static String CommandEditor_Label; public static String CommandEditor_Description; @@ -52,10 +54,6 @@ public class Messages { public static String CommandEditor_ParameterOptional; public static String CommandEditor_ParameterOptional_No; public static String CommandEditor_ParameterOptional_Yes; - public static String CommandEditor_Up; - public static String CommandEditor_Down; - public static String CommandEditor_Add; - public static String CommandEditor_Remove; public static String CommandEditor_ParameterId; public static String DirectMenuItemEditor_Label; @@ -64,15 +62,10 @@ public class Messages { public static String DirectMenuItemEditor_Find; public static String ControlFactory_BindingContexts; - public static String ControlFactory_Add; - public static String ControlFactory_Up; - public static String ControlFactory_Down; - public static String ControlFactory_Remove; public static String ControlFactory_Tags; public static String ControlFactory_Key; public static String ControlFactory_Value; public static String ControlFactory_ContextVariables; - public static String ControlFactory_AddNoEllipse; public static String DirectToolItemEditor_ClassURI; public static String DirectToolItemEditor_Find; @@ -86,20 +79,12 @@ public class Messages { public static String HandledMenuItemEditor_Parameters; public static String HandledMenuItemEditor_Tag; public static String HandledMenuItemEditor_Value; - public static String HandledMenuItemEditor_Up; - public static String HandledMenuItemEditor_Down; - public static String HandledMenuItemEditor_Add; - public static String HandledMenuItemEditor_Remove; public static String HandledToolItemEditor_Command; public static String HandledToolItemEditor_Find; public static String HandledToolItemEditor_Parameters; public static String HandledToolItemEditor_ParametersName; public static String HandledToolItemEditor_ParametersValue; - public static String HandledToolItemEditor_Up; - public static String HandledToolItemEditor_Down; - public static String HandledToolItemEditor_Add; - public static String HandledToolItemEditor_Remove; public static String HandledToolItemEditor_Label; public static String HandledToolItemEditor_Description; @@ -122,10 +107,6 @@ public class Messages { public static String KeyBindingEditor_Parameters; public static String KeyBindingEditor_ParametersKey; public static String KeyBindingEditor_ParametersValue; - public static String KeyBindingEditor_Up; - public static String KeyBindingEditor_Down; - public static String KeyBindingEditor_Add; - public static String KeyBindingEditor_Remove; public static String MenuEditor_Label; public static String MenuEditor_Description; @@ -133,13 +114,10 @@ public class Messages { public static String MenuEditor_MenuItems; public static String MenuEditor_MenuItemType; public static String MenuEditor_MenuItemItemType; - public static String MenuEditor_Up; - public static String MenuEditor_Down; public static String MenuEditor_HandledMenuItem; public static String MenuEditor_Separator; public static String MenuEditor_Menu; public static String MenuEditor_DirectMenuItem; - public static String MenuEditor_Remove; public static String MenuEditor_LabelLabel; public static String MenuEditor_Tooltip; public static String MenuEditor_IconURI; @@ -155,32 +133,6 @@ public class Messages { public static String MenuSeparatorEditor_Label; public static String MenuSeparatorEditor_Id; - public static String ModelComponentEditor_Id; - public static String ModelComponentEditor_ParentId; - public static String ModelComponentEditor_Find; - public static String ModelComponentEditor_PositionInParent; - public static String ModelComponentEditor_Processor; - public static String ModelComponentEditor_Tags; - public static String ModelComponentEditor_Label; - public static String ModelComponentEditor_Description; - public static String ModelComponentEditor_Handlers; - public static String ModelComponentEditor_BindingTables; - public static String ModelComponentEditor_KeyBindings; - public static String ModelComponentEditor_Commands; - public static String ModelComponentEditor_Menus; - public static String ModelComponentEditor_UiChildren; - public static String ModelComponentEditor_PartDescriptors; - public static String ModelComponentEditor_DetailParentId; - public static String ModelComponentEditor_MenuContributions; - - public static String ModelComponentsEditor_Label; - public static String ModelComponentsEditor_Description; - public static String ModelComponentsEditor_ModelContributions; - public static String ModelComponentsEditor_Up; - public static String ModelComponentsEditor_Down; - public static String ModelComponentsEditor_Add; - public static String ModelComponentsEditor_Remove; - public static String PartDescriptorEditor_Label; public static String PartDescriptorEditor_Descriptor; public static String PartDescriptorEditor_Id; @@ -196,8 +148,6 @@ public class Messages { public static String PartDescriptorEditor_PersitedState; public static String PartDescriptorEditor_PersitedStateKey; public static String PartDescriptorEditor_PersitedStateValue; - public static String PartDescriptorEditor_Add; - public static String PartDescriptorEditor_Remove; public static String PartDescriptorEditor_Variables; public static String PartDescriptorEditor_Properties; public static String PartDescriptorEditor_PropertiesKey; @@ -218,8 +168,6 @@ public class Messages { public static String PartEditor_PersitedState; public static String PartEditor_PersitedStateKey; public static String PartEditor_PersitedStateValue; - public static String PartEditor_Add; - public static String PartEditor_Remove; public static String PartEditor_Menus; public static String PartEditor_Handlers; public static String PartEditor_ContainerData; @@ -233,9 +181,6 @@ public class Messages { public static String PartSashContainerEditor_Horizontal; public static String PartSashContainerEditor_SelectedElement; public static String PartSashContainerEditor_Controls; - public static String PartSashContainerEditor_Up; - public static String PartSashContainerEditor_Down; - public static String PartSashContainerEditor_Remove; public static String PartSashContainerEditor_ContainerData; public static String PartStackEditor_Label; @@ -243,11 +188,7 @@ public class Messages { public static String PartStackEditor_Id; public static String PartStackEditor_SelectedElement; public static String PartStackEditor_Parts; - public static String PartStackEditor_Up; - public static String PartStackEditor_Down; - public static String PartStackEditor_Remove; public static String PartStackEditor_ContainerData; - public static String PerspectiveStackEditor_Add; public static String PerspectiveEditor_Label; public static String PerspectiveEditor_Description; @@ -258,9 +199,6 @@ public class Messages { public static String PerspectiveEditor_IconURI; public static String PerspectiveEditor_Find; public static String PerspectiveEditor_Controls; - public static String PerspectiveEditor_Up; - public static String PerspectiveEditor_Down; - public static String PerspectiveEditor_Remove; public static String PerspectiveStackEditor_Perspectives; public static String PerspectiveStackEditor_Label; @@ -279,13 +217,10 @@ public class Messages { public static String ToolBarEditor_ToolbarItems; public static String ToolBarEditor_ToolbarItemsType; public static String ToolBarEditor_ToolbarItemsItemType; - public static String ToolBarEditor_Up; - public static String ToolBarEditor_Down; public static String ToolBarEditor_HandledToolItem; public static String ToolBarEditor_DirectToolItem; public static String ToolBarEditor_ToolControl; public static String ToolBarEditor_Separator; - public static String ToolBarEditor_Remove; public static String ToolBarSeparatorEditor_Label; public static String ToolBarSeparatorEditor_Id; @@ -301,10 +236,6 @@ public class Messages { public static String VBindingTableEditor_Name; public static String VBindingTableEditor_LabelDescription; public static String VBindingTableEditor_Id; - public static String VBindingTableEditor_Up; - public static String VBindingTableEditor_Down; - public static String VBindingTableEditor_Add; - public static String VBindingTableEditor_Remove; public static String AddonsEditor_Id; public static String AddonsEditor_ClassURI; @@ -319,21 +250,14 @@ public class Messages { public static String MenuContributionEditor_MenuItems; public static String MenuContributionEditor_MenuItemType; public static String MenuContributionEditor_MenuItemItemType; - public static String MenuContributionEditor_Up; - public static String MenuContributionEditor_Down; public static String MenuContributionEditor_HandledMenuItem; public static String MenuContributionEditor_Separator; public static String MenuContributionEditor_Menu; public static String MenuContributionEditor_DirectMenuItem; - public static String MenuContributionEditor_Remove; public static String MenuContributionEditor_ParentId; public static String MenuContributionEditor_Position; public static String ModelFragmentsEditor_ModelFragments; - public static String ModelFragmentsEditor_Up; - public static String ModelFragmentsEditor_Down; - public static String ModelFragmentsEditor_Add; - public static String ModelFragmentsEditor_Remove; public static String ModelFragmentsEditor_Label; public static String ModelFragmentsEditor_Description; @@ -342,9 +266,6 @@ public class Messages { public static String StringModelFragment_Featurename; public static String StringModelFragment_ParentId; public static String StringModelFragment_PositionInList; - public static String StringModelFragment_Up; - public static String StringModelFragment_Down; - public static String StringModelFragment_Remove; public static String StringModelFragment_Elements; public static String StringModelFragment_Find; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index efb9a05514..d4580dfa9e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -8,6 +8,12 @@ # * Contributors: # * Tom Schindl - initial API and implementation # ****************************************************************************** +ModelTooling_Common_Up=Up +ModelTooling_Common_Down=Down +ModelTooling_Common_AddEllipsis=Add ... +ModelTooling_Common_Add=Add +ModelTooling_Common_Remove=Remove + AbstractCommandSelectionDialog_Label_CommandId=Command-Id ApplicationEditor_Label=Application @@ -31,10 +37,6 @@ BindingTableEditor_Find=Find ... BindingTableEditor_Keybindings=Keybindings BindingTableEditor_KeySequence=KeySequence BindingTableEditor_Command=Command -BindingTableEditor_Up=Up -BindingTableEditor_Down=Down -BindingTableEditor_Add=Add ... -BindingTableEditor_Remove=Remove CommandEditor_Label=Command CommandEditor_Description=Command bla bla bla @@ -47,10 +49,6 @@ CommandEditor_ParameterTypeId=Type-Id CommandEditor_ParameterOptional=Optional CommandEditor_ParameterOptional_Yes=yes CommandEditor_ParameterOptional_No=no -CommandEditor_Up=Up -CommandEditor_Down=Down -CommandEditor_Add=Add ... -CommandEditor_Remove=Remove CommandEditor_ParameterId=Id DirectMenuItemEditor_Label=DirectMenuItem @@ -59,15 +57,10 @@ DirectMenuItemEditor_ClassURI=Class URI DirectMenuItemEditor_Find=Find ... ControlFactory_BindingContexts=Binding Contexts -ControlFactory_Add=Add ... -ControlFactory_Up=Up -ControlFactory_Down=Down -ControlFactory_Remove=Remove ControlFactory_Tags=Tags ControlFactory_Key=Key ControlFactory_Value=Value ControlFactory_ContextVariables=Context Variables -ControlFactory_AddNoEllipse=Add DirectToolItemEditor_ClassURI=Class URI DirectToolItemEditor_Find=Find ... @@ -81,20 +74,12 @@ HandledMenuItemEditor_Find=Find ... HandledMenuItemEditor_Parameters=Parameters HandledMenuItemEditor_Tag=Name HandledMenuItemEditor_Value=Value -HandledMenuItemEditor_Up=Up -HandledMenuItemEditor_Down=Down -HandledMenuItemEditor_Add=Add ... -HandledMenuItemEditor_Remove=Remove HandledToolItemEditor_Command=Command HandledToolItemEditor_Find=Find ... HandledToolItemEditor_Parameters=Parameters HandledToolItemEditor_ParametersName=Name HandledToolItemEditor_ParametersValue=Value -HandledToolItemEditor_Up=Up -HandledToolItemEditor_Down=Down -HandledToolItemEditor_Add=Add ... -HandledToolItemEditor_Remove=Remove HandledToolItemEditor_Label=Handled Tool Item HandledToolItemEditor_Description=Handled Tool Item bla bla bla @@ -117,10 +102,6 @@ KeyBindingEditor_Find=Find ... KeyBindingEditor_Parameters=Parameters KeyBindingEditor_ParametersKey=Key KeyBindingEditor_ParametersValue=Value -KeyBindingEditor_Up=Up -KeyBindingEditor_Down=Down -KeyBindingEditor_Add=Add ... -KeyBindingEditor_Remove=Remove MenuEditor_Label=Menu MenuEditor_Description=Menu bla bla bla @@ -128,12 +109,9 @@ MenuEditor_Id=Id MenuEditor_MenuItems=MenuItems MenuEditor_MenuItemType=Type MenuEditor_MenuItemItemType=Item Type -MenuEditor_Up=Up -MenuEditor_Down=Down MenuEditor_HandledMenuItem=Handled MenuItem MenuEditor_Separator=Separator MenuEditor_Menu=Menu -MenuEditor_Remove=Remove MenuEditor_DirectMenuItem=Direct MenuItem MenuEditor_LabelLabel=Label MenuEditor_Tooltip=Tooltip @@ -151,32 +129,6 @@ MenuItemEditor_Find=Find ... MenuSeparatorEditor_Label=Separator MenuSeparatorEditor_Id=Id -ModelComponentEditor_Id=Id -ModelComponentEditor_ParentId=Parent-Id -ModelComponentEditor_Find=Find ... -ModelComponentEditor_PositionInParent=Position in Parent -ModelComponentEditor_Processor=Processor -ModelComponentEditor_Tags=Tags -ModelComponentEditor_Label=Model Component -ModelComponentEditor_Description=The model component ... bla bla bla -ModelComponentEditor_Handlers=Handlers -ModelComponentEditor_BindingTables=BindingTables -ModelComponentEditor_KeyBindings=KeyBindings -ModelComponentEditor_Commands=Commands -ModelComponentEditor_Menus=Menus -ModelComponentEditor_UiChildren=UI-Children -ModelComponentEditor_PartDescriptors=PartDescriptors -ModelComponentEditor_DetailParentId=parentId -ModelComponentEditor_MenuContributions=MenuContributions - -ModelComponentsEditor_Label=Model Components -ModelComponentsEditor_Description=Some bla bla bla bla -ModelComponentsEditor_ModelContributions=Model Contributions -ModelComponentsEditor_Up=Up -ModelComponentsEditor_Down=Down -ModelComponentsEditor_Add=Add -ModelComponentsEditor_Remove=Remove - PartDescriptorEditor_Label=PartDescriptor PartDescriptorEditor_Descriptor=PartDescriptor Bla Bla Bla Bla PartDescriptorEditor_Id=Id @@ -192,8 +144,6 @@ PartDescriptorEditor_Category=Category PartDescriptorEditor_PersitedState=Persited State PartDescriptorEditor_PersitedStateKey=Key PartDescriptorEditor_PersitedStateValue=Value -PartDescriptorEditor_Add=Add ... -PartDescriptorEditor_Remove=Remove PartDescriptorEditor_Variables=Variables PartDescriptorEditor_Properties=Properties PartDescriptorEditor_PropertiesKey=Key @@ -214,10 +164,9 @@ PartEditor_Closeable=Closeable PartEditor_PersitedState=Persisted State PartEditor_PersitedStateKey=Key PartEditor_PersitedStateValue=Value -PartEditor_Add=Add ... -PartEditor_Remove=Remove PartEditor_Menus=Menus PartEditor_Handlers=Handlers +PartEditor_ContainerData=Container Data PartEditor_ToolBar=ToolBar PartSashContainerEditor_Label=Sash @@ -228,9 +177,6 @@ PartSashContainerEditor_Vertical=Vertical PartSashContainerEditor_Horizontal=Horizontal PartSashContainerEditor_SelectedElement=Selected Element PartSashContainerEditor_Controls=Controls -PartSashContainerEditor_Up=Up -PartSashContainerEditor_Down=Down -PartSashContainerEditor_Remove=Remove PartSashContainerEditor_ContainerData=Container Data PartStackEditor_Label=Part Stack @@ -238,9 +184,6 @@ PartStackEditor_Description=Stack bla bla bla PartStackEditor_Id=Id PartStackEditor_SelectedElement=Selected Element PartStackEditor_Parts=Parts -PartStackEditor_Up=Up -PartStackEditor_Down=Down -PartStackEditor_Remove=Remove PartStackEditor_ContainerData=Container Data PerspectiveEditor_Label=Perspective @@ -253,17 +196,12 @@ PerspectiveEditor_Tooltip=Tooltip PerspectiveEditor_IconURI=Icon URI PerspectiveEditor_Find=Find ... PerspectiveEditor_Controls=Controls -PerspectiveEditor_Up=Up -PerspectiveEditor_Down=Down -PerspectiveEditor_Remove=Remove -PartEditor_ContainerData=Container Data PerspectiveStackEditor_Label=Perspective Stack PerspectiveStackEditor_Description=Perspective Stack Bla Bla Bla PerspectiveStackEditor_Id=Id PerspectiveStackEditor_SelectedElement=Selected Element PerspectiveStackEditor_Perspectives=Perspectives -PerspectiveStackEditor_Add=Add ... PlaceholderEditor_Label=Placeholder PlaceholderEditor_Descriptor=Placeholder Bla Bla Bla Bla @@ -276,13 +214,10 @@ ToolBarEditor_Id=Id ToolBarEditor_ToolbarItems=Toolbar Items ToolBarEditor_ToolbarItemsType=Type ToolBarEditor_ToolbarItemsItemType=Item-Type -ToolBarEditor_Up=Up -ToolBarEditor_Down=Down ToolBarEditor_HandledToolItem=Handled ToolItem ToolBarEditor_DirectToolItem=Direct ToolItem ToolBarEditor_ToolControl=Tool Control ToolBarEditor_Separator=Separator -ToolBarEditor_Remove=Remove ToolBarSeparatorEditor_Label=Separator ToolBarSeparatorEditor_Id=Id @@ -298,10 +233,6 @@ VBindingTableEditor_Contexts=Contexts VBindingTableEditor_Name=Name VBindingTableEditor_LabelDescription=Description VBindingTableEditor_Id=Id -VBindingTableEditor_Up=Up -VBindingTableEditor_Down=Down -VBindingTableEditor_Add=Add ... -VBindingTableEditor_Remove=Remove AddonsEditor_Id=Id AddonsEditor_ClassURI=Class URI @@ -316,21 +247,14 @@ MenuContributionEditor_Id=Id MenuContributionEditor_MenuItems=Menu Items MenuContributionEditor_MenuItemType=Type MenuContributionEditor_MenuItemItemType=Item Type -MenuContributionEditor_Up=Up -MenuContributionEditor_Down=Down MenuContributionEditor_HandledMenuItem=Handled MenuItem MenuContributionEditor_Separator=Separator MenuContributionEditor_Menu=Menu MenuContributionEditor_DirectMenuItem=Direct MenuItem -MenuContributionEditor_Remove=Remove MenuContributionEditor_ParentId=Parent-Id MenuContributionEditor_Position=Position ModelFragmentsEditor_ModelFragments=Model Fragements -ModelFragmentsEditor_Up=Up -ModelFragmentsEditor_Down=Down -ModelFragmentsEditor_Add=Add -ModelFragmentsEditor_Remove=Remove ModelFragmentsEditor_Label=Model Fragments ModelFragmentsEditor_Description=Description @@ -339,9 +263,6 @@ StringModelFragment_Description=String Model Fragment Bla Bla Bla StringModelFragment_Featurename=Featurename StringModelFragment_ParentId=Element Id StringModelFragment_PositionInList=Position in list -StringModelFragment_Up=Up -StringModelFragment_Down=Down -StringModelFragment_Remove=Remove StringModelFragment_Elements=Elements StringModelFragment_Find=Find ... diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index 53f4c33078..2575a50b8c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -222,7 +222,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.BindingTableEditor_Up); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -249,7 +249,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.BindingTableEditor_Down); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -276,7 +276,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.BindingTableEditor_Add); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -294,7 +294,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.BindingTableEditor_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 4e55a7a0fb..817a4d3e55 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -375,17 +375,17 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.CommandEditor_Up); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.CommandEditor_Down); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.CommandEditor_Add); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -402,7 +402,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.CommandEditor_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index eda2300136..3ea808b921 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -188,7 +188,7 @@ public void keyPressed(KeyEvent e) { }); Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_AddNoEllipse); + b.setText(Messages.ModelTooling_Common_Add); b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); gd = new GridData(GridData.FILL, GridData.CENTER, false, false); gd.verticalIndent = vIndent; @@ -222,7 +222,7 @@ public void widgetSelected(SelectionEvent e) { buttonComp.setLayout(gl); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Up); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -249,7 +249,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Down); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -276,7 +276,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index 8ed2596dc2..a485953633 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -19,6 +17,7 @@ import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledMenuItemCommandSelectionDialog; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MParameter; @@ -67,7 +66,7 @@ public class HandledMenuItemEditor extends MenuItemEditor { private IModelResource resource; public HandledMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource) { - super(editingDomain,editor,project); + super(editingDomain, editor, project); this.resource = resource; } @@ -234,17 +233,17 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledMenuItemEditor_Up); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledMenuItemEditor_Down); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledMenuItemEditor_Add); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -261,7 +260,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledMenuItemEditor_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index e0eb7458f7..11010d8259 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -19,6 +17,7 @@ import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledToolItemCommandSelectionDialog; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MParameter; @@ -223,17 +222,17 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledToolItemEditor_Up); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledToolItemEditor_Down); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledToolItemEditor_Add); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -250,7 +249,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledToolItemEditor_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 05c8a27716..bf062fc6d6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -285,17 +285,17 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.KeyBindingEditor_Up); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.KeyBindingEditor_Down); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.KeyBindingEditor_Add); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -312,7 +312,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.KeyBindingEditor_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index 0be1b71242..a8b64ddf8b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -246,7 +246,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.MenuContributionEditor_Up); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -273,7 +273,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.MenuContributionEditor_Down); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -338,7 +338,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.MenuContributionEditor_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 33d7513cdb..caef11f362 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -281,7 +281,7 @@ public void widgetSelected(SelectionEvent e) { buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.MenuEditor_Up); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -308,7 +308,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.MenuEditor_Down); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -373,7 +373,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.MenuEditor_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java index 708cd12b60..056746d27a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java @@ -10,56 +10,45 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; - -import java.util.ArrayList; -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerComparator; - -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; - -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; - -import org.eclipse.core.databinding.observable.list.WritableList; - -import org.eclipse.e4.ui.model.fragment.MFragmentFactory; - - -import org.eclipse.e4.ui.model.fragment.MModelFragment; - -import org.eclipse.e4.ui.model.fragment.MModelFragments; - -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; - import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.fragment.MFragmentFactory; +import org.eclipse.e4.ui.model.fragment.MModelFragment; +import org.eclipse.e4.ui.model.fragment.MModelFragments; +import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerComparator; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -75,12 +64,12 @@ public class ModelFragmentsEditor extends AbstractComponentEditor { private IListProperty MODEL_FRAGMENTS__FRAGMENTS = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS); private IListProperty MODEL_FRAGMENTS__IMPORTS = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS); - + private Composite composite; private Image image; public ModelFragmentsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override @@ -118,19 +107,19 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); - + { Label l = new Label(parent, SWT.NONE); l.setText("Imports"); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); - + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); + final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 200; viewer.getControl().setLayoutData(gd); - + IEMFListProperty prop = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS); viewer.setInput(prop.observeDetail(getMaster())); @@ -219,7 +208,7 @@ public int compare(Viewer viewer, Object e1, Object e2) { List list = new ArrayList(); addClasses(ApplicationPackageImpl.eINSTANCE, list); list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS)); - + childrenDropDown.setInput(list); childrenDropDown.getCombo().select(0); @@ -263,7 +252,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ModelFragmentsEditor_ModelFragments); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); @@ -285,7 +274,7 @@ public void widgetSelected(SelectionEvent e) { buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelFragmentsEditor_Up); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -312,7 +301,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelFragmentsEditor_Down); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -339,7 +328,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelFragmentsEditor_Add); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -357,7 +346,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelFragmentsEditor_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -392,7 +381,7 @@ public void addClasses(EPackage ePackage, List list) { addClasses(eSubPackage, list); } } - + @Override public IObservableList getChildList(Object element) { WritableList list = new WritableList(); @@ -408,7 +397,7 @@ protected boolean accepted(Object o) { return true; } }); - + return list; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 8f1d50c42e..b8f0bb6453 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -399,14 +399,16 @@ public String getText(Object element) { buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartDescriptorEditor_Add); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + // FIXME Implementation is missing b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartDescriptorEditor_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + // FIXME Implementation is missing } // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 01f8d314df..843bebdccf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -382,14 +382,16 @@ public String getText(Object element) { buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartEditor_Add); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + // FIXME Implementation is missing b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartEditor_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + // FIXME Implementation is missing } ControlFactory.createStringListWidget(parent, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 1435e6e19e..8ac7960107 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -238,7 +238,7 @@ public String getText(Object element) { buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartSashContainerEditor_Up); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -265,7 +265,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartSashContainerEditor_Down); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -325,7 +325,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartSashContainerEditor_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 6c82eb7bf0..f7fcc3eabb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -197,7 +197,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartStackEditor_Up); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -224,7 +224,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartStackEditor_Down); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -282,7 +282,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartStackEditor_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 65528d5a34..d162074a25 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -266,7 +266,7 @@ public void widgetSelected(SelectionEvent e) { buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PerspectiveEditor_Up); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -293,7 +293,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PerspectiveEditor_Down); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -353,7 +353,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PerspectiveEditor_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 46f968a2fc..3790fb4496 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -182,7 +182,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartStackEditor_Up); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -209,7 +209,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartStackEditor_Down); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -237,7 +237,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setText(Messages.PerspectiveStackEditor_Add); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -254,7 +254,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartStackEditor_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index 0bc7185bda..460341cf82 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -10,80 +10,58 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.jface.viewers.Viewer; - -import org.eclipse.jface.viewers.ViewerComparator; - -import org.eclipse.e4.ui.model.fragment.MStringModelFragment; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FeatureSelectionDialog; - -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; - -import org.eclipse.emf.ecore.EPackage; - +import java.net.MalformedURLException; +import java.net.URL; import java.util.ArrayList; - +import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FeatureSelectionDialog; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; - -import org.eclipse.emf.ecore.EClassifier; - import org.eclipse.e4.ui.model.fragment.MModelFragment; - -import java.util.List; +import org.eclipse.e4.ui.model.fragment.MStringModelFragment; +import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerComparator; +import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Button; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.TableViewer; - -import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; - -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; - -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.emf.databinding.EMFProperties; - -import org.eclipse.e4.tools.emf.ui.internal.Messages; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.emf.databinding.EMFDataBindingContext; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; - -import org.eclipse.emf.edit.domain.EditingDomain; - -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class StringModelFragment extends AbstractComponentEditor { private Composite composite; @@ -93,7 +71,7 @@ public class StringModelFragment extends AbstractComponentEditor { private IListProperty MODEL_FRAGMENT__ELEMENTS = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS); public StringModelFragment(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override @@ -160,27 +138,27 @@ private Composite createForm(Composite parent) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; comp.setLayoutData(gd); - GridLayout gl = new GridLayout(2,false); - gl.marginWidth=gl.marginHeight=0; - gl.verticalSpacing=0; - gl.marginLeft=gl.marginBottom=gl.marginRight=gl.marginTop=0; + GridLayout gl = new GridLayout(2, false); + gl.marginWidth = gl.marginHeight = 0; + gl.verticalSpacing = 0; + gl.marginLeft = gl.marginBottom = gl.marginRight = gl.marginTop = 0; comp.setLayout(gl); - + Text t = new Text(comp, SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__FEATURENAME).observeDetail(getMaster())); - + final Button button = new Button(comp, SWT.PUSH | SWT.FLAT); button.setText(Messages.StringModelFragment_Find); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - FeatureSelectionDialog dialog = new FeatureSelectionDialog(button.getShell(),getEditingDomain(),(MStringModelFragment) getMaster().getValue()); + FeatureSelectionDialog dialog = new FeatureSelectionDialog(button.getShell(), getEditingDomain(), (MStringModelFragment) getMaster().getValue()); dialog.open(); } }); - + } { @@ -199,7 +177,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); l.setText(Messages.StringModelFragment_Elements); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); @@ -221,7 +199,7 @@ public void widgetSelected(SelectionEvent e) { buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.StringModelFragment_Up); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -248,7 +226,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.StringModelFragment_Down); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -296,7 +274,7 @@ public int compare(Viewer viewer, Object e1, Object e2) { List list = new ArrayList(); addClasses(ApplicationPackageImpl.eINSTANCE, list); list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS)); - + childrenDropDown.setInput(list); childrenDropDown.getCombo().select(0); @@ -319,7 +297,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.StringModelFragment_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index 220e61d440..95898f7a40 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -248,7 +248,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ToolBarEditor_Up); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -275,7 +275,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ToolBarEditor_Down); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -340,7 +340,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ToolBarEditor_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 8a644d3134..bf1fde9485 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -214,7 +214,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ToolBarEditor_Up); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -241,7 +241,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ToolBarEditor_Down); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -306,7 +306,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ToolBarEditor_Remove); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { From fac4211813807a47373ef45150056b367db4174f Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 5 Jul 2010 22:39:11 +0000 Subject: [PATCH 0179/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * cleaning up translations --- .../e4/tools/emf/ui/internal/Messages.java | 22 +-------- .../tools/emf/ui/internal/Messages.properties | 22 +-------- .../common/component/AddonsEditor.java | 45 +++++++++---------- .../common/component/ApplicationEditor.java | 2 +- .../common/component/BindingTableEditor.java | 4 +- .../common/component/CommandEditor.java | 2 +- .../common/component/HandlerEditor.java | 2 +- .../common/component/KeyBindingEditor.java | 2 +- .../component/MenuContributionEditor.java | 2 +- .../internal/common/component/MenuEditor.java | 2 +- .../common/component/MenuItemEditor.java | 2 +- .../common/component/MenuSeparatorEditor.java | 2 +- .../component/PartDescriptorEditor.java | 2 +- .../internal/common/component/PartEditor.java | 2 +- .../component/PartSashContainerEditor.java | 2 +- .../common/component/PartStackEditor.java | 2 +- .../common/component/PerspectiveEditor.java | 2 +- .../component/PerspectiveStackEditor.java | 2 +- .../common/component/PlaceholderEditor.java | 2 +- .../component/ToolBarContributionEditor.java | 2 +- .../common/component/ToolBarEditor.java | 2 +- .../component/ToolBarSeparatorEditor.java | 2 +- .../common/component/ToolControlEditor.java | 2 +- .../component/TrimContributionEditor.java | 2 +- 24 files changed, 46 insertions(+), 87 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 562e7a2ffb..d6a6cf23b0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -18,12 +18,12 @@ public class Messages { public static String ModelTooling_Common_AddEllipsis; public static String ModelTooling_Common_Add; public static String ModelTooling_Common_Remove; + public static String ModelTooling_Common_Id; public static String AbstractCommandSelectionDialog_Label_CommandId; public static String ApplicationEditor_Label; public static String ApplicationEditor_Description; - public static String ApplicationEditor_Id; public static String ApplicationEditor_Handlers; public static String ApplicationEditor_PartDescriptors; public static String ApplicationEditor_BindingTables; @@ -36,7 +36,6 @@ public class Messages { public static String BindingTableEditor_Label; public static String BindingTableEditor_Description; - public static String BindingTableEditor_Id; public static String BindingTableEditor_ContextId; public static String BindingTableEditor_Find; public static String BindingTableEditor_Keybindings; @@ -45,7 +44,6 @@ public class Messages { public static String CommandEditor_Label; public static String CommandEditor_Description; - public static String CommandEditor_Id; public static String CommandEditor_Name; public static String CommandEditor_LabelDescription; public static String CommandEditor_Parameters; @@ -90,7 +88,6 @@ public class Messages { public static String HandlerEditor_Label; public static String HandlerEditor_Description; - public static String HandlerEditor_Id; public static String HandlerEditor_Command; public static String HandlerEditor_Find; public static String HandlerEditor_ClassURI; @@ -100,7 +97,6 @@ public class Messages { public static String KeyBindingEditor_Label; public static String KeyBindingEditor_Description; - public static String KeyBindingEditor_Id; public static String KeyBindingEditor_Sequence; public static String KeyBindingEditor_Command; public static String KeyBindingEditor_Find; @@ -110,7 +106,6 @@ public class Messages { public static String MenuEditor_Label; public static String MenuEditor_Description; - public static String MenuEditor_Id; public static String MenuEditor_MenuItems; public static String MenuEditor_MenuItemType; public static String MenuEditor_MenuItemItemType; @@ -122,7 +117,6 @@ public class Messages { public static String MenuEditor_Tooltip; public static String MenuEditor_IconURI; - public static String MenuItemEditor_Id; public static String MenuItemEditor_Type; public static String MenuItemEditor_Label; public static String MenuItemEditor_Tooltip; @@ -131,11 +125,9 @@ public class Messages { public static String MenuEditor_MainMenu; public static String MenuSeparatorEditor_Label; - public static String MenuSeparatorEditor_Id; public static String PartDescriptorEditor_Label; public static String PartDescriptorEditor_Descriptor; - public static String PartDescriptorEditor_Id; public static String PartDescriptorEditor_LabelLabel; public static String PartDescriptorEditor_Tooltip; public static String PartDescriptorEditor_IconURI; @@ -158,7 +150,6 @@ public class Messages { public static String PartEditor_Label; public static String PartEditor_Description; - public static String PartEditor_Id; public static String PartEditor_LabelLabel; public static String PartEditor_Tooltip; public static String PartEditor_IconURI; @@ -175,7 +166,6 @@ public class Messages { public static String PartSashContainerEditor_Label; public static String PartSashContainerEditor_Description; - public static String PartSashContainerEditor_Id; public static String PartSashContainerEditor_Orientation; public static String PartSashContainerEditor_Vertical; public static String PartSashContainerEditor_Horizontal; @@ -185,14 +175,12 @@ public class Messages { public static String PartStackEditor_Label; public static String PartStackEditor_Description; - public static String PartStackEditor_Id; public static String PartStackEditor_SelectedElement; public static String PartStackEditor_Parts; public static String PartStackEditor_ContainerData; public static String PerspectiveEditor_Label; public static String PerspectiveEditor_Description; - public static String PerspectiveEditor_Id; public static String PerspectiveEditor_LabelLabel; public static String PerspectiveEditor_SelectedElement; public static String PerspectiveEditor_Tooltip; @@ -203,17 +191,14 @@ public class Messages { public static String PerspectiveStackEditor_Perspectives; public static String PerspectiveStackEditor_Label; public static String PerspectiveStackEditor_Description; - public static String PerspectiveStackEditor_Id; public static String PerspectiveStackEditor_SelectedElement; public static String PlaceholderEditor_Label; public static String PlaceholderEditor_Descriptor; - public static String PlaceholderEditor_Id; public static String PlaceholderEditor_FindReference; public static String ToolBarEditor_Label; public static String ToolBarEditor_Description; - public static String ToolBarEditor_Id; public static String ToolBarEditor_ToolbarItems; public static String ToolBarEditor_ToolbarItemsType; public static String ToolBarEditor_ToolbarItemsItemType; @@ -223,11 +208,9 @@ public class Messages { public static String ToolBarEditor_Separator; public static String ToolBarSeparatorEditor_Label; - public static String ToolBarSeparatorEditor_Id; public static String ToolControlEditor_Label; public static String ToolControlEditor_Description; - public static String ToolControlEditor_Id; public static String ToolControlEditor_ClassURI; public static String VBindingTableEditor_Label; @@ -235,9 +218,7 @@ public class Messages { public static String VBindingTableEditor_Contexts; public static String VBindingTableEditor_Name; public static String VBindingTableEditor_LabelDescription; - public static String VBindingTableEditor_Id; - public static String AddonsEditor_Id; public static String AddonsEditor_ClassURI; public static String AddonsEditor_Find; @@ -246,7 +227,6 @@ public class Messages { public static String ContributionClassDialog_Label_Classname; public static String ContributionClassDialog_ShellTitle; - public static String MenuContributionEditor_Id; public static String MenuContributionEditor_MenuItems; public static String MenuContributionEditor_MenuItemType; public static String MenuContributionEditor_MenuItemItemType; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index d4580dfa9e..ce6235777c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -13,12 +13,12 @@ ModelTooling_Common_Down=Down ModelTooling_Common_AddEllipsis=Add ... ModelTooling_Common_Add=Add ModelTooling_Common_Remove=Remove +ModelTooling_Common_Id=Id AbstractCommandSelectionDialog_Label_CommandId=Command-Id ApplicationEditor_Label=Application ApplicationEditor_Description=Application bla, bla, bla -ApplicationEditor_Id=Id ApplicationEditor_Handlers=Handlers ApplicationEditor_PartDescriptors=Part Descriptors ApplicationEditor_BindingTables=BindingTables @@ -31,7 +31,6 @@ ApplicationEditor_TrimContributions=Trim Contributions BindingTableEditor_Label=BindingTable BindingTableEditor_Description=BindingTable bla bla bla -BindingTableEditor_Id=Id BindingTableEditor_ContextId=Context Id BindingTableEditor_Find=Find ... BindingTableEditor_Keybindings=Keybindings @@ -40,7 +39,6 @@ BindingTableEditor_Command=Command CommandEditor_Label=Command CommandEditor_Description=Command bla bla bla -CommandEditor_Id=Id CommandEditor_Name=Name CommandEditor_LabelDescription=Description CommandEditor_Parameters=Parameters @@ -85,7 +83,6 @@ HandledToolItemEditor_Description=Handled Tool Item bla bla bla HandlerEditor_Label=Handler HandlerEditor_Description=Handler bla bla bla -HandlerEditor_Id=Id HandlerEditor_Command=Command HandlerEditor_Find=Find ... HandlerEditor_ClassURI=Class URI @@ -95,7 +92,6 @@ InputPartEditor_InputURI=Input URI KeyBindingEditor_Label=Binding KeyBindingEditor_Description=Binding bla bla bla -KeyBindingEditor_Id=Id KeyBindingEditor_Sequence=Sequence KeyBindingEditor_Command=Command KeyBindingEditor_Find=Find ... @@ -105,7 +101,6 @@ KeyBindingEditor_ParametersValue=Value MenuEditor_Label=Menu MenuEditor_Description=Menu bla bla bla -MenuEditor_Id=Id MenuEditor_MenuItems=MenuItems MenuEditor_MenuItemType=Type MenuEditor_MenuItemItemType=Item Type @@ -118,7 +113,6 @@ MenuEditor_Tooltip=Tooltip MenuEditor_IconURI=Icon URI MenuEditor_MainMenu=Main Menu -MenuItemEditor_Id=Id MenuItemEditor_Type=Type MenuItemEditor_Label=Label MenuItemEditor_Tooltip=Tooltip @@ -127,11 +121,9 @@ MenuItemEditor_Find=Find ... MenuSeparatorEditor_Label=Separator -MenuSeparatorEditor_Id=Id PartDescriptorEditor_Label=PartDescriptor PartDescriptorEditor_Descriptor=PartDescriptor Bla Bla Bla Bla -PartDescriptorEditor_Id=Id PartDescriptorEditor_LabelLabel=Label PartDescriptorEditor_Tooltip=Tooltip PartDescriptorEditor_IconURI=Icon URI @@ -154,7 +146,6 @@ PartDescriptorEditor_ContainerData=Container Data PartEditor_Label=Part PartEditor_Description=Part Bla Bla Bla Bla -PartEditor_Id=Id PartEditor_LabelLabel=Label PartEditor_Tooltip=Tooltip PartEditor_IconURI=Icon URI @@ -171,7 +162,6 @@ PartEditor_ToolBar=ToolBar PartSashContainerEditor_Label=Sash PartSashContainerEditor_Description=Sash bla bla bla -PartSashContainerEditor_Id=Id PartSashContainerEditor_Orientation=Orientation PartSashContainerEditor_Vertical=Vertical PartSashContainerEditor_Horizontal=Horizontal @@ -181,14 +171,12 @@ PartSashContainerEditor_ContainerData=Container Data PartStackEditor_Label=Part Stack PartStackEditor_Description=Stack bla bla bla -PartStackEditor_Id=Id PartStackEditor_SelectedElement=Selected Element PartStackEditor_Parts=Parts PartStackEditor_ContainerData=Container Data PerspectiveEditor_Label=Perspective PerspectiveEditor_Description=Perspective Bla Bla Bla -PerspectiveEditor_Id=Id PerspectiveEditor_LabelLabel=Label PerspectiveEditor_SelectedElement=Selected Element PerspectiveEditor_Label=Label @@ -199,18 +187,15 @@ PerspectiveEditor_Controls=Controls PerspectiveStackEditor_Label=Perspective Stack PerspectiveStackEditor_Description=Perspective Stack Bla Bla Bla -PerspectiveStackEditor_Id=Id PerspectiveStackEditor_SelectedElement=Selected Element PerspectiveStackEditor_Perspectives=Perspectives PlaceholderEditor_Label=Placeholder PlaceholderEditor_Descriptor=Placeholder Bla Bla Bla Bla -PlaceholderEditor_Id=Id PlaceholderEditor_FindReference=Find ... ToolBarEditor_Label=Toolbar ToolBarEditor_Description=Toolbar bla bla bla -ToolBarEditor_Id=Id ToolBarEditor_ToolbarItems=Toolbar Items ToolBarEditor_ToolbarItemsType=Type ToolBarEditor_ToolbarItemsItemType=Item-Type @@ -220,11 +205,9 @@ ToolBarEditor_ToolControl=Tool Control ToolBarEditor_Separator=Separator ToolBarSeparatorEditor_Label=Separator -ToolBarSeparatorEditor_Id=Id ToolControlEditor_Label=ToolControl ToolControlEditor_Description=ToolControl bla bla bla -ToolControlEditor_Id=Id ToolControlEditor_ClassURI=Class URI VBindingTableEditor_Label=Binding Configuration @@ -232,9 +215,7 @@ VBindingTableEditor_Description=Binding Configuration Bla Bla Bla Bla VBindingTableEditor_Contexts=Contexts VBindingTableEditor_Name=Name VBindingTableEditor_LabelDescription=Description -VBindingTableEditor_Id=Id -AddonsEditor_Id=Id AddonsEditor_ClassURI=Class URI AddonsEditor_Find=Find ... @@ -243,7 +224,6 @@ ContributionClassDialog_DialogTitle=Find Contribution Class ContributionClassDialog_Label_Classname=Classname ContributionClassDialog_ShellTitle=Find Contribution Class -MenuContributionEditor_Id=Id MenuContributionEditor_MenuItems=Menu Items MenuContributionEditor_MenuItemType=Type MenuContributionEditor_MenuItemItemType=Item Type diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index 9b75c4e5a5..33cfabc375 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -48,15 +48,15 @@ public class AddonsEditor extends AbstractComponentEditor { private IProject project; private Image image; private EStackLayout stackLayout; - + public AddonsEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain,editor); + super(editingDomain, editor); this.project = project; } @Override public Image getImage(Object element, Display display) { - if( image == null ) { + if (image == null) { try { image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Addons.png")); //$NON-NLS-1$ } catch (MalformedURLException e) { @@ -76,8 +76,8 @@ public String getLabel(Object element) { @Override public String getDetailLabel(Object element) { MContribution contrib = (MContribution) element; - if( contrib.getContributionURI() != null && contrib.getContributionURI().trim().length() > 0 ) { - return contrib.getContributionURI().substring(contrib.getContributionURI().lastIndexOf('/')+1); + if (contrib.getContributionURI() != null && contrib.getContributionURI().trim().length() > 0) { + return contrib.getContributionURI().substring(contrib.getContributionURI().lastIndexOf('/') + 1); } return null; } @@ -101,49 +101,48 @@ public Composite getEditor(Composite parent, Object object) { composite = createForm(parent, context, getMaster(), false); } } - - if( getEditor().isModelFragment() ) { + + if (getEditor().isModelFragment()) { Control topControl; - if( Util.isImport((EObject) object) ) { + if (Util.isImport((EObject) object)) { topControl = composite.getChildren()[1]; } else { - topControl = composite.getChildren()[0]; + topControl = composite.getChildren()[0]; } - - if( stackLayout.topControl != topControl ) { + + if (stackLayout.topControl != topControl) { stackLayout.topControl = topControl; composite.layout(true, true); } } - + getMaster().setValue(object); return composite; } - + protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if( getEditor().isModelFragment() && isImport ) { + if (getEditor().isModelFragment() && isImport) { ControlFactory.createFindImport(parent, this, context); return parent; } { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.AddonsEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -152,21 +151,21 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster())); - final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText(Messages.AddonsEditor_Find); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); dialog.open(); } }); } - -// ControlFactory.createBindingsWidget(parent, this); + + // ControlFactory.createBindingsWidget(parent, this); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 3d19f4294e..b8d3d431bc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -119,7 +119,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ApplicationEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index 2575a50b8c..f0a68af973 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -143,7 +143,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.BindingTableEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); @@ -204,7 +204,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.BindingTableEditor_Id); + column.getColumn().setText(Messages.ModelTooling_Common_Id); column.getColumn().setWidth(170); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 817a4d3e55..bf2cbff690 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -145,7 +145,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.CommandEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 4caa6b8315..b90df2b255 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -133,7 +133,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.HandlerEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index bf062fc6d6..822cb8db1a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -148,7 +148,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.KeyBindingEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index a8b64ddf8b..83d4fd7425 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -166,7 +166,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index caef11f362..fee9dce6f6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -165,7 +165,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 662a124d85..2029c67fa9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -131,7 +131,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuItemEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index 8479ac77ea..982db2a1d0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -122,7 +122,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuSeparatorEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index b8f0bb6453..eb71055b85 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -162,7 +162,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 843bebdccf..f447bbc457 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -165,7 +165,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 8ac7960107..cade3f6e8c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -165,7 +165,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartSashContainerEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index f7fcc3eabb..30fec8bb92 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -146,7 +146,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartStackEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index d162074a25..473640cae1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -168,7 +168,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PerspectiveEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 3790fb4496..50e532ce14 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -144,7 +144,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PerspectiveStackEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index b0571a0da3..82bca30ceb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -160,7 +160,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PlaceholderEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index 95898f7a40..9423592a8b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -168,7 +168,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index bf1fde9485..8af7fc1e2c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -160,7 +160,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ToolBarEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index a8eeac79d9..ed85e5d34a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -122,7 +122,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ToolBarSeparatorEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index f1344ce398..93ea8cf9e2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -137,7 +137,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ToolControlEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index d3fa9a9a11..6444965798 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -163,7 +163,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_Id); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); From d5babb78ea4d6f8ebf338c945b55e2c8c549fef8 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 5 Jul 2010 23:01:35 +0000 Subject: [PATCH 0180/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * adding editor for CommandParameter --- .../full/modelelements/CommandParameter.gif | Bin 0 -> 612 bytes .../emf/ui/internal/common/ModelEditor.java | 2 + .../common/component/CommandEditor.java | 247 +++++------------- .../component/CommandParameterEditor.java | 158 +++++++++++ 4 files changed, 226 insertions(+), 181 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CommandParameter.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CommandParameter.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CommandParameter.gif new file mode 100644 index 0000000000000000000000000000000000000000..b7f03d5679831bf19ec4643b6e079722414aa1d8 GIT binary patch literal 612 zcmV-q0-OCuNk%w1VGsZi0OkMyZiB9Kh_ZExvwM%XfRww0nZAsl!-}54k)_7~RhBe& ztAnh}%iZcUZ;$f(|Jd~Z-Sz+L`Ty+t|Lyw!^!)$#{r~d(|N8#_I*M6ClU_1}Nj{ZU zM3`Gclv_!WU9-}>Erdjey_KcUuuYd=bhLwjxQ>v)oTJXIzS_mc+{?z=%h%-EJd;jC zmsLTMQb?LvN}F3vmR(?{a8{CIai#VN@P5H7J6Miy=aBbaQNCIwFjMDm-g$cXDrSYB?*HGG1s&d3JDV zWn?y&IAC8}d3ktsW>q7X8ck7JwRvY_GZ~j4N<>+;S4BWQ9hWpaOjdbMMoUL7C6_-e zQe9V5P*_1QTm}UL0RVa@Ej~j?PB$+Mmy0PR8yFlWTomX*aDadScX}2?sF0vSg$oJt y2}%ILL4yPq7!E9WP>_NL5++D!KtZ5H1{f`(prop.observeDetail(cp.getKnownElements()))); - column.setEditingSupport(new EditingSupport(viewer) { - private TextCellEditor editor = new TextCellEditor(viewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - if (value.toString().trim().length() == 0) { - value = null; - } - - Command cmd = SetCommand.create(getEditingDomain(), element, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, value); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - MCommandParameter obj = (MCommandParameter) element; - return obj.getElementId() != null ? obj.getElementId() : ""; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return editor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__NAME); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.CommandEditor_ParameterName); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - column.setEditingSupport(new EditingSupport(viewer) { - private TextCellEditor editor = new TextCellEditor(viewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.COMMAND_PARAMETER__NAME, value); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - MCommandParameter obj = (MCommandParameter) element; - return obj.getName() != null ? obj.getName() : ""; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return editor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__TYPE_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.CommandEditor_ParameterTypeId); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - column.setEditingSupport(new EditingSupport(viewer) { - private TextCellEditor editor = new TextCellEditor(viewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.COMMAND_PARAMETER__TYPE_ID, value); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - MCommandParameter obj = (MCommandParameter) element; - return obj.getTypeId() != null ? obj.getTypeId() : ""; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return editor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__OPTIONAL); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.CommandEditor_ParameterOptional); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements())) { - @Override - public String getText(MCommandParameter element) { - return element.isOptional() ? Messages.CommandEditor_ParameterOptional_Yes : Messages.CommandEditor_ParameterOptional_No; - } - }); - column.setEditingSupport(new EditingSupport(viewer) { - private ComboBoxCellEditor editor = new ComboBoxCellEditor(viewer.getTable(), new String[] { Messages.CommandEditor_ParameterOptional_Yes, Messages.CommandEditor_ParameterOptional_No }); - - @Override - protected void setValue(Object element, Object value) { - int idx = ((Number) value).intValue(); - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.COMMAND_PARAMETER__OPTIONAL, idx == 0); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - MCommandParameter obj = (MCommandParameter) element; - return obj.isOptional() ? 0 : 1; - } - - @Override - protected CellEditor getCellEditor(Object element) { - return editor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(viewer) { - @Override - protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { - boolean singleSelect = ((IStructuredSelection) viewer.getSelection()).size() == 1; - boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent) event.sourceEvent).button == 1; - - return singleSelect && (isLeftDoubleMouseSelect || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); - } - }; - TableViewerEditor.create(viewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); - IEMFEditListProperty mProp = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__PARAMETERS); viewer.setInput(mProp.observeDetail(getMaster())); @@ -378,11 +207,55 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MCommand container = (MCommand) getMaster().getValue(); + int idx = container.getParameters().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.COMMAND__PARAMETERS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MCommand container = (MCommand) getMaster().getValue(); + int idx = container.getParameters().indexOf(obj) + 1; + if (idx < container.getParameters().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.COMMAND__PARAMETERS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); @@ -396,7 +269,7 @@ public void widgetSelected(SelectionEvent e) { if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); - viewer.editElement(param, 0); + getEditor().setSelection(param); } } }); @@ -405,6 +278,18 @@ public void widgetSelected(SelectionEvent e) { b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.COMMAND__PARAMETERS, keybinding); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); } ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); @@ -414,7 +299,7 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - return null; + return COMMAND__PARAMETERS.observe(element); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java new file mode 100644 index 0000000000..d3ffd1f40c --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java @@ -0,0 +1,158 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import java.net.MalformedURLException; +import java.net.URL; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.commands.MCommandParameter; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class CommandParameterEditor extends AbstractComponentEditor { + private Composite composite; + private Image image; + private EMFDataBindingContext context; + + private EStackLayout stackLayout; + + public CommandParameterEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain, editor); + } + + @Override + public Image getImage(Object element, Display display) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingContext.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "Command Parameter"; + } + + @Override + public String getDetailLabel(Object element) { + MCommandParameter param = (MCommandParameter) element; + if (param.getName() != null && param.getName().trim().length() > 0) { + return param.getName().trim(); + } else if (param.getElementId() != null && param.getElementId().trim().length() > 0) { + return param.getElementId().trim(); + } + return null; + } + + @Override + public String getDescription(Object element) { + return "Command Parameter Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new EStackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } + } + + if (getEditor().isModelFragment()) { + Control topControl; + if (Util.isImport((EObject) object)) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if (stackLayout.topControl != topControl) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + if (isImport) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + + ControlFactory.createTextField(parent, "Id", master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); + ControlFactory.createTextField(parent, "Name", master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__NAME)); + ControlFactory.createTextField(parent, "TypeId", master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__TYPE_ID)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Optional"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + Button checkbox = new Button(parent, SWT.CHECK); + checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); + + IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__OPTIONAL); + IWidgetValueProperty uiProp = WidgetProperties.selection(); + + context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); + } + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + +} From ef4e0603f7eb1fd14cc3df492fb759932a1cfc66 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 5 Jul 2010 23:19:19 +0000 Subject: [PATCH 0181/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * adding editor for Parameter --- .../icons/full/modelelements/Parameter.gif | Bin 0 -> 184 bytes .../emf/ui/internal/common/ModelEditor.java | 2 + .../component/CommandParameterEditor.java | 2 +- .../component/HandledMenuItemEditor.java | 165 +++++++----------- .../component/HandledToolItemEditor.java | 144 +++++---------- .../common/component/ParameterEditor.java | 140 +++++++++++++++ 6 files changed, 246 insertions(+), 207 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.gif new file mode 100644 index 0000000000000000000000000000000000000000..46e9bfa668478bf74bdb6f1b9b977bf0e2ca3422 GIT binary patch literal 184 zcmZ?wbhEHb6krfwIKsfd5IRjdeW8BIN}JmCg$s^WEIr=0<-+1aHxFNbcHzOBw-=Y) z+Bx<3!sZJL>rc+8*w>x6r7n3(UCP?h*#H0k19cMwia%Kx85o2abU-RWb~3P(prop.observeDetail(cp.getKnownElements()))); - column.setEditingSupport(new EditingSupport(tableviewer) { - private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.PARAMETER__NAME, value); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - String val = ((MParameter) element).getName(); - return val == null ? "" : val; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__VALUE); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.HandledMenuItemEditor_Value); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - column.setEditingSupport(new EditingSupport(tableviewer) { - private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.PARAMETER__VALUE, value); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - String val = ((MParameter) element).getValue(); - return val == null ? "" : val; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(tableviewer) { - @Override - protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { - boolean singleSelect = ((IStructuredSelection) tableviewer.getSelection()).size() == 1; - boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent) event.sourceEvent).button == 1; - - return singleSelect && (isLeftDoubleMouseSelect || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); - } - }; - TableViewerEditor.create(tableviewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); + viewer.setContentProvider(cp); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); - tableviewer.setInput(prop.observeDetail(master)); + viewer.setInput(prop.observeDetail(master)); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); @@ -236,11 +146,55 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MHandledItem container = (MHandledItem) getMaster().getValue(); + int idx = container.getParameters().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MHandledItem container = (MHandledItem) getMaster().getValue(); + int idx = container.getParameters().indexOf(obj) + 1; + if (idx < container.getParameters().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); @@ -254,7 +208,7 @@ public void widgetSelected(SelectionEvent e) { Command cmd = AddCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, param); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); - tableviewer.editElement(param, 0); + getEditor().setSelection(param); } } }); @@ -264,7 +218,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { - IStructuredSelection s = (IStructuredSelection) tableviewer.getSelection(); + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (!s.isEmpty()) { MHandledItem item = (MHandledItem) master.getValue(); Command cmd = RemoveCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, s.toList()); @@ -279,4 +233,9 @@ public void widgetSelected(SelectionEvent e) { b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); } } + + @Override + public IObservableList getChildList(Object element) { + return HANDLED_ITEM__PARAMETERS.observe(element); + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index 11010d8259..4ef9c0b28d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -12,44 +12,35 @@ import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledToolItemCommandSelectionDialog; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MParameter; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ColumnViewerEditor; -import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; -import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; -import org.eclipse.jface.viewers.EditingSupport; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.viewers.TableViewerEditor; -import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -64,6 +55,7 @@ public class HandledToolItemEditor extends ToolItemEditor { private Image image; private IModelResource resource; + private IEMFEditListProperty HANDLED_ITEM__PARAMETERS = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); public HandledToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource) { super(editingDomain, editor, project); @@ -117,100 +109,18 @@ public void widgetSelected(SelectionEvent e) { l.setText(Messages.HandledToolItemEditor_Parameters); l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - final TableViewer tableviewer = new TableViewer(parent); + final TableViewer viewer = new TableViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 120; - tableviewer.getTable().setHeaderVisible(true); - tableviewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + viewer.getControl().setLayoutData(gd); ObservableListContentProvider cp = new ObservableListContentProvider(); - tableviewer.setContentProvider(cp); - - { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__NAME); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.HandledToolItemEditor_ParametersName); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - column.setEditingSupport(new EditingSupport(tableviewer) { - private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.PARAMETER__NAME, value); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - String val = ((MParameter) element).getName(); - return val == null ? "" : val; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__VALUE); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.HandledToolItemEditor_ParametersValue); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - column.setEditingSupport(new EditingSupport(tableviewer) { - private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.PARAMETER__VALUE, value); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - String val = ((MParameter) element).getValue(); - return val == null ? "" : val; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(tableviewer) { - @Override - protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { - boolean singleSelect = ((IStructuredSelection) tableviewer.getSelection()).size() == 1; - boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent) event.sourceEvent).button == 1; - - return singleSelect && (isLeftDoubleMouseSelect || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); - } - }; - TableViewerEditor.create(tableviewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); + viewer.setContentProvider(cp); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); - tableviewer.setInput(prop.observeDetail(getMaster())); + viewer.setInput(prop.observeDetail(getMaster())); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); @@ -225,6 +135,28 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MHandledItem container = (MHandledItem) getMaster().getValue(); + int idx = container.getParameters().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); @@ -243,8 +175,8 @@ public void widgetSelected(SelectionEvent e) { Command cmd = AddCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, param); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(param); } - tableviewer.editElement(param, 0); } }); @@ -253,7 +185,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { - IStructuredSelection s = (IStructuredSelection) tableviewer.getSelection(); + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (!s.isEmpty()) { MHandledItem item = (MHandledItem) master.getValue(); Command cmd = RemoveCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, s.toList()); @@ -278,4 +210,10 @@ public String getLabel(Object element) { public String getDescription(Object element) { return Messages.HandledToolItemEditor_Description; } + + @Override + public IObservableList getChildList(Object element) { + return HANDLED_ITEM__PARAMETERS.observe(element); + } + } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java new file mode 100644 index 0000000000..0048711c65 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java @@ -0,0 +1,140 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import java.net.MalformedURLException; +import java.net.URL; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.commands.MParameter; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; + +public class ParameterEditor extends AbstractComponentEditor { + private Composite composite; + private Image image; + private EMFDataBindingContext context; + + private EStackLayout stackLayout; + + public ParameterEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain, editor); + } + + @Override + public Image getImage(Object element, Display display) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + public String getLabel(Object element) { + return "Parameter"; + } + + @Override + public String getDetailLabel(Object element) { + MParameter param = (MParameter) element; + if (param.getName() != null && param.getName().trim().length() > 0) { + return param.getName().trim(); + } else if (param.getElementId() != null && param.getElementId().trim().length() > 0) { + return param.getElementId().trim(); + } + return null; + } + + @Override + public String getDescription(Object element) { + return "Parameter Bla Bla Bla Bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new EStackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } + } + + if (getEditor().isModelFragment()) { + Control topControl; + if (Util.isImport((EObject) object)) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if (stackLayout.topControl != topControl) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout(3, false)); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + if (isImport) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + + ControlFactory.createTextField(parent, "Id", master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); + ControlFactory.createTextField(parent, "Name", master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__NAME)); + ControlFactory.createTextField(parent, "Value", master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__VALUE)); + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + +} From 7a1c853c907c4abbab29e4e21735db18054a0530 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 5 Jul 2010 23:24:26 +0000 Subject: [PATCH 0182/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * adding editor for Popup Menu --- .../emf/ui/internal/common/ModelEditor.java | 2 ++ .../common/component/PopupMenuEditor.java | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 4e8ac6cc59..9ee1d2e11f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -71,6 +71,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.PerspectiveEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PerspectiveStackEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PlaceholderEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.PopupMenuEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.StringModelFragment; import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarContributionEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarEditor; @@ -567,6 +568,7 @@ private void registerDefaultEditors() { registerEditor(MenuPackageImpl.Literals.TOOL_CONTROL, new ToolControlEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(MenuPackageImpl.Literals.MENU, new MenuEditor(modelProvider.getEditingDomain(), project, this)); + registerEditor(MenuPackageImpl.Literals.POPUP_MENU, new PopupMenuEditor(modelProvider.getEditingDomain(), project, this)); registerEditor(MenuPackageImpl.Literals.MENU_SEPARATOR, new MenuSeparatorEditor(modelProvider.getEditingDomain(), this)); registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), this, project, modelProvider)); registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this, project)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java new file mode 100644 index 0000000000..20bc628bb5 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.emf.edit.domain.EditingDomain; + +public class PopupMenuEditor extends MenuEditor { + + public PopupMenuEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { + super(editingDomain, project, editor); + } + + @Override + public String getLabel(Object element) { + return "Popup Menu"; + } + + @Override + public String getDescription(Object element) { + return "Popup Menu Bla Bla Bla Bla"; + } +} From 29ce6b3fc592dbf168ea4e7bf424f6f1f2b2951f Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 6 Jul 2010 20:12:39 +0000 Subject: [PATCH 0183/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * adding editor for Popup Menu --- .../ui/internal/common/component/MenuEditor.java | 2 +- .../internal/common/component/PopupMenuEditor.java | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index fee9dce6f6..68a43a4030 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -151,7 +151,7 @@ public Composite getEditor(Composite parent, Object object) { return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean rootMenu, boolean isImport) { + protected Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean rootMenu, boolean isImport) { parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java index 20bc628bb5..0199da71f0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java @@ -10,9 +10,13 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.widgets.Composite; public class PopupMenuEditor extends MenuEditor { @@ -20,6 +24,16 @@ public PopupMenuEditor(EditingDomain editingDomain, IProject project, ModelEdito super(editingDomain, project, editor); } + @Override + protected Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean rootMenu, boolean isImport) { + Composite comp = super.createForm(parent, context, master, rootMenu, isImport); + if (!isImport) { + ControlFactory.createStringListWidget(comp, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); + } + + return comp; + } + @Override public String getLabel(Object element) { return "Popup Menu"; From 74b628d9aaa041ba7756352b3ae3a7655b33ad8f Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 6 Jul 2010 20:25:18 +0000 Subject: [PATCH 0184/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * adding Part properties support --- .../internal/common/component/PartEditor.java | 104 +++++++++++++++++- 1 file changed, 100 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index f447bbc457..fdfd4aae45 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -33,6 +33,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartIconDialogEditor; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationFactoryImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.basic.MPart; @@ -41,6 +42,7 @@ import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.BasicEMap; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; @@ -49,14 +51,21 @@ import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -335,7 +344,7 @@ public void widgetSelected(SelectionEvent e) { gd.verticalIndent = VERTICAL_LIST_WIDGET_INDENT; l.setLayoutData(gd); - TableViewer tableviewer = new TableViewer(parent); + final TableViewer tableviewer = new TableViewer(parent); tableviewer.getTable().setHeaderVisible(true); ObservableListContentProvider cp = new ObservableListContentProvider(); tableviewer.setContentProvider(cp); @@ -369,10 +378,39 @@ public String getText(Object element) { } }); + final TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); + column.setEditingSupport(new EditingSupport(tableviewer) { + + @Override + protected void setValue(Object element, Object value) { + Command cmd = SetCommand.create(getEditingDomain(), element, ApplicationPackageImpl.Literals.STRING_TO_STRING_MAP__KEY, value.toString().trim().length() == 0 ? null : value.toString()); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + @SuppressWarnings("unchecked") + @Override + protected Object getValue(Object element) { + Entry entry = (Entry) element; + return entry.getValue() == null ? "" : entry.getValue(); //$NON-NLS-1$ + } + + @Override + protected CellEditor getCellEditor(Object element) { + return cellEditor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE); tableviewer.setInput(prop.observeDetail(getMaster())); - Composite buttonComp = new Composite(parent, SWT.NONE); + final Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); GridLayout gl = new GridLayout(); gl.marginLeft = 0; @@ -385,13 +423,71 @@ public String getText(Object element) { b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - // FIXME Implementation is missing + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + Dialog dialog = new Dialog(buttonComp.getShell()) { + private Text key; + private Text value; + + @Override + protected Control createDialogArea(Composite parent) { + Composite comp = (Composite) super.createDialogArea(parent); + Composite container = new Composite(comp, SWT.NONE); + container.setLayout(new GridLayout(2, false)); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Label l = new Label(container, SWT.NONE); + l.setText("Key"); + + key = new Text(container, SWT.BORDER); + key.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + l = new Label(container, SWT.NONE); + l.setText("Value"); + + value = new Text(container, SWT.BORDER); + value.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + return comp; + } + + @Override + protected void okPressed() { + if (key.getText().trim().length() > 0) { + BasicEMap.Entry entry = (org.eclipse.emf.common.util.BasicEMap.Entry) ApplicationFactoryImpl.eINSTANCE.createStringToStringMap(); + entry.setHash(key.hashCode()); + entry.setKey(key.getText()); + entry.setValue(value.getText().trim().length() > 0 ? value.getText() : null); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, entry); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + super.okPressed(); + } + } + } + }; + dialog.open(); + + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - // FIXME Implementation is missing + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IStructuredSelection selection = (IStructuredSelection) tableviewer.getSelection(); + if (!selection.isEmpty()) { + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, selection.toList()); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); } ControlFactory.createStringListWidget(parent, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); From 448d109f96daf55c3786872bc7b747a5a410e5f1 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 6 Jul 2010 20:42:19 +0000 Subject: [PATCH 0185/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * adding Part properties support --- .../common/component/ControlFactory.java | 164 +++++++++++++++++ .../component/PartDescriptorEditor.java | 106 ----------- .../internal/common/component/PartEditor.java | 172 +----------------- 3 files changed, 166 insertions(+), 276 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 3ea808b921..58adaf7e38 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -12,6 +12,7 @@ import java.util.Arrays; import java.util.List; +import java.util.Map.Entry; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.map.IObservableMap; @@ -24,11 +25,13 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationElement; +import org.eclipse.e4.ui.model.application.impl.ApplicationFactoryImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MContext; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.BasicEMap; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFListProperty; @@ -40,17 +43,24 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider; import org.eclipse.jface.databinding.viewers.ViewerProperties; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.ColumnLabelProvider; import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.EditingSupport; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.swt.SWT; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; @@ -60,10 +70,164 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; public class ControlFactory { + public static void createMapProperties(Composite parent, final AbstractComponentEditor editor, String label, final EStructuralFeature feature, int vIndent) { + Label l = new Label(parent, SWT.NONE); + l.setText(label); + GridData gd = new GridData(GridData.END, GridData.BEGINNING, false, false); + gd.verticalIndent = vIndent; + l.setLayoutData(gd); + + final TableViewer tableviewer = new TableViewer(parent); + tableviewer.getTable().setHeaderVisible(true); + ObservableListContentProvider cp = new ObservableListContentProvider(); + tableviewer.setContentProvider(cp); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 80; + gd.verticalIndent = vIndent; + tableviewer.getControl().setLayoutData(gd); + + TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Key"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ColumnLabelProvider() { + @SuppressWarnings("unchecked") + @Override + public String getText(Object element) { + Entry entry = (Entry) element; + return entry.getKey(); + } + }); + + // FIXME How can we react upon changes in the Map-Value? + column = new TableViewerColumn(tableviewer, SWT.NONE); + column.getColumn().setText("Value"); + column.getColumn().setWidth(200); + column.setLabelProvider(new ColumnLabelProvider() { + @SuppressWarnings("unchecked") + @Override + public String getText(Object element) { + Entry entry = (Entry) element; + return entry.getValue(); + } + }); + + final TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); + column.setEditingSupport(new EditingSupport(tableviewer) { + + @Override + protected void setValue(Object element, Object value) { + Command cmd = SetCommand.create(editor.getEditingDomain(), element, ApplicationPackageImpl.Literals.STRING_TO_STRING_MAP__KEY, value.toString().trim().length() == 0 ? null : value.toString()); + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + } + } + + @SuppressWarnings("unchecked") + @Override + protected Object getValue(Object element) { + Entry entry = (Entry) element; + return entry.getValue() == null ? "" : entry.getValue(); //$NON-NLS-1$ + } + + @Override + protected CellEditor getCellEditor(Object element) { + return cellEditor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + + IEMFEditListProperty prop = EMFEditProperties.list(editor.getEditingDomain(), feature); + tableviewer.setInput(prop.observeDetail(editor.getMaster())); + + final Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_AddEllipsis); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + Dialog dialog = new Dialog(buttonComp.getShell()) { + private Text key; + private Text value; + + @Override + protected Control createDialogArea(Composite parent) { + Composite comp = (Composite) super.createDialogArea(parent); + Composite container = new Composite(comp, SWT.NONE); + container.setLayout(new GridLayout(2, false)); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Label l = new Label(container, SWT.NONE); + l.setText("Key"); + + key = new Text(container, SWT.BORDER); + key.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + l = new Label(container, SWT.NONE); + l.setText("Value"); + + value = new Text(container, SWT.BORDER); + value.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + return comp; + } + + @Override + protected void okPressed() { + if (key.getText().trim().length() > 0) { + BasicEMap.Entry entry = (org.eclipse.emf.common.util.BasicEMap.Entry) ApplicationFactoryImpl.eINSTANCE.createStringToStringMap(); + entry.setHash(key.hashCode()); + entry.setKey(key.getText()); + entry.setValue(value.getText().trim().length() > 0 ? value.getText() : null); + Command cmd = AddCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), feature, entry); + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + super.okPressed(); + } + } + } + }; + dialog.open(); + + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Remove); + b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IStructuredSelection selection = (IStructuredSelection) tableviewer.getSelection(); + if (!selection.isEmpty()) { + Command cmd = RemoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), feature, selection.toList()); + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + public static void createTextField(Composite parent, String label, IObservableValue master, EMFDataBindingContext context, IWidgetValueProperty textProp, IEMFEditValueProperty modelProp) { Label l = new Label(parent, SWT.NONE); l.setText(label); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index eb71055b85..6ea8626355 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; -import java.util.Map.Entry; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IObservableValue; @@ -44,18 +43,12 @@ import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -347,105 +340,6 @@ public void widgetSelected(SelectionEvent e) { context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CATEGORY).observeDetail(master)); } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_PersitedState); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - TableViewer tableviewer = new TableViewer(parent); - tableviewer.getTable().setHeaderVisible(true); - ObservableListContentProvider cp = new ObservableListContentProvider(); - tableviewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 80; - tableviewer.getControl().setLayoutData(gd); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.PartDescriptorEditor_PersitedStateKey); - column.getColumn().setWidth(200); - column.setLabelProvider(new ColumnLabelProvider() { - @SuppressWarnings("unchecked") - @Override - public String getText(Object element) { - Entry entry = (Entry) element; - return entry.getKey(); - } - }); - - // FIXME How can we react upon changes in the Map-Value? - column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.PartDescriptorEditor_PersitedStateValue); - column.getColumn().setWidth(200); - column.setLabelProvider(new ColumnLabelProvider() { - @SuppressWarnings("unchecked") - @Override - public String getText(Object element) { - Entry entry = (Entry) element; - return entry.getValue(); - } - }); - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE); - tableviewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - // FIXME Implementation is missing - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - // FIXME Implementation is missing - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_Variables); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - ListViewer viewer = new ListViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - gd.heightHint = 80; - viewer.getList().setLayoutData(gd); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_Properties); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - TableViewer tableviewer = new TableViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - gd.heightHint = 80; - tableviewer.getTable().setHeaderVisible(true); - tableviewer.getControl().setLayoutData(gd); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.PartDescriptorEditor_PropertiesKey); - column.getColumn().setWidth(200); - - column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.PartDescriptorEditor_PropertiesValue); - column.getColumn().setWidth(200); - } - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index fdfd4aae45..eac5c60f48 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; -import java.util.Map.Entry; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IObservableValue; @@ -33,7 +32,6 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartIconDialogEditor; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationFactoryImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.basic.MPart; @@ -42,30 +40,17 @@ import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.BasicEMap; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.EditingSupport; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -335,161 +320,8 @@ public void widgetSelected(SelectionEvent e) { // ------------------------------------------------------------ ControlFactory.createStringListWidget(parent, this, "Binding Contexts", CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_PersitedState); - GridData gd = new GridData(GridData.END, GridData.BEGINNING, false, false); - gd.verticalIndent = VERTICAL_LIST_WIDGET_INDENT; - l.setLayoutData(gd); - - final TableViewer tableviewer = new TableViewer(parent); - tableviewer.getTable().setHeaderVisible(true); - ObservableListContentProvider cp = new ObservableListContentProvider(); - tableviewer.setContentProvider(cp); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 80; - gd.verticalIndent = VERTICAL_LIST_WIDGET_INDENT; - tableviewer.getControl().setLayoutData(gd); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.PartEditor_PersitedStateKey); - column.getColumn().setWidth(200); - column.setLabelProvider(new ColumnLabelProvider() { - @SuppressWarnings("unchecked") - @Override - public String getText(Object element) { - Entry entry = (Entry) element; - return entry.getKey(); - } - }); - - // FIXME How can we react upon changes in the Map-Value? - column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.PartEditor_PersitedStateValue); - column.getColumn().setWidth(200); - column.setLabelProvider(new ColumnLabelProvider() { - @SuppressWarnings("unchecked") - @Override - public String getText(Object element) { - Entry entry = (Entry) element; - return entry.getValue(); - } - }); - - final TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); - column.setEditingSupport(new EditingSupport(tableviewer) { - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, ApplicationPackageImpl.Literals.STRING_TO_STRING_MAP__KEY, value.toString().trim().length() == 0 ? null : value.toString()); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @SuppressWarnings("unchecked") - @Override - protected Object getValue(Object element) { - Entry entry = (Entry) element; - return entry.getValue() == null ? "" : entry.getValue(); //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE); - tableviewer.setInput(prop.observeDetail(getMaster())); - - final Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - Dialog dialog = new Dialog(buttonComp.getShell()) { - private Text key; - private Text value; - - @Override - protected Control createDialogArea(Composite parent) { - Composite comp = (Composite) super.createDialogArea(parent); - Composite container = new Composite(comp, SWT.NONE); - container.setLayout(new GridLayout(2, false)); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - - Label l = new Label(container, SWT.NONE); - l.setText("Key"); - - key = new Text(container, SWT.BORDER); - key.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - l = new Label(container, SWT.NONE); - l.setText("Value"); - - value = new Text(container, SWT.BORDER); - value.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - return comp; - } - - @Override - protected void okPressed() { - if (key.getText().trim().length() > 0) { - BasicEMap.Entry entry = (org.eclipse.emf.common.util.BasicEMap.Entry) ApplicationFactoryImpl.eINSTANCE.createStringToStringMap(); - entry.setHash(key.hashCode()); - entry.setKey(key.getText()); - entry.setValue(value.getText().trim().length() > 0 ? value.getText() : null); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, entry); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - super.okPressed(); - } - } - } - }; - dialog.open(); - - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - IStructuredSelection selection = (IStructuredSelection) tableviewer.getSelection(); - if (!selection.isEmpty()) { - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, selection.toList()); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - + ControlFactory.createMapProperties(parent, this, "Persisted State", ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, this, "Context Properties", UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); From 668e1046296f42e3fd8428ab483a6beb27844d1b Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 6 Jul 2010 20:50:52 +0000 Subject: [PATCH 0186/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * adding properties support --- .../common/component/AddonsEditor.java | 3 +- .../common/component/HandlerEditor.java | 2 +- .../common/component/PerspectiveEditor.java | 2 + .../common/component/PopupMenuEditor.java | 1 + .../common/component/ToolControlEditor.java | 69 +------------------ .../common/component/WindowEditor.java | 1 + 6 files changed, 9 insertions(+), 69 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index 33cfabc375..83e387423f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -165,7 +165,8 @@ public void widgetSelected(SelectionEvent e) { }); } - // ControlFactory.createBindingsWidget(parent, this); + ControlFactory.createMapProperties(parent, this, "Persisted State", ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index b90df2b255..e73d1c34b2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -202,7 +202,7 @@ public void widgetSelected(SelectionEvent e) { } }); } - + ControlFactory.createMapProperties(parent, this, "Persisted State", ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 473640cae1..713677cb5f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -371,6 +371,8 @@ public void widgetSelected(SelectionEvent e) { }); } + ControlFactory.createMapProperties(parent, this, "Context Properties", UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java index 0199da71f0..9dc6bbf464 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java @@ -28,6 +28,7 @@ public PopupMenuEditor(EditingDomain editingDomain, IProject project, ModelEdito protected Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean rootMenu, boolean isImport) { Composite comp = super.createForm(parent, context, master, rootMenu, isImport); if (!isImport) { + ControlFactory.createMapProperties(parent, this, "Context Properties", UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(comp, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index 93ea8cf9e2..b8aaeafde2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; -import java.util.Map.Entry; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; @@ -26,15 +25,10 @@ import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -170,67 +164,8 @@ public void widgetSelected(SelectionEvent e) { }); } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Persited State"); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - TableViewer tableviewer = new TableViewer(parent); - tableviewer.getTable().setHeaderVisible(true); - ObservableListContentProvider cp = new ObservableListContentProvider(); - tableviewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 80; - tableviewer.getControl().setLayoutData(gd); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Key"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ColumnLabelProvider() { - @SuppressWarnings("unchecked") - @Override - public String getText(Object element) { - Entry entry = (Entry) element; - return entry.getKey(); - } - }); - - // FIXME How can we react upon changes in the Map-Value? - column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Value"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ColumnLabelProvider() { - @SuppressWarnings("unchecked") - @Override - public String getText(Object element) { - Entry entry = (Entry) element; - return entry.getValue(); - } - }); - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE); - tableviewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - } + ControlFactory.createMapProperties(parent, this, "Persisted State", ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index f025d062a4..c289fa23ff 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -312,6 +312,7 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createSelectedElement(parent, this, context, "Selected Element"); ControlFactory.createStringListWidget(parent, this, "Binding Contexts", CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, this, "Context Properties", UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); From 040ee776cdb262c9bfe00fbdf42db8cfbc46b878 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 6 Jul 2010 21:03:20 +0000 Subject: [PATCH 0187/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * adding missing rendered classes --- .../emf/ui/internal/common/ModelEditor.java | 6 +++ .../common/component/RenderedMenuEditor.java | 27 ++++++++++++ .../common/component/RenderedMenuItem.java | 42 +++++++++++++++++++ .../component/RenderedToolBarEditor.java | 26 ++++++++++++ 4 files changed, 101 insertions(+) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 9ee1d2e11f..e9cbc7d446 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -72,6 +72,9 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.PerspectiveStackEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PlaceholderEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.PopupMenuEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.RenderedMenuEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.RenderedMenuItem; +import org.eclipse.e4.tools.emf.ui.internal.common.component.RenderedToolBarEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.StringModelFragment; import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarContributionEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarEditor; @@ -562,16 +565,19 @@ private void registerDefaultEditors() { registerEditor(CommandsPackageImpl.Literals.BINDING_CONTEXT, new BindingContextEditor(modelProvider.getEditingDomain(), this)); registerEditor(MenuPackageImpl.Literals.TOOL_BAR, new ToolBarEditor(modelProvider.getEditingDomain(), this)); + registerEditor(MenuPackageImpl.Literals.RENDERED_TOOL_BAR, new RenderedToolBarEditor(modelProvider.getEditingDomain(), this)); registerEditor(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, new HandledToolItemEditor(modelProvider.getEditingDomain(), this, project, modelProvider)); registerEditor(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, new ToolBarSeparatorEditor(modelProvider.getEditingDomain(), this)); registerEditor(MenuPackageImpl.Literals.TOOL_CONTROL, new ToolControlEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(MenuPackageImpl.Literals.MENU, new MenuEditor(modelProvider.getEditingDomain(), project, this)); + registerEditor(MenuPackageImpl.Literals.RENDERED_MENU, new RenderedMenuEditor(modelProvider.getEditingDomain(), project, this)); registerEditor(MenuPackageImpl.Literals.POPUP_MENU, new PopupMenuEditor(modelProvider.getEditingDomain(), project, this)); registerEditor(MenuPackageImpl.Literals.MENU_SEPARATOR, new MenuSeparatorEditor(modelProvider.getEditingDomain(), this)); registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), this, project, modelProvider)); registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this, project)); + registerEditor(MenuPackageImpl.Literals.RENDERED_MENU_ITEM, new RenderedMenuItem(modelProvider.getEditingDomain(), this, project)); registerEditor(MenuPackageImpl.Literals.MENU_CONTRIBUTION, new MenuContributionEditor(modelProvider.getEditingDomain(), project, this)); registerEditor(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION, new ToolBarContributionEditor(modelProvider.getEditingDomain(), project, this)); registerEditor(MenuPackageImpl.Literals.TRIM_CONTRIBUTION, new TrimContributionEditor(modelProvider.getEditingDomain(), project, this)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java new file mode 100644 index 0000000000..fdabe40bd3 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.emf.edit.domain.EditingDomain; + +public class RenderedMenuEditor extends MenuEditor { + + public RenderedMenuEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { + super(editingDomain, project, editor); + } + + @Override + public String getLabel(Object element) { + return "Rendered Menu"; + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java new file mode 100644 index 0000000000..aeb169ad9b --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.widgets.Composite; + +public class RenderedMenuItem extends MenuItemEditor { + + public RenderedMenuItem(EditingDomain editingDomain, ModelEditor editor, IProject project) { + super(editingDomain, editor, project); + } + + @Override + protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + // TODO Auto-generated method stub + + } + + @Override + public String getLabel(Object element) { + return "Rendered MenuItem"; + } + + @Override + public String getDescription(Object element) { + return "Rendered MenuItem Bla Bla Bla Bla"; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java new file mode 100644 index 0000000000..4cc0c20648 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.emf.edit.domain.EditingDomain; + +public class RenderedToolBarEditor extends ToolBarEditor { + + public RenderedToolBarEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain, editor); + } + + @Override + public String getLabel(Object element) { + return "Rendered ToolBar"; + } +} From 102e65c93907a7218fe39b6ec824b69a93f13a17 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 6 Jul 2010 21:08:31 +0000 Subject: [PATCH 0188/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling --- .../tools/emf/ui/internal/common/component/ControlFactory.java | 1 + 1 file changed, 1 insertion(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 58adaf7e38..289a2e9870 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -170,6 +170,7 @@ public void widgetSelected(SelectionEvent e) { @Override protected Control createDialogArea(Composite parent) { + getShell().setText("Key/Value Pair"); Composite comp = (Composite) super.createDialogArea(parent); Composite container = new Composite(comp, SWT.NONE); container.setLayout(new GridLayout(2, false)); From 241b6482a1ed7d95e4efb0a49b2b4e5e58e3ef2c Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 6 Jul 2010 22:03:38 +0000 Subject: [PATCH 0189/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling --- .../icons/full/obj16/Addons.png | Bin 0 -> 859 bytes bundles/org.eclipse.e4.tools/plugin.xml | 7 +++++++ .../wizards/classes/AbstractNewClassPage.java | 1 - 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 bundles/org.eclipse.e4.tools/icons/full/obj16/Addons.png diff --git a/bundles/org.eclipse.e4.tools/icons/full/obj16/Addons.png b/bundles/org.eclipse.e4.tools/icons/full/obj16/Addons.png new file mode 100644 index 0000000000000000000000000000000000000000..3262767cda95a217ac8d3fabf6c4bfe3514fd770 GIT binary patch literal 859 zcmV-h1El-)HU~Z@BQ7|ITsWqFPt%czwZJk^u%JZL0Ogu z7-JwwQn0tTclx3}?kvID+L{XidsxQ^&e&|W7P?hu`JbU6)Keq zD2hUaNxZkB72a$%4^2)^`UtC|A7te-nGAX1Xrjep5qO>_@7ffX%SGn`-ED7gLpU5( zk(@u5K{Og2Z)$29rKuELp-_NyIt_Job>MI~K&R7bgynLX>`sh~jA#lt3}_YQwqglZ ztJPR4mEiF3kO&v?|I7ONdO%xaZnyg`4MVH2u&{85WF^F8xkx0!oK7d7&*!07ENT-s zHZ~xYO7;1CzImGB_xm6GXq~MiVV0C|gzZGQ)-QC?rN*&h*fy7fxUu2>pgCsM)-Q?tMb$Vds z*E@*sEW?$R-d!Zlo`yI#H#gqa);3B?D6pBWXVBO67?`R6Qy3_qLZ+|_MxhlJx8`9r z{Xs@mdTouNQ0N7+J#TJqhNGh+O#w+J@OC~45~`3D2_z=L-&zrFU%dy%Qdzg0ic~cM z%s{~na19L&^isj*=4PpCtqL-e!E)J#V5X7%DWt(#}Pq3W$oGSy^Pc4j%jrk7_ z4xV5*S(C}slXQfB*Dx$m5ut)=uA6Vdoof#vmX1Pr{o_H2ueAT3P;2Ktrs3gX7h2gv zE62G1jK||?p|odbXLH|f%y4eoeRKHd`|tRw^&nXM?`u5!c)i}iTrM|2E9N*Z__gcJ lE2dmBR}@y4olxbIzJJd{=EC=vF*^VN002ovPDHLkV1lGDi4On( literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools/plugin.xml b/bundles/org.eclipse.e4.tools/plugin.xml index 56fd224e4e..d00322a1c6 100644 --- a/bundles/org.eclipse.e4.tools/plugin.xml +++ b/bundles/org.eclipse.e4.tools/plugin.xml @@ -53,6 +53,13 @@ id="org.eclipse.e4.tools.newpart" name="New Part Class"> + + diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java index 37ab73c963..719aecf4cb 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java @@ -362,7 +362,6 @@ public PackageFragmentToStringConverter() { } public Object convert(Object fromObject) { - System.err.println(" =======================> Converting: " + fromObject); if( fromObject == null ) { return ""; } From 3e6fe6fbcb43ec5b6eae9f402548103ddff81da9 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 6 Jul 2010 22:05:13 +0000 Subject: [PATCH 0190/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling --- .../plugin.xml | 3 + .../extension/AddonContributionEditor.java | 84 +++++++++++++++++++ .../extension/HandlerContributionEditor.java | 18 +--- .../extension/PartContributionEditor.java | 31 ++++--- .../e4/tools/emf/editor3x/extension/Util.java | 19 +++++ .../common/component/AddonsEditor.java | 21 ++++- .../wizards/classes/AbstractNewClassPage.java | 5 -- .../classes/AbstractNewClassWizard.java | 4 +- .../wizards/classes/NewAddonClassWizard.java | 44 ++++++++++ .../classes/templates/AddonTemplate.java | 32 +++++++ .../templates/addon.txtjet | 24 ++++++ 11 files changed, 250 insertions(+), 35 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/Util.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java create mode 100644 bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/AddonTemplate.java create mode 100644 bundles/org.eclipse.e4.tools/templates/addon.txtjet diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml index a6d28c8adf..e232671bfb 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml @@ -20,6 +20,9 @@ + + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java new file mode 100644 index 0000000000..ce8de80ff3 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.editor3x.extension; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.e4.internal.tools.wizards.classes.NewAddonClassWizard; +import org.eclipse.e4.internal.tools.wizards.classes.NewHandlerClassWizard; +import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; +import org.eclipse.e4.ui.model.application.MContribution; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jdt.core.ICompilationUnit; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.IType; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.ui.JavaUI; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PartInitException; + +public class AddonContributionEditor implements IContributionClassCreator { + + public boolean isSupported(EClass element) { + return Util.isTypeOrSuper(ApplicationPackageImpl.Literals.ADDON, element); + } + + public void createOpen(MContribution contribution, EditingDomain domain, + IProject project, Shell shell) { + if( contribution.getContributionURI() == null || contribution.getContributionURI().trim().length() == 0 ) { + NewAddonClassWizard wizard = new NewAddonClassWizard(); + wizard.init( null, new StructuredSelection(project)); + WizardDialog dialog = new WizardDialog(shell, wizard); + if( dialog.open() == WizardDialog.OK ) { + IFile f = wizard.getFile(); + ICompilationUnit el = JavaCore.createCompilationUnitFrom(f); + try { + String packageName = el.getPackageDeclarations()[0].getElementName(); + String className = wizard.getDomainClass().getName(); + Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "platform:/plugin/" + f.getProject().getName() + "/" + packageName+"."+className); + if( cmd.canExecute() ) { + domain.getCommandStack().execute(cmd); + } + } catch (JavaModelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } else { + URI uri = URI.createURI(contribution.getContributionURI()); + IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(uri.segment(1)); + //TODO If this is not a WS-Resource we need to open differently + if( p != null ) { + IJavaProject jp = JavaCore.create(p); + try { + IType t = jp.findType(uri.segment(2)); + JavaUI.openInEditor(t); + } catch (JavaModelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (PartInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java index e90faa7331..4ebf9a28d5 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java @@ -10,16 +10,12 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x.extension; -import java.net.URL; - import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.FileLocator; import org.eclipse.e4.internal.tools.wizards.classes.NewHandlerClassWizard; import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; @@ -33,15 +29,11 @@ import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.ui.JavaUI; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.IDE; public class HandlerContributionEditor implements IContributionClassCreator { @@ -87,14 +79,12 @@ public void createOpen(MContribution contribution, EditingDomain domain, IProjec public boolean isSupported(EClass element) { return - isTypeOrSuper(CommandsPackageImpl.Literals.HANDLER,element) + Util.isTypeOrSuper(CommandsPackageImpl.Literals.HANDLER,element) || - isTypeOrSuper(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, element) + Util.isTypeOrSuper(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, element) || - isTypeOrSuper(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, element); + Util.isTypeOrSuper(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, element); } - private boolean isTypeOrSuper(EClass eClass, EClass element) { - return eClass.equals(element) || element.getEAllSuperTypes().contains(eClass); - } + } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java index 154e887df0..c6f5c3a32d 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java @@ -38,18 +38,26 @@ public class PartContributionEditor implements IContributionClassCreator { public void createOpen(MContribution contribution, EditingDomain domain, IProject project, Shell shell) { - if( contribution.getContributionURI() == null || contribution.getContributionURI().trim().length() == 0 ) { + if (contribution.getContributionURI() == null + || contribution.getContributionURI().trim().length() == 0) { NewPartClassWizard wizard = new NewPartClassWizard(); - wizard.init( null, new StructuredSelection(project)); + wizard.init(null, new StructuredSelection(project)); WizardDialog dialog = new WizardDialog(shell, wizard); - if( dialog.open() == WizardDialog.OK ) { + if (dialog.open() == WizardDialog.OK) { IFile f = wizard.getFile(); ICompilationUnit el = JavaCore.createCompilationUnitFrom(f); try { - String packageName = el.getPackageDeclarations()[0].getElementName(); + String packageName = el.getPackageDeclarations()[0] + .getElementName(); String className = wizard.getDomainClass().getName(); - Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "platform:/plugin/" + f.getProject().getName() + "/" + packageName+"."+className); - if( cmd.canExecute() ) { + Command cmd = SetCommand + .create(domain, + contribution, + ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, + "platform:/plugin/" + + f.getProject().getName() + "/" + + packageName + "." + className); + if (cmd.canExecute()) { domain.getCommandStack().execute(cmd); } } catch (JavaModelException e) { @@ -59,9 +67,10 @@ public void createOpen(MContribution contribution, EditingDomain domain, } } else { URI uri = URI.createURI(contribution.getContributionURI()); - IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(uri.segment(1)); - //TODO If this is not a WS-Resource we need to open differently - if( p != null ) { + IProject p = ResourcesPlugin.getWorkspace().getRoot() + .getProject(uri.segment(1)); + // TODO If this is not a WS-Resource we need to open differently + if (p != null) { IJavaProject jp = JavaCore.create(p); try { IType t = jp.findType(uri.segment(2)); @@ -78,9 +87,7 @@ public void createOpen(MContribution contribution, EditingDomain domain, } public boolean isSupported(EClass element) { - return BasicPackageImpl.Literals.PART == element - || element.getEAllSuperTypes().contains( - BasicPackageImpl.Literals.PART); + return Util.isTypeOrSuper(BasicPackageImpl.Literals.PART, element); } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/Util.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/Util.java new file mode 100644 index 0000000000..f49d3b784c --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/Util.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.editor3x.extension; + +import org.eclipse.emf.ecore.EClass; + +public class Util { + public static boolean isTypeOrSuper(EClass eClass, EClass element) { + return eClass.equals(element) || element.getEAllSuperTypes().contains(eClass); + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index 83e387423f..e946c8df8f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -16,6 +16,7 @@ import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; @@ -40,6 +41,7 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Link; import org.eclipse.swt.widgets.Text; public class AddonsEditor extends AbstractComponentEditor { @@ -145,9 +147,22 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, // ------------------------------------------------------------ { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.AddonsEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + final IContributionClassCreator c = getEditor().getContributionCreator(ApplicationPackageImpl.Literals.ADDON); + if (project != null && c != null) { + final Link l = new Link(parent, SWT.NONE); + l.setText("" + Messages.PartEditor_ClassURI + ""); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + l.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project, l.getShell()); + } + }); + } else { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.AddonsEditor_ClassURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + } Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java index 719aecf4cb..fe4d7f7178 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java @@ -196,11 +196,6 @@ public void widgetSelected(SelectionEvent e) { }); } - { - Label l = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); - l.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 3, 1)); - } - { IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java index 2aae8de99a..16974d80e1 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java @@ -28,6 +28,8 @@ import org.eclipse.jface.wizard.Wizard; import org.eclipse.ui.INewWizard; import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; public abstract class AbstractNewClassWizard extends Wizard implements INewWizard { protected IPackageFragmentRoot root; @@ -35,7 +37,6 @@ public abstract class AbstractNewClassWizard extends Wizard implements INewWizar public void init(IWorkbench workbench, IStructuredSelection selection) { root = getFragmentRoot(getInitialJavaElement(selection)); - System.err.println("Root: " + root); } protected IJavaElement getInitialJavaElement(IStructuredSelection selection) { @@ -129,6 +130,7 @@ public boolean performFinish() { file.setContents(new ByteArrayInputStream(content.getBytes()), IFile.FORCE | IFile.KEEP_HISTORY, null); } + IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file); unit.open(null); } catch (CoreException e) { // TODO Auto-generated catch block diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java new file mode 100644 index 0000000000..a7710aff75 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.internal.tools.wizards.classes; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.e4.internal.tools.wizards.classes.templates.AddonTemplate; +import org.eclipse.swt.widgets.Composite; + +public class NewAddonClassWizard extends AbstractNewClassWizard { + @Override + public void addPages() { + addPage(new AbstractNewClassPage("Classinformation", + "New Handler", + "Create a new handler class", root, ResourcesPlugin.getWorkspace().getRoot()) { + + @Override + protected void createFields(Composite parent, + DataBindingContext dbc) { + } + + @Override + protected JavaClass createInstance() { + return new JavaClass(root); + } + + }); + } + + @Override + protected String getContent() { + AddonTemplate template = new AddonTemplate(); + return template.generate(getDomainClass()); + } + +} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/AddonTemplate.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/AddonTemplate.java new file mode 100644 index 0000000000..52be770c3d --- /dev/null +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/AddonTemplate.java @@ -0,0 +1,32 @@ +package org.eclipse.e4.internal.tools.wizards.classes.templates; + +import org.eclipse.e4.internal.tools.wizards.classes.AbstractNewClassPage.JavaClass; + +public class AddonTemplate +{ + protected static String nl; + public static synchronized AddonTemplate create(String lineSeparator) + { + nl = lineSeparator; + AddonTemplate result = new AddonTemplate(); + nl = null; + return result; + } + + public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; + protected final String TEXT_1 = " " + NL + "package "; + protected final String TEXT_2 = ";" + NL + "" + NL + "import javax.inject.Inject;" + NL + "import javax.annotation.PostConstruct;" + NL + "import javax.annotation.PreDestroy;" + NL + "" + NL + "import org.eclipse.e4.core.services.events.IEventBroker;" + NL + "" + NL + "public class "; + protected final String TEXT_3 = " {" + NL + "\t@Inject" + NL + "\tIEventBroker eventBroker;" + NL + "\t" + NL + "\t@PostConstruct" + NL + "\tvoid hookListeners() {" + NL + "\t\t// Hook event listeners" + NL + "\t}" + NL + "\t" + NL + "\t@PreDestroy" + NL + "\tvoid unhookListeners() {" + NL + "\t\t// Unhook event listeners" + NL + "\t}" + NL + "}"; + + public String generate(Object argument) + { + final StringBuffer stringBuffer = new StringBuffer(); + JavaClass domainClass = (JavaClass)argument; + stringBuffer.append(TEXT_1); + stringBuffer.append( domainClass.getPackageFragment().getElementName() ); + stringBuffer.append(TEXT_2); + stringBuffer.append( domainClass.getName() ); + stringBuffer.append(TEXT_3); + return stringBuffer.toString(); + } +} diff --git a/bundles/org.eclipse.e4.tools/templates/addon.txtjet b/bundles/org.eclipse.e4.tools/templates/addon.txtjet new file mode 100644 index 0000000000..32436d2b30 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/templates/addon.txtjet @@ -0,0 +1,24 @@ +<%@ jet package="org.eclipse.e4.internal.tools.wizards.classes.templates" class="AddonTemplate" imports="org.eclipse.e4.internal.tools.wizards.classes.AbstractNewClassPage.JavaClass" %> +<% JavaClass domainClass = (JavaClass)argument; %> +package <%= domainClass.getPackageFragment().getElementName() %>; + +import javax.inject.Inject; +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; + +import org.eclipse.e4.core.services.events.IEventBroker; + +public class <%= domainClass.getName() %> { + @Inject + IEventBroker eventBroker; + + @PostConstruct + void hookListeners() { + // Hook event listeners + } + + @PreDestroy + void unhookListeners() { + // Unhook event listeners + } +} \ No newline at end of file From 5618c47456c8f92d224ff018427f842db83f058c Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 6 Jul 2010 22:24:08 +0000 Subject: [PATCH 0191/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling --- .../internal/tools/wizards/classes/NewAddonClassWizard.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java index a7710aff75..fba02f96fb 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java @@ -19,8 +19,8 @@ public class NewAddonClassWizard extends AbstractNewClassWizard { @Override public void addPages() { addPage(new AbstractNewClassPage("Classinformation", - "New Handler", - "Create a new handler class", root, ResourcesPlugin.getWorkspace().getRoot()) { + "New Addon", + "Create a new addon class", root, ResourcesPlugin.getWorkspace().getRoot()) { @Override protected void createFields(Composite parent, From ff668f46881d7d5c559ba35aa4defe1dd101afbd Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 8 Jul 2010 09:23:12 +0000 Subject: [PATCH 0192/1286] Bug 308439 - Correct plugin for e4 wizards --- bundles/org.eclipse.e4.tools/build.properties | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools/build.properties b/bundles/org.eclipse.e4.tools/build.properties index e9863e281e..02422f7fd3 100644 --- a/bundles/org.eclipse.e4.tools/build.properties +++ b/bundles/org.eclipse.e4.tools/build.properties @@ -2,4 +2,6 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - plugin.xml + plugin.xml,\ + icons/,\ + templates/ From f5b2c4e2a732e2d3bbdaa6dcca04659f9dee9e36 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 8 Jul 2010 10:28:50 +0000 Subject: [PATCH 0193/1286] Bug 319250 - [Model Tooling] Shortcut to open liveeditor only works once From a2e3d15be79f82dcfbcdd693f8b0c5bc842ba42e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 8 Jul 2010 15:50:25 +0000 Subject: [PATCH 0194/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * added support for model reference searching in workspace --- .../META-INF/MANIFEST.MF | 5 +- .../OSGI-INF/workspacee4xmiprovider.xml | 7 + .../build.properties | 3 +- .../emf/editor3x/ModelElementProvider.java | 109 ++++++++++ .../OSGI-INF/contributioncollector.xml | 1 + .../emf/ui/common/IModelElementProvider.java | 26 +++ .../common/ClassContributionCollector.java | 35 ++- .../common/component/ControlFactory.java | 2 +- .../dialogs/FindImportElementDialog.java | 202 +++++++++++++----- 9 files changed, 324 insertions(+), 66 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/workspacee4xmiprovider.xml create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelElementProvider.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index 33eead93a8..f469004729 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -26,6 +26,7 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.tools.compat;bundle-version="1.0.0", org.eclipse.e4.tools.services;bundle-version="1.0.0", org.eclipse.e4.tools;bundle-version="0.9.0", - org.eclipse.jdt.ui;bundle-version="3.6.0" -Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/xmiresourcecontextfunction.xml, OSGI-INF/projectfunction.xml + org.eclipse.jdt.ui;bundle-version="3.6.0", + org.eclipse.search;bundle-version="3.6.0" +Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/xmiresourcecontextfunction.xml, OSGI-INF/projectfunction.xml, OSGI-INF/workspacee4xmiprovider.xml Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/workspacee4xmiprovider.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/workspacee4xmiprovider.xml new file mode 100644 index 0000000000..cd3b8d23e9 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/workspacee4xmiprovider.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties index 4f0aef779f..dadf4c01ee 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties @@ -3,5 +3,6 @@ bin.includes = META-INF/,\ .,\ plugin.xml,\ icons/,\ - OSGI-INF/ + OSGI-INF/,\ + OSGI-INF/workspacee4xmiprovider.xml source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelElementProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelElementProvider.java new file mode 100644 index 0000000000..f5e463bfcb --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelElementProvider.java @@ -0,0 +1,109 @@ +package org.eclipse.e4.tools.emf.editor3x; + +import java.util.regex.Pattern; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider; +import org.eclipse.e4.ui.model.application.MApplicationElement; +import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; +import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.search.core.text.TextSearchEngine; +import org.eclipse.search.core.text.TextSearchRequestor; +import org.eclipse.search.core.text.TextSearchScope; + +//FIXME In the next release we could probably use EMF-Query +public class ModelElementProvider implements IModelElementProvider { + private ResourceSet resourceSet; + + public void getModelElements(Filter filter, ModelResultHandler handler) { + if (resourceSet == null) { + resourceSet = new ResourceSetImpl(); + TextSearchEngine engine = TextSearchEngine.createDefault(); + TextSearchScope scope = TextSearchScope + .newSearchScope(new IResource[] { ResourcesPlugin + .getWorkspace().getRoot() }, Pattern + .compile(".+\\.e4xmi"), true); + engine.search(scope, new RequestorImpl(filter, handler), + Pattern.compile(".+\\.e4xmi"), null); + } else { + applyFilter(filter, handler); + } + } + + private void applyFilter(Filter filter, ModelResultHandler handler) { + for (Resource res : resourceSet.getResources()) { + if (res.getURI().equals(filter.object.eResource().getURI())) { +// System.err.println("Skipped because self"); + } else { + TreeIterator it = EcoreUtil.getAllContents(res, + true); + while (it.hasNext()) { + EObject o = it.next(); + if (o.eContainingFeature() == FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS) { +// System.err +// .println("Skipped because it is an import"); + } else { + if (o.eClass().equals(filter.object.eClass())) { + + if (o instanceof MApplicationElement) { + String elementId = ((MApplicationElement) o).getElementId(); + if( elementId != null && elementId.trim().length() > 0 ) { + if( filter.elementIdPattern.matcher(elementId).matches() ) { + handler.result(o); + } + } + } + } + } + } + } + } + } + + class RequestorImpl extends TextSearchRequestor { + private final Filter filter; + private final ModelResultHandler handler; + + public RequestorImpl(Filter filter, ModelResultHandler handler) { + this.filter = filter; + this.handler = handler; + } + + @Override + public boolean acceptFile(IFile file) throws CoreException { + try { + if( file.getProject().isOpen() ) { + resourceSet.getResource(URI.createPlatformResourceURI("/" + + file.getFullPath().makeRelative().toString(), true), + true); + } + } catch (Exception e) { + e.printStackTrace(); + } + + return super.acceptFile(file); + } + + @Override + public void endReporting() { + applyFilter(filter, handler); + super.endReporting(); + } + } + + public void clearCache() { + for (Resource r : resourceSet.getResources()) { + r.unload(); + } + resourceSet = null; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml index 42e124fe44..fca98c87e2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml +++ b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml @@ -5,4 +5,5 @@ + diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java new file mode 100644 index 0000000000..b9f03d1af6 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java @@ -0,0 +1,26 @@ +package org.eclipse.e4.tools.emf.ui.common; + +import java.util.regex.Pattern; +import org.eclipse.emf.ecore.EObject; + +public interface IModelElementProvider { + public class Filter { + public final EObject object; + public final String elementId; + public final Pattern elementIdPattern; + + public Filter(EObject object, String elementId) { + this.object = object; + this.elementId = elementId; + this.elementIdPattern = Pattern.compile(".*" + elementId.replaceAll("\\.", "\\\\.") + ".*"); + } + } + + public interface ModelResultHandler { + public void result(EObject data); + } + + public void getModelElements(Filter filter, ModelResultHandler handler); + + public void clearCache(); +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java index b642e95558..6862765b12 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java @@ -10,27 +10,50 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; - import java.util.concurrent.CopyOnWriteArrayList; import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider; import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionResultHandler; import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Filter; +import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider; +import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.ModelResultHandler; public class ClassContributionCollector { private CopyOnWriteArrayList providers = new CopyOnWriteArrayList(); - + private CopyOnWriteArrayList modelElementProviders = new CopyOnWriteArrayList(); + public void addContributor(IClassContributionProvider contributor) { providers.add(contributor); } - + public void removeContributor(IClassContributionProvider contributor) { providers.remove(contributor); } - + + public void addModelElementContributor(IModelElementProvider provider) { + modelElementProviders.add(provider); + } + + public void removeModelElementContributor(IModelElementProvider provider) { + modelElementProviders.remove(provider); + } + public void findContributions(Filter filter, ContributionResultHandler resultHandler) { - - for( IClassContributionProvider contributor: providers ) { + + for (IClassContributionProvider contributor : providers) { contributor.findContribution(filter, resultHandler); } } + + public void findModelElements(org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.Filter filter, ModelResultHandler resultHandler) { + + for (IModelElementProvider contributor : modelElementProviders) { + contributor.getModelElements(filter, resultHandler); + } + } + + public void clearModelCache() { + for (IModelElementProvider contributor : modelElementProviders) { + contributor.clearCache(); + } + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 289a2e9870..1623bacaf4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -260,7 +260,7 @@ public static void createFindImport(Composite parent, final AbstractComponentEdi b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - FindImportElementDialog dialog = new FindImportElementDialog(b.getShell(), editor.getEditingDomain(), (EObject) editor.getMaster().getValue()); + FindImportElementDialog dialog = new FindImportElementDialog(b.getShell(), editor, (EObject) editor.getMaster().getValue()); dialog.open(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java index 9a508b9271..d10fbb4f7a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java @@ -1,94 +1,184 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.Filter; +import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.ModelResultHandler; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; +import org.eclipse.e4.ui.model.application.MApplicationElement; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; import org.eclipse.jface.viewers.TableViewer; - -import org.eclipse.e4.ui.model.application.MApplication; - -import org.eclipse.swt.widgets.Button; - -import org.eclipse.swt.widgets.Text; - -import org.eclipse.swt.layout.GridLayout; - -import org.eclipse.swt.widgets.Label; - -import org.eclipse.swt.layout.GridData; - +import org.eclipse.jface.viewers.ViewerCell; import org.eclipse.swt.SWT; - -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; - import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; - +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; - +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; - -import org.eclipse.emf.edit.domain.EditingDomain; - -import org.eclipse.emf.ecore.EObject; - +import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; - -import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.swt.widgets.Text; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; public class FindImportElementDialog extends TitleAreaDialog { - private MApplication runningApp; - - public FindImportElementDialog(Shell parentShell, EditingDomain domain, EObject element/*, MApplication runningApp*/) { + private EObject element; + private AbstractComponentEditor editor; + private TableViewer viewer; + + public FindImportElementDialog(Shell parentShell, AbstractComponentEditor editor, EObject element) { super(parentShell); - this.runningApp = runningApp; + this.element = element; + this.editor = editor; } - + @Override protected Control createDialogArea(Composite parent) { Composite comp = (Composite) super.createDialogArea(parent); - + final Image titleImage = new Image(parent.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/import_wiz.png")); setTitleImage(titleImage); getShell().addDisposeListener(new DisposeListener() { - + public void widgetDisposed(DisposeEvent e) { titleImage.dispose(); } }); - + getShell().setText("Find Import Elements"); setTitle("Find Import Elements"); setMessage("Search for an elements whose ID you'd like to import"); - - Composite container = new Composite(comp,SWT.NONE); + + Composite container = new Composite(comp, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(3, false)); - - + container.setLayout(new GridLayout(2, false)); + Label l = new Label(container, SWT.NONE); l.setText("Search"); - + final Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); GridData gd = new GridData(GridData.FILL_HORIZONTAL); searchText.setLayoutData(gd); - - new Label(container, SWT.NONE); - - l = new Label(container, SWT.NONE); - l.setText("File"); - - Text t = new Text(container, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setText("memory://running-model"); - - Button b = new Button(container, SWT.PUSH); - b.setText("Browse"); - + l = new Label(container, SWT.PUSH); - - TableViewer viewer = new TableViewer(container); + + viewer = new TableViewer(container); viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - + viewer.setLabelProvider(new StyledCellLabelProvider() { + @Override + public void update(ViewerCell cell) { + EObject o = (EObject) cell.getElement(); + cell.setImage(editor.getImage(o, searchText.getDisplay())); + + StyledString styledString = new StyledString(editor.getLabel(o), null); + String detailLabel = editor.getDetailLabel(o); + if (detailLabel != null) { + styledString.append(" - " + detailLabel, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + } + + styledString.append(" - " + o.eResource().getURI(), StyledString.COUNTER_STYLER); //$NON-NLS-1$ + cell.setStyleRanges(styledString.getStyleRanges()); + cell.setText(styledString.getString()); + } + }); + viewer.setContentProvider(new ObservableListContentProvider()); + viewer.addDoubleClickListener(new IDoubleClickListener() { + + public void doubleClick(DoubleClickEvent event) { + okPressed(); + } + }); + + final WritableList list = new WritableList(); + viewer.setInput(list); + + final ClassContributionCollector collector = getCollector(); + + searchText.addModifyListener(new ModifyListener() { + private ModelResultHandlerImpl currentResultHandler; + + public void modifyText(ModifyEvent e) { + if (currentResultHandler != null) { + currentResultHandler.cancled = true; + } + list.clear(); + currentResultHandler = new ModelResultHandlerImpl(list); + Filter filter = new Filter(element, searchText.getText()); + collector.findModelElements(filter, currentResultHandler); + } + }); + + Button button = new Button(container, SWT.PUSH); + button.setText("Clear Cache"); + button.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false, 2, 1)); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + collector.clearModelCache(); + } + }); + return comp; } + + @Override + protected void okPressed() { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (!s.isEmpty()) { + MApplicationElement el = (MApplicationElement) s.getFirstElement(); + if (el.getElementId() != null && el.getElementId().trim().length() > 0) { + Command cmd = SetCommand.create(editor.getEditingDomain(), element, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, el.getElementId()); + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + } + } + super.okPressed(); + } + } + + private ClassContributionCollector getCollector() { + Bundle bundle = FrameworkUtil.getBundle(FindImportElementDialog.class); + BundleContext context = bundle.getBundleContext(); + ServiceReference ref = context.getServiceReference(ClassContributionCollector.class.getName()); + if (ref != null) { + return (ClassContributionCollector) context.getService(ref); + } + return null; + } + + private static class ModelResultHandlerImpl implements ModelResultHandler { + private boolean cancled = false; + private IObservableList list; + + public ModelResultHandlerImpl(IObservableList list) { + this.list = list; + } + + public void result(EObject data) { + if (!cancled) { + list.add(data); + } + } + + } } \ No newline at end of file From 9774a636b3e0d5f9b0b2a41cbc4477644255e28a Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 8 Jul 2010 18:01:13 +0000 Subject: [PATCH 0195/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * added support for model reference searching in workspace --- .../META-INF/MANIFEST.MF | 5 ++- .../emf/ui/common/IModelElementProvider.java | 2 +- .../dialogs/FindImportElementDialog.java | 31 +++++++++++++++---- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index f469004729..a521ba15df 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -26,7 +26,6 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.tools.compat;bundle-version="1.0.0", org.eclipse.e4.tools.services;bundle-version="1.0.0", org.eclipse.e4.tools;bundle-version="0.9.0", - org.eclipse.jdt.ui;bundle-version="3.6.0", - org.eclipse.search;bundle-version="3.6.0" -Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/xmiresourcecontextfunction.xml, OSGI-INF/projectfunction.xml, OSGI-INF/workspacee4xmiprovider.xml + org.eclipse.jdt.ui;bundle-version="3.6.0" +Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/xmiresourcecontextfunction.xml, OSGI-INF/projectfunction.xml, OSGI-INF/pdee4xmiprovider.xml Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java index b9f03d1af6..6c5cf3b0c6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java @@ -12,7 +12,7 @@ public class Filter { public Filter(EObject object, String elementId) { this.object = object; this.elementId = elementId; - this.elementIdPattern = Pattern.compile(".*" + elementId.replaceAll("\\.", "\\\\.") + ".*"); + this.elementIdPattern = Pattern.compile(".*" + elementId.replaceAll("\\.", "\\\\.").replaceAll("\\*", ".*") + ".*"); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java index d10fbb4f7a..5eb756e889 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java @@ -90,9 +90,10 @@ public void update(ViewerCell cell) { EObject o = (EObject) cell.getElement(); cell.setImage(editor.getImage(o, searchText.getDisplay())); - StyledString styledString = new StyledString(editor.getLabel(o), null); + MApplicationElement appEl = (MApplicationElement) o; + StyledString styledString = new StyledString(editor.getLabel(o) + " (" + appEl.getElementId() + ")", null); String detailLabel = editor.getDetailLabel(o); - if (detailLabel != null) { + if (detailLabel != null && !detailLabel.equals(appEl.getElementId())) { styledString.append(" - " + detailLabel, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ } @@ -122,8 +123,8 @@ public void modifyText(ModifyEvent e) { currentResultHandler.cancled = true; } list.clear(); - currentResultHandler = new ModelResultHandlerImpl(list); Filter filter = new Filter(element, searchText.getText()); + currentResultHandler = new ModelResultHandlerImpl(list, filter, editor); collector.findModelElements(filter, currentResultHandler); } }); @@ -169,16 +170,34 @@ private ClassContributionCollector getCollector() { private static class ModelResultHandlerImpl implements ModelResultHandler { private boolean cancled = false; private IObservableList list; + private Filter filter; + private AbstractComponentEditor editor; - public ModelResultHandlerImpl(IObservableList list) { + public ModelResultHandlerImpl(IObservableList list, Filter filter, AbstractComponentEditor editor) { this.list = list; + this.filter = filter; + this.editor = editor; } public void result(EObject data) { if (!cancled) { - list.add(data); + if (data instanceof MApplicationElement) { + String elementId = ((MApplicationElement) data).getElementId(); + if (elementId != null && elementId.trim().length() > 0) { + if (filter.elementIdPattern.matcher(elementId).matches()) { + list.add(data); + return; + } + } + + String label = editor.getDetailLabel(data); + if (label != null && label.trim().length() > 0) { + if (filter.elementIdPattern.matcher(label).matches()) { + list.add(data); + } + } + } } } - } } \ No newline at end of file From 934287024eaae60f12c9e833cc60de05d4430c2e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 8 Jul 2010 18:06:08 +0000 Subject: [PATCH 0196/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * added support for model reference searching in workspace --- ...e4xmiprovider.xml => pdee4xmiprovider.xml} | 4 +- .../build.properties | 3 +- .../emf/editor3x/ModelElementProvider.java | 109 ---------------- .../emf/editor3x/TargetElementProviders.java | 122 ++++++++++++++++++ .../dialogs/FindImportElementDialog.java | 6 +- 5 files changed, 129 insertions(+), 115 deletions(-) rename bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/{workspacee4xmiprovider.xml => pdee4xmiprovider.xml} (58%) delete mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelElementProvider.java create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/workspacee4xmiprovider.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdee4xmiprovider.xml similarity index 58% rename from bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/workspacee4xmiprovider.xml rename to bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdee4xmiprovider.xml index cd3b8d23e9..54795752ac 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/workspacee4xmiprovider.xml +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdee4xmiprovider.xml @@ -1,6 +1,6 @@ - - + + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties index dadf4c01ee..4f0aef779f 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties @@ -3,6 +3,5 @@ bin.includes = META-INF/,\ .,\ plugin.xml,\ icons/,\ - OSGI-INF/,\ - OSGI-INF/workspacee4xmiprovider.xml + OSGI-INF/ source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelElementProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelElementProvider.java deleted file mode 100644 index f5e463bfcb..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelElementProvider.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.eclipse.e4.tools.emf.editor3x; - -import java.util.regex.Pattern; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.search.core.text.TextSearchEngine; -import org.eclipse.search.core.text.TextSearchRequestor; -import org.eclipse.search.core.text.TextSearchScope; - -//FIXME In the next release we could probably use EMF-Query -public class ModelElementProvider implements IModelElementProvider { - private ResourceSet resourceSet; - - public void getModelElements(Filter filter, ModelResultHandler handler) { - if (resourceSet == null) { - resourceSet = new ResourceSetImpl(); - TextSearchEngine engine = TextSearchEngine.createDefault(); - TextSearchScope scope = TextSearchScope - .newSearchScope(new IResource[] { ResourcesPlugin - .getWorkspace().getRoot() }, Pattern - .compile(".+\\.e4xmi"), true); - engine.search(scope, new RequestorImpl(filter, handler), - Pattern.compile(".+\\.e4xmi"), null); - } else { - applyFilter(filter, handler); - } - } - - private void applyFilter(Filter filter, ModelResultHandler handler) { - for (Resource res : resourceSet.getResources()) { - if (res.getURI().equals(filter.object.eResource().getURI())) { -// System.err.println("Skipped because self"); - } else { - TreeIterator it = EcoreUtil.getAllContents(res, - true); - while (it.hasNext()) { - EObject o = it.next(); - if (o.eContainingFeature() == FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS) { -// System.err -// .println("Skipped because it is an import"); - } else { - if (o.eClass().equals(filter.object.eClass())) { - - if (o instanceof MApplicationElement) { - String elementId = ((MApplicationElement) o).getElementId(); - if( elementId != null && elementId.trim().length() > 0 ) { - if( filter.elementIdPattern.matcher(elementId).matches() ) { - handler.result(o); - } - } - } - } - } - } - } - } - } - - class RequestorImpl extends TextSearchRequestor { - private final Filter filter; - private final ModelResultHandler handler; - - public RequestorImpl(Filter filter, ModelResultHandler handler) { - this.filter = filter; - this.handler = handler; - } - - @Override - public boolean acceptFile(IFile file) throws CoreException { - try { - if( file.getProject().isOpen() ) { - resourceSet.getResource(URI.createPlatformResourceURI("/" - + file.getFullPath().makeRelative().toString(), true), - true); - } - } catch (Exception e) { - e.printStackTrace(); - } - - return super.acceptFile(file); - } - - @Override - public void endReporting() { - applyFilter(filter, handler); - super.endReporting(); - } - } - - public void clearCache() { - for (Resource r : resourceSet.getResources()) { - r.unload(); - } - resourceSet = null; - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java new file mode 100644 index 0000000000..c9c753471b --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java @@ -0,0 +1,122 @@ +package org.eclipse.e4.tools.emf.editor3x; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider; +import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.Filter; +import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.ModelResultHandler; +import org.eclipse.e4.ui.model.application.MApplicationElement; +import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; +import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.pde.core.plugin.IPluginModelBase; +import org.eclipse.pde.internal.core.PDECore; +import org.eclipse.pde.internal.core.PDEExtensionRegistry; +import org.eclipse.pde.internal.core.PluginModelManager; + +public class TargetElementProviders implements IModelElementProvider { + private ResourceSet resourceSet; + + public void getModelElements(Filter filter, ModelResultHandler handler) { + if( resourceSet == null ) { + resourceSet = new ResourceSetImpl(); + PDEExtensionRegistry reg = new PDEExtensionRegistry(); + IExtension[] extensions = reg.findExtensions("org.eclipse.e4.workbench.model", true); + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + + for( IExtension ext : extensions ) { + for( IConfigurationElement el : ext.getConfigurationElements() ) { + if( el.getName().equals("fragment") ) { + URI uri; +// System.err.println("Model-Ext: Checking: " + ext.getContributor().getName()); + IProject p = root.getProject(ext.getContributor().getName()); + if( p.exists() && p.isOpen() ) { + uri = URI.createPlatformResourceURI(ext.getContributor().getName() + "/" + el.getAttribute("uri"), true); + } else { + uri = URI.createURI("platform:/plugin/" + ext.getContributor().getName() + "/" + el.getAttribute("uri") ); + } +// System.err.println(uri); + try { + resourceSet.getResource(uri, true); + } catch (Exception e) { + e.printStackTrace(); +// System.err.println("=============> Failing"); + } + + } + } + } + + extensions = reg.findExtensions("org.eclipse.core.runtime.products", true); + for( IExtension ext : extensions ) { + for( IConfigurationElement el : ext.getConfigurationElements() ) { + if( el.getName().equals("product") ) { + for( IConfigurationElement prop: el.getChildren("property") ) { + if( prop.getAttribute("name").equals("applicationXMI") ) { + String v = prop.getAttribute("value"); + String[] s = v.split("/"); + URI uri; +// System.err.println("Product-Ext: Checking: " + v + " => P:" + s[0] + ""); + IProject p = root.getProject(s[0]); + if( p.exists() && p.isOpen() ) { + uri = URI.createPlatformResourceURI(v, true ); + } else { + uri = URI.createURI("platform:/plugin/" + v ); + } + +// System.err.println(uri); + try { + resourceSet.getResource(uri, true); + } catch (Exception e) { + e.printStackTrace(); +// System.err.println("=============> Failing"); + } + break; + } + } + } + } + } + } + + applyFilter(filter, handler); + } + + private void applyFilter(Filter filter, ModelResultHandler handler) { + for (Resource res : resourceSet.getResources()) { + if (res.getURI().equals(filter.object.eResource().getURI())) { +// System.err.println("Skipped because self"); + } else { + TreeIterator it = EcoreUtil.getAllContents(res, + true); + while (it.hasNext()) { + EObject o = it.next(); + if (o.eContainingFeature() == FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS) { +// System.err +// .println("Skipped because it is an import"); + } else { + if (o.eClass().equals(filter.object.eClass())) { + handler.result(o); + } + } + } + } + } + } + + public void clearCache() { + for (Resource r : resourceSet.getResources()) { + r.unload(); + } + resourceSet = null; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java index 5eb756e889..0f71fd7c5f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java @@ -83,7 +83,9 @@ public void widgetDisposed(DisposeEvent e) { l = new Label(container, SWT.PUSH); viewer = new TableViewer(container); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + gd = new GridData(GridData.FILL_BOTH); + gd.heightHint = 200; + viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new StyledCellLabelProvider() { @Override public void update(ViewerCell cell) { @@ -191,7 +193,7 @@ public void result(EObject data) { } String label = editor.getDetailLabel(data); - if (label != null && label.trim().length() > 0) { + if (elementId != null && label != null && label.trim().length() > 0) { if (filter.elementIdPattern.matcher(label).matches()) { list.add(data); } From ad9de3020e3971ce58214d126175533c147aa824 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 8 Jul 2010 18:35:05 +0000 Subject: [PATCH 0197/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * added support moving entries between models --- .../emf/ui/internal/common/ModelEditor.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index e9cbc7d446..cefdeededc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -844,6 +844,16 @@ public boolean performDrop(Object data) { } } + if (feature == FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS) { + MApplicationElement el = (MApplicationElement) EcoreUtil.create(((EObject) data).eClass()); + el.setElementId(((MApplicationElement) data).getElementId()); + Command cmd = AddCommand.create(domain, parent, feature, el); + if (cmd.canExecute()) { + domain.getCommandStack().execute(cmd); + } + return true; + } + if (feature != null && parent != null) { List list = (List) parent.eGet(feature); int index = list.indexOf(getCurrentTarget()); @@ -856,11 +866,18 @@ public boolean performDrop(Object data) { Command cmd = MoveCommand.create(domain, parent, feature, data, index); if (cmd.canExecute()) { domain.getCommandStack().execute(cmd); + return true; } } else { + // Moving between different sources is always a copy + if (parent.eResource() != ((EObject) data).eResource()) { + data = EcoreUtil.copy((EObject) data); + } + Command cmd = AddCommand.create(domain, parent, feature, data, index); if (cmd.canExecute()) { domain.getCommandStack().execute(cmd); + return true; } } } From 2d1c27f4ef14f7d0689d047f13bbd31cd0428848 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 8 Jul 2010 18:59:21 +0000 Subject: [PATCH 0198/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed context problem --- .../src/org/eclipse/e4/tools/compat/internal/PartHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java index 5c74bc6456..aceae1ebf8 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java @@ -42,7 +42,7 @@ public static IEclipseContext createPartContext(WorkbenchPart part) throws PartI Object instance = site.getService(clazz); Method m = clazz.getMethod("getContext", new Class[0]); IEclipseContext ctx = (IEclipseContext) m.invoke(instance); - IEclipseContext rv = ctx; + IEclipseContext rv = ctx.createChild(); while( ctx.getParent() != null ) { ctx = ctx.getParent(); } From 47476fef478c86be6b865d694d8a131fddb8ef6c Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 8 Jul 2010 20:00:00 +0000 Subject: [PATCH 0199/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * adding toberendered and visible attributes --- .../component/AbstractComponentEditor.java | 38 ++++++++------ .../common/ComponentLabelProvider.java | 52 ++++++++++++++----- .../common/component/ApplicationEditor.java | 3 ++ .../common/component/ControlFactory.java | 11 ++++ .../component/MenuContributionEditor.java | 3 ++ .../internal/common/component/MenuEditor.java | 3 ++ .../common/component/MenuItemEditor.java | 3 ++ .../internal/common/component/PartEditor.java | 3 ++ .../component/PartSashContainerEditor.java | 3 ++ .../common/component/PartStackEditor.java | 3 ++ .../common/component/PerspectiveEditor.java | 3 ++ .../component/PerspectiveStackEditor.java | 3 ++ .../component/ToolBarContributionEditor.java | 3 ++ .../common/component/ToolBarEditor.java | 3 ++ .../component/ToolBarSeparatorEditor.java | 4 ++ .../common/component/ToolControlEditor.java | 4 ++ .../common/component/ToolItemEditor.java | 3 ++ .../common/component/TrimBarEditor.java | 3 ++ .../component/TrimContributionEditor.java | 3 ++ .../common/component/WindowEditor.java | 3 ++ 20 files changed, 125 insertions(+), 29 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index 5ca17b80a6..ab6a55b6b1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -14,9 +14,7 @@ import java.io.InputStream; import java.net.URL; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.runtime.FileLocator; @@ -24,6 +22,7 @@ import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; +import org.eclipse.jface.resource.ImageRegistry; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; @@ -31,7 +30,10 @@ public abstract class AbstractComponentEditor { private EditingDomain editingDomain; - private static Map IMAGE_MAP = new HashMap(); + private static ImageRegistry IMG_REG = new ImageRegistry(); + // private static Map IMAGE_MAP = new HashMap(); + private static final String[] IMAGES = { "/icons/full/obj16/zoom.png", //$NON-NLS-1$ "/icons/full/obj16/table_add.png", //$NON-NLS-1$ "/icons/full/obj16/table_delete.png", //$NON-NLS-1$ @@ -69,12 +71,12 @@ public WritableValue getMaster() { } public Image getImage(Display d, int id) { - Image img = IMAGE_MAP.get(id); + Image img = IMG_REG.get(IMAGES[id]); if (img == null) { try { InputStream in = AbstractComponentEditor.class.getClassLoader().getResourceAsStream(IMAGES[id]); img = new Image(d, in); - IMAGE_MAP.put(id, img); + IMG_REG.put(IMAGES[id], img); in.close(); } catch (IOException e) { // TODO Auto-generated catch block @@ -98,19 +100,23 @@ public Image getImage(Display d, int id) { public abstract IObservableList getChildList(Object element); protected Image loadSharedImage(Display d, URL path) { - try { - URL url = FileLocator.resolve(path); - if (url != null) { - InputStream in = url.openStream(); - Image image = new Image(d, in); - in.close(); - return image; + Image img = IMG_REG.get(path.toString()); + if (img == null) { + try { + URL url = FileLocator.resolve(path); + if (url != null) { + InputStream in = url.openStream(); + img = new Image(d, in); + IMG_REG.put(path.toString(), img); + in.close(); + } + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); } - return null; + + return img; } public FeaturePath[] getLabelProperties() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java index 1ee616330e..9f4165c4c9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java @@ -11,11 +11,16 @@ package org.eclipse.e4.tools.emf.ui.internal.common; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.emf.ecore.EObject; +import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.viewers.StyledCellLabelProvider; import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.StyledString.Styler; import org.eclipse.jface.viewers.ViewerCell; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.TextStyle; public class ComponentLabelProvider extends StyledCellLabelProvider { private Image modelComponentsImage; @@ -27,23 +32,44 @@ public class ComponentLabelProvider extends StyledCellLabelProvider { private ModelEditor editor; + private static Styler NOT_RENDERED_STYLER = new Styler() { + { + JFaceResources.getColorRegistry().put("NOT_RENDERED_STYLER", new RGB(200, 200, 200)); + } + + @Override + public void applyStyles(TextStyle textStyle) { + textStyle.foreground = JFaceResources.getColorRegistry().get("NOT_RENDERED_STYLER"); + } + }; + public ComponentLabelProvider(ModelEditor editor) { this.editor = editor; } @Override - public void update(final ViewerCell cell) { - if( cell.getElement() instanceof EObject ) { + public void update(final ViewerCell cell) { + if (cell.getElement() instanceof EObject) { EObject o = (EObject) cell.getElement(); AbstractComponentEditor elementEditor = editor.getEditor(o.eClass()); - if( elementEditor != null ) { + if (elementEditor != null) { String label = elementEditor.getLabel(o); String detailText = elementEditor.getDetailLabel(o); - if( detailText == null ) { - cell.setText(label); + Styler styler = null; + + if (o instanceof MUIElement) { + if (!((MUIElement) o).isToBeRendered()) { + styler = NOT_RENDERED_STYLER; + } + } + + if (detailText == null) { + StyledString styledString = new StyledString(label, styler); + cell.setText(styledString.getString()); + cell.setStyleRanges(styledString.getStyleRanges()); } else { - StyledString styledString = new StyledString(label, null); + StyledString styledString = new StyledString(label, styler); styledString.append(" - " + detailText, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); @@ -52,7 +78,7 @@ public void update(final ViewerCell cell) { } else { cell.setText(cell.getElement().toString()); } - } else if( cell.getElement() instanceof VirtualEntry ) { + } else if (cell.getElement() instanceof VirtualEntry) { String s = cell.getElement().toString(); cell.setText(s); } else { @@ -62,32 +88,32 @@ public void update(final ViewerCell cell) { @Override public void dispose() { - if( modelComponentsImage != null ) { + if (modelComponentsImage != null) { modelComponentsImage.dispose(); modelComponentsImage = null; } - if( modelComonentImage != null ) { + if (modelComonentImage != null) { modelComonentImage.dispose(); modelComonentImage = null; } - if( partsImage != null ) { + if (partsImage != null) { partsImage.dispose(); partsImage = null; } - if( menusImage != null ) { + if (menusImage != null) { menusImage.dispose(); menusImage = null; } - if( partImage != null ) { + if (partImage != null) { partImage.dispose(); partImage = null; } - if( partDescriptorImage != null ) { + if (partDescriptorImage != null) { partDescriptorImage.dispose(); partDescriptorImage = null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index b8d3d431bc..1b609c96a0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -149,6 +149,9 @@ public void widgetSelected(SelectionEvent e) { createRemoveRootContext.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); } + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createStringListWidget(parent, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, this, "Binding Contexts", CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 1623bacaf4..783f3d3ac0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -477,4 +477,15 @@ private static void handleAddText(AbstractComponentEditor editor, EStructuralFea tagText.setText(""); //$NON-NLS-1$ } } + + public static void createCheckBox(Composite parent, String label, IObservableValue master, EMFDataBindingContext context, IWidgetValueProperty selectionProp, IEMFEditValueProperty modelProp) { + Label l = new Label(parent, SWT.NONE); + l.setText(label); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + Button t = new Button(parent, SWT.CHECK); + t.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); + context.bindValue(selectionProp.observe(t), modelProp.observeDetail(master)); + + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index 83d4fd7425..2eeab91cc2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -355,6 +355,9 @@ public void widgetSelected(SelectionEvent e) { }); } + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 68a43a4030..db7589572c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -390,6 +390,9 @@ public void widgetSelected(SelectionEvent e) { }); } + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 2029c67fa9..834022ca59 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -261,6 +261,9 @@ public Object convert(Object fromObject) { createFormSubTypeForm(parent, context, master); + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index eac5c60f48..8d7f8eb9fb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -319,6 +319,9 @@ public void widgetSelected(SelectionEvent e) { } // ------------------------------------------------------------ + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createStringListWidget(parent, this, "Binding Contexts", CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createMapProperties(parent, this, "Persisted State", ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createMapProperties(parent, this, "Context Properties", UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index cade3f6e8c..ffbb5b20de 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -343,6 +343,9 @@ public void widgetSelected(SelectionEvent e) { }); } + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 30fec8bb92..ce2e8bfa3d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -300,6 +300,9 @@ public void widgetSelected(SelectionEvent e) { }); } + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 713677cb5f..58ab8c662b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -371,6 +371,9 @@ public void widgetSelected(SelectionEvent e) { }); } + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createMapProperties(parent, this, "Context Properties", UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 50e532ce14..a720c365f7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -272,6 +272,9 @@ public void widgetSelected(SelectionEvent e) { }); } + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index 9423592a8b..2ea5fa8aec 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -357,6 +357,9 @@ public void widgetSelected(SelectionEvent e) { }); } + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 8af7fc1e2c..b667d3d1dc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -323,6 +323,9 @@ public void widgetSelected(SelectionEvent e) { }); } + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index ed85e5d34a..e39e5088f9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -20,6 +20,7 @@ import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; @@ -132,6 +133,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index b8aaeafde2..fb93b7e6b2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -23,6 +23,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; @@ -164,6 +165,9 @@ public void widgetSelected(SelectionEvent e) { }); } + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createMapProperties(parent, this, "Persisted State", ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 9d2f9401d7..3da617a176 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -246,6 +246,9 @@ public Object convert(Object fromObject) { createSubTypeFormElements(parent, context, master); + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index cf5520040d..df4c7349aa 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -301,6 +301,9 @@ public void widgetSelected(SelectionEvent e) { }); } + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index 6444965798..5a3d7340ab 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -324,6 +324,9 @@ public void widgetSelected(SelectionEvent e) { }); } + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index c289fa23ff..ca24845d44 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -310,6 +310,9 @@ public void widgetSelected(SelectionEvent e) { createRemoveMainMenu.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); } + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createSelectedElement(parent, this, context, "Selected Element"); ControlFactory.createStringListWidget(parent, this, "Binding Contexts", CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createMapProperties(parent, this, "Context Properties", UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); From 65f16771d9f09b487566ae950beb2c6523de1696 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 8 Jul 2010 20:10:49 +0000 Subject: [PATCH 0200/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixing feature paths --- .../emf/ui/internal/common/component/ApplicationEditor.java | 6 ++++++ .../internal/common/component/MenuContributionEditor.java | 5 +++++ .../tools/emf/ui/internal/common/component/MenuEditor.java | 6 ++++++ .../emf/ui/internal/common/component/MenuItemEditor.java | 2 +- .../tools/emf/ui/internal/common/component/PartEditor.java | 2 +- .../internal/common/component/PartSashContainerEditor.java | 2 +- .../emf/ui/internal/common/component/PartStackEditor.java | 6 ++++++ .../emf/ui/internal/common/component/PerspectiveEditor.java | 3 +-- .../internal/common/component/PerspectiveStackEditor.java | 5 +++++ .../common/component/ToolBarContributionEditor.java | 5 +++++ .../emf/ui/internal/common/component/ToolBarEditor.java | 5 +++++ .../internal/common/component/ToolBarSeparatorEditor.java | 5 +++++ .../emf/ui/internal/common/component/ToolControlEditor.java | 6 ++++++ .../emf/ui/internal/common/component/ToolItemEditor.java | 2 +- .../emf/ui/internal/common/component/TrimBarEditor.java | 2 +- .../internal/common/component/TrimContributionEditor.java | 5 +++++ .../emf/ui/internal/common/component/WindowEditor.java | 2 +- 17 files changed, 61 insertions(+), 8 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 1b609c96a0..5e8b84e86f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -33,6 +33,7 @@ import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; @@ -282,4 +283,9 @@ public void handleValueChange(ValueChangeEvent event) { public String getDetailLabel(Object element) { return null; } + + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index 2eeab91cc2..28807d5363 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -33,6 +33,7 @@ import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; @@ -368,4 +369,8 @@ public IObservableList getChildList(Object element) { return ELEMENT_CONTAINER__CHILDREN.observe(element); } + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index db7589572c..119f47080f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -39,6 +39,7 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; @@ -424,4 +425,9 @@ public String getDetailLabel(Object element) { } return null; } + + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 834022ca59..c24cff032b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -287,6 +287,6 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 8d7f8eb9fb..66d9dd70f8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -407,6 +407,6 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index ffbb5b20de..a24f1a6539 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -363,6 +363,6 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL) }; + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index ce2e8bfa3d..08875801d9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -30,6 +30,7 @@ import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EClass; @@ -317,4 +318,9 @@ public IObservableList getChildList(Object element) { public String getDetailLabel(Object element) { return null; } + + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 58ab8c662b..39dcb813bd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -113,7 +113,7 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } @Override @@ -385,5 +385,4 @@ public void widgetSelected(SelectionEvent e) { public IObservableList getChildList(Object element) { return ELEMENT_CONTAINER__CHILDREN.observe(element); } - } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index a720c365f7..24c8701156 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -30,6 +30,7 @@ import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; @@ -285,4 +286,8 @@ public IObservableList getChildList(Object element) { return ELEMENT_CONTAINER__CHILDREN.observe(element); } + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index 2ea5fa8aec..47b7b45623 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -33,6 +33,7 @@ import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; @@ -370,4 +371,8 @@ public IObservableList getChildList(Object element) { return ELEMENT_CONTAINER__CHILDREN.observe(element); } + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index b667d3d1dc..c6cf9e7711 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -32,6 +32,7 @@ import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; @@ -339,4 +340,8 @@ public String getDetailLabel(Object element) { return null; } + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index e39e5088f9..61d1c3717e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -22,6 +22,7 @@ import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; @@ -144,4 +145,8 @@ public IObservableList getChildList(Object element) { return null; } + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index fb93b7e6b2..7671ba354c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -25,6 +25,7 @@ import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; @@ -179,4 +180,9 @@ public IObservableList getChildList(Object element) { // TODO Auto-generated method stub return null; } + + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 3da617a176..160ce5dacc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -275,6 +275,6 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__TOOLTIP) }; + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__TOOLTIP), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index df4c7349aa..06615f7e36 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -325,7 +325,7 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TRIM_CONTAINER__SIDE) }; + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TRIM_CONTAINER__SIDE), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index 5a3d7340ab..ee94d9792a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -30,6 +30,7 @@ import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EClass; @@ -337,4 +338,8 @@ public IObservableList getChildList(Object element) { return ELEMENT_CONTAINER__CHILDREN.observe(element); } + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index ca24845d44..b5633c7886 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -415,7 +415,7 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } @Override From e3d56ce71ad8431e1198b2d639892124c4ff5c15 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 8 Jul 2010 20:54:11 +0000 Subject: [PATCH 0201/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * showing not rendered items in gray --- .../icons/full/modelelements/tbr/Addons.png | Bin 0 -> 543 bytes .../full/modelelements/tbr/Application.png | Bin 0 -> 335 bytes .../full/modelelements/tbr/BindingContext.gif | Bin 0 -> 994 bytes .../full/modelelements/tbr/BindingTable.png | Bin 0 -> 439 bytes .../icons/full/modelelements/tbr/Command.gif | Bin 0 -> 889 bytes .../modelelements/tbr/CommandParameter.gif | Bin 0 -> 1009 bytes .../full/modelelements/tbr/DirectMenuItem.gif | Bin 0 -> 978 bytes .../full/modelelements/tbr/DirectToolItem.gif | Bin 0 -> 929 bytes .../modelelements/tbr/HandledMenuItem.gif | Bin 0 -> 979 bytes .../modelelements/tbr/HandledToolItem.gif | Bin 0 -> 960 bytes .../icons/full/modelelements/tbr/Handler.gif | Bin 0 -> 982 bytes .../full/modelelements/tbr/KeyBinding.gif | Bin 0 -> 917 bytes .../icons/full/modelelements/tbr/Menu.gif | Bin 0 -> 981 bytes .../modelelements/tbr/MenuContribution.gif | Bin 0 -> 872 bytes .../icons/full/modelelements/tbr/MenuItem.gif | Bin 0 -> 941 bytes .../full/modelelements/tbr/MenuSeparator.gif | Bin 0 -> 945 bytes .../full/modelelements/tbr/ModelFragments.png | Bin 0 -> 380 bytes .../full/modelelements/tbr/Parameter.gif | Bin 0 -> 877 bytes .../icons/full/modelelements/tbr/Part.gif | Bin 0 -> 942 bytes .../full/modelelements/tbr/PartDescriptor.gif | Bin 0 -> 962 bytes .../modelelements/tbr/PartSashContainer.gif | Bin 0 -> 969 bytes .../tbr/PartSashContainer_vertical.gif | Bin 0 -> 937 bytes .../full/modelelements/tbr/PartStack.gif | Bin 0 -> 963 bytes .../full/modelelements/tbr/Perspective.gif | Bin 0 -> 953 bytes .../modelelements/tbr/PerspectiveStack.gif | Bin 0 -> 964 bytes .../full/modelelements/tbr/Placeholder.gif | Bin 0 -> 893 bytes .../modelelements/tbr/StringModelFragment.png | Bin 0 -> 442 bytes .../icons/full/modelelements/tbr/ToolBar.gif | Bin 0 -> 981 bytes .../modelelements/tbr/ToolBarContribution.gif | Bin 0 -> 872 bytes .../modelelements/tbr/ToolBarSeparator.gif | Bin 0 -> 989 bytes .../full/modelelements/tbr/ToolControl.gif | Bin 0 -> 956 bytes .../modelelements/tbr/TrimContribution.gif | Bin 0 -> 872 bytes .../icons/full/modelelements/tbr/Window.gif | Bin 0 -> 945 bytes .../full/modelelements/tbr/WindowTrim.gif | Bin 0 -> 945 bytes .../common/component/ApplicationEditor.java | 32 ++++++--- .../component/DirectMenuItemEditor.java | 31 +++++++-- .../component/DirectToolItemEditor.java | 31 +++++++-- .../component/HandledMenuItemEditor.java | 31 +++++++-- .../component/HandledToolItemEditor.java | 31 +++++++-- .../component/MenuContributionEditor.java | 31 +++++++-- .../internal/common/component/MenuEditor.java | 29 ++++++-- .../common/component/MenuItemEditor.java | 33 ++++++--- .../internal/common/component/PartEditor.java | 31 +++++++-- .../component/PartSashContainerEditor.java | 63 +++++++++++++----- .../common/component/PartStackEditor.java | 31 +++++++-- .../common/component/PerspectiveEditor.java | 31 +++++++-- .../component/PerspectiveStackEditor.java | 31 +++++++-- .../component/ToolBarContributionEditor.java | 31 +++++++-- .../common/component/ToolBarEditor.java | 32 +++++++-- .../component/ToolBarSeparatorEditor.java | 33 ++++++--- .../common/component/ToolControlEditor.java | 31 +++++++-- .../common/component/TrimBarEditor.java | 31 +++++++-- .../component/TrimContributionEditor.java | 31 +++++++-- .../common/component/WindowEditor.java | 31 +++++++-- 54 files changed, 503 insertions(+), 153 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Addons.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Application.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/BindingContext.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/BindingTable.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Command.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/CommandParameter.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectMenuItem.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectToolItem.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/HandledMenuItem.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/HandledToolItem.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Handler.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/KeyBinding.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Menu.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuContribution.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuItem.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuSeparator.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ModelFragments.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Parameter.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Part.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartDescriptor.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer_vertical.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartStack.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Perspective.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PerspectiveStack.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Placeholder.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/StringModelFragment.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBar.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBarContribution.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBarSeparator.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolControl.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/TrimContribution.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Window.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/WindowTrim.gif diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Addons.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Addons.png new file mode 100644 index 0000000000000000000000000000000000000000..907e837f127daab508a9abf905b27ad74779346e GIT binary patch literal 543 zcmV+)0^t3LP)Px#0%A)?L;(MXkIcUS000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2igY+6dMj* zM2sf@00E;(L_t(2&qa|xYZGArhoASjq}U5-Pmy*k}Cl3_o~;PXnC1WP3^ zjCDsxDJR%SbxQHPS6F&h0Uw55*C8ZP;GuxBkb&eYZ(Qn)J~UP*mQxIW*eAnfd=$sD zo;;|4Xm08$9mHY6A&qy*<1xaOYd0JL8;2^B9{21kww02GRdCPNaA5w*>qQ(-V0o{*)1H3sb!#TDA@vHwl=gacl!PA_YG-g6y` z#W5hyCpubXeR%muJ)Gn>SrnEZ7%ZBUt4P0{`XFsA&auT_;su5fi)BEb&+PO~NjPAo zI=Gwk&d-g1mlzb&l)tFTto3tZrqJ54bG70Bny1`b>@P?} hJ^$1dbf&HW{sCC=$cdRWJZ1m@002ovPDHLkV1lCq=h*-N literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Application.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Application.png new file mode 100644 index 0000000000000000000000000000000000000000..f4665b36ecaa9427030280927d047b0d18b4824a GIT binary patch literal 335 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf67>k44ofy`glX(f`FeQ1ryD?& z%qMg$HGU-ie9q4FqScT72hW`+6H~{3qOjX=``idpmRgm2d$s8;Bof!<^AboFyt=akR{07I{U-2eap literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/BindingContext.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/BindingContext.gif new file mode 100644 index 0000000000000000000000000000000000000000..1d6aefeb4d86cfc8e4d568e91d4ac0231da43dec GIT binary patch literal 994 zcmV<810DQFNk%w1VGsZi0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW008~~EC2ui01yBW000QT0R8=AB83W-EL^yZQTM80Lw}1FHLAqP z)2Uau$f(=M&>s_m1`#S8LndNGe|k8ooT5^l9+c|-$()Hsj2W5rUZ$KmlZ-E6Va(+8 zHz(%5EJzVLf)uIJmO1|97|k*h%O_D+vec8~kImGXRHj&wX^)M+HR_TvTAS?O6rT3h z_$#B%&ar3D?C>O8X0AF!=hDSPWUsJcdtm&1Q3oh+IzWdFfAQBPtsg*${Opz4#b46T Qpp*I=O}eyce*pmiJH6cJC;$Ke literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/BindingTable.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/BindingTable.png new file mode 100644 index 0000000000000000000000000000000000000000..d572b27c76c114a33182dfedf0354618765b5812 GIT binary patch literal 439 zcmV;o0Z9IdP)Px#0%A)?L;(MXkIcUS000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2igY+6c-1G zEqjju00BEmL_t(2&wbHBOH^SL#_`|Gy>S;qwwcJJXca*q2!SPuZdz!#30g!!(84}O zE?h~gwz=>l_yr0wMg%2r5e15i!YM;r1Wk?H`@XM>8L`FCIg7J-p8t6cr(d%2tB#3tLqsjKe~=9C3F5qAb`@2Ywk0@elyZY$3O zOnYw%th)<-oe`o;OJ-diY)Eof|0QH5Y?$a1db52>s3dhQJ6f6!-1NqlVL$yb-RKLF zUB5lmv2W9P4`sglU}&L#<|n%zd*!2HqrQ0Qz%BQDeO~Vo_6%V`>5)mZW|W@bLXi_B z*KK1_Wk~}a(Te-p-CFXxRgN7sJ{vcp@WYP6HJ2P~muq{q-n(yPmq#0`BNvNI{b*jh hx$4|;_;%QNZ~_zhl$N_+B8C6}002ovPDHLkV1kwLv)ljx literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Command.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Command.gif new file mode 100644 index 0000000000000000000000000000000000000000..86e51747ed5923db07f4d01806e0aefe01cd6bd1 GIT binary patch literal 889 zcmV-<1BU!ZNk%w1VGsZi0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000P90RIUbNU)&6g9sBUTqw{D8ioSbC=+9b zAsSu2goUY?kjyJsv1sK2GX|lUNt7s6%G4>8n1f&(If4|a(v~g=xp4X<>Pi-cSW-=~ P!jQ@oh)9zv4F~``cwDDw literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/CommandParameter.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/CommandParameter.gif new file mode 100644 index 0000000000000000000000000000000000000000..486f025172d4a3ba0e2f3483f9cf115b734fc193 GIT binary patch literal 1009 zcmV6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW008v>EC2ui01yBW000Qi0PEFLHmZ*wL8+z*T)6Pnpjpgfxw2G< z7(;>8{*-dYFW4wnr3i()NJ){UXaD*IdqhbRsEc?6`APQgpTA|2C=I&k#ta!@HUC|! zBlBXLG-iPQTju7Bp+6Tt-PvR8pRzo75b;TMQ5+vZ%a+NZgUC>!d!8;iIwYu`FhG$Y zEpjA?khY5pt&Q?Sl-9jA^+s`;gs5#jQ}*~F;m5BZ61)PD#LHI(i9W@F2NxFD=G{Gf f_sZ-83|X6HeW;P#6-?N0J#B4}AZc?KZ$JP${o?6n literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectMenuItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectMenuItem.gif new file mode 100644 index 0000000000000000000000000000000000000000..ad4c980d3a418b060b70bbda2110b73f836f7865 GIT binary patch literal 978 zcmV;@116ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW008~~EC2ui01yBW000QD0R0IZNU$KmS_l&=tW|K9zK0MY(kd7$ zpC(I?6cqxrCts|BukMMwhp(i_R|Q$wyO?p~9($|`GOI_kW=&=U&FI|8bLT)Y^MVSU z=j@N1M$QIuL5Gf|Mme55O=>gHO17(4oyn2*uWK}_{-lT<%ZJdvMvW{*Iy6wlt+%(@ zr1^*D3>r3c27YOZQ4*bc&@TO}M`)lVrc9lM`P9|jt1yNoNuG=b(IG-;`~?I6JJ3tl A+5i9m literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectToolItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectToolItem.gif new file mode 100644 index 0000000000000000000000000000000000000000..3e30ae05adedb8753829505b5132c37c9b778a48 GIT binary patch literal 929 zcmV;S177?`Nk%w1VGsZi0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW008~~EC2ui01yBW000Pn0R0IZNU)&6g9sBUR5*!{!-o(bPV(1B zkfMtiGX|2<#~&RQtP7Htz{sTwU6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000QE0RIUbNU$KmS_l&=tW|K9zK0MY(kd7$ zpC(I?6cqxrCts|BukMMwhp(i_R|Q$wyO?p~9($|`GOI_kW=&=U&FIwW2F=c$1I5f6 zI&Y0KF=mL48OQ}4x{GLZ`4Se!3_30Ytz_Gpjm#@pv1sK2vs9pzvuDLjqC}}urcR;6 z3{-KeE*M9SAVsRQr3=9?Pc3ob^hwl}EM5vqa*7U1swq~SMp7)PGL6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000P`0RIUbNU)&6g9sBUR5*!{!-o(bPWsnJ zkfMtiGX|2<=N}zKp+brr8A=SDe`^$}TB*tn8kQ@?tobKK(XX4o)+iHW2B#P?|FkHI zMl>24UA}~cF%wOUmVZ$cg_|0V%qv*2XypPkCJIzFTEc1(Gl>$VN|`#9{5NTcTen~w iIf4|a(v~h04RYc1Nz|1r3bCY`VrAh!DpL*y1OPj9Xv9AN literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Handler.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Handler.gif new file mode 100644 index 0000000000000000000000000000000000000000..22b96c27f6be5346c749f0bcadf6c98c89e5daa4 GIT binary patch literal 982 zcmV;{11bDRNk%w1VGsZi0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW008~~EC2ui01yBW000QH0R0IZNU&hRZkpzxK{H2FH-r8(#eoH@ z)~!^M8Wz;l2NkS;uvCdu)ko97ZgD=LTJ{els+XwZJd9X~5+#-`VcE24(q9}zKyl^- z>M4%EIB=2*YsoYl98YKjo*_eZDbrJ$?FE6_$2TAwE63 z!6~F?sW3Tm^bC3gXJ*7akAw+>BPWofM|pY<)C7mnqfD6|5rU(bAVN0_-8h8ExnMv5 EJ5a*XvH$=8 literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/KeyBinding.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/KeyBinding.gif new file mode 100644 index 0000000000000000000000000000000000000000..5ae4c89a5c390e01675825c713eb8ee9bce9e6f0 GIT binary patch literal 917 zcmV;G18V$7Nk%w1VGsZi0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000Pb0RIUbNU)&6fosqlJcve_7&8kAlF{W$ zSQv-}vuMo1#gQXOkt%KJLNLofESx@xx?(cpKq{%GSXtQe-;^m4|JBTyjFC@9$#U8` r_Uu_SJ2?@ZOBe4MqMU%1rh5h`r=N3JkNM&02M{7VL34@~7!UwE=&QH~ literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Menu.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Menu.gif new file mode 100644 index 0000000000000000000000000000000000000000..0153af73a851e4d3c50aea94ec723e20b04a6d60 GIT binary patch literal 981 zcmV;`11kJSNk%w1VGsZi0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000QG0RIUbNU)&6g9W2Vp>ie57B6AOm`Std zO&mG@-awLssnaM`vUL42#w=Pjj0&k(!SWCcnTc%Pz`;mnp3R##kQK75WJM}C~6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000O@0RIUbNU)&6g9sBU{C8#HKwwvZIb;Z^ y;X+M-FltH&F(WXH5e;6s;t|-#iWUiW)O0c=LX8<6l1!-(qQr?bC+b8P5CA)SPM)6t literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuItem.gif new file mode 100644 index 0000000000000000000000000000000000000000..790a5017cb0e92de30248b62f93adc8a68f4b7fc GIT binary patch literal 941 zcmV;e15*4)Nk%w1VGsZi0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000Pz0RIUbNU$KmS_l&=tW|K9zK0MY(kd7$ zpC(I?6cqxrCts|BukMMwhp(i_R|Q$wyO?p~9($|`GOI_kW=&=U&FI|8bLT)Y^MVQ; zI&aKCF6hv))W|U@mw{HYNu8Qa+texprD)yCbt^#?x5A1QtD@i+r5Ks+LFc8Qq@-}; PMsh2uuHCx=0|Ed$YX-#h literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuSeparator.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuSeparator.gif new file mode 100644 index 0000000000000000000000000000000000000000..52408e3e8ec0b4895caa00804a8232be4dda95fa GIT binary patch literal 945 zcmV;i15W%$Nk%w1VGsZi0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW008~~EC2ui01yBW000P%0R0IZNU$KmO$ZYz+*B}=zK0MYW-53| zpC(I?6cqxrC*P%lluA TrOQ(g&z(DV^Ww!LFdzUs6B)#t literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ModelFragments.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ModelFragments.png new file mode 100644 index 0000000000000000000000000000000000000000..ebf5a85efdcc132cb677f9525df038d92368b0a1 GIT binary patch literal 380 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf67>k44ofy`glX(f`FeQ1ryD-p~-T1ppJI3|~{-fXbmAh?NZy26bcH+J#gZCt=DkS%!7OT=W-f*;NXKhoYs zNW|aEHoAJimgl)2*E0XyP4n)rc>FN^?p>n^q92P&!ZOwFuZz=Yn7h43!|g_?sK-H9 z4)=;R>dzk@zGIxcKG32=)Wt!_vD#3eJk`^kVb-+KC5_+iOMc>9~<-> z4r$J7x*Tz!kV%jyVmdKI;Vst04<@2_W%F@ literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Parameter.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Parameter.gif new file mode 100644 index 0000000000000000000000000000000000000000..044d786b007237b711909b28187aefa795682a46 GIT binary patch literal 877 zcmV-z1CsnlNk%w1VGsZi0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000O|0RIUbNU)&6g9sBUM3N>GHH8Daxth}p z;y_PZEDG$F<{?BRAVFFTsqr5Yjj2+mgb0e7OHdFg^_ocuBBE0`5kdUJlV?eS0RaFz DiiDtY literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Part.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Part.gif new file mode 100644 index 0000000000000000000000000000000000000000..6f86ad5bf3cf35ea3e9c58085a6dad2a63eed633 GIT binary patch literal 942 zcmV;f15x}(Nk%w1VGsZi0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW008~~EC2ui01yBW000P!0R8=AB83W-EL^yZQTM80Lw}1FHLAqP z)2Uau$f(=M&>s_m1`#S8LndNGe|k8oT&YeEN_GEY%AEPHp39UpbK3Mb2WHNh_2&4K z6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW008~~EC2ui01yBW000P|0R0IZNU$J5MhFuk{Kv4MB7G1e(qhz* zU?P40n2b^P%Gbny1rOz0vv}PLs&53H*gFpE*KC1JJht(e*gdg literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer.gif new file mode 100644 index 0000000000000000000000000000000000000000..94bdda3e6dffde4cc34b19432c60a37f5c2d489f GIT binary patch literal 969 zcmV;)12+6eNk%w1VGsZi0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000Q40RIUbNU)&5O$ZYzR46bLx`z)hL4=q| zphR{U*;PW95#uF+lsK|$*G`g1lIoFDuurg9QFTcdzWdv1ZHu5y%G}zPI?= r!hOp}U>s}Ij$!gmDLS6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000Pv0RIUbNU)$mf{GkPqI42oVdp)|=FJu6nNS&0+} LU2K%mVL$*oB|pUA literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartStack.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartStack.gif new file mode 100644 index 0000000000000000000000000000000000000000..5d94ef32e76d6c9c6e4a2627e6fff9ab8f658a8e GIT binary patch literal 963 zcmV;!13dgkNk%w1VGsZi0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW008s=EC2ui01yBW000P}0O<)FNU$J5KUuQ)q1Q%;kTwSWi2L_X zoS$ literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Perspective.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Perspective.gif new file mode 100644 index 0000000000000000000000000000000000000000..6cc4e83788f4bb0e1ed88d23586218f204cbc864 GIT binary patch literal 953 zcmV;q14jHuNk%w1VGaNe0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW008~~EC2ui01f~S000P<0RIUbNRSUfY5$~!gSRl8rhkhVKAD1K zibX)y_$>OD%Agfssg{YP$7i3(ZuiktqZewaQ+j~HCEfY&&>*X&29*kf6wskihYS++8P3Yhf29VVHT#e4Kd}U@ b{OhLW>>;NE*;>(J#mW-CTK?{x8xR0Ht2NL; literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PerspectiveStack.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PerspectiveStack.gif new file mode 100644 index 0000000000000000000000000000000000000000..c9dc7d45f580e68f8db1126a62a0bd10f93d1d8b GIT binary patch literal 964 zcmV;#13UajNk%w1VGsZi0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000P~0RIUbNU)&6g9f8Skzxf4moH<^sBr^F z&cHX2AW`B(%GIr4$)Z)WC{W>)Dp20xz|b zlr5X2o<&F9yEITzyF5kp;8TPS-6DLF1~O_VrfQgcX~L$-w`gFYc2Vrvi?Xk+TS5c< mpj8;9AKkis2Igtkub)4^{{H&KGq8@~!-x+fT+G;DKma>i^woL* literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Placeholder.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Placeholder.gif new file mode 100644 index 0000000000000000000000000000000000000000..36c1a4b3b3ab29e79b78d7b3bf8f9d51ca43126c GIT binary patch literal 893 zcmV-@1A_cVNk%w1VGsZi0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW008~~EC2ui01yBW000PD0R0IZNU)&6g9sBU^!M-ILV^DpHFAis zVZ%nVCLa7}sAETPvkXxj_^%JNlPICh>NAp|99=MD>LMklCBri~agri+#wJ9IT`G0) TS@2(zCPWQ3e8{w^(|`awG@q^J literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/StringModelFragment.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/StringModelFragment.png new file mode 100644 index 0000000000000000000000000000000000000000..7a2780ba83d114f825cca8e554599a0ee0966e48 GIT binary patch literal 442 zcmV;r0Y(0aP)Px#0%A)?L;(MXkIcUS000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2igY+6dD3e z>G4ef00BNpL_t(2&wbHBZ%knn#_`{sUO`pM7)cS45)m0zHWC{<8;Oq~79>7}_%eI~ zf(VI)2)l_`5Y1IJ2yN7)Zri!pP9Aj^`FE!k(k zA2zNR;X!nSU)E)zC2QNQ6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000QG0RIUbNU)&6g9W2Vp>ie57B6AOm`Std zO&mG@-awLssnaM`vUL42#w=Pjj0&k(!SWCcnTc%Pz`;mnp3R##kQK75WJM}C~6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000O@0RIUbNU)&6g9sBU{C8{NKw!6kIb;Z^ y;lgQvFiuMdF(WXH5e?qD6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW008~~EC2ui01yBW000QO0R0IZNU)$mf&XS4^cO`6l`C0(BrIYk z&6+oHkRoz zW3F5jaZnOwsuS+0xI;s|Wy?m4QbI#ivqDW{?b$PEjuJZZ`t{jXi*4R8NhoEHpFo2O zLG9D7Zry}-?e_7Pr=7jO_7c_`JlGx{e{tH~Tg6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000P?0RIUbNU-3*O$ZYzR48!MxQ7rUKHMZQ z(>Qk+Gir2~N#Lc68#i7ONa^CccNkBiL^(+yq;c?K%7phW=DSD&8;y&{Qy$NsJR1pA zG;ZEJc}9~aRV2{RxO(*JL8TW}YCS^&1&y=EwX0Wqf&~56ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000O@0RIUbNU)&6g9sBU{C8{NKw!6kIb;Z^ y;lgQvFiuMdF(WXH5e?qD6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000P%0RIUbNU)&5IC13Av4dxipFo5RC0f)- z;3HG2UeVeW4B4}4+rEi=bTHw zBoCj_qe$^(5@@Mt(xjFIQgZtAC?$cBQf{zk=?s^@fzGqFdzUsBGt{E literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/WindowTrim.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/WindowTrim.gif new file mode 100644 index 0000000000000000000000000000000000000000..ca9858dfb0c215c5ea1e4b1596fb36ab072ab589 GIT binary patch literal 945 zcmV;i15W%$Nk%w1VGsZi0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000P%0RIUbNU)&5IC13Av4dxipFo5RC0f)- z;3HG2UeVeW4B4}4+rEi=bTHw zBoCj_qe$^(5@@Mt(xjFIQgZtAC?$cBQf{zk=?s^@fzGqFdzUsBGt{E literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 5e8b84e86f..22815f0d40 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -28,6 +28,7 @@ import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; @@ -55,6 +56,7 @@ public class ApplicationEditor extends AbstractComponentEditor { private Composite composite; private Image image; + private Image tbrImage; private EMFDataBindingContext context; private Button createRemoveRootContext; @@ -75,16 +77,30 @@ public ApplicationEditor(EditingDomain editingDomain, ModelEditor editor) { @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Application.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Application.png")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Application.png")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - - return image; + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index 436c59b0a6..2bc6dc61cd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -20,6 +20,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; @@ -40,6 +41,7 @@ public class DirectMenuItemEditor extends MenuItemEditor { private Image image; + private Image tbrImage; public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain, editor, project); @@ -47,16 +49,31 @@ public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IPr @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectMenuItem.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - return image; + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index 13adde111b..60ae7d9e37 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -20,6 +20,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; @@ -40,6 +41,7 @@ public class DirectToolItemEditor extends ToolItemEditor { private Image image; + private Image tbrImage; public DirectToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain, editor, project); @@ -47,16 +49,31 @@ public DirectToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IPr @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectToolItem.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - return image; + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index 13f1a56ec6..c0ef2c703d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -23,6 +23,7 @@ import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; @@ -57,6 +58,7 @@ public class HandledMenuItemEditor extends MenuItemEditor { private IModelResource resource; private IEMFEditListProperty HANDLED_ITEM__PARAMETERS = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); + private Image tbrImage; public HandledMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource) { super(editingDomain, editor, project); @@ -65,16 +67,31 @@ public HandledMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IP @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/HandledMenuItem.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - return image; + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index 4ef9c0b28d..c4f783cd4c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -23,6 +23,7 @@ import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; @@ -56,6 +57,7 @@ public class HandledToolItemEditor extends ToolItemEditor { private Image image; private IModelResource resource; private IEMFEditListProperty HANDLED_ITEM__PARAMETERS = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); + private Image tbrImage; public HandledToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource) { super(editingDomain, editor, project); @@ -64,16 +66,31 @@ public HandledToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IP @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledToolItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledToolItem.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/HandledToolItem.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - return image; + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index 28807d5363..e563588cf2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -27,6 +27,7 @@ import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; @@ -70,6 +71,7 @@ public class MenuContributionEditor extends AbstractComponentEditor { private Composite composite; private Image image; + private Image tbrImage; private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); @@ -93,16 +95,31 @@ public MenuContributionEditor(EditingDomain editingDomain, IProject project, Mod @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuContribution.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - return image; + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 119f47080f..01c9ed5c52 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -29,6 +29,7 @@ import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -82,6 +83,7 @@ public class MenuEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; + private Image tbrImage; private static class Struct { private final String label; @@ -102,16 +104,29 @@ public MenuEditor(EditingDomain editingDomain, IProject project, ModelEditor edi @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Menu.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } } } - return image; + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index c24cff032b..64ffa5f46e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -26,6 +26,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuItemIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.ItemType; @@ -58,7 +59,8 @@ public abstract class MenuItemEditor extends AbstractComponentEditor { private Composite composite; - private Image menuImage; + private Image image; + private Image tbrImage; private EMFDataBindingContext context; protected IProject project; private EStackLayout stackLayout; @@ -70,16 +72,31 @@ public MenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject @Override public Image getImage(Object element, Display display) { - if (menuImage == null) { - try { - menuImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuItem.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuItem.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - return menuImage; + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 66d9dd70f8..ff1ea3a111 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -33,6 +33,7 @@ import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; @@ -77,6 +78,7 @@ public class PartEditor extends AbstractComponentEditor { private IValueProperty PART__TOOLBAR = EMFProperties.value(BasicPackageImpl.Literals.PART__TOOLBAR); private Button createRemoveToolBar; private EStackLayout stackLayout; + private Image tbrImage; public PartEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain, editor); @@ -85,16 +87,31 @@ public PartEditor(EditingDomain editingDomain, ModelEditor editor, IProject proj @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Part.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - return image; + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index a24f1a6539..6160dbc034 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -70,6 +70,8 @@ public class PartSashContainerEditor extends AbstractComponentEditor { private Composite composite; private Image vImage; private Image hImage; + private Image vTbrImage; + private Image hTbrImage; private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); @@ -83,29 +85,56 @@ public PartSashContainerEditor(EditingDomain editingDomain, ModelEditor editor) public Image getImage(Object element, Display display) { boolean horizontal = ((MPartSashContainer) element).isHorizontal(); - if (vImage == null && !horizontal) { - try { - vImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } + if (!horizontal) { + if (((MPartSashContainer) element).isToBeRendered()) { + if (vImage == null) { + try { + vImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } - if (hImage == null && horizontal) { - try { - hImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + return vImage; + } else { + if (vTbrImage == null) { + try { + vTbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer_vertical.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return vTbrImage; } } if (horizontal) { - return hImage; - } else { - return vImage; + if (((MPartSashContainer) element).isToBeRendered()) { + if (hImage != null) { + try { + hImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return hImage; + } else { + if (hTbrImage != null) { + try { + hTbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return hTbrImage; + + } } + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 08875801d9..f3bfd49de6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -24,6 +24,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -71,6 +72,7 @@ public class PartStackEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private StackLayout stackLayout; + private Image tbrImage; public PartStackEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); @@ -78,16 +80,31 @@ public PartStackEditor(EditingDomain editingDomain, ModelEditor editor) { @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartStack.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - return image; + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 39dcb813bd..ab9b7e853d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -27,6 +27,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PerspectiveIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; @@ -76,6 +77,7 @@ public class PerspectiveEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; + private Image tbrImage; public PerspectiveEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { super(editingDomain, editor); @@ -84,16 +86,31 @@ public PerspectiveEditor(EditingDomain editingDomain, IProject project, ModelEdi @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Perspective.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Perspective.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Perspective.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - return image; + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 24c8701156..ce58ae7730 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -24,6 +24,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.advanced.MAdvancedFactory; import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -64,6 +65,7 @@ public class PerspectiveStackEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; + private Image tbrImage; public PerspectiveStackEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); @@ -71,16 +73,31 @@ public PerspectiveStackEditor(EditingDomain editingDomain, ModelEditor editor) { @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PerspectiveStack.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - return image; + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index 47b7b45623..be4b9029c9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -27,6 +27,7 @@ import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; @@ -75,6 +76,7 @@ public class ToolBarContributionEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; + private Image tbrImage; private static class Struct { private final String label; @@ -95,16 +97,31 @@ public ToolBarContributionEditor(EditingDomain editingDomain, IProject project, @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBarContribution.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - return image; + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index c6cf9e7711..c805d8d1d4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -26,6 +26,7 @@ import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; @@ -74,6 +75,7 @@ public class ToolBarEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; + private Image tbrImage; private static class Struct { private final String label; @@ -93,15 +95,31 @@ public ToolBarEditor(EditingDomain editingDomain, ModelEditor editor) { @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBar.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBar.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBar.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - return image; + + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index 61d1c3717e..d85512b656 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -20,6 +20,7 @@ import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; @@ -39,10 +40,11 @@ import org.eclipse.swt.widgets.Text; public class ToolBarSeparatorEditor extends AbstractComponentEditor { - private Image separatorImage; private Composite composite; private EMFDataBindingContext context; private EStackLayout stackLayout; + private Image image; + private Image tbrImage; public ToolBarSeparatorEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); @@ -50,16 +52,31 @@ public ToolBarSeparatorEditor(EditingDomain editingDomain, ModelEditor editor) { @Override public Image getImage(Object element, Display display) { - if (separatorImage == null) { - try { - separatorImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBarSeparator.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - return separatorImage; + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index 7671ba354c..d8fcbb0088 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -23,6 +23,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; @@ -50,6 +51,7 @@ public class ToolControlEditor extends AbstractComponentEditor { private Composite composite; private IProject project; private EStackLayout stackLayout; + private Image tbrImage; public ToolControlEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain, editor); @@ -68,16 +70,31 @@ public String getDescription(Object element) { @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolControl.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - return image; + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index 06615f7e36..b12908f513 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -25,6 +25,7 @@ import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MGenericTrimContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.SideValue; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; @@ -73,6 +74,7 @@ public class TrimBarEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; + private Image tbrImage; public TrimBarEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); @@ -81,16 +83,31 @@ public TrimBarEditor(EditingDomain editingDomain, ModelEditor editor) { @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/WindowTrim.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - return image; + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index ee94d9792a..d063856457 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -25,6 +25,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; @@ -70,6 +71,7 @@ public class TrimContributionEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; + private Image tbrImage; private static class Struct { private final String label; @@ -90,16 +92,31 @@ public TrimContributionEditor(EditingDomain editingDomain, IProject project, Mod @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/TrimContribution.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - return image; + return null; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index b5633c7886..6e00dea3cc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -31,6 +31,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.WindowIconDialogEditor; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; @@ -78,6 +79,7 @@ public class WindowEditor extends AbstractComponentEditor { private Action addMainMenu; private Button createRemoveMainMenu; private EStackLayout stackLayout; + private Image tbrImage; public WindowEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain, editor); @@ -92,16 +94,31 @@ public void run() { @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif")); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (element instanceof MUIElement) { + if (((MUIElement) element).isToBeRendered()) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return image; + } else { + if (tbrImage == null) { + try { + tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Window.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return tbrImage; } } - return image; + return null; } @Override From d493d0f12b28ea0de5a6511cb502284ce11d08bc Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 8 Jul 2010 21:16:32 +0000 Subject: [PATCH 0202/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * showing not rendered items in gray --- .../common/ComponentLabelProvider.java | 6 +++- .../component/DirectMenuItemEditor.java | 31 +++++++------------ .../component/DirectToolItemEditor.java | 31 +++++++------------ .../component/HandledMenuItemEditor.java | 31 +++++++------------ .../component/HandledToolItemEditor.java | 31 +++++++------------ .../internal/common/component/MenuEditor.java | 29 +++++++---------- .../common/component/PerspectiveEditor.java | 31 +++++++------------ .../component/PerspectiveStackEditor.java | 31 +++++++------------ .../component/ToolBarContributionEditor.java | 31 +++++++------------ .../common/component/ToolBarEditor.java | 31 +++++++------------ .../component/ToolBarSeparatorEditor.java | 31 +++++++------------ .../common/component/ToolControlEditor.java | 31 +++++++------------ .../common/component/TrimBarEditor.java | 31 +++++++------------ .../component/TrimContributionEditor.java | 31 +++++++------------ .../common/component/WindowEditor.java | 29 +++++++---------- 15 files changed, 173 insertions(+), 263 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java index 9f4165c4c9..e12afdf246 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java @@ -59,7 +59,11 @@ public void update(final ViewerCell cell) { Styler styler = null; if (o instanceof MUIElement) { - if (!((MUIElement) o).isToBeRendered()) { + if (!((MUIElement) o).isVisible()) { + label += ""; + styler = NOT_RENDERED_STYLER; + } else if (!((MUIElement) o).isToBeRendered()) { + label += ""; styler = NOT_RENDERED_STYLER; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index 2bc6dc61cd..43b63336a6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -40,8 +40,6 @@ import org.eclipse.swt.widgets.Text; public class DirectMenuItemEditor extends MenuItemEditor { - private Image image; - private Image tbrImage; public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain, editor, project); @@ -50,26 +48,21 @@ public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IPr @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return image; } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectMenuItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectMenuItem.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return tbrImage; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index 60ae7d9e37..6119433069 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -40,8 +40,6 @@ import org.eclipse.swt.widgets.Text; public class DirectToolItemEditor extends ToolItemEditor { - private Image image; - private Image tbrImage; public DirectToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain, editor, project); @@ -50,26 +48,21 @@ public DirectToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IPr @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return image; } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectToolItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectToolItem.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return tbrImage; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index c0ef2c703d..81ced576f9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -54,11 +54,9 @@ import org.eclipse.swt.widgets.Text; public class HandledMenuItemEditor extends MenuItemEditor { - private Image image; private IModelResource resource; private IEMFEditListProperty HANDLED_ITEM__PARAMETERS = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); - private Image tbrImage; public HandledMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource) { super(editingDomain, editor, project); @@ -68,26 +66,21 @@ public HandledMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IP @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return image; } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/HandledMenuItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/HandledMenuItem.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return tbrImage; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index c4f783cd4c..410ad14257 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -54,10 +54,8 @@ import org.eclipse.swt.widgets.Text; public class HandledToolItemEditor extends ToolItemEditor { - private Image image; private IModelResource resource; private IEMFEditListProperty HANDLED_ITEM__PARAMETERS = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); - private Image tbrImage; public HandledToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource) { super(editingDomain, editor, project); @@ -67,26 +65,21 @@ public HandledToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IP @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledToolItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledToolItem.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return image; } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/HandledToolItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/HandledToolItem.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return tbrImage; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 01c9ed5c52..5891271674 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -77,13 +77,11 @@ public class MenuEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; - private Image tbrImage; private static class Struct { private final String label; @@ -105,23 +103,20 @@ public MenuEditor(EditingDomain editingDomain, IProject project, ModelEditor edi @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Menu.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Menu.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index ab9b7e853d..8e91d780bb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -71,13 +71,11 @@ public class PerspectiveEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; - private Image tbrImage; public PerspectiveEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { super(editingDomain, editor); @@ -87,26 +85,21 @@ public PerspectiveEditor(EditingDomain editingDomain, IProject project, ModelEdi @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Perspective.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Perspective.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return image; } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Perspective.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Perspective.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return tbrImage; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index ce58ae7730..490d58290a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -60,12 +60,10 @@ public class PerspectiveStackEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; - private Image tbrImage; public PerspectiveStackEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); @@ -74,26 +72,21 @@ public PerspectiveStackEditor(EditingDomain editingDomain, ModelEditor editor) { @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return image; } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PerspectiveStack.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PerspectiveStack.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return tbrImage; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index be4b9029c9..9c32fe0208 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -70,13 +70,11 @@ public class ToolBarContributionEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; - private Image tbrImage; private static class Struct { private final String label; @@ -98,26 +96,21 @@ public ToolBarContributionEditor(EditingDomain editingDomain, IProject project, @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return image; } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBarContribution.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBarContribution.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return tbrImage; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index c805d8d1d4..d1de5cb376 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -70,12 +70,10 @@ public class ToolBarEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; - private Image tbrImage; private static class Struct { private final String label; @@ -96,26 +94,21 @@ public ToolBarEditor(EditingDomain editingDomain, ModelEditor editor) { @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBar.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBar.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return image; } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBar.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBar.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return tbrImage; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index d85512b656..10fcd7c761 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -43,8 +43,6 @@ public class ToolBarSeparatorEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private EStackLayout stackLayout; - private Image image; - private Image tbrImage; public ToolBarSeparatorEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); @@ -53,26 +51,21 @@ public ToolBarSeparatorEditor(EditingDomain editingDomain, ModelEditor editor) { @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return image; } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBarSeparator.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBarSeparator.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return tbrImage; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index d8fcbb0088..4c1763e154 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -46,12 +46,10 @@ import org.eclipse.swt.widgets.Text; public class ToolControlEditor extends AbstractComponentEditor { - private Image image; private EMFDataBindingContext context; private Composite composite; private IProject project; private EStackLayout stackLayout; - private Image tbrImage; public ToolControlEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain, editor); @@ -71,26 +69,21 @@ public String getDescription(Object element) { @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return image; } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolControl.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolControl.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return tbrImage; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index b12908f513..65d4308082 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -68,13 +68,11 @@ public class TrimBarEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private ModelEditor editor; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; - private Image tbrImage; public TrimBarEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); @@ -84,26 +82,21 @@ public TrimBarEditor(EditingDomain editingDomain, ModelEditor editor) { @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return image; } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/WindowTrim.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/WindowTrim.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return tbrImage; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index d063856457..ec62d555cd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -65,13 +65,11 @@ public class TrimContributionEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; - private Image tbrImage; private static class Struct { private final String label; @@ -93,26 +91,21 @@ public TrimContributionEditor(EditingDomain editingDomain, IProject project, Mod @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return image; } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/TrimContribution.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/TrimContribution.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return tbrImage; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 6e00dea3cc..ad9c6f5678 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -95,26 +95,21 @@ public void run() { @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return image; } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Window.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Window.gif"));//$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return tbrImage; } } From 574094bcaed5ba8923601c13807de6d20f5ba940 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 9 Jul 2010 09:47:52 +0000 Subject: [PATCH 0203/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed problem with not showing up a sash image --- .../component/PartSashContainerEditor.java | 65 +++++++------------ 1 file changed, 25 insertions(+), 40 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 6160dbc034..0f7404c60f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -24,6 +24,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; @@ -68,10 +69,6 @@ public class PartSashContainerEditor extends AbstractComponentEditor { private Composite composite; - private Image vImage; - private Image hImage; - private Image vTbrImage; - private Image hTbrImage; private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); @@ -86,52 +83,40 @@ public Image getImage(Object element, Display display) { boolean horizontal = ((MPartSashContainer) element).isHorizontal(); if (!horizontal) { - if (((MPartSashContainer) element).isToBeRendered()) { - if (vImage == null) { - try { - vImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - - return vImage; } else { - if (vTbrImage == null) { - try { - vTbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer_vertical.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer_vertical.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return vTbrImage; } } if (horizontal) { - if (((MPartSashContainer) element).isToBeRendered()) { - if (hImage != null) { - try { - hImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return hImage; } else { - if (hTbrImage != null) { - try { - hTbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - return hTbrImage; - } } return null; From 76011a573c8ae27b7fcd020e88a1a8f37bc5da4f Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 9 Jul 2010 10:29:21 +0000 Subject: [PATCH 0204/1286] Bug 319250 - [Model Tooling] Shortcut to open liveeditor only works once From 1330985506552580142fefc0d898d6e0b783170d Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 9 Jul 2010 11:26:44 +0000 Subject: [PATCH 0205/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * added container referencing --- .../emf/editor3x/TargetElementProviders.java | 7 +- .../emf/ui/common/IModelElementProvider.java | 7 +- .../eclipse/e4/tools/emf/ui/common/Util.java | 104 +++++- .../common/component/StringModelFragment.java | 33 +- .../dialogs/FeatureSelectionDialog.java | 302 +++++++----------- .../dialogs/FindImportElementDialog.java | 39 ++- .../FindParentReferenceElementDialog.java | 263 +++++++++++++++ 7 files changed, 526 insertions(+), 229 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java index c9c753471b..a53b2cdba9 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java @@ -92,9 +92,6 @@ public void getModelElements(Filter filter, ModelResultHandler handler) { private void applyFilter(Filter filter, ModelResultHandler handler) { for (Resource res : resourceSet.getResources()) { - if (res.getURI().equals(filter.object.eResource().getURI())) { -// System.err.println("Skipped because self"); - } else { TreeIterator it = EcoreUtil.getAllContents(res, true); while (it.hasNext()) { @@ -103,12 +100,12 @@ private void applyFilter(Filter filter, ModelResultHandler handler) { // System.err // .println("Skipped because it is an import"); } else { - if (o.eClass().equals(filter.object.eClass())) { + if (o.eClass().equals(filter.eClass)) { + System.err.println("Found: " + o); handler.result(o); } } } - } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java index 6c5cf3b0c6..a3c01b1645 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java @@ -1,16 +1,17 @@ package org.eclipse.e4.tools.emf.ui.common; import java.util.regex.Pattern; +import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; public interface IModelElementProvider { public class Filter { - public final EObject object; + public final EClass eClass; public final String elementId; public final Pattern elementIdPattern; - public Filter(EObject object, String elementId) { - this.object = object; + public Filter(EClass eClass, String elementId) { + this.eClass = eClass; this.elementId = elementId; this.elementIdPattern = Pattern.compile(".*" + elementId.replaceAll("\\.", "\\\\.").replaceAll("\\*", ".*") + ".*"); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java index 19d535ce1f..16f542502e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java @@ -1,15 +1,115 @@ package org.eclipse.e4.tools.emf.ui.common; +import java.util.ArrayList; +import java.util.List; +import java.util.Map.Entry; +import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; - +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; public class Util { public static final boolean isNullOrEmpty(String element) { return element == null || element.trim().length() == 0; } - + public static final boolean isImport(EObject object) { return object.eContainingFeature() == FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS; } + + public static final void addClasses(EPackage ePackage, List list) { + for (EClassifier c : ePackage.getEClassifiers()) { + if (c instanceof EClass) { + EClass eclass = (EClass) c; + if (eclass != ApplicationPackageImpl.Literals.APPLICATION && !eclass.isAbstract() && !eclass.isInterface() && eclass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT)) { + list.add(new FeatureClass(eclass.getName(), eclass)); + } + } + } + + for (EPackage eSubPackage : ePackage.getESubpackages()) { + addClasses(eSubPackage, list); + } + } + + public static List loadPackages() { + List packs = new ArrayList(); + + for (Entry regEntry : EPackage.Registry.INSTANCE.entrySet()) { + if (regEntry.getValue() instanceof EPackage) { + EPackage ePackage = (EPackage) regEntry.getValue(); + InternalPackage iePackage = new InternalPackage(ePackage); + boolean found = false; + for (EClassifier cl : ePackage.getEClassifiers()) { + if (cl instanceof EClass) { + EClass eClass = (EClass) cl; + if (eClass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT)) { + if (!eClass.isInterface() && !eClass.isAbstract()) { + found = true; + InternalClass ieClass = new InternalClass(iePackage, eClass); + iePackage.classes.add(ieClass); + for (EReference f : eClass.getEAllReferences()) { + ieClass.features.add(new InternalFeature(ieClass, f)); + } + } + } + } + } + if (found) { + packs.add(iePackage); + } + } + } + + return packs; + } + + public static class InternalPackage { + public final EPackage ePackage; + public List classes = new ArrayList(); + + public InternalPackage(EPackage ePackage) { + this.ePackage = ePackage; + } + + @Override + public String toString() { + return ePackage.toString(); + } + + public List getAllClasses() { + ArrayList rv = new ArrayList(classes.size()); + for (InternalClass c : classes) { + rv.add(c.eClass); + } + return rv; + } + } + + public static class InternalClass { + public final InternalPackage pack; + public final EClass eClass; + public List features = new ArrayList(); + + public InternalClass(InternalPackage pack, EClass eClass) { + this.eClass = eClass; + this.pack = pack; + } + } + + public static class InternalFeature { + public final InternalClass clazz; + public final EStructuralFeature feature; + + public InternalFeature(InternalClass clazz, EStructuralFeature feature) { + this.clazz = clazz; + this.feature = feature; + } + + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index 460341cf82..020765acdc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -17,11 +17,13 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FeatureSelectionDialog; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindParentReferenceElementDialog; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.fragment.MModelFragment; import org.eclipse.e4.ui.model.fragment.MStringModelFragment; @@ -32,9 +34,7 @@ import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; @@ -123,10 +123,20 @@ private Composite createForm(Composite parent) { l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); + t.setEditable(false); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__PARENT_ELEMENT_ID).observeDetail(getMaster())); + + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText("Find"); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FindParentReferenceElementDialog dialog = new FindParentReferenceElementDialog(b.getShell(), StringModelFragment.this, (MStringModelFragment) getMaster().getValue()); + dialog.open(); + } + }); } { @@ -272,7 +282,7 @@ public int compare(Viewer viewer, Object e1, Object e2) { }); List list = new ArrayList(); - addClasses(ApplicationPackageImpl.eINSTANCE, list); + Util.addClasses(ApplicationPackageImpl.eINSTANCE, list); list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS)); childrenDropDown.setInput(list); @@ -318,21 +328,6 @@ public void widgetSelected(SelectionEvent e) { return parent; } - public void addClasses(EPackage ePackage, List list) { - for (EClassifier c : ePackage.getEClassifiers()) { - if (c instanceof EClass) { - EClass eclass = (EClass) c; - if (eclass != ApplicationPackageImpl.Literals.APPLICATION && !eclass.isAbstract() && !eclass.isInterface() && eclass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT)) { - list.add(new FeatureClass(eclass.getName(), eclass)); - } - } - } - - for (EPackage eSubPackage : ePackage.getESubpackages()) { - addClasses(eSubPackage, list); - } - } - public void dispose() { if (image != null) { image.dispose(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java index 0b4908554f..ee2036a230 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java @@ -13,19 +13,17 @@ import java.text.BreakIterator; import java.util.ArrayList; import java.util.List; -import java.util.Map.Entry; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.e4.tools.emf.ui.common.Util.InternalClass; +import org.eclipse.e4.tools.emf.ui.common.Util.InternalFeature; +import org.eclipse.e4.tools.emf.ui.common.Util.InternalPackage; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.StringMatcher; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.fragment.MStringModelFragment; import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; import org.eclipse.e4.ui.model.internal.ModelUtils; import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.dialogs.TitleAreaDialog; @@ -61,7 +59,7 @@ public class FeatureSelectionDialog extends TitleAreaDialog { private TreeViewer viewer; private MStringModelFragment fragment; private EditingDomain editingDomain; - + public FeatureSelectionDialog(Shell parentShell, EditingDomain editingDomain, MStringModelFragment fragment) { super(parentShell); this.fragment = fragment; @@ -73,19 +71,18 @@ protected Control createDialogArea(Composite parent) { getShell().setText(Messages.FeatureSelectionDialog_ShellTitle); setTitle(Messages.FeatureSelectionDialog_DialogTitle); setMessage(Messages.FeatureSelectionDialog_DialogMessage); - - + Composite composite = (Composite) super.createDialogArea(parent); - - final Image packageImage = new Image(getShell().getDisplay(),getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/EPackage.gif")); //$NON-NLS-1$ - final Image classImage = new Image(getShell().getDisplay(),getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/class_obj.gif")); //$NON-NLS-1$ - final Image featureImage = new Image(getShell().getDisplay(),getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/field_public_obj.gif")); //$NON-NLS-1$ - final Image newTitleImage = new Image(getShell().getDisplay(),getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/fieldrefact_wiz.png")); //$NON-NLS-1$ + + final Image packageImage = new Image(getShell().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/EPackage.gif")); //$NON-NLS-1$ + final Image classImage = new Image(getShell().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/class_obj.gif")); //$NON-NLS-1$ + final Image featureImage = new Image(getShell().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/field_public_obj.gif")); //$NON-NLS-1$ + final Image newTitleImage = new Image(getShell().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/fieldrefact_wiz.png")); //$NON-NLS-1$ setTitleImage(newTitleImage); - + composite.addDisposeListener(new DisposeListener() { - + public void widgetDisposed(DisposeEvent e) { packageImage.dispose(); classImage.dispose(); @@ -93,8 +90,7 @@ public void widgetDisposed(DisposeEvent e) { newTitleImage.dispose(); } }); - - + Composite container = new Composite(composite, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); container.setLayout(new GridLayout(2, false)); @@ -104,16 +100,16 @@ public void widgetDisposed(DisposeEvent e) { final Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - + new Label(container, SWT.NONE); viewer = new TreeViewer(container); GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint=200; + gd.heightHint = 200; viewer.getControl().setLayoutData(gd); viewer.setContentProvider(new ContentProviderImpl()); - viewer.setLabelProvider(new LabelProviderImpl(packageImage,classImage,featureImage)); + viewer.setLabelProvider(new LabelProviderImpl(packageImage, classImage, featureImage)); viewer.addDoubleClickListener(new IDoubleClickListener() { - + public void doubleClick(DoubleClickEvent event) { okPressed(); } @@ -121,19 +117,19 @@ public void doubleClick(DoubleClickEvent event) { viewer.setComparator(new ViewerComparator() { @Override public int compare(Viewer viewer, Object e1, Object e2) { - if( e1.getClass() == InternalPackage.class ) { - return ((InternalPackage)e1).ePackage.getNsURI().compareTo(((InternalPackage)e2).ePackage.getNsURI()); - } else if( e1.getClass() == InternalClass.class ) { - return ((InternalClass)e1).eClass.getName().compareTo(((InternalClass)e2).eClass.getName()); - } else if( e1.getClass() == InternalFeature.class ) { - return ((InternalFeature)e1).feature.getName().compareTo(((InternalFeature)e2).feature.getName()); + if (e1.getClass() == InternalPackage.class) { + return ((InternalPackage) e1).ePackage.getNsURI().compareTo(((InternalPackage) e2).ePackage.getNsURI()); + } else if (e1.getClass() == InternalClass.class) { + return ((InternalClass) e1).eClass.getName().compareTo(((InternalClass) e2).eClass.getName()); + } else if (e1.getClass() == InternalFeature.class) { + return ((InternalFeature) e1).feature.getName().compareTo(((InternalFeature) e2).feature.getName()); } return super.compare(viewer, e1, e2); } }); - + final ViewerFilterImpl filter = new ViewerFilterImpl(); - + viewer.addFilter(filter); searchText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { @@ -142,86 +138,53 @@ public void modifyText(ModifyEvent e) { } }); - - viewer.setInput(loadPackages()); - + viewer.setInput(Util.loadPackages()); + return composite; } - + @Override protected void okPressed() { IStructuredSelection sel = (IStructuredSelection) viewer.getSelection(); - if( ! sel.isEmpty() && sel.getFirstElement().getClass() == InternalFeature.class ) { + if (!sel.isEmpty() && sel.getFirstElement().getClass() == InternalFeature.class) { InternalFeature f = (InternalFeature) sel.getFirstElement(); Command cmd = SetCommand.create(editingDomain, fragment, FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__FEATURENAME, f.feature.getName()); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { editingDomain.getCommandStack().execute(cmd); - super.okPressed(); + super.okPressed(); } } } - - private static List loadPackages() { - List packs = new ArrayList(); - - for( Entry regEntry : EPackage.Registry.INSTANCE.entrySet() ) { - if( regEntry.getValue() instanceof EPackage ) { - EPackage ePackage = (EPackage) regEntry.getValue(); - InternalPackage iePackage = new InternalPackage(ePackage); - boolean found = false; - for( EClassifier cl : ePackage.getEClassifiers() ) { - if( cl instanceof EClass ) { - EClass eClass = (EClass) cl; - if( eClass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT) ) { - if( ! eClass.isInterface() && ! eClass.isAbstract() ) { - found = true; - InternalClass ieClass = new InternalClass(iePackage, eClass); - iePackage.classes.add(ieClass); - for( EReference f : eClass.getEAllReferences() ) { - ieClass.features.add(new InternalFeature(ieClass, f)); - } - } - } - } - } - if( found ) { - packs.add(iePackage); - } - } - } - - return packs; - } - + static class ContentProviderImpl implements ITreeContentProvider { public void dispose() { - + } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - + } public Object[] getElements(Object inputElement) { - return ((List)inputElement).toArray(); + return ((List) inputElement).toArray(); } public Object[] getChildren(Object parentElement) { - if( parentElement.getClass() == InternalPackage.class ) { - return ((InternalPackage)parentElement).classes.toArray(); - } else if( parentElement.getClass() == InternalClass.class ) { - return ((InternalClass)parentElement).features.toArray(); + if (parentElement.getClass() == InternalPackage.class) { + return ((InternalPackage) parentElement).classes.toArray(); + } else if (parentElement.getClass() == InternalClass.class) { + return ((InternalClass) parentElement).features.toArray(); } return new Object[0]; } public Object getParent(Object element) { - if( element.getClass() == InternalFeature.class ) { - return ((InternalFeature)element).clazz; - } else if( element.getClass() == InternalClass.class ) { - return ((InternalClass)element).pack; + if (element.getClass() == InternalFeature.class) { + return ((InternalFeature) element).clazz; + } else if (element.getClass() == InternalClass.class) { + return ((InternalClass) element).pack; } return null; } @@ -229,43 +192,43 @@ public Object getParent(Object element) { public boolean hasChildren(Object element) { return getChildren(element).length > 0; } - + } - + static class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { private final Image packageImage; private final Image classImage; private final Image featureImage; - + public LabelProviderImpl(Image packageImage, Image classImage, Image featureImage) { this.packageImage = packageImage; this.classImage = classImage; this.featureImage = featureImage; } - + public void update(final ViewerCell cell) { - if( cell.getElement().getClass() == InternalPackage.class ) { + if (cell.getElement().getClass() == InternalPackage.class) { InternalPackage o = (InternalPackage) cell.getElement(); - StyledString styledString = new StyledString(o.ePackage.getName()); - styledString.append( " - " + o.ePackage.getNsURI(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + StyledString styledString = new StyledString(o.ePackage.getName()); + styledString.append(" - " + o.ePackage.getNsURI(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); cell.setImage(packageImage); - } else if( cell.getElement().getClass() == InternalClass.class ) { + } else if (cell.getElement().getClass() == InternalClass.class) { InternalClass o = (InternalClass) cell.getElement(); cell.setText(o.eClass.getName()); cell.setImage(classImage); } else { InternalFeature o = (InternalFeature) cell.getElement(); - StyledString styledString = new StyledString(o.feature.getName()); - + StyledString styledString = new StyledString(o.feature.getName()); + EClassifier type = ModelUtils.getTypeArgument(o.clazz.eClass, o.feature.getEGenericType()); - if( o.feature.isMany() ) { - styledString.append(" : List<" + type.getName()+ ">", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ //$NON-NLS-2$ + if (o.feature.isMany()) { + styledString.append(" : List<" + type.getName() + ">", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ //$NON-NLS-2$ } else { styledString.append(" : " + type.getName(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ } - + cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); cell.setImage(featureImage); @@ -277,10 +240,10 @@ public Image getImage(Object element) { } public String getText(Object element) { - if( element.getClass() == InternalPackage.class ) { + if (element.getClass() == InternalPackage.class) { InternalPackage o = (InternalPackage) element; return o.ePackage.getName(); - } else if( element.getClass() == InternalClass.class ) { + } else if (element.getClass() == InternalClass.class) { InternalClass o = (InternalClass) element; return o.eClass.getName(); } else { @@ -289,39 +252,39 @@ public String getText(Object element) { } } } - + static class ViewerFilterImpl extends ViewerFilter { private StringMatcher matcher; - + @Override public boolean select(Viewer viewer, Object parentElement, Object element) { - - if( element.getClass() == InternalPackage.class ) { - ILabelProvider pv = (ILabelProvider) ((StructuredViewer)viewer).getLabelProvider(); - for( InternalClass c : ((InternalPackage)element).classes ) { - if( match(pv.getText(c)) ) { + + if (element.getClass() == InternalPackage.class) { + ILabelProvider pv = (ILabelProvider) ((StructuredViewer) viewer).getLabelProvider(); + for (InternalClass c : ((InternalPackage) element).classes) { + if (match(pv.getText(c))) { return true; } } return false; - } else if( element.getClass() == InternalPackage.class ) { - ILabelProvider pv = (ILabelProvider) ((StructuredViewer)viewer).getLabelProvider(); - return match(pv.getText(element)); + } else if (element.getClass() == InternalPackage.class) { + ILabelProvider pv = (ILabelProvider) ((StructuredViewer) viewer).getLabelProvider(); + return match(pv.getText(element)); } - + return true; } - + protected boolean wordMatches(String text) { if (text == null) { return false; } - - //If the whole text matches we are all set - if(match(text)) { + + // If the whole text matches we are all set + if (match(text)) { return true; } - + // Otherwise check if any of the words of the text matches String[] words = getWords(text); for (int i = 0; i < words.length; i++) { @@ -333,56 +296,59 @@ protected boolean wordMatches(String text) { return false; } - + /** - * Answers whether the given String matches the pattern. - * - * @param string the String to test - * - * @return whether the string matches the pattern - */ - private boolean match(String string) { - if (matcher == null) { + * Answers whether the given String matches the pattern. + * + * @param string + * the String to test + * + * @return whether the string matches the pattern + */ + private boolean match(String string) { + if (matcher == null) { return true; } - return matcher.match(string); - } - - /** - * The pattern string for which this filter should select - * elements in the viewer. - * - * @param patternString - */ - public void setPattern(String patternString) { - - if (patternString == null || patternString.equals("")) { //$NON-NLS-1$ + return matcher.match(string); + } + + /** + * The pattern string for which this filter should select elements in + * the viewer. + * + * @param patternString + */ + public void setPattern(String patternString) { + + if (patternString == null || patternString.equals("")) { //$NON-NLS-1$ matcher = null; } else { String pattern = patternString + "*"; //$NON-NLS-1$ -// if (includeLeadingWildcard) { -// pattern = "*" + pattern; //$NON-NLS-1$ -// } + // if (includeLeadingWildcard) { + // pattern = "*" + pattern; //$NON-NLS-1$ + // } matcher = new StringMatcher(pattern, true, false); } - } - - /** - * Take the given filter text and break it down into words using a - * BreakIterator. - * - * @param text - * @return an array of words - */ - private String[] getWords(String text){ - List words = new ArrayList(); + } + + /** + * Take the given filter text and break it down into words using a + * BreakIterator. + * + * @param text + * @return an array of words + */ + private String[] getWords(String text) { + List words = new ArrayList(); // Break the text up into words, separating based on whitespace and // common punctuation. // Previously used String.split(..., "\\W"), where "\W" is a regular // expression (see the Javadoc for class Pattern). - // Need to avoid both String.split and regular expressions, in order to + // Need to avoid both String.split and regular expressions, in order + // to // compile against JCL Foundation (bug 80053). - // Also need to do this in an NL-sensitive way. The use of BreakIterator + // Also need to do this in an NL-sensitive way. The use of + // BreakIterator // was suggested in bug 90579. BreakIterator iter = BreakIterator.getWordInstance(); iter.setText(text); @@ -400,42 +366,6 @@ private String[] getWords(String text){ i = j; } return (String[]) words.toArray(new String[words.size()]); - } - } - - static class InternalPackage { - final EPackage ePackage; - List classes = new ArrayList(); - - public InternalPackage(EPackage ePackage) { - this.ePackage = ePackage; - } - - @Override - public String toString() { - return ePackage.toString(); - } - } - - static class InternalClass { - final InternalPackage pack; - final EClass eClass; - List features = new ArrayList(); - - public InternalClass(InternalPackage pack, EClass eClass) { - this.eClass = eClass; - this.pack = pack; - } - } - - static class InternalFeature { - final InternalClass clazz; - final EStructuralFeature feature; - - public InternalFeature(InternalClass clazz, EStructuralFeature feature) { - this.clazz = clazz; - this.feature = feature; } - } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java index 0f71fd7c5f..085fc44bf0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java @@ -10,6 +10,7 @@ import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.dialogs.TitleAreaDialog; @@ -125,8 +126,8 @@ public void modifyText(ModifyEvent e) { currentResultHandler.cancled = true; } list.clear(); - Filter filter = new Filter(element, searchText.getText()); - currentResultHandler = new ModelResultHandlerImpl(list, filter, editor); + Filter filter = new Filter(element.eClass(), searchText.getText()); + currentResultHandler = new ModelResultHandlerImpl(list, filter, editor, element.eResource()); collector.findModelElements(filter, currentResultHandler); } }); @@ -153,9 +154,11 @@ protected void okPressed() { Command cmd = SetCommand.create(editor.getEditingDomain(), element, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, el.getElementId()); if (cmd.canExecute()) { editor.getEditingDomain().getCommandStack().execute(cmd); + super.okPressed(); } + } else { + setErrorMessage("You can not import an element without an ID"); } - super.okPressed(); } } @@ -174,31 +177,39 @@ private static class ModelResultHandlerImpl implements ModelResultHandler { private IObservableList list; private Filter filter; private AbstractComponentEditor editor; + private Resource resource; - public ModelResultHandlerImpl(IObservableList list, Filter filter, AbstractComponentEditor editor) { + public ModelResultHandlerImpl(IObservableList list, Filter filter, AbstractComponentEditor editor, Resource resource) { this.list = list; this.filter = filter; this.editor = editor; + this.resource = resource; } public void result(EObject data) { if (!cancled) { - if (data instanceof MApplicationElement) { - String elementId = ((MApplicationElement) data).getElementId(); - if (elementId != null && elementId.trim().length() > 0) { - if (filter.elementIdPattern.matcher(elementId).matches()) { + if (!resource.getURI().equals(data.eResource().getURI())) + if (data instanceof MApplicationElement) { + String elementId = ((MApplicationElement) data).getElementId(); + if (elementId == null) { list.add(data); return; } - } - String label = editor.getDetailLabel(data); - if (elementId != null && label != null && label.trim().length() > 0) { - if (filter.elementIdPattern.matcher(label).matches()) { - list.add(data); + if (elementId != null && elementId.trim().length() > 0) { + if (filter.elementIdPattern.matcher(elementId).matches()) { + list.add(data); + return; + } + } + + String label = editor.getDetailLabel(data); + if (elementId != null && label != null && label.trim().length() > 0) { + if (filter.elementIdPattern.matcher(label).matches()) { + list.add(data); + } } } - } } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java new file mode 100644 index 0000000000..c38bc0257a --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java @@ -0,0 +1,263 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import java.util.ArrayList; +import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.Filter; +import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.ModelResultHandler; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.e4.tools.emf.ui.common.Util.InternalPackage; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; +import org.eclipse.e4.ui.model.application.MApplicationElement; +import org.eclipse.e4.ui.model.fragment.MStringModelFragment; +import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.jface.viewers.ViewerComparator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; + +public class FindParentReferenceElementDialog extends TitleAreaDialog { + private MStringModelFragment fragment; + private AbstractComponentEditor editor; + private TableViewer viewer; + + public FindParentReferenceElementDialog(Shell parentShell, AbstractComponentEditor editor, MStringModelFragment fragment) { + super(parentShell); + this.fragment = fragment; + this.editor = editor; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite comp = (Composite) super.createDialogArea(parent); + + final Image titleImage = new Image(parent.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/import_wiz.png")); + setTitleImage(titleImage); + getShell().addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + titleImage.dispose(); + } + }); + + getShell().setText("Find Parent Elements"); + setTitle("Find Parent Elements"); + setMessage("Search for an elements who you like to references as parent"); + + Composite container = new Composite(comp, SWT.NONE); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + container.setLayout(new GridLayout(2, false)); + + Label l = new Label(container, SWT.NONE); + l.setText("Container-Type"); + + final ComboViewer eClassViewer = new ComboViewer(container); + eClassViewer.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + return ((EClass) element).getName(); + } + }); + eClassViewer.setContentProvider(new ArrayContentProvider()); + List eClassList = new ArrayList(); + for (InternalPackage p : Util.loadPackages()) { + eClassList.addAll(p.getAllClasses()); + } + eClassViewer.setComparator(new ViewerComparator() { + @Override + public int compare(Viewer viewer, Object e1, Object e2) { + EClass ec1 = (EClass) e1; + EClass ec2 = (EClass) e2; + return ec1.getName().compareTo(ec2.getName()); + } + }); + eClassViewer.setInput(eClassList); + eClassViewer.getCombo().select(0); + eClassViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + l = new Label(container, SWT.NONE); + l.setText("Search"); + + final Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + searchText.setLayoutData(gd); + + l = new Label(container, SWT.PUSH); + + viewer = new TableViewer(container); + gd = new GridData(GridData.FILL_BOTH); + gd.heightHint = 200; + viewer.getControl().setLayoutData(gd); + viewer.setLabelProvider(new StyledCellLabelProvider() { + @Override + public void update(ViewerCell cell) { + EObject o = (EObject) cell.getElement(); + AbstractComponentEditor editor = FindParentReferenceElementDialog.this.editor.getEditor().getEditor(o.eClass()); + cell.setImage(editor.getImage(o, searchText.getDisplay())); + + MApplicationElement appEl = (MApplicationElement) o; + + StyledString styledString = new StyledString(editor.getLabel(o) + " (" + (appEl.getElementId() == null ? "" : appEl.getElementId()) + ")", null); + String detailLabel = editor.getDetailLabel(o); + if (detailLabel != null && !detailLabel.equals(appEl.getElementId())) { + styledString.append(" - " + detailLabel, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + } + + styledString.append(" - " + o.eResource().getURI(), StyledString.COUNTER_STYLER); //$NON-NLS-1$ + cell.setStyleRanges(styledString.getStyleRanges()); + cell.setText(styledString.getString()); + } + }); + viewer.setContentProvider(new ObservableListContentProvider()); + viewer.addDoubleClickListener(new IDoubleClickListener() { + + public void doubleClick(DoubleClickEvent event) { + okPressed(); + } + }); + + final WritableList list = new WritableList(); + viewer.setInput(list); + + final ClassContributionCollector collector = getCollector(); + + searchText.addModifyListener(new ModifyListener() { + private ModelResultHandlerImpl currentResultHandler; + + public void modifyText(ModifyEvent e) { + if (currentResultHandler != null) { + currentResultHandler.cancled = true; + } + list.clear(); + + Filter filter = new Filter((EClass) ((IStructuredSelection) eClassViewer.getSelection()).getFirstElement(), searchText.getText()); + + currentResultHandler = new ModelResultHandlerImpl(list, filter, editor, ((EObject) fragment).eResource()); + collector.findModelElements(filter, currentResultHandler); + } + }); + + Button button = new Button(container, SWT.PUSH); + button.setText("Clear Cache"); + button.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false, 2, 1)); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + collector.clearModelCache(); + } + }); + + return comp; + } + + @Override + protected void okPressed() { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (!s.isEmpty()) { + MApplicationElement el = (MApplicationElement) s.getFirstElement(); + if (el.getElementId() != null && el.getElementId().trim().length() > 0) { + Command cmd = SetCommand.create(editor.getEditingDomain(), fragment, FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__PARENT_ELEMENT_ID, el.getElementId()); + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + super.okPressed(); + } + } else { + setErrorMessage("You can not reference an element without an ID"); + } + } + } + + private ClassContributionCollector getCollector() { + Bundle bundle = FrameworkUtil.getBundle(FindParentReferenceElementDialog.class); + BundleContext context = bundle.getBundleContext(); + ServiceReference ref = context.getServiceReference(ClassContributionCollector.class.getName()); + if (ref != null) { + return (ClassContributionCollector) context.getService(ref); + } + return null; + } + + private static class ModelResultHandlerImpl implements ModelResultHandler { + private boolean cancled = false; + private IObservableList list; + private Filter filter; + private AbstractComponentEditor editor; + private Resource resource; + + private List noId = new ArrayList(); + + public ModelResultHandlerImpl(IObservableList list, Filter filter, AbstractComponentEditor editor, Resource resource) { + this.list = list; + this.filter = filter; + this.editor = editor; + this.resource = resource; + } + + public void result(EObject data) { + if (!cancled) { + if (!resource.getURI().equals(data.eResource().getURI())) { + if (data instanceof MApplicationElement) { + String elementId = ((MApplicationElement) data).getElementId(); + if (elementId == null) { + list.add(data); + return; + } + + if (elementId != null && elementId.trim().length() > 0) { + if (filter.elementIdPattern.matcher(elementId).matches()) { + list.add(data); + return; + } + } + + String label = editor.getDetailLabel(data); + if (elementId != null && label != null && label.trim().length() > 0) { + if (filter.elementIdPattern.matcher(label).matches()) { + list.add(data); + return; + } + } + } + } + } + } + } + +} \ No newline at end of file From 1392aba4172771e5e9fd4cfd44f53300559987f7 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 9 Jul 2010 13:32:08 +0000 Subject: [PATCH 0206/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed layout --- .../common/component/StringModelFragment.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index 020765acdc..9aed3b94bc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -122,14 +122,24 @@ private Composite createForm(Composite parent) { l.setText(Messages.StringModelFragment_ParentId); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - Text t = new Text(parent, SWT.BORDER); - t.setEditable(false); + Composite comp = new Composite(parent, SWT.NONE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + comp.setLayoutData(gd); + GridLayout gl = new GridLayout(2, false); + gl.marginWidth = gl.marginHeight = 0; + gl.verticalSpacing = 0; + gl.marginLeft = gl.marginBottom = gl.marginRight = gl.marginTop = 0; + comp.setLayout(gl); + + Text t = new Text(comp, SWT.BORDER); + t.setEditable(false); + gd = new GridData(GridData.FILL_HORIZONTAL); t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__PARENT_ELEMENT_ID).observeDetail(getMaster())); - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText("Find"); + final Button b = new Button(comp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.StringModelFragment_Find); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { From f4a2d714a748dabcb60bb9f1a1e184b8121c14a4 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 9 Jul 2010 13:35:18 +0000 Subject: [PATCH 0207/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed c&p --- .../e4/tools/emf/ui/internal/common/ModelEditor.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index cefdeededc..2e7ff81bae 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -700,6 +700,16 @@ public void paste() { } } + if (feature == FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS && container != null) { + MApplicationElement el = (MApplicationElement) EcoreUtil.create(((EObject) o).eClass()); + el.setElementId(((MApplicationElement) o).getElementId()); + Command cmd = AddCommand.create(getModelProvider().getEditingDomain(), container, feature, el); + if (cmd.canExecute()) { + getModelProvider().getEditingDomain().getCommandStack().execute(cmd); + } + return; + } + if (feature != null && container != null) { Command cmd = AddCommand.create(getModelProvider().getEditingDomain(), container, feature, o); if (cmd.canExecute()) { @@ -844,7 +854,7 @@ public boolean performDrop(Object data) { } } - if (feature == FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS) { + if (feature == FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS && parent != null) { MApplicationElement el = (MApplicationElement) EcoreUtil.create(((EObject) data).eClass()); el.setElementId(((MApplicationElement) data).getElementId()); Command cmd = AddCommand.create(domain, parent, feature, el); From 1b7733c3ad36193fc907566dd9ac1703089a4631 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 9 Jul 2010 13:44:35 +0000 Subject: [PATCH 0208/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * adding toberendered and visible attributes --- .../emf/ui/internal/common/component/PlaceholderEditor.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 82bca30ceb..2faa2d96dd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -28,6 +28,7 @@ import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; @@ -220,6 +221,8 @@ public void widgetSelected(SelectionEvent e) { } }); } + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ return parent; } From 38a1d6a6c65c325b6e0de0f2204aa936316584c2 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 9 Jul 2010 15:48:31 +0000 Subject: [PATCH 0209/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed imports --- .../compat/internal/WorkbenchLogger.java | 2 + .../emf/editor3x/E4WorkbenchModelEditor.java | 1 - .../emf/editor3x/TargetElementProviders.java | 6 -- .../extension/AddonContributionEditor.java | 1 - .../e4/tools/emf/ui/common/EStackLayout.java | 3 +- .../tools/emf/ui/common/IEditorFeature.java | 4 +- .../e4/tools/emf/ui/common/ImageTooltip.java | 33 ++----- .../common/component/InputPartEditor.java | 3 +- .../common/component/TrimmedWindowEditor.java | 5 +- .../AbstractCommandSelectionDialog.java | 23 ++--- .../dialogs/SharedElementsDialog.java | 94 ++++++------------- .../virtual/VMenuContributionsEditor.java | 20 +--- .../virtual/VModelFragmentsEditor.java | 19 +--- .../virtual/VModelImportsEditor.java | 29 ++---- .../virtual/VToolBarContributionsEditor.java | 24 +---- .../virtual/VTrimContributionsEditor.java | 28 +----- .../virtual/VWindowSharedElementsEditor.java | 24 ++--- .../internal/wbm/ApplicationModelEditor.java | 3 +- 18 files changed, 86 insertions(+), 236 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/WorkbenchLogger.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/WorkbenchLogger.java index d5e64d8a36..ff8cbf85dc 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/WorkbenchLogger.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/WorkbenchLogger.java @@ -1,7 +1,9 @@ package org.eclipse.e4.tools.compat.internal; import java.util.ArrayList; + import javax.inject.Inject; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java index 726842fae1..38b089228d 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java @@ -13,7 +13,6 @@ import org.eclipse.e4.tools.compat.parts.DIEditorPart; import org.eclipse.e4.tools.emf.ui.common.IModelResource.ModelListener; import org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor; -import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.actions.ActionFactory; @SuppressWarnings("restriction") diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java index a53b2cdba9..4f4718d541 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java @@ -6,9 +6,6 @@ import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtension; import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider; -import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.Filter; -import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.ModelResultHandler; -import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.common.util.URI; @@ -17,10 +14,7 @@ import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.pde.core.plugin.IPluginModelBase; -import org.eclipse.pde.internal.core.PDECore; import org.eclipse.pde.internal.core.PDEExtensionRegistry; -import org.eclipse.pde.internal.core.PluginModelManager; public class TargetElementProviders implements IModelElementProvider { private ResourceSet resourceSet; diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java index ce8de80ff3..dee4f6bdcc 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java @@ -14,7 +14,6 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.e4.internal.tools.wizards.classes.NewAddonClassWizard; -import org.eclipse.e4.internal.tools.wizards.classes.NewHandlerClassWizard; import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/EStackLayout.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/EStackLayout.java index 2b3b836c24..dee6098e7b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/EStackLayout.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/EStackLayout.java @@ -11,11 +11,10 @@ package org.eclipse.e4.tools.emf.ui.common; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StackLayout; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.custom.StackLayout; - public class EStackLayout extends StackLayout { private boolean onlyVisible; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java index cf0411f955..3771b73976 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java @@ -1,10 +1,8 @@ package org.eclipse.e4.tools.emf.ui.common; -import org.eclipse.emf.ecore.EStructuralFeature; - import java.util.List; - import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EStructuralFeature; public interface IEditorFeature { public class FeatureClass { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java index 87251ca5b5..2c3a30ce8a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java @@ -1,42 +1,23 @@ package org.eclipse.e4.tools.emf.ui.common; -import java.io.FileNotFoundException; - -import java.text.DecimalFormat; - -import java.text.NumberFormat; - import java.io.ByteArrayInputStream; - -import org.eclipse.swt.graphics.ImageData; - import java.io.ByteArrayOutputStream; - -import org.eclipse.swt.layout.GridLayout; - +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; - +import java.text.DecimalFormat; import org.eclipse.emf.common.util.URI; - import org.eclipse.jface.resource.JFaceResources; - -import org.eclipse.swt.graphics.Image; - -import org.eclipse.swt.graphics.Font; - -import org.eclipse.swt.widgets.Label; - +import org.eclipse.jface.window.ToolTip; import org.eclipse.swt.SWT; - +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; - import org.eclipse.swt.widgets.Control; - -import org.eclipse.jface.window.ToolTip; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; public abstract class ImageTooltip extends ToolTip { private Image image; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java index b1164d29fa..35328c55bd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java @@ -10,11 +10,10 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java index b00e589e71..e55c47e267 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java @@ -10,16 +10,15 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.emf.ecore.EObject; - import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; public class TrimmedWindowEditor extends WindowEditor { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java index 6134c2a0f1..d0ae2cab10 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java @@ -10,30 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; - -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; - -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.common.util.TreeIterator; - -import org.eclipse.emf.ecore.util.EcoreUtil; - -import org.eclipse.e4.ui.model.fragment.MModelFragments; - import java.util.ArrayList; import java.util.List; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; -import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.commands.MCommand; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.dialogs.TitleAreaDialog; import org.eclipse.jface.viewers.AbstractTreeViewer; @@ -48,6 +35,8 @@ import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerCell; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.graphics.Image; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java index f843431ff4..50a20e6c20 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java @@ -1,85 +1,49 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; - -import org.eclipse.emf.edit.command.SetCommand; - -import org.eclipse.emf.common.command.Command; - -import org.eclipse.jface.viewers.IStructuredSelection; - +import java.util.ArrayList; +import java.util.List; import org.eclipse.e4.tools.emf.ui.common.IModelResource; - -import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder; - +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; - -import org.eclipse.jface.viewers.StyledString; - +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.MApplication; +import org.eclipse.e4.ui.model.application.MApplicationElement; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; - -import org.eclipse.swt.graphics.Image; - -import org.eclipse.jface.viewers.ViewerCell; - -import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer; - +import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder; +import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.MPart; - -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.StyledCellLabelProvider; - -import org.eclipse.e4.ui.model.fragment.MStringModelFragment; - +import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer; +import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.model.fragment.MModelFragment; - import org.eclipse.e4.ui.model.fragment.MModelFragments; - -import org.eclipse.e4.ui.model.application.ui.MUIElement; - -import org.eclipse.e4.ui.model.application.ui.basic.MWindow; - -import java.util.ArrayList; - -import java.util.List; - +import org.eclipse.e4.ui.model.fragment.MStringModelFragment; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.ecore.EObject; - -import org.eclipse.e4.ui.model.application.MApplicationElement; - -import org.eclipse.e4.ui.model.application.MApplication; - +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.viewers.AbstractTreeViewer; +import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IDoubleClickListener; - -import org.eclipse.jface.viewers.ArrayContentProvider; - +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; import org.eclipse.jface.viewers.TableViewer; - +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; - import org.eclipse.swt.layout.GridLayout; - -import org.eclipse.swt.widgets.Text; - -import org.eclipse.swt.SWT; - -import org.eclipse.swt.widgets.Label; - import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; - +import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; - -import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.swt.widgets.Text; public class SharedElementsDialog extends TitleAreaDialog { private TableViewer viewer; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java index 54a03e5c2c..51956f3f7a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java @@ -10,16 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuContributions; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution; - -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; - -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; - import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -28,11 +18,11 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptorContainer; -import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuContributions; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java index 22c351910c..ff947948ef 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java @@ -10,14 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import org.eclipse.e4.ui.model.fragment.MModelFragments; - -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; - -import org.eclipse.e4.ui.model.fragment.MStringModelFragment; - -import org.eclipse.e4.ui.model.fragment.MFragmentFactory; - import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -25,23 +17,20 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.fragment.MFragmentFactory; +import org.eclipse.e4.ui.model.fragment.MModelFragments; +import org.eclipse.e4.ui.model.fragment.MStringModelFragment; +import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java index 4152290714..7335cc89c8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java @@ -10,39 +10,24 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; - import java.util.ArrayList; -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerComparator; - -import org.eclipse.e4.ui.model.fragment.MModelFragments; - -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; - -import org.eclipse.e4.ui.model.fragment.MStringModelFragment; - -import org.eclipse.e4.ui.model.fragment.MFragmentFactory; - import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.fragment.MModelFragments; +import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; @@ -55,6 +40,8 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerComparator; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java index e1edb402f7..9813292221 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java @@ -10,20 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution; - -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContributions; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuContributions; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution; - -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; - -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; - import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -32,11 +18,11 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptorContainer; -import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; +import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution; +import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContributions; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java index 42b3bd4a4d..a98176cde9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java @@ -10,24 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import org.eclipse.e4.ui.model.application.ui.menu.MTrimContribution; - -import org.eclipse.e4.ui.model.application.ui.menu.MTrimContributions; - -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution; - -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContributions; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuContributions; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution; - -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; - -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; - import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -36,11 +18,11 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptorContainer; -import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; +import org.eclipse.e4.ui.model.application.ui.menu.MTrimContribution; +import org.eclipse.e4.ui.model.application.ui.menu.MTrimContributions; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java index 253f4fe051..66761b232d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java @@ -11,12 +11,16 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.ecore.EClass; @@ -25,34 +29,24 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Label; - -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.jface.viewers.TableViewer; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; - -import org.eclipse.emf.edit.domain.EditingDomain; - -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.swt.widgets.Label; public class VWindowSharedElementsEditor extends AbstractComponentEditor { private Composite composite; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java index c406dfc689..60a2ae91af 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java @@ -10,9 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.wbm; -import javax.inject.Named; - import javax.inject.Inject; +import javax.inject.Named; import org.eclipse.core.resources.IProject; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.core.di.annotations.Optional; From cf3d713ce012e9e0eaa13caff2c0885f9a06fa39 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 13 Jul 2010 11:38:54 +0000 Subject: [PATCH 0210/1286] Bug 319687 - [ModelTooling] Feature Description and Copyright incorrect --- .../org.eclipse.e4.core.tools.feature/feature.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/org.eclipse.e4.core.tools.feature/feature.properties b/features/org.eclipse.e4.core.tools.feature/feature.properties index b4f9dc8130..70a37cf4d4 100755 --- a/features/org.eclipse.e4.core.tools.feature/feature.properties +++ b/features/org.eclipse.e4.core.tools.feature/feature.properties @@ -28,18 +28,18 @@ secondaryUpdateSiteName=Ganymede Discovery Site # "description" property - description of the feature -description=Eclipse e4 Multiple Programming Language +description=Eclipse e4 Modeltooling # "copyright" property - text of the "Feature Update Copyright" copyright=\ -Copyright (c) 2000, 2009 IBM Corporation and others.\n\ +Copyright (c) 2000, 2009 BestSolution.at and others.\n\ All rights reserved. This program and the accompanying materials\n\ are made available under the terms of the Eclipse Public License v1.0\n\ which accompanies this distribution, and is available at\n\ http://www.eclipse.org/legal/epl-v10.html\n\ \n\ Contributors:\n\ - IBM Corporation - initial API and implementation\n + BestSolution.at - initial API and implementation\n ################ end of copyright property #################################### # "licenseURL" property - URL of the "Feature License" From 1c997e8b8d8972f843856b7b7d43696376a16a13 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 16 Jul 2010 22:08:49 +0000 Subject: [PATCH 0211/1286] Bug 320131 - NPE in ModelEditor.setFocus --- .../eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 2e7ff81bae..e62fc2ecf6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -657,7 +657,9 @@ public void setFocus() { if (clipboardHandler == null) { clipboardHandler = new ClipboardHandler(); } - clipboardService.setHandler(clipboardHandler); + if (clipboardService != null) { + clipboardService.setHandler(clipboardHandler); + } viewer.getControl().setFocus(); } From 377a12a9bb101dd839635b8e2a73c672b8f64b12 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 11:00:26 +0000 Subject: [PATCH 0212/1286] Bug 318383 - Sash and Stack not updated if model is modified - Renderer * implemented moving for stacks --- .../eclipse/e4/tools/emf/ui/common/Util.java | 25 +++++++++++++++++++ .../common/component/PartStackEditor.java | 14 +++-------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java index 16f542502e..5a54ad348a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java @@ -5,13 +5,19 @@ import java.util.Map.Entry; import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; public class Util { public static final boolean isNullOrEmpty(String element) { @@ -69,6 +75,25 @@ public static List loadPackages() { return packs; } + public static boolean moveElementByIndex(EditingDomain editingDomain, MUIElement element, boolean liveModel, int index) { + if (liveModel) { + MElementContainer container = element.getParent(); + container.getChildren().remove(element); + container.getChildren().add(index, element); + container.setSelectedElement(element); + return true; + } else { + MElementContainer container = element.getParent(); + Command cmd = MoveCommand.create(editingDomain, container, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, element, index); + + if (cmd.canExecute()) { + editingDomain.getCommandStack().execute(cmd); + return true; + } + return false; + } + } + public static class InternalPackage { public final EPackage ePackage; public List classes = new ArrayList(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index f3bfd49de6..19c7adc85d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -38,7 +38,6 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -228,10 +227,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } @@ -252,17 +248,13 @@ public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (s.size() == 1) { Object obj = s.getFirstElement(); - MElementContainer container = (MElementContainer) getMaster().getValue(); + MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } - } } } From d36ff018fe70a167d6f51f051fdbc367f8fdac61 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 11:17:15 +0000 Subject: [PATCH 0213/1286] Bug 318383 - Sash and Stack not updated if model is modified - Renderer * implemented moving for all element containers --- .../component/MenuContributionEditor.java | 11 +- .../internal/common/component/MenuEditor.java | 11 +- .../component/PartSashContainerEditor.java | 11 +- .../common/component/PerspectiveEditor.java | 11 +- .../component/PerspectiveStackEditor.java | 11 +- .../component/ToolBarContributionEditor.java | 11 +- .../common/component/ToolBarEditor.java | 11 +- .../common/component/TrimBarEditor.java | 11 +- .../component/TrimContributionEditor.java | 11 +- .../virtual/VWindowControlEditor.java | 103 ++++++++---------- .../component/virtual/VWindowEditor.java | 52 ++++----- 11 files changed, 85 insertions(+), 169 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index e563588cf2..fa7b3eaf14 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -42,7 +42,6 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -277,10 +276,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } @@ -304,10 +300,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 5891271674..f4278c1be9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -48,7 +48,6 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -305,10 +304,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } @@ -332,10 +328,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 0f7404c60f..55057b99de 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -39,7 +39,6 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -265,10 +264,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } @@ -292,10 +288,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 8e91d780bb..3dd1a150a5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -44,7 +44,6 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -289,10 +288,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } @@ -316,10 +312,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 490d58290a..94673c50d8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -36,7 +36,6 @@ import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -206,10 +205,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } @@ -233,10 +229,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index 9c32fe0208..f4a7d9167d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -42,7 +42,6 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -272,10 +271,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } @@ -299,10 +295,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index d1de5cb376..e0411acdb4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -41,7 +41,6 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -239,10 +238,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } @@ -266,10 +262,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index 65d4308082..516e873ab6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -39,7 +39,6 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -225,10 +224,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } @@ -252,10 +248,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index ec62d555cd..2972f95dec 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -38,7 +38,6 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -249,10 +248,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } @@ -276,10 +272,7 @@ public void widgetSelected(SelectionEvent e) { MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index 12ce25b892..2e43c53208 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -13,11 +13,13 @@ import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -29,7 +31,6 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -56,7 +57,7 @@ public class VWindowControlEditor extends AbstractComponentEditor { private TableViewer viewer; public VWindowControlEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override @@ -81,19 +82,18 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + composite = createForm(parent, context, getMaster()); } - VirtualEntry o = (VirtualEntry)object; + VirtualEntry o = (VirtualEntry) object; viewer.setInput(o.getList()); getMaster().setValue(o.getOriginalParent()); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); parent.setLayout(new GridLayout(3, false)); { @@ -105,46 +105,42 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - + GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(getMaster())); - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(2,false); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); + if (idx >= 0) { + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -153,30 +149,26 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Down"); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; - if( idx < container.getChildren().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); + if (idx < container.getChildren().size()) { + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } - } } } }); - + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); childrenDropDown.setContentProvider(new ArrayContentProvider()); @@ -187,48 +179,42 @@ public String getText(Object element) { return eclass.getName(); } }); - childrenDropDown.setInput(new EClass[] { - AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, - BasicPackageImpl.Literals.PART_SASH_CONTAINER, - BasicPackageImpl.Literals.PART_STACK, - BasicPackageImpl.Literals.PART, - BasicPackageImpl.Literals.INPUT_PART - }); + childrenDropDown.setInput(new EClass[] { AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART }); childrenDropDown.setSelection(new StructuredSelection(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK)); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! childrenDropDown.getSelection().isEmpty() ) { - EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); - + if (!childrenDropDown.getSelection().isEmpty()) { + EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); + EObject eObject = EcoreUtil.create(eClass); - + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); getEditor().setSelection(eObject); } } } }); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Remove"); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List elements = ((IStructuredSelection)viewer.getSelection()).toList(); - + if (!viewer.getSelection().isEmpty()) { + List elements = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } @@ -236,7 +222,6 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index 3f358ad029..61129e57a6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -13,11 +13,13 @@ import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -29,7 +31,6 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -57,7 +58,7 @@ public class VWindowEditor extends AbstractComponentEditor { private TableViewer viewer; public VWindowEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override @@ -156,7 +157,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2,false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -164,28 +165,25 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - + b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); + if (idx >= 0) { + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -194,25 +192,21 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Down"); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; - if( idx < container.getChildren().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); + if (idx < container.getChildren().size()) { + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } - } } } @@ -230,16 +224,16 @@ public String getText(Object element) { }); childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.WINDOW, BasicPackageImpl.Literals.TRIMMED_WINDOW }); childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.WINDOW)); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); + EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); EObject handler = EcoreUtil.create(eClass); - + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, handler); if (cmd.canExecute()) { @@ -252,7 +246,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Remove"); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -262,7 +256,7 @@ public void widgetSelected(SelectionEvent e) { Command cmd = RemoveCommand.create(getEditingDomain(), container, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, windows); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); - if( container.getChildren().size() > 0 ) { + if (container.getChildren().size() > 0) { viewer.setSelection(new StructuredSelection(container.getChildren().get(0))); } } From d8b50e3b88d3faa11706f86e0309335cd4de9d64 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 11:27:02 +0000 Subject: [PATCH 0214/1286] Bug 318383 - Sash and Stack not updated if model is modified - Renderer * fixed drag and drop --- .../emf/ui/internal/common/ModelEditor.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index e62fc2ecf6..734dc615f5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -44,6 +44,7 @@ import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.ISelectionProviderService; import org.eclipse.e4.tools.emf.ui.common.MemoryTransfer; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ShadowComposite; import org.eclipse.e4.tools.emf.ui.internal.common.component.AddonsEditor; @@ -787,7 +788,7 @@ public void dragSetData(DragSourceEvent event) { } } - static class DropListener extends ViewerDropAdapter { + class DropListener extends ViewerDropAdapter { private EditingDomain domain; protected DropListener(Viewer viewer, EditingDomain domain) { @@ -866,7 +867,7 @@ public boolean performDrop(Object data) { return true; } - if (feature != null && parent != null) { + if (feature != null && parent != null && parent.eGet(feature) instanceof List) { List list = (List) parent.eGet(feature); int index = list.indexOf(getCurrentTarget()); @@ -875,10 +876,14 @@ public boolean performDrop(Object data) { } if (parent == ((EObject) data).eContainer()) { - Command cmd = MoveCommand.create(domain, parent, feature, data, index); - if (cmd.canExecute()) { - domain.getCommandStack().execute(cmd); - return true; + if (parent instanceof MElementContainer && data instanceof MUIElement) { + Util.moveElementByIndex(domain, (MUIElement) data, isLiveModel(), index); + } else { + Command cmd = MoveCommand.create(domain, parent, feature, data, index); + if (cmd.canExecute()) { + domain.getCommandStack().execute(cmd); + return true; + } } } else { // Moving between different sources is always a copy From eda3afb310035688812035bc91056fda257b83d3 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 11:40:48 +0000 Subject: [PATCH 0215/1286] Bug 318246 - [Model Tooling] Drag and drop for Parts into container --- .../org/eclipse/e4/tools/emf/ui/common/Util.java | 8 +++++++- .../emf/ui/internal/common/ModelEditor.java | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java index 5a54ad348a..b7addc99de 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java @@ -79,7 +79,13 @@ public static boolean moveElementByIndex(EditingDomain editingDomain, MUIElement if (liveModel) { MElementContainer container = element.getParent(); container.getChildren().remove(element); - container.getChildren().add(index, element); + + if (index >= 0) { + container.getChildren().add(index, element); + } else { + container.getChildren().add(element); + } + container.setSelectedElement(element); return true; } else { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 734dc615f5..76e81b0404 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -717,6 +717,11 @@ public void paste() { Command cmd = AddCommand.create(getModelProvider().getEditingDomain(), container, feature, o); if (cmd.canExecute()) { getModelProvider().getEditingDomain().getCommandStack().execute(cmd); + if (isLiveModel()) { + if (container instanceof MElementContainer && o instanceof MUIElement) { + ((MElementContainer) container).setSelectedElement((MUIElement) o); + } + } } } } @@ -827,6 +832,11 @@ public boolean performDrop(Object data) { Command cmd = AddCommand.create(domain, parent, feature, data); if (cmd.canExecute()) { domain.getCommandStack().execute(cmd); + if (isLiveModel()) { + if (parent instanceof MElementContainer && data instanceof MUIElement) { + ((MElementContainer) parent).setSelectedElement((MUIElement) data); + } + } } } } else if (getCurrentLocation() == LOCATION_AFTER || getCurrentLocation() == LOCATION_BEFORE) { @@ -894,6 +904,12 @@ public boolean performDrop(Object data) { Command cmd = AddCommand.create(domain, parent, feature, data, index); if (cmd.canExecute()) { domain.getCommandStack().execute(cmd); + if (isLiveModel()) { + if (parent instanceof MElementContainer && data instanceof MUIElement) { + ((MElementContainer) parent).setSelectedElement((MUIElement) data); + } + } + return true; } } From e603d009b9b434490c04c7824d78af722b6e2331 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 12:54:25 +0000 Subject: [PATCH 0216/1286] Bug 320091 - [Tools] liveeditor generates invalid keybindings --- .../common/component/AddonsEditor.java | 4 +- .../common/component/ApplicationEditor.java | 4 +- .../component/BindingContextEditor.java | 6 +- .../common/component/BindingTableEditor.java | 6 +- .../common/component/CommandEditor.java | 6 +- .../component/CommandParameterEditor.java | 4 +- .../common/component/HandlerEditor.java | 4 +- .../common/component/InputPartEditor.java | 9 +- .../common/component/KeyBindingEditor.java | 67 +++++++++++- .../component/MenuContributionEditor.java | 6 +- .../internal/common/component/MenuEditor.java | 6 +- .../common/component/MenuItemEditor.java | 4 +- .../common/component/MenuSeparatorEditor.java | 4 +- .../component/ModelFragmentsEditor.java | 8 +- .../common/component/ParameterEditor.java | 4 +- .../component/PartDescriptorEditor.java | 4 +- .../internal/common/component/PartEditor.java | 4 +- .../component/PartSashContainerEditor.java | 6 +- .../common/component/PartStackEditor.java | 6 +- .../common/component/PerspectiveEditor.java | 6 +- .../component/PerspectiveStackEditor.java | 6 +- .../common/component/PlaceholderEditor.java | 4 +- .../common/component/StringModelFragment.java | 10 +- .../component/ToolBarContributionEditor.java | 6 +- .../common/component/ToolBarEditor.java | 6 +- .../component/ToolBarSeparatorEditor.java | 4 +- .../common/component/ToolControlEditor.java | 4 +- .../common/component/ToolItemEditor.java | 4 +- .../common/component/TrimBarEditor.java | 6 +- .../component/TrimContributionEditor.java | 6 +- .../common/component/TrimmedWindowEditor.java | 14 +-- .../common/component/WindowEditor.java | 4 +- .../component/virtual/VApplicationAddons.java | 83 +++++++------- .../virtual/VBindingTableEditor.java | 6 +- .../component/virtual/VCommandEditor.java | 77 ++++++------- .../component/virtual/VHandlerEditor.java | 72 ++++++------ .../virtual/VMenuContributionsEditor.java | 79 +++++++------- .../common/component/virtual/VMenuEditor.java | 18 +-- .../virtual/VModelFragmentsEditor.java | 99 +++++++++-------- .../virtual/VModelImportsEditor.java | 27 ++--- .../component/virtual/VPartDescriptor.java | 73 +++++++------ .../virtual/VToolBarContributionsEditor.java | 77 ++++++------- .../virtual/VTrimContributionsEditor.java | 79 +++++++------- .../virtual/VWindowControlEditor.java | 6 +- .../component/virtual/VWindowEditor.java | 6 +- .../virtual/VWindowSharedElementsEditor.java | 103 +++++++++--------- .../component/virtual/VWindowTrimEditor.java | 45 ++++---- 47 files changed, 609 insertions(+), 483 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index e946c8df8f..4ae0446015 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -124,7 +124,9 @@ public Composite getEditor(Composite parent, Object object) { protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 22815f0d40..d33cd92810 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -130,7 +130,9 @@ public Composite getEditor(Composite parent, Object object) { protected Composite createForm(Composite parent, EMFDataBindingContext context) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java index 506f378725..dc2e753cc5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java @@ -135,7 +135,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -166,7 +168,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); + gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index f0a68af973..b8d4933394 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -132,7 +132,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -214,7 +216,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); + gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index d02a3afb3d..e3ebd7a220 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -127,7 +127,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -196,7 +198,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); + gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java index 75dcbc4a42..52c9598b40 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java @@ -119,7 +119,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index e73d1c34b2..61258de2ee 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -121,7 +121,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java index 35328c55bd..3ccdaf593e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java @@ -32,16 +32,15 @@ public InputPartEditor(EditingDomain editingDomain, ModelEditor editor, IProject super(editingDomain, editor, project); } - @Override public String getLabel(Object element) { return Messages.InputPartEditor_Label; } - + @Override protected void createSubformElements(Composite parent, EMFDataBindingContext context, IObservableValue master) { IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); @@ -50,9 +49,9 @@ protected void createSubformElements(Composite parent, EMFDataBindingContext con Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; + gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.INPUT__INPUT_URI).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.INPUT__INPUT_URI).observeDetail(master)); } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 822cb8db1a..7d22843310 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -12,9 +12,16 @@ import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.core.databinding.Binding; +import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.core.databinding.validation.IValidator; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.Util; @@ -37,9 +44,13 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.bindings.keys.KeySequence; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.fieldassist.ControlDecoration; +import org.eclipse.jface.fieldassist.FieldDecoration; +import org.eclipse.jface.fieldassist.FieldDecorationRegistry; import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.ColumnViewerEditor; import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; @@ -136,7 +147,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -164,11 +177,41 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO l.setText(Messages.KeyBindingEditor_Sequence); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - Text t = new Text(parent, SWT.BORDER); + final Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_SEQUENCE__KEY_SEQUENCE).observeDetail(getMaster())); + Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_SEQUENCE__KEY_SEQUENCE).observeDetail(getMaster()), new UpdateValueStrategy().setBeforeSetValidator(new BindingValidator()), new UpdateValueStrategy()); + + final ControlDecoration dec = new ControlDecoration(t, SWT.TOP); + binding.getValidationStatus().addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + IStatus s = (IStatus) event.getObservableValue().getValue(); + if (s.isOK()) { + dec.setDescriptionText(null); + dec.setImage(null); + } else { + dec.setDescriptionText(s.getMessage()); + + String fieldDecorationID = null; + switch (s.getSeverity()) { + case IStatus.INFO: + fieldDecorationID = FieldDecorationRegistry.DEC_INFORMATION; + break; + case IStatus.WARNING: + fieldDecorationID = FieldDecorationRegistry.DEC_WARNING; + break; + case IStatus.ERROR: + case IStatus.CANCEL: + fieldDecorationID = FieldDecorationRegistry.DEC_ERROR; + break; + } + FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(fieldDecorationID); + dec.setImage(fieldDecoration == null ? null : fieldDecoration.getImage()); + } + } + }); } // ------------------------------------------------------------ @@ -277,7 +320,7 @@ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent even Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); + gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -353,4 +396,20 @@ public String getDetailLabel(Object element) { public FeaturePath[] getLabelProperties() { return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.KEY_SEQUENCE__KEY_SEQUENCE) }; } + + class BindingValidator implements IValidator { + + public IStatus validate(Object value) { + if (value != null && value.toString().trim().length() > 0) { + try { + KeySequence.getInstance(value.toString()); + return Status.OK_STATUS; + } catch (Exception e) { + return new Status(IStatus.ERROR, "org.eclipse.e4.tools.emf.ui", e.getMessage(), e); + } + } + + return new Status(IStatus.ERROR, "org.eclipse.e4.tools.emf.ui", "Keybinding must not be empty!"); + } + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index fa7b3eaf14..1fdccca0c8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -171,7 +171,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -255,7 +257,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); + gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index f4278c1be9..746ab44399 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -163,7 +163,9 @@ public Composite getEditor(Composite parent, Object object) { protected Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean rootMenu, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -283,7 +285,7 @@ public void widgetSelected(SelectionEvent e) { Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); + gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 64ffa5f46e..395e7f4e9f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -134,7 +134,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); IWidgetValueProperty checkProp = WidgetProperties.selection(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index 982db2a1d0..2671fd8573 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -110,7 +110,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java index 056746d27a..b937f16f45 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java @@ -106,7 +106,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); { Label l = new Label(parent, SWT.NONE); @@ -125,7 +127,7 @@ private Composite createForm(Composite parent) { Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); + gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -266,7 +268,7 @@ public void widgetSelected(SelectionEvent e) { Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); + gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java index 0048711c65..f058aa16be 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java @@ -115,7 +115,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 6ea8626355..7265aa3afc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -143,7 +143,9 @@ public Composite getEditor(Composite parent, Object object) { protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index ff1ea3a111..bdddfe05e9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -164,7 +164,9 @@ public Composite getEditor(Composite parent, Object object) { protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 55057b99de..a41a870e12 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -166,7 +166,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -243,7 +245,7 @@ public String getText(Object element) { Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); + gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 19c7adc85d..700392d180 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -151,7 +151,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -206,7 +208,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); + gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 3dd1a150a5..340f63a52a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -165,7 +165,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -267,7 +269,7 @@ public void widgetSelected(SelectionEvent e) { Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); + gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 94673c50d8..20eaeceacf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -142,7 +142,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -184,7 +186,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); + gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 2faa2d96dd..9c20311225 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -149,7 +149,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index 9aed3b94bc..50efba48e0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -114,7 +114,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); { @@ -126,7 +128,7 @@ private Composite createForm(Composite parent) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; comp.setLayoutData(gd); - GridLayout gl = new GridLayout(2, false); + gl = new GridLayout(2, false); gl.marginWidth = gl.marginHeight = 0; gl.verticalSpacing = 0; gl.marginLeft = gl.marginBottom = gl.marginRight = gl.marginTop = 0; @@ -158,7 +160,7 @@ public void widgetSelected(SelectionEvent e) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; comp.setLayoutData(gd); - GridLayout gl = new GridLayout(2, false); + gl = new GridLayout(2, false); gl.marginWidth = gl.marginHeight = 0; gl.verticalSpacing = 0; gl.marginLeft = gl.marginBottom = gl.marginRight = gl.marginTop = 0; @@ -211,7 +213,7 @@ public void widgetSelected(SelectionEvent e) { Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); + gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index f4a7d9167d..4d0a999e9e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -166,7 +166,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -250,7 +252,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); + gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index e0411acdb4..b5c390acf9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -159,7 +159,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -217,7 +219,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); + gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index 10fcd7c761..b4688cb37b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -122,7 +122,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index 4c1763e154..04b600aa13 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -131,7 +131,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 160ce5dacc..94c5e62680 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -97,7 +97,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index 516e873ab6..5040098700 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -147,7 +147,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -203,7 +205,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); + gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index 2972f95dec..19d3e2c1db 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -161,7 +161,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -227,7 +229,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); + gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java index e55c47e267..dcf63e635c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java @@ -23,19 +23,19 @@ public class TrimmedWindowEditor extends WindowEditor { private IListProperty TRIMMED_WINDOW__TRIM_BARS = EMFProperties.list(BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS); - + public TrimmedWindowEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain,editor, project); + super(editingDomain, editor, project); } public IObservableList getChildList(Object element) { IObservableList list = super.getChildList(element); - - if( getEditor().isModelFragment() && Util.isImport((EObject) element) ) { + + if (getEditor().isModelFragment() && Util.isImport((EObject) element)) { return list; } - - list.add(new VirtualEntry( ModelEditor.VIRTUAL_TRIMMED_WINDOW_TRIMS, TRIMMED_WINDOW__TRIM_BARS, element, "TrimBars") { + + list.add(new VirtualEntry(ModelEditor.VIRTUAL_TRIMMED_WINDOW_TRIMS, TRIMMED_WINDOW__TRIM_BARS, element, "TrimBars") { @Override protected boolean accepted(Object o) { @@ -45,7 +45,7 @@ protected boolean accepted(Object o) { }); return list; } - + @Override public String getLabel(Object element) { return "Trimmed Window"; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index ad9c6f5678..5bc5a3d190 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -166,7 +166,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java index 5b4a622efc..127121ef61 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java @@ -37,15 +37,15 @@ public class VApplicationAddons extends AbstractComponentEditor { private Composite composite; private TableViewer viewer; private EMFDataBindingContext context; - + private List actions = new ArrayList(); - - //FIXME We need to plug this stuff into the command frameworks + + // FIXME We need to plug this stuff into the command frameworks private AddAddonCommand addAddonCommand = new AddAddonCommand(); private RemoveAddonCommand removeAddonCommand = new RemoveAddonCommand(); - + public VApplicationAddons(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); actions.add(new Action("Add Addon") { @Override public void run() { @@ -76,21 +76,22 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + composite = createForm(parent, context, getMaster()); } - VirtualEntry o = (VirtualEntry)object; + VirtualEntry o = (VirtualEntry) object; viewer.setInput(o.getList()); getMaster().setValue(o.getOriginalParent()); return composite; } - - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - + + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); + { Label l = new Label(parent, SWT.NONE); l.setText("Commands"); @@ -104,14 +105,14 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, viewer.getControl().setLayoutData(gd); viewer.getTable().setHeaderVisible(true); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); @@ -121,21 +122,21 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MApplication container = (MApplication) getMaster().getValue(); int idx = container.getCommands().indexOf(obj) - 1; - if( idx >= 0 ) { + if (idx >= 0) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__ADDONS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -148,21 +149,21 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MApplication container = (MApplication) getMaster().getValue(); int idx = container.getCommands().indexOf(obj) + 1; - if( idx < container.getCommands().size() ) { + if (idx < container.getCommands().size()) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__ADDONS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -186,24 +187,24 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - handleRemoveAddons(((IStructuredSelection)viewer.getSelection()).toList()); + if (!viewer.getSelection().isEmpty()) { + handleRemoveAddons(((IStructuredSelection) viewer.getSelection()).toList()); } } }); } - + return parent; } - + private void handleAddAddon() { addAddonCommand.execute(getEditingDomain(), (MApplication) getMaster().getValue()); } - + private void handleRemoveAddons(List addons) { removeAddonCommand.execute(getEditingDomain(), addons); } - + @Override public IObservableList getChildList(Object element) { // TODO Auto-generated method stub diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index 7d66ce41f6..4f359ccde9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -93,7 +93,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); { Label l = new Label(parent, SWT.NONE); @@ -110,7 +112,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); + gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index 156bdd2a51..0e45fe1884 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -52,11 +52,11 @@ public class VCommandEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private TableViewer viewer; - + private EStructuralFeature commandsFeature; public VCommandEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature commandsFeature) { - super(editingDomain,editor); + super(editingDomain, editor); this.commandsFeature = commandsFeature; } @@ -82,20 +82,21 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + composite = createForm(parent, context, getMaster()); } - VirtualEntry o = (VirtualEntry)object; + VirtualEntry o = (VirtualEntry) object; viewer.setInput(o.getList()); getMaster().setValue(o.getOriginalParent()); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); { Label l = new Label(parent, SWT.NONE); @@ -112,29 +113,29 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME); - + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Name"); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - + { IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Id"); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); @@ -144,21 +145,21 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MApplication container = (MApplication) getMaster().getValue(); int idx = container.getCommands().indexOf(obj) - 1; - if( idx >= 0 ) { + if (idx >= 0) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -171,21 +172,21 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MApplication container = (MApplication) getMaster().getValue(); int idx = container.getCommands().indexOf(obj) + 1; - if( idx < container.getCommands().size() ) { + if (idx < container.getCommands().size()) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -200,8 +201,8 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { MCommand command = CommandsFactoryImpl.eINSTANCE.createCommand(); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, command); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); getEditor().setSelection(command); } @@ -215,10 +216,10 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List commands = ((IStructuredSelection)viewer.getSelection()).toList(); + if (!viewer.getSelection().isEmpty()) { + List commands = ((IStructuredSelection) viewer.getSelection()).toList(); Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, commands); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index 9744229f4f..e2a3d703b3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -53,7 +53,7 @@ public class VHandlerEditor extends AbstractComponentEditor { private TableViewer viewer; public VHandlerEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override @@ -78,20 +78,21 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + composite = createForm(parent, context, getMaster()); } - VirtualEntry o = (VirtualEntry)object; + VirtualEntry o = (VirtualEntry) object; viewer.setInput(o.getList()); getMaster().setValue(o.getOriginalParent()); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); { Label l = new Label(parent, SWT.NONE); @@ -114,7 +115,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - + { IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); @@ -123,7 +124,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, column.getColumn().setWidth(300); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - + { IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); @@ -134,12 +135,12 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, } Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); @@ -149,21 +150,21 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MHandlerContainer container = (MHandlerContainer) getMaster().getValue(); int idx = container.getHandlers().indexOf(obj) - 1; - if( idx >= 0 ) { + if (idx >= 0) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -176,21 +177,21 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MHandlerContainer container = (MHandlerContainer) getMaster().getValue(); int idx = container.getHandlers().indexOf(obj) + 1; - if( idx < container.getHandlers().size() ) { + if (idx < container.getHandlers().size()) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -205,8 +206,8 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { MHandler handler = MCommandsFactory.INSTANCE.createHandler(); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, handler); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); getEditor().setSelection(handler); } @@ -220,10 +221,10 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List handlers = ((IStructuredSelection)viewer.getSelection()).toList(); + if (!viewer.getSelection().isEmpty()) { + List handlers = ((IStructuredSelection) viewer.getSelection()).toList(); Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, handlers); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } @@ -231,7 +232,6 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java index 51956f3f7a..715b29c9b0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java @@ -53,7 +53,7 @@ public class VMenuContributionsEditor extends AbstractComponentEditor { private TableViewer viewer; public VMenuContributionsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override @@ -78,20 +78,21 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + composite = createForm(parent, context, getMaster()); } - VirtualEntry o = (VirtualEntry)object; + VirtualEntry o = (VirtualEntry) object; viewer.setInput(o.getList()); getMaster().setValue(o.getOriginalParent()); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); { Label l = new Label(parent, SWT.NONE); @@ -108,38 +109,38 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Id"); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - + { IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__PARENT_ID); - + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("ParentId"); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - + { IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__POSITION_IN_PARENT); - + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Position"); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); @@ -149,21 +150,21 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MMenuContributions container = (MMenuContributions) getMaster().getValue(); int idx = container.getMenuContributions().indexOf(obj) - 1; - if( idx >= 0 ) { + if (idx >= 0) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -176,21 +177,21 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MMenuContributions container = (MMenuContributions) getMaster().getValue(); int idx = container.getMenuContributions().indexOf(obj) + 1; - if( idx < container.getMenuContributions().size() ) { + if (idx < container.getMenuContributions().size()) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -205,8 +206,8 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { MMenuContribution command = MMenuFactory.INSTANCE.createMenuContribution(); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, command); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); getEditor().setSelection(command); } @@ -220,10 +221,10 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List commands = ((IStructuredSelection)viewer.getSelection()).toList(); + if (!viewer.getSelection().isEmpty()) { + List commands = ((IStructuredSelection) viewer.getSelection()).toList(); Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, commands); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java index 6a187c8cf2..ff13dd9f52 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -50,7 +50,7 @@ public class VMenuEditor extends AbstractComponentEditor { private EStructuralFeature feature; public VMenuEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature feature) { - super(editingDomain,editor); + super(editingDomain, editor); this.feature = feature; } @@ -88,8 +88,10 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); + Label l = new Label(parent, SWT.NONE); l.setText("Menus"); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); @@ -97,17 +99,17 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - + IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); viewer.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); - + GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); + gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -157,10 +159,10 @@ public void widgetSelected(SelectionEvent e) { } } }); - + return parent; } - + @Override public IObservableList getChildList(Object element) { // TODO Auto-generated method stub diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java index ff947948ef..e5892602bd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java @@ -50,7 +50,7 @@ public class VModelFragmentsEditor extends AbstractComponentEditor { private TableViewer viewer; public VModelFragmentsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override @@ -75,20 +75,21 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + composite = createForm(parent, context, getMaster()); } - VirtualEntry o = (VirtualEntry)object; + VirtualEntry o = (VirtualEntry) object; viewer.setInput(o.getList()); getMaster().setValue(o.getOriginalParent()); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); { Label l = new Label(parent, SWT.NONE); @@ -99,46 +100,45 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - + GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS); viewer.setInput(prop.observeDetail(getMaster())); - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(2,false); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MModelFragments container = (MModelFragments) getMaster().getValue(); int idx = container.getFragments().indexOf(obj) - 1; - if( idx >= 0 ) { + if (idx >= 0) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -147,30 +147,30 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Down"); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MModelFragments container = (MModelFragments) getMaster().getValue(); int idx = container.getFragments().indexOf(obj) + 1; - if( idx < container.getFragments().size() ) { + if (idx < container.getFragments().size()) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } }); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Add"); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); @@ -178,30 +178,30 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - - MStringModelFragment eObject = MFragmentFactory.INSTANCE.createStringModelFragment(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, eObject); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - + + MStringModelFragment eObject = MFragmentFactory.INSTANCE.createStringModelFragment(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(eObject); + } + } }); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Remove"); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List elements = ((IStructuredSelection)viewer.getSelection()).toList(); - + if (!viewer.getSelection().isEmpty()) { + List elements = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, elements); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } @@ -209,7 +209,6 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java index 7335cc89c8..f351dc6aa2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java @@ -61,7 +61,7 @@ public class VModelImportsEditor extends AbstractComponentEditor { public VModelImportsEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); } - + @Override public Image getImage(Object element, Display display) { return null; @@ -84,36 +84,37 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + composite = createForm(parent, context, getMaster()); } - VirtualEntry o = (VirtualEntry)object; + VirtualEntry o = (VirtualEntry) object; viewer.setInput(o.getList()); getMaster().setValue(o.getOriginalParent()); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); { Label l = new Label(parent, SWT.NONE); l.setText("Imports"); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - + viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 200; viewer.getControl().setLayoutData(gd); - + Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); + gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -196,7 +197,7 @@ public int compare(Viewer viewer, Object e1, Object e2) { List list = new ArrayList(); addClasses(ApplicationPackageImpl.eINSTANCE, list); list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS)); - + childrenDropDown.setInput(list); childrenDropDown.getCombo().select(0); @@ -254,7 +255,7 @@ public void addClasses(EPackage ePackage, List list) { addClasses(eSubPackage, list); } } - + @Override public IObservableList getChildList(Object element) { // TODO Auto-generated method stub diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java index aac36fea5c..ac08e04bc6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java @@ -78,20 +78,21 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + composite = createForm(parent, context, getMaster()); } - VirtualEntry o = (VirtualEntry)object; + VirtualEntry o = (VirtualEntry) object; viewer.setInput(o.getList()); getMaster().setValue(o.getOriginalParent()); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); { Label l = new Label(parent, SWT.NONE); @@ -108,29 +109,29 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL); - + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Name"); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - + { IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CATEGORY); - + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Category"); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); @@ -140,21 +141,21 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MPartDescriptorContainer container = (MPartDescriptorContainer) getMaster().getValue(); int idx = container.getDescriptors().indexOf(obj) - 1; - if( idx >= 0 ) { + if (idx >= 0) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -167,21 +168,21 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MPartDescriptorContainer container = (MPartDescriptorContainer) getMaster().getValue(); int idx = container.getDescriptors().indexOf(obj) + 1; - if( idx < container.getDescriptors().size() ) { + if (idx < container.getDescriptors().size()) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -196,8 +197,8 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { MPartDescriptor command = MBasicFactory.INSTANCE.createPartDescriptor(); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, command); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); getEditor().setSelection(command); } @@ -211,10 +212,10 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List commands = ((IStructuredSelection)viewer.getSelection()).toList(); + if (!viewer.getSelection().isEmpty()) { + List commands = ((IStructuredSelection) viewer.getSelection()).toList(); Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, commands); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java index 9813292221..3d1ba17b3a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java @@ -78,20 +78,21 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + composite = createForm(parent, context, getMaster()); } - VirtualEntry o = (VirtualEntry)object; + VirtualEntry o = (VirtualEntry) object; viewer.setInput(o.getList()); getMaster().setValue(o.getOriginalParent()); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); { Label l = new Label(parent, SWT.NONE); @@ -108,38 +109,38 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Id"); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - + { IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__PARENT_ID); - + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("ParentId"); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - + { IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__POSITION_IN_PARENT); - + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Position"); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); @@ -149,21 +150,21 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MToolBarContributions container = (MToolBarContributions) getMaster().getValue(); int idx = container.getToolBarContributions().indexOf(obj) - 1; - if( idx >= 0 ) { + if (idx >= 0) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -176,21 +177,21 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MToolBarContributions container = (MToolBarContributions) getMaster().getValue(); int idx = container.getToolBarContributions().indexOf(obj) + 1; - if( idx < container.getToolBarContributions().size() ) { + if (idx < container.getToolBarContributions().size()) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -205,8 +206,8 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { MToolBarContribution command = MMenuFactory.INSTANCE.createToolBarContribution(); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, command); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); getEditor().setSelection(command); } @@ -220,10 +221,10 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List commands = ((IStructuredSelection)viewer.getSelection()).toList(); + if (!viewer.getSelection().isEmpty()) { + List commands = ((IStructuredSelection) viewer.getSelection()).toList(); Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, commands); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java index a98176cde9..925129a5f0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java @@ -53,7 +53,7 @@ public class VTrimContributionsEditor extends AbstractComponentEditor { private TableViewer viewer; public VTrimContributionsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override @@ -78,20 +78,21 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + composite = createForm(parent, context, getMaster()); } - VirtualEntry o = (VirtualEntry)object; + VirtualEntry o = (VirtualEntry) object; viewer.setInput(o.getList()); getMaster().setValue(o.getOriginalParent()); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); { Label l = new Label(parent, SWT.NONE); @@ -108,38 +109,38 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, { IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Id"); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - + { IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__PARENT_ID); - + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("ParentId"); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - + { IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__POSITION_IN_PARENT); - + TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText("Position"); column.getColumn().setWidth(200); column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); } - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); @@ -149,21 +150,21 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MTrimContributions container = (MTrimContributions) getMaster().getValue(); int idx = container.getTrimContributions().indexOf(obj) - 1; - if( idx >= 0 ) { + if (idx >= 0) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -176,21 +177,21 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MTrimContributions container = (MTrimContributions) getMaster().getValue(); int idx = container.getTrimContributions().indexOf(obj) + 1; - if( idx < container.getTrimContributions().size() ) { + if (idx < container.getTrimContributions().size()) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -205,8 +206,8 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { MTrimContribution command = MMenuFactory.INSTANCE.createTrimContribution(); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, command); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); getEditor().setSelection(command); } @@ -220,10 +221,10 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List commands = ((IStructuredSelection)viewer.getSelection()).toList(); + if (!viewer.getSelection().isEmpty()) { + List commands = ((IStructuredSelection) viewer.getSelection()).toList(); Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, commands); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index 2e43c53208..87e5278b7d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -94,7 +94,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); { Label l = new Label(parent, SWT.NONE); @@ -115,7 +117,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); + gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index 61129e57a6..bb4dbe0c9f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -95,7 +95,9 @@ public Composite getEditor(Composite parent, Object object) { private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); Label l = new Label(parent, SWT.NONE); l.setText("Windows"); @@ -157,7 +159,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); + gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java index 66761b232d..f8f48d06cb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java @@ -54,7 +54,7 @@ public class VWindowSharedElementsEditor extends AbstractComponentEditor { private TableViewer viewer; public VWindowSharedElementsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override @@ -79,20 +79,21 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + composite = createForm(parent, context, getMaster()); } - VirtualEntry o = (VirtualEntry)object; + VirtualEntry o = (VirtualEntry) object; viewer.setInput(o.getList()); getMaster().setValue(o.getOriginalParent()); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); { Label l = new Label(parent, SWT.NONE); @@ -103,46 +104,45 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - + GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS); viewer.setInput(prop.observeDetail(getMaster())); - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(2,false); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Up"); b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; - if( idx >= 0 ) { + if (idx >= 0) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } @@ -151,30 +151,30 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Down"); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; - if( idx < container.getChildren().size() ) { + if (idx < container.getChildren().size()) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, obj, idx); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } - + } } } }); - + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); childrenDropDown.setContentProvider(new ArrayContentProvider()); @@ -185,46 +185,42 @@ public String getText(Object element) { return eclass.getName(); } }); - childrenDropDown.setInput(new EClass[] { - BasicPackageImpl.Literals.PART_SASH_CONTAINER, - BasicPackageImpl.Literals.PART, - BasicPackageImpl.Literals.INPUT_PART - }); + childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART }); childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART)); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! childrenDropDown.getSelection().isEmpty() ) { - EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); - + if (!childrenDropDown.getSelection().isEmpty()) { + EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); + EObject eObject = EcoreUtil.create(eClass); - + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, eObject); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); getEditor().setSelection(eObject); } } } }); - + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Remove"); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List elements = ((IStructuredSelection)viewer.getSelection()).toList(); - + if (!viewer.getSelection().isEmpty()) { + List elements = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, elements); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } @@ -232,10 +228,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; } - + @Override public IObservableList getChildList(Object element) { // TODO Auto-generated method stub diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java index 1d7ea1156f..f921ef902d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -45,7 +45,7 @@ public class VWindowTrimEditor extends AbstractComponentEditor { private TableViewer viewer; public VWindowTrimEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); + super(editingDomain, editor); } @Override @@ -70,20 +70,21 @@ public String getDescription(Object element) { @Override public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { + if (composite == null) { context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); + composite = createForm(parent, context, getMaster()); } - VirtualEntry o = (VirtualEntry)object; + VirtualEntry o = (VirtualEntry) object; viewer.setInput(o.getList()); getMaster().setValue(o.getOriginalParent()); return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); { Label l = new Label(parent, SWT.NONE); @@ -94,20 +95,20 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - + GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - + Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; buttonComp.setLayout(gl); - + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText("Add Trim"); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); @@ -117,8 +118,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, public void widgetSelected(SelectionEvent e) { MTrimBar handler = MBasicFactory.INSTANCE.createTrimBar(); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS, handler); - - if( cmd.canExecute() ) { + + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); getEditor().setSelection(handler); } @@ -132,10 +133,10 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List trimElements = ((IStructuredSelection)viewer.getSelection()).toList(); + if (!viewer.getSelection().isEmpty()) { + List trimElements = ((IStructuredSelection) viewer.getSelection()).toList(); Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS, trimElements); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } From a07a7b98ba30a12ad718c30ddd6f96be7442bd1e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 13:07:08 +0000 Subject: [PATCH 0217/1286] Bug 320091 - [Tools] liveeditor generates invalid keybindings --- .../emf/ui/internal/common/component/KeyBindingEditor.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 7d22843310..61581b8f4d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -183,7 +183,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO t.setLayoutData(gd); Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_SEQUENCE__KEY_SEQUENCE).observeDetail(getMaster()), new UpdateValueStrategy().setBeforeSetValidator(new BindingValidator()), new UpdateValueStrategy()); - final ControlDecoration dec = new ControlDecoration(t, SWT.TOP); + final ControlDecoration dec = new ControlDecoration(t, SWT.BOTTOM); binding.getValidationStatus().addValueChangeListener(new IValueChangeListener() { public void handleValueChange(ValueChangeEvent event) { @@ -400,16 +400,17 @@ public FeaturePath[] getLabelProperties() { class BindingValidator implements IValidator { public IStatus validate(Object value) { + int statusCode = getEditor().isLiveModel() ? IStatus.ERROR : IStatus.WARNING; if (value != null && value.toString().trim().length() > 0) { try { KeySequence.getInstance(value.toString()); return Status.OK_STATUS; } catch (Exception e) { - return new Status(IStatus.ERROR, "org.eclipse.e4.tools.emf.ui", e.getMessage(), e); + return new Status(statusCode, "org.eclipse.e4.tools.emf.ui", e.getMessage(), e); } } - return new Status(IStatus.ERROR, "org.eclipse.e4.tools.emf.ui", "Keybinding must not be empty!"); + return new Status(statusCode, "org.eclipse.e4.tools.emf.ui", "Keybinding must not be empty!"); } } } From 73d3d80177e138ee16514e1ea83747dbc4ac4414 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 13:11:52 +0000 Subject: [PATCH 0218/1286] Bug 320091 - [Tools] liveeditor generates invalid keybindings --- .../ui/internal/common/component/KeyBindingEditor.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 61581b8f4d..a2c31eb649 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -403,14 +403,20 @@ public IStatus validate(Object value) { int statusCode = getEditor().isLiveModel() ? IStatus.ERROR : IStatus.WARNING; if (value != null && value.toString().trim().length() > 0) { try { - KeySequence.getInstance(value.toString()); + KeySequence keySequence = KeySequence.getInstance(value.toString()); + if (!keySequence.isComplete()) { + return new Status(statusCode, "org.eclipse.e4.tools.emf.ui", "Keysequence is not complete"); + } + if (keySequence.isEmpty()) { + return new Status(statusCode, "org.eclipse.e4.tools.emf.ui", "Keysequence must not be empty!"); + } return Status.OK_STATUS; } catch (Exception e) { return new Status(statusCode, "org.eclipse.e4.tools.emf.ui", e.getMessage(), e); } } - return new Status(statusCode, "org.eclipse.e4.tools.emf.ui", "Keybinding must not be empty!"); + return new Status(statusCode, "org.eclipse.e4.tools.emf.ui", "Keysequence must not be empty!"); } } } From 8179f5ef6dc25514b5ded069d11f25f363cd02f0 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 14:34:32 +0000 Subject: [PATCH 0219/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * setting a default application id --- .../wizards/model/BaseApplicationModelWizard.java | 2 +- .../wizards/model/NewApplicationModelWizard.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java index 0ec8559dd2..ff59f7ef20 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java @@ -155,7 +155,7 @@ public void run() { protected abstract EObject createInitialModel(); - private IFile getModelFile() throws CoreException { + protected IFile getModelFile() throws CoreException { String containerName = page.getContainerName(); String fileName = page.getFileName(); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java index c68662560b..7b625052be 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.internal.tools.wizards.model; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.emf.ecore.EObject; @@ -22,6 +24,13 @@ public String getDefaultFileName() { } protected EObject createInitialModel() { - return (EObject) MApplicationFactory.INSTANCE.createApplication(); + MApplication application = MApplicationFactory.INSTANCE.createApplication(); + try { + application.setElementId(getModelFile().getProject().getName() + ".application"); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return (EObject) application; } } \ No newline at end of file From 203e33556d962a87647d001f5f0aa732923cc7f5 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 14:56:12 +0000 Subject: [PATCH 0220/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * some nls stuff --- .../e4/tools/emf/ui/internal/Messages.java | 19 +++++------------- .../tools/emf/ui/internal/Messages.properties | 20 +++++-------------- .../common/component/AddonsEditor.java | 12 +++++------ .../common/component/BindingTableEditor.java | 2 +- .../component/DirectMenuItemEditor.java | 2 +- .../component/DirectToolItemEditor.java | 2 +- .../component/HandledMenuItemEditor.java | 2 +- .../component/HandledToolItemEditor.java | 2 +- .../common/component/HandlerEditor.java | 4 ++-- .../common/component/KeyBindingEditor.java | 2 +- .../internal/common/component/MenuEditor.java | 2 +- .../common/component/MenuItemEditor.java | 2 +- .../component/PartDescriptorEditor.java | 4 ++-- .../internal/common/component/PartEditor.java | 4 ++-- .../common/component/PerspectiveEditor.java | 2 +- .../common/component/PlaceholderEditor.java | 2 +- .../common/component/StringModelFragment.java | 4 ++-- 17 files changed, 34 insertions(+), 53 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index d6a6cf23b0..e072a09575 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -19,6 +19,7 @@ public class Messages { public static String ModelTooling_Common_Add; public static String ModelTooling_Common_Remove; public static String ModelTooling_Common_Id; + public static String ModelTooling_Common_FindEllipsis; public static String AbstractCommandSelectionDialog_Label_CommandId; @@ -37,7 +38,6 @@ public class Messages { public static String BindingTableEditor_Label; public static String BindingTableEditor_Description; public static String BindingTableEditor_ContextId; - public static String BindingTableEditor_Find; public static String BindingTableEditor_Keybindings; public static String BindingTableEditor_KeySequence; public static String BindingTableEditor_Command; @@ -57,7 +57,6 @@ public class Messages { public static String DirectMenuItemEditor_Label; public static String DirectMenuItemEditor_Description; public static String DirectMenuItemEditor_ClassURI; - public static String DirectMenuItemEditor_Find; public static String ControlFactory_BindingContexts; public static String ControlFactory_Tags; @@ -66,20 +65,17 @@ public class Messages { public static String ControlFactory_ContextVariables; public static String DirectToolItemEditor_ClassURI; - public static String DirectToolItemEditor_Find; public static String DirectToolItemEditor_Label; public static String DirectToolItemEditor_Description; public static String HandledMenuItemEditor_Label; public static String HandledMenuItemEditor_Description; public static String HandledMenuItemEditor_Command; - public static String HandledMenuItemEditor_Find; public static String HandledMenuItemEditor_Parameters; public static String HandledMenuItemEditor_Tag; public static String HandledMenuItemEditor_Value; public static String HandledToolItemEditor_Command; - public static String HandledToolItemEditor_Find; public static String HandledToolItemEditor_Parameters; public static String HandledToolItemEditor_ParametersName; public static String HandledToolItemEditor_ParametersValue; @@ -89,7 +85,6 @@ public class Messages { public static String HandlerEditor_Label; public static String HandlerEditor_Description; public static String HandlerEditor_Command; - public static String HandlerEditor_Find; public static String HandlerEditor_ClassURI; public static String InputPartEditor_Label; @@ -99,7 +94,6 @@ public class Messages { public static String KeyBindingEditor_Description; public static String KeyBindingEditor_Sequence; public static String KeyBindingEditor_Command; - public static String KeyBindingEditor_Find; public static String KeyBindingEditor_Parameters; public static String KeyBindingEditor_ParametersKey; public static String KeyBindingEditor_ParametersValue; @@ -121,7 +115,6 @@ public class Messages { public static String MenuItemEditor_Label; public static String MenuItemEditor_Tooltip; public static String MenuItemEditor_IconURI; - public static String MenuItemEditor_Find; public static String MenuEditor_MainMenu; public static String MenuSeparatorEditor_Label; @@ -131,7 +124,6 @@ public class Messages { public static String PartDescriptorEditor_LabelLabel; public static String PartDescriptorEditor_Tooltip; public static String PartDescriptorEditor_IconURI; - public static String PartDescriptorEditor_Find; public static String PartDescriptorEditor_ClassURI; public static String PartDescriptorEditor_Dirtyable; public static String PartDescriptorEditor_Closeable; @@ -153,7 +145,6 @@ public class Messages { public static String PartEditor_LabelLabel; public static String PartEditor_Tooltip; public static String PartEditor_IconURI; - public static String PartEditor_Find; public static String PartEditor_ClassURI; public static String PartEditor_Closeable; public static String PartEditor_PersitedState; @@ -185,7 +176,6 @@ public class Messages { public static String PerspectiveEditor_SelectedElement; public static String PerspectiveEditor_Tooltip; public static String PerspectiveEditor_IconURI; - public static String PerspectiveEditor_Find; public static String PerspectiveEditor_Controls; public static String PerspectiveStackEditor_Perspectives; @@ -195,7 +185,6 @@ public class Messages { public static String PlaceholderEditor_Label; public static String PlaceholderEditor_Descriptor; - public static String PlaceholderEditor_FindReference; public static String ToolBarEditor_Label; public static String ToolBarEditor_Description; @@ -220,7 +209,10 @@ public class Messages { public static String VBindingTableEditor_LabelDescription; public static String AddonsEditor_ClassURI; - public static String AddonsEditor_Find; + public static String AddonsEditor_TreeLabel; + public static String AddonsEditor_TreeLabelDescription; + public static String AddonsEditor_PersistedState; + public static String AddonsEditor_Tags; public static String ContributionClassDialog_DialogMessage; public static String ContributionClassDialog_DialogTitle; @@ -247,7 +239,6 @@ public class Messages { public static String StringModelFragment_ParentId; public static String StringModelFragment_PositionInList; public static String StringModelFragment_Elements; - public static String StringModelFragment_Find; public static String FeatureSelectionDialog_Filter; public static String FeatureSelectionDialog_ShellTitle; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index ce6235777c..a71661103b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -14,6 +14,7 @@ ModelTooling_Common_AddEllipsis=Add ... ModelTooling_Common_Add=Add ModelTooling_Common_Remove=Remove ModelTooling_Common_Id=Id +ModelTooling_Common_FindEllipsis=Find ... AbstractCommandSelectionDialog_Label_CommandId=Command-Id @@ -32,7 +33,6 @@ ApplicationEditor_TrimContributions=Trim Contributions BindingTableEditor_Label=BindingTable BindingTableEditor_Description=BindingTable bla bla bla BindingTableEditor_ContextId=Context Id -BindingTableEditor_Find=Find ... BindingTableEditor_Keybindings=Keybindings BindingTableEditor_KeySequence=KeySequence BindingTableEditor_Command=Command @@ -52,7 +52,6 @@ CommandEditor_ParameterId=Id DirectMenuItemEditor_Label=DirectMenuItem DirectMenuItemEditor_Description=DirectMenuItem bla bla bla DirectMenuItemEditor_ClassURI=Class URI -DirectMenuItemEditor_Find=Find ... ControlFactory_BindingContexts=Binding Contexts ControlFactory_Tags=Tags @@ -61,20 +60,17 @@ ControlFactory_Value=Value ControlFactory_ContextVariables=Context Variables DirectToolItemEditor_ClassURI=Class URI -DirectToolItemEditor_Find=Find ... DirectToolItemEditor_Label=Direct Tool Item DirectToolItemEditor_Description=Direct Tool Item bla bla bla HandledMenuItemEditor_Label=HandledMenuItem HandledMenuItemEditor_Description=HandledMenuItem bla bla bla HandledMenuItemEditor_Command=Command -HandledMenuItemEditor_Find=Find ... HandledMenuItemEditor_Parameters=Parameters HandledMenuItemEditor_Tag=Name HandledMenuItemEditor_Value=Value HandledToolItemEditor_Command=Command -HandledToolItemEditor_Find=Find ... HandledToolItemEditor_Parameters=Parameters HandledToolItemEditor_ParametersName=Name HandledToolItemEditor_ParametersValue=Value @@ -84,7 +80,6 @@ HandledToolItemEditor_Description=Handled Tool Item bla bla bla HandlerEditor_Label=Handler HandlerEditor_Description=Handler bla bla bla HandlerEditor_Command=Command -HandlerEditor_Find=Find ... HandlerEditor_ClassURI=Class URI InputPartEditor_Label=InputPart @@ -94,7 +89,6 @@ KeyBindingEditor_Label=Binding KeyBindingEditor_Description=Binding bla bla bla KeyBindingEditor_Sequence=Sequence KeyBindingEditor_Command=Command -KeyBindingEditor_Find=Find ... KeyBindingEditor_Parameters=Parameters KeyBindingEditor_ParametersKey=Key KeyBindingEditor_ParametersValue=Value @@ -117,8 +111,6 @@ MenuItemEditor_Type=Type MenuItemEditor_Label=Label MenuItemEditor_Tooltip=Tooltip MenuItemEditor_IconURI=Icon URI -MenuItemEditor_Find=Find ... - MenuSeparatorEditor_Label=Separator @@ -127,7 +119,6 @@ PartDescriptorEditor_Descriptor=PartDescriptor Bla Bla Bla Bla PartDescriptorEditor_LabelLabel=Label PartDescriptorEditor_Tooltip=Tooltip PartDescriptorEditor_IconURI=Icon URI -PartDescriptorEditor_Find=Find ... PartDescriptorEditor_ClassURI=Class URI PartDescriptorEditor_Dirtyable=Dirtyable PartDescriptorEditor_Closeable=Closeable @@ -149,7 +140,6 @@ PartEditor_Description=Part Bla Bla Bla Bla PartEditor_LabelLabel=Label PartEditor_Tooltip=Tooltip PartEditor_IconURI=Icon URI -PartEditor_Find=Find ... PartEditor_ClassURI=Class URI PartEditor_Closeable=Closeable PartEditor_PersitedState=Persisted State @@ -182,7 +172,6 @@ PerspectiveEditor_SelectedElement=Selected Element PerspectiveEditor_Label=Label PerspectiveEditor_Tooltip=Tooltip PerspectiveEditor_IconURI=Icon URI -PerspectiveEditor_Find=Find ... PerspectiveEditor_Controls=Controls PerspectiveStackEditor_Label=Perspective Stack @@ -192,7 +181,6 @@ PerspectiveStackEditor_Perspectives=Perspectives PlaceholderEditor_Label=Placeholder PlaceholderEditor_Descriptor=Placeholder Bla Bla Bla Bla -PlaceholderEditor_FindReference=Find ... ToolBarEditor_Label=Toolbar ToolBarEditor_Description=Toolbar bla bla bla @@ -217,7 +205,10 @@ VBindingTableEditor_Name=Name VBindingTableEditor_LabelDescription=Description AddonsEditor_ClassURI=Class URI -AddonsEditor_Find=Find ... +AddonsEditor_TreeLabel=Addon +AddonsEditor_TreeLabelDescription=Addon Bla Bla Bla +AddonsEditor_PersistedState=Persisted State +AddonsEditor_Tags=Tags ContributionClassDialog_DialogMessage=Enter the name of the contributing class ContributionClassDialog_DialogTitle=Find Contribution Class @@ -244,7 +235,6 @@ StringModelFragment_Featurename=Featurename StringModelFragment_ParentId=Element Id StringModelFragment_PositionInList=Position in list StringModelFragment_Elements=Elements -StringModelFragment_Find=Find ... FeatureSelectionDialog_Filter=Filter FeatureSelectionDialog_ShellTitle=Find Featurename diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index 4ae0446015..e05295ca28 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -72,7 +72,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Addon"; + return Messages.AddonsEditor_TreeLabel; } @Override @@ -86,7 +86,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Addon Bla Bla Bla"; + return Messages.AddonsEditor_TreeLabelDescription; } @Override @@ -152,7 +152,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, final IContributionClassCreator c = getEditor().getContributionCreator(ApplicationPackageImpl.Literals.ADDON); if (project != null && c != null) { final Link l = new Link(parent, SWT.NONE); - l.setText("" + Messages.PartEditor_ClassURI + ""); + l.setText("" + Messages.PartEditor_ClassURI + ""); //$NON-NLS-1$//$NON-NLS-2$ l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); l.addSelectionListener(new SelectionAdapter() { @Override @@ -172,7 +172,7 @@ public void widgetSelected(SelectionEvent e) { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.AddonsEditor_Find); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -182,8 +182,8 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createMapProperties(parent, this, "Persisted State", ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, this, Messages.AddonsEditor_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.AddonsEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index b8d4933394..ae5292289f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -167,7 +167,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.BindingTableEditor_Find); + b.setText(Messages.ModelTooling_Common_FindEllipsis); } { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index 43b63336a6..2b06123e4d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -109,7 +109,7 @@ public void widgetSelected(SelectionEvent e) { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.DirectMenuItemEditor_Find); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index 6119433069..6f6bb09643 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -95,7 +95,7 @@ public void widgetSelected(SelectionEvent e) { context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.DirectToolItemEditor_Find); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index 81ced576f9..9e0edd8d72 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -113,7 +113,7 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(master)); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledMenuItemEditor_Find); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index 410ad14257..df026640db 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -101,7 +101,7 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(master)); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledToolItemEditor_Find); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 61258de2ee..470f87da56 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -157,7 +157,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.HANDLER__COMMAND, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(getMaster())); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandlerEditor_Find); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @@ -194,7 +194,7 @@ public void widgetSelected(SelectionEvent e) { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.HandlerEditor_Find); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index a2c31eb649..b7fe83abdb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -226,7 +226,7 @@ public void handleValueChange(ValueChangeEvent event) { context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.KEY_BINDING__COMMAND, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(getMaster())); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.KeyBindingEditor_Find); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 746ab44399..cce027be2d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -239,7 +239,7 @@ protected URI getImageURI() { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.MenuItemEditor_Find); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 395e7f4e9f..d0a8ce0f69 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -230,7 +230,7 @@ protected URI getImageURI() { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setText(Messages.MenuItemEditor_Find); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 7265aa3afc..c2947039d3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -219,7 +219,7 @@ protected URI getImageURI() { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.PartDescriptorEditor_Find); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -242,7 +242,7 @@ public void widgetSelected(SelectionEvent e) { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.PartDescriptorEditor_Find); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index bdddfe05e9..251c2aefdb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -240,7 +240,7 @@ protected URI getImageURI() { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.PartEditor_Find); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -276,7 +276,7 @@ public void widgetSelected(SelectionEvent e) { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.PartEditor_Find); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 340f63a52a..8d2ba2e6d9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -241,7 +241,7 @@ protected URI getImageURI() { }; final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PerspectiveEditor_Find); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 9c20311225..4a7b462908 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -214,7 +214,7 @@ public Object convert(Object fromObject) { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.PlaceholderEditor_FindReference); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index 50efba48e0..b698d3ecde 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -141,7 +141,7 @@ private Composite createForm(Composite parent) { context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__PARENT_ELEMENT_ID).observeDetail(getMaster())); final Button b = new Button(comp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.StringModelFragment_Find); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -172,7 +172,7 @@ public void widgetSelected(SelectionEvent e) { context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__FEATURENAME).observeDetail(getMaster())); final Button button = new Button(comp, SWT.PUSH | SWT.FLAT); - button.setText(Messages.StringModelFragment_Find); + button.setText(Messages.ModelTooling_Common_FindEllipsis); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { From 3ada360b9804131f503c81857b0b1d942504fa22 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 15:05:00 +0000 Subject: [PATCH 0221/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * some nls stuff --- .../org/eclipse/e4/tools/emf/ui/internal/Messages.java | 7 +++++++ .../e4/tools/emf/ui/internal/Messages.properties | 8 ++++++++ .../internal/common/component/ApplicationEditor.java | 10 +++++----- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index e072a09575..76b5049af6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -21,6 +21,11 @@ public class Messages { public static String ModelTooling_Common_Id; public static String ModelTooling_Common_FindEllipsis; + public static String ModelTooling_UIElement_ToBeRendered; + public static String ModelTooling_UIElement_Visible; + + public static String ModelTooling_Context_Variables; + public static String AbstractCommandSelectionDialog_Label_CommandId; public static String ApplicationEditor_Label; @@ -34,6 +39,8 @@ public class Messages { public static String ApplicationEditor_MenuContributions; public static String ApplicationEditor_ToolBarContributions; public static String ApplicationEditor_TrimContributions; + public static String ApplicationEditor_RootContext; + public static String ApplicationEditor_BindingContexts; public static String BindingTableEditor_Label; public static String BindingTableEditor_Description; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index a71661103b..7e1a90495d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -16,6 +16,11 @@ ModelTooling_Common_Remove=Remove ModelTooling_Common_Id=Id ModelTooling_Common_FindEllipsis=Find ... +ModelTooling_UIElement_ToBeRendered=To Be Rendered +ModelTooling_UIElement_Visible=Visible + +ModelTooling_Context_Variables=Variables + AbstractCommandSelectionDialog_Label_CommandId=Command-Id ApplicationEditor_Label=Application @@ -29,6 +34,9 @@ ApplicationEditor_Addons=Addons ApplicationEditor_MenuContributions=Menu Contributions ApplicationEditor_ToolBarContributions=Toolbar Contributions ApplicationEditor_TrimContributions=Trim Contributions +ApplicationEditor_RootContext=Root Context +ApplicationEditor_BindingContexts=Binding Contexts + BindingTableEditor_Label=BindingTable BindingTableEditor_Description=BindingTable bla bla bla diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index d33cd92810..4dda304402 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -150,7 +150,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) { Label l = new Label(parent, SWT.NONE); - l.setText("Root Context"); + l.setText(Messages.ApplicationEditor_RootContext); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); createRemoveRootContext = new Button(parent, SWT.CHECK); @@ -168,11 +168,11 @@ public void widgetSelected(SelectionEvent e) { createRemoveRootContext.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); } - ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, "Binding Contexts", CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ApplicationEditor_BindingContexts, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); return parent; } From b2e25ab69f3b815b5b6d948315e45d0712e04e71 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 16:23:52 +0000 Subject: [PATCH 0222/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * added category support --- .../icons/full/modelelements/Category.png | Bin 0 -> 781 bytes .../icons/full/modelelements/Command.gif | Bin 495 -> 0 bytes .../icons/full/modelelements/Command.png | Bin 0 -> 836 bytes .../full/modelelements/CommandParameter.gif | Bin 612 -> 0 bytes .../full/modelelements/CommandParameter.png | Bin 0 -> 586 bytes .../icons/full/modelelements/Handler.gif | Bin 379 -> 0 bytes .../icons/full/modelelements/Handler.png | Bin 0 -> 774 bytes .../icons/full/modelelements/KeyBinding.gif | Bin 321 -> 0 bytes .../icons/full/modelelements/KeyBinding.png | Bin 0 -> 343 bytes .../icons/full/modelelements/Parameter.gif | Bin 184 -> 0 bytes .../icons/full/modelelements/Parameter.png | Bin 0 -> 586 bytes .../icons/full/modelelements/tbr/Command.gif | Bin 889 -> 0 bytes .../icons/full/modelelements/tbr/Handler.gif | Bin 982 -> 0 bytes .../full/modelelements/tbr/KeyBinding.gif | Bin 917 -> 0 bytes .../e4/tools/emf/ui/internal/Messages.java | 12 +- .../tools/emf/ui/internal/Messages.properties | 15 +- .../emf/ui/internal/common/ModelEditor.java | 6 +- .../common/component/ApplicationEditor.java | 11 + .../common/component/CategoryEditor.java | 137 +++++++++++ .../common/component/CommandEditor.java | 28 ++- .../component/CommandParameterEditor.java | 2 +- .../common/component/HandlerEditor.java | 2 +- .../common/component/KeyBindingEditor.java | 2 +- .../common/component/ParameterEditor.java | 2 +- .../CommandCategorySelectionDialog.java | 182 ++++++++++++++ .../component/virtual/VApplicationAddons.java | 6 +- .../virtual/VApplicationCategoriesEditor.java | 223 ++++++++++++++++++ 27 files changed, 615 insertions(+), 13 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Category.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CommandParameter.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CommandParameter.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.png delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Command.gif delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Handler.gif delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/KeyBinding.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Category.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Category.png new file mode 100644 index 0000000000000000000000000000000000000000..d04dd7f513f574b6010273d879ec9c2dd1e5fc66 GIT binary patch literal 781 zcmV+o1M>WdP)hGNhxyAUiWDzvzAp&MOTEEMdb z-KY>(MO>5!t%8VV7Yo%QYGN8YNyf}*Cds_{bMJfa-s57@1`%R=;N!qq{J!tNIfw}V zSC>!nb?#@X*H7?^&ws3+j;XJ@K4fRgr*T&=dxA;QrFmAo*X`tIwBNtPka>1QBzs=m z{g0)1*_R&2(GuTpzQa)xj3mu(+O)`;Va<)v(SK@8z+Ic0Zlmda4xjavYPGDY5 zFf%&E-w*RNuZ&sW32iN4H3Sv-bCerFjl4%J8W&=wzo+`*5{ckf*7fdTVFFB8ACmlrB(d?gOB#nOp>jh}F32Bg8Hs zHo)l@AP#XFT#cr*Cf(hD*f!GL1B^eu#=Y0Fn7|<7VqEkJi5Kb+XFy^QgSaYUE4Vm7 zYye8VbvHhth{7Uq5sByPvI|SFI6!O(u@%H=oXG;{e*qG@xwtyp6qQpMT*ebgg3Exk zBh~;R;?=wIELLlg(3vHGHsAjBk| literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.gif deleted file mode 100644 index c3193fd9ef95e62945158833e9c18f3e3840934d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 495 zcmZ?wbhEHb6krfwc*elMo9x7&<}8rrER^9Ql;J9z;U<#lCR6AqoZ%vt?JkkyE}7$@ zSQe;M9wbxXC6ntRSLCf&>aSEDs8SWITo#~I;;&K}tWg`LSsSKZAE{FxsaqeZRvoNf z6|7bsXwVcDvZ^q2bz#WL!q8QPp373bmZy0xO^sS#61BcGVs(+%@)W<-8F8D-eO9FU zuS`qcUKzM9J#|xJ%ErWut;rn+S~9jJb{uGG+t=8>zp49RYtGK3z9X&uN7|>H>@3-x zShgo|`iYLp{fQO(5@(#~n0K~&*2&I!XL=T2=<7J1)N>+n&Bgw8mnLkyGI7hbiHGh^ zKX7~6|Ns9P1`|;H$->CM5Wt`Vaug^|7}$Lp0-BmzTHD$?I=i}?Bd&FJc z+<9cW#4JoKZEQv5I(U^7lr=SU^hMeQRkU>V4EO{(*bPmsxcIxc9a%Yh*jOfYz&dqT~oxC<;gIOR^S%DIiX_Scdk}vgKP!L@}D(FJ>QuL4&2|W}( z1Vs^zWETnXMvxi>si`B5la80k%W*t&&OT@Fwt_;DMf+txto41Yz1Cg=V+{Xu`h8v> zQCXQ3(tSn82CHKJ3B2^WDBuzWj8eu<8AZ#!B%=d?AA|cB<9`+S8@=}-U@y~PBb1pf zCc7Byn_{4l)IMat;ah%nGRC*N{eAKxG+Pl#6B;5Ff`7 z7sJ4G21%xLMW89{o-?n|ZA~eMuJnV1?m{H9U_`}SSOSTtAW?!^vmFtQ;C!r(*$5q9 z5fF*x$0s_WM82c9!-u#yidbewJP%rJu?UPwFz~+;HLA#PuE*JtE>vi&b6FtD^Ryw< z^97owA|W9c!5%9@;|aK}#pCLvfCqLPYAw8Z_B`aL6(KX(i-+!LWyuYPc~KxN{=}AB zo_32nX?yP0ax~TXPTPsK_n%npu_(Toq=W=)l|pQ6pBy! zcf7ss=~I+f>)hUaga*gJgG=ymnD>Qh&?o`X3FZ_Dg_*^eCkx_-q1Ldt{Fc%hzjtD2 z`gvrg7X#gGTo8rEN0VyJLYg%jZkvaX)&!R&9bF@BXd7&uTu`xD_>9nsz6z^tMQy zJJHemUXnn!aJX-!iL0IZ6WIn;VKs!{_|5d7OJSl=IGs@P;?7*la?VfOO=or#Hn2Yc O0000Erdjey_KcUuuYd=bhLwjxQ>v)oTJXIzS_mc+{?z=%h%-EJd;jC zmsLTMQb?LvN}F3vmR(?{a8{CIai#VN@P5H7J6Miy=aBbaQNCIwFjMDm-g$cXDrSYB?*HGG1s&d3JDV zWn?y&IAC8}d3ktsW>q7X8ck7JwRvY_GZ~j4N<>+;S4BWQ9hWpaOjdbMMoUL7C6_-e zQe9V5P*_1QTm}UL0RVa@Ej~j?PB$+Mmy0PR8yFlWTomX*aDadScX}2?sF0vSg$oJt y2}%ILL4yPq7!E9WP>_NL5++D!KtZ5H1{f`6YY{78#rvt}vj%qrc zN=UU@y$E6COaj9&r1NAlaUpajQlL~SorN%pOwHs*2laYgHBA$?ZOd~4Rw@5yFm2?1ZIg`0V-$-;GT1Fi5dB7wUSNi^%`^Ge62m>OBeX610Nsukl}DhDG-mxT?nhyYH!4he7Ri8 zrq0Ti&UXUvqX&F@JcJAe14@BNBqAY_QZAPjF(Y3r7P9H_kB#@LgFAf>xz>Qp&n=|a z>ro1XLZK^nmO`PRh#C2OK0ktd7l6-A;O5?fz1gNnCX)yR0-Qf6T{aP*iM?lCLeYNChZ zME|t4Kq*J#ax2FU508od{@|VOltj+J(UOww!N5}U3iQCI3ZqHwGu%qFO+M$;f|G|KP zbfEZ?g^__lk3k2d733!dwiyo73p{kh9NV1~0xTMO)-@+?HCpL1C+*_|jkQs$L%3SK zWZD#%Uw+AK^#3sVq2$yax7_cq>g;#(C^lABHOjI%u}OEy<@M@F%Q8AK@K5dOm7mJO z;KV30f4Z*Rd;#G}fjokO)8$r)3o+Lza0p5E$no(>iVJg;1ab?@$%#scNeOe;IkR(c Y3G?y_b8(z@@nG_1@(Z}@>d0UX09ibCp#T5? diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.png new file mode 100644 index 0000000000000000000000000000000000000000..2d5fb90ec6ee08f53947e0266a87b03f75893446 GIT binary patch literal 774 zcmV+h1Nr=kP) zlgUq0Q544c8(ae&UR$8ps&snq6^bPY3v3xAmMW74Di$h~GCH6E3TaYs2#6A<7K*gC z777H71_Wa;(dfp+g-drPCSWu)#PInZi72LJ;o?i~$-U=y&UbQ89Dul3%3P+Axkzc* zbH-y;QF=hR{qLItf%ci2_&e5wNo0gnVatG?ul6Zw=o$I9Ljfn*ic3`U?>IfEim3g{ zujU&$-hy6wn;w(xme|zJm;lWJxtTFfM)q0`kX!Vu0+d${$}LCddK1<^htTe-fUYL3 zB`SdNsZD>RgvLj1<^@h6_+cDRK2Brcr2~>%$*5S)hyV33PV^teac3%|4lz@8p4?)5 z?t5o^?q+%^%)Yygo~I^U4VR!bTnWuE35hcWrfCDR3q+sxJ79e7Fg`&)RCqLA^2^y^ z0laVfadW90_Fz8Brm|r47sB^u1VgI>kanj)Z4`zMSfHlm8>CwXa$JVM`$2RrmZB-3 zN10m-!;BvH*Br3V8t`DH7m`jf#2upVDXl{5ff18_pzCPK1Zu$$CKKvd8FGeFf)+K<|x33pc7P&S#3GZT4mEw;nr(Ze*F z3&*?-4U-lm*#tber5 z%S_ceqB`b3ko6r~BbvDwdohTvP(3a(pq{x#T$yQsu#OKwEe}KuH^Mh@nxg_(Nw136 zq#a^3xNBke)In+!?qk3%4wB69{pF`Tzg`07*qoM6N<$ Eg55P&8UO$Q literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.gif deleted file mode 100644 index d289b194fb6f9229adc4f0dc93850e926fe0da0d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 321 zcmZ?wbhEHb6krfwxXJ(m|NsBLaN)s+4?kYK_;BFF2iNdL6%8{QIu;x_aU-K*LP5if zf(aW=T)6Sz#Rs7b7oiMS;S4vCOgEWAKe23gi5z#y91q2^K$!wBnOqOKB5$SgK$Xg1 zjoL8H+Ay8^NVV!<^{QacWvO1vQ+!sW`man2T$i4@DKTSPV$RN_%KeG6PIk^a)3f+O z-$`dXYaZs9=SbAto%g@>T~?_bH&lTUn@`uo|1bXE{eSR(AO)ESb=V4`uk}mK|39Px&03WLbv~pzk+s7D@lK^ zn+aB+sp)&Y_x-B3>;6ywU--WQNUr<8>TU0P-|L#1U&;A)67w(+> pDf@fM7q9#F25QXo3rUI;002ro52U44e~JJA002ovPDHLkV1l;_q@Mr) literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.gif deleted file mode 100644 index 46e9bfa668478bf74bdb6f1b9b977bf0e2ca3422..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 184 zcmZ?wbhEHb6krfwIKsfd5IRjdeW8BIN}JmCg$s^WEIr=0<-+1aHxFNbcHzOBw-=Y) z+Bx<3!sZJL>rc+8*w>x6r7n3(UCP?h*#H0k19cMwia%Kx85o2abU-RWb~3P6YY{78#rvt}vj%qrc zN=UU@y$E6COaj9&r1NAlaUpajQlL~SorN%pOwHs*2laYgHBA$?ZOd~4Rw@5yFm2?1ZIg`0V-$-;GT1Fi5dB7wUSNi^%`^Ge62m>OBeX610Nsukl}DhDG-mxT?nhyYH!4he7Ri8 zrq0Ti&UXUvqX&F@JcJAe14@BNBqAY_QZAPjF(Y3r7P9H_kB#@LgFAf>xz>Qp&n=|a z>ro1XLZK^nmO`PRh#C2OK0ktd7l6-A;O5?fz1gNnCX)yR06ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000P90RIUbNU)&6g9sBUTqw{D8ioSbC=+9b zAsSu2goUY?kjyJsv1sK2GX|lUNt7s6%G4>8n1f&(If4|a(v~g=xp4X<>Pi-cSW-=~ P!jQ@oh)9zv4F~``cwDDw diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Handler.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Handler.gif deleted file mode 100644 index 22b96c27f6be5346c749f0bcadf6c98c89e5daa4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 982 zcmV;{11bDRNk%w1VGsZi0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW008~~EC2ui01yBW000QH0R0IZNU&hRZkpzxK{H2FH-r8(#eoH@ z)~!^M8Wz;l2NkS;uvCdu)ko97ZgD=LTJ{els+XwZJd9X~5+#-`VcE24(q9}zKyl^- z>M4%EIB=2*YsoYl98YKjo*_eZDbrJ$?FE6_$2TAwE63 z!6~F?sW3Tm^bC3gXJ*7akAw+>BPWofM|pY<)C7mnqfD6|5rU(bAVN0_-8h8ExnMv5 EJ5a*XvH$=8 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/KeyBinding.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/KeyBinding.gif deleted file mode 100644 index 5ae4c89a5c390e01675825c713eb8ee9bce9e6f0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 917 zcmV;G18V$7Nk%w1VGsZi0OtSz000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000Pb0RIUbNU)&6fosqlJcve_7&8kAlF{W$ zSQv-}vuMo1#gQXOkt%KJLNLofESx@xx?(cpKq{%GSXtQe-;^m4|JBTyjFC@9$#U8` r_Uu_SJ2?@ZOBe4MqMU%1rh5h`r=N3JkNM&02M{7VL34@~7!UwE=&QH~ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 76b5049af6..53e1950330 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -12,7 +12,7 @@ import org.eclipse.osgi.util.NLS; -public class Messages { +public class Messages extends NLS { public static String ModelTooling_Common_Up; public static String ModelTooling_Common_Down; public static String ModelTooling_Common_AddEllipsis; @@ -41,6 +41,7 @@ public class Messages { public static String ApplicationEditor_TrimContributions; public static String ApplicationEditor_RootContext; public static String ApplicationEditor_BindingContexts; + public static String ApplicationEditor_Categories; public static String BindingTableEditor_Label; public static String BindingTableEditor_Description; @@ -60,6 +61,7 @@ public class Messages { public static String CommandEditor_ParameterOptional_No; public static String CommandEditor_ParameterOptional_Yes; public static String CommandEditor_ParameterId; + public static String CommandEditor_Category; public static String DirectMenuItemEditor_Label; public static String DirectMenuItemEditor_Description; @@ -252,6 +254,14 @@ public class Messages { public static String FeatureSelectionDialog_DialogTitle; public static String FeatureSelectionDialog_DialogMessage; + public static String CategoryEditor_TreeLabel; + public static String CategoryEditor_TreeLabelDescriptor; + public static String CategoryEditor_Name; + public static String CategoryEditor_Description; + public static String CategoryEditor_Tags; + + public static String CommandCategorySelectionDialog_LabelCategoryId; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 7e1a90495d..5cc3d53b84 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -36,7 +36,7 @@ ApplicationEditor_ToolBarContributions=Toolbar Contributions ApplicationEditor_TrimContributions=Trim Contributions ApplicationEditor_RootContext=Root Context ApplicationEditor_BindingContexts=Binding Contexts - +ApplicationEditor_Categories=Command Categories BindingTableEditor_Label=BindingTable BindingTableEditor_Description=BindingTable bla bla bla @@ -56,6 +56,7 @@ CommandEditor_ParameterOptional=Optional CommandEditor_ParameterOptional_Yes=yes CommandEditor_ParameterOptional_No=no CommandEditor_ParameterId=Id +CommandEditor_Category=Category DirectMenuItemEditor_Label=DirectMenuItem DirectMenuItemEditor_Description=DirectMenuItem bla bla bla @@ -93,7 +94,7 @@ HandlerEditor_ClassURI=Class URI InputPartEditor_Label=InputPart InputPartEditor_InputURI=Input URI -KeyBindingEditor_Label=Binding +KeyBindingEditor_Label=KeyBinding KeyBindingEditor_Description=Binding bla bla bla KeyBindingEditor_Sequence=Sequence KeyBindingEditor_Command=Command @@ -247,4 +248,12 @@ StringModelFragment_Elements=Elements FeatureSelectionDialog_Filter=Filter FeatureSelectionDialog_ShellTitle=Find Featurename FeatureSelectionDialog_DialogTitle=Featurename -FeatureSelectionDialog_DialogMessage=Find the name of the feature you want to contribute to \ No newline at end of file +FeatureSelectionDialog_DialogMessage=Find the name of the feature you want to contribute to + +CategoryEditor_TreeLabel=Command Category +CategoryEditor_TreeLabelDescriptor=Command Category Bla Bla Bla +CategoryEditor_Name=Name +CategoryEditor_Description=Description +CategoryEditor_Tags=Tags + +CommandCategorySelectionDialog_LabelCategoryId=Category Id \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 76e81b0404..d9fb290bc2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -51,6 +51,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.ApplicationEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.BindingContextEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.BindingTableEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.CategoryEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.CommandEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.CommandParameterEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.DirectMenuItemEditor; @@ -86,6 +87,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.TrimmedWindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VApplicationAddons; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VApplicationCategoriesEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VBindingTableEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VCommandEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; @@ -181,6 +183,7 @@ public class ModelEditor { public static final String VIRTUAL_WINDOW_SHARED_ELEMENTS = ModelEditor.class.getName() + ".VIRTUAL_WINDOW_SHARED_ELEMENTS"; //$NON-NLS-1$ public static final String VIRTUAL_MODEL_FRAGEMENTS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_FRAGEMENTS"; //$NON-NLS-1$ public static final String VIRTUAL_MODEL_IMPORTS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_IMPORTS"; //$NON-NLS-1$ + public static final String VIRTUAL_CATEGORIES = ModelEditor.class.getName() + ".VIRTUAL_CATEGORIES"; //$NON-NLS-1$ private Map editorMap = new HashMap(); private Map virtualEditors = new HashMap(); @@ -520,7 +523,7 @@ private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_WINDOW_SHARED_ELEMENTS, new VWindowSharedElementsEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_MODEL_FRAGEMENTS, new VModelFragmentsEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_MODEL_IMPORTS, new VModelImportsEditor(modelProvider.getEditingDomain(), this)); - + registerVirtualEditor(VIRTUAL_CATEGORIES, new VApplicationCategoriesEditor(modelProvider.getEditingDomain(), this)); } private void registerVirtualEditor(String id, AbstractComponentEditor editor) { @@ -564,6 +567,7 @@ private void registerDefaultEditors() { registerEditor(CommandsPackageImpl.Literals.PARAMETER, new ParameterEditor(modelProvider.getEditingDomain(), this)); registerEditor(CommandsPackageImpl.Literals.BINDING_TABLE, new BindingTableEditor(modelProvider.getEditingDomain(), this)); registerEditor(CommandsPackageImpl.Literals.BINDING_CONTEXT, new BindingContextEditor(modelProvider.getEditingDomain(), this)); + registerEditor(CommandsPackageImpl.Literals.CATEGORY, new CategoryEditor(modelProvider.getEditingDomain(), this)); registerEditor(MenuPackageImpl.Literals.TOOL_BAR, new ToolBarEditor(modelProvider.getEditingDomain(), this)); registerEditor(MenuPackageImpl.Literals.RENDERED_TOOL_BAR, new RenderedToolBarEditor(modelProvider.getEditingDomain(), this)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 4dda304402..a0728c30da 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -69,6 +69,8 @@ public class ApplicationEditor extends AbstractComponentEditor { private IListProperty MENU_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS); private IListProperty TOOLBAR_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS); private IListProperty TRIM_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS); + private IListProperty APPLICATION__CATEGORIES = EMFProperties.list(ApplicationPackageImpl.Literals.APPLICATION__CATEGORIES); + private IValueProperty BINDING_TABLE_CONTAINER__ROOT_CONTEXT = EMFProperties.value(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT); public ApplicationEditor(EditingDomain editingDomain, ModelEditor editor) { @@ -240,6 +242,15 @@ protected boolean accepted(Object o) { }); + list.add(new VirtualEntry(ModelEditor.VIRTUAL_CATEGORIES, APPLICATION__CATEGORIES, element, Messages.ApplicationEditor_Categories) { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + list.add(new VirtualEntry(ModelEditor.VIRTUAL_WINDOWS, ELEMENT_CONTAINER__CHILDREN, element, Messages.ApplicationEditor_Windows) { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java new file mode 100644 index 0000000000..fd1aa52211 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java @@ -0,0 +1,137 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import java.net.MalformedURLException; +import java.net.URL; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; + +public class CategoryEditor extends AbstractComponentEditor { + + private Composite composite; + private Image image; + private EMFDataBindingContext context; + private EStackLayout stackLayout; + + public CategoryEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain, editor); + } + + @Override + public Image getImage(Object element, Display display) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Category.png")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + public String getLabel(Object element) { + return Messages.CategoryEditor_TreeLabel; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return Messages.CategoryEditor_TreeLabelDescriptor; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new EStackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } + } + + if (getEditor().isModelFragment()) { + Control topControl; + if (Util.isImport((EObject) object)) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if (stackLayout.topControl != topControl) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + if (isImport) { + ControlFactory.createFindImport(parent, this, context); + + return parent; + } + + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); + ControlFactory.createTextField(parent, Messages.CategoryEditor_Name, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.CATEGORY__NAME)); + ControlFactory.createTextField(parent, Messages.CategoryEditor_Description, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.CATEGORY__DESCRIPTION)); + ControlFactory.createStringListWidget(parent, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return null; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index e3ebd7a220..30c2ced40e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -21,6 +21,7 @@ import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.CommandCategorySelectionDialog; import org.eclipse.e4.ui.model.application.commands.MCommand; import org.eclipse.e4.ui.model.application.commands.MCommandParameter; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; @@ -72,7 +73,7 @@ public CommandEditor(EditingDomain editingDomain, ModelEditor editor) { public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.png")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -178,6 +179,31 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__DESCRIPTION).observeDetail(getMaster())); } + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.CommandEditor_Category); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + t.setLayoutData(gd); + t.setEditable(false); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.COMMAND__CATEGORY, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(getMaster())); + + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_FindEllipsis); + b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + CommandCategorySelectionDialog dialog = new CommandCategorySelectionDialog(b.getShell(), getEditor().getModelProvider(), (MCommand) getMaster().getValue()); + dialog.open(); + } + }); + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java index 52c9598b40..8815123fe6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java @@ -53,7 +53,7 @@ public CommandParameterEditor(EditingDomain editingDomain, ModelEditor editor) { public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CommandParameter.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CommandParameter.png")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 470f87da56..3ee7dae174 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -67,7 +67,7 @@ public HandlerEditor(EditingDomain editingDomain, ModelEditor editor, IModelReso public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.png")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index b7fe83abdb..ff1dae4a1c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -92,7 +92,7 @@ public KeyBindingEditor(EditingDomain editingDomain, ModelEditor editor, IModelR public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.png")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java index f058aa16be..d48cf40438 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java @@ -49,7 +49,7 @@ public ParameterEditor(EditingDomain editingDomain, ModelEditor editor) { public Image getImage(Object element, Display display) { if (image == null) { try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.gif")); //$NON-NLS-1$ + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.png")); //$NON-NLS-1$ } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java new file mode 100644 index 0000000000..49dabd3381 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java @@ -0,0 +1,182 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import java.util.ArrayList; +import java.util.List; +import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; +import org.eclipse.e4.ui.model.application.commands.MCategory; +import org.eclipse.e4.ui.model.application.commands.MCommand; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.viewers.AbstractTreeViewer; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public class CommandCategorySelectionDialog extends TitleAreaDialog { + private IModelResource resource; + private TableViewer viewer; + private MCommand command; + + public CommandCategorySelectionDialog(Shell parentShell, IModelResource resource, MCommand command) { + super(parentShell); + this.resource = resource; + this.command = command; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + getShell().setText("Command Category Dialog"); + setTitle("Command Category"); + setMessage("Search for a Command Category"); + + final Image titleImage = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newexp_wiz.png")); + setTitleImage(titleImage); + getShell().addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + titleImage.dispose(); + } + }); + + Composite container = new Composite(composite, SWT.NONE); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + container.setLayout(new GridLayout(2, false)); + + Label l = new Label(container, SWT.NONE); + l.setText(Messages.CommandCategorySelectionDialog_LabelCategoryId); + + Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); + searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + new Label(container, SWT.NONE); + viewer = new TableViewer(container); + viewer.setContentProvider(new ArrayContentProvider()); + viewer.setLabelProvider(new LabelProviderImpl()); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + viewer.addDoubleClickListener(new IDoubleClickListener() { + + public void doubleClick(DoubleClickEvent event) { + okPressed(); + } + }); + + List categories = new ArrayList(); + TreeIterator it = EcoreUtil.getAllContents((EObject) resource.getRoot().get(0), true); + while (it.hasNext()) { + EObject o = it.next(); + if (o.eClass() == CommandsPackageImpl.Literals.CATEGORY) { + categories.add(o); + } + } + viewer.setInput(categories); + + final PatternFilter filter = new PatternFilter() { + @Override + protected boolean isParentMatch(Viewer viewer, Object element) { + return viewer instanceof AbstractTreeViewer && super.isParentMatch(viewer, element); + } + }; + viewer.addFilter(filter); + + searchText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + filter.setPattern(((Text) e.widget).getText()); + viewer.refresh(); + } + }); + + return composite; + } + + @Override + protected void okPressed() { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (!s.isEmpty()) { + Command cmd = SetCommand.create(resource.getEditingDomain(), command, CommandsPackageImpl.Literals.COMMAND__CATEGORY, s.getFirstElement()); + if (cmd.canExecute()) { + resource.getEditingDomain().getCommandStack().execute(cmd); + super.okPressed(); + } + } + } + + private static class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { + + public void update(final ViewerCell cell) { + MCategory cmd = (MCategory) cell.getElement(); + + StyledString styledString = new StyledString(); + if (cmd.getName() != null) { + styledString.append(cmd.getName()); + } + if (cmd.getDescription() != null) { + styledString.append(" - " + cmd.getDescription(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + } + if (cmd.getElementId() != null) { + styledString.append(" - " + cmd.getElementId(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + } + cell.setText(styledString.getString()); + cell.setStyleRanges(styledString.getStyleRanges()); + } + + public Image getImage(Object element) { + return null; + } + + public String getText(Object element) { + MCategory command = (MCategory) element; + String s = ""; //$NON-NLS-1$ + if (command.getName() != null) { + s += command.getName(); + } + + if (command.getDescription() != null) { + s += " " + command.getDescription(); //$NON-NLS-1$ + } + + if (command.getElementId() != null) { + s += " " + command.getElementId(); //$NON-NLS-1$ + } + + return s; + } + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java index 127121ef61..8a32545123 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java @@ -127,7 +127,7 @@ public void widgetSelected(SelectionEvent e) { if (s.size() == 1) { Object obj = s.getFirstElement(); MApplication container = (MApplication) getMaster().getValue(); - int idx = container.getCommands().indexOf(obj) - 1; + int idx = container.getAddons().indexOf(obj) - 1; if (idx >= 0) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__ADDONS, obj, idx); @@ -154,8 +154,8 @@ public void widgetSelected(SelectionEvent e) { if (s.size() == 1) { Object obj = s.getFirstElement(); MApplication container = (MApplication) getMaster().getValue(); - int idx = container.getCommands().indexOf(obj) + 1; - if (idx < container.getCommands().size()) { + int idx = container.getAddons().indexOf(obj) + 1; + if (idx < container.getAddons().size()) { Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__ADDONS, obj, idx); if (cmd.canExecute()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java new file mode 100644 index 0000000000..a97af9b7b1 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java @@ -0,0 +1,223 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import java.util.ArrayList; +import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MApplication; +import org.eclipse.e4.ui.model.application.commands.MCategory; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsFactoryImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VApplicationCategoriesEditor extends AbstractComponentEditor { + private Composite composite; + private TableViewer viewer; + private EMFDataBindingContext context; + + private List actions = new ArrayList(); + + public VApplicationCategoriesEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain, editor); + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return "Command Categories"; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return "Command Categories bla bla bla bla"; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + composite = createForm(parent, context, getMaster()); + } + VirtualEntry o = (VirtualEntry) object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); + + { + Label l = new Label(parent, SWT.NONE); + l.setText("Categories"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Up"); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MApplication container = (MApplication) getMaster().getValue(); + int idx = container.getCategories().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__CATEGORIES, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Down"); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MApplication container = (MApplication) getMaster().getValue(); + int idx = container.getCategories().indexOf(obj) + 1; + if (idx < container.getCategories().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__CATEGORIES, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Add ..."); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MCategory command = CommandsFactoryImpl.eINSTANCE.createCategory(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__CATEGORIES, command); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(command); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText("Remove"); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List commands = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__CATEGORIES, commands); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } +} From 4b11c5d810be51cf3c7089f818a9bc23e32ab133 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 16:41:14 +0000 Subject: [PATCH 0223/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * support to find contexts --- .../e4/tools/emf/ui/internal/Messages.java | 2 + .../tools/emf/ui/internal/Messages.properties | 3 +- .../common/component/BindingTableEditor.java | 16 +- .../BindingContextSelectionDialog.java | 188 ++++++++++++++++++ .../CommandCategorySelectionDialog.java | 8 +- .../dialogs/SharedElementsDialog.java | 77 ++++--- 6 files changed, 250 insertions(+), 44 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 53e1950330..aec6d792ea 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -262,6 +262,8 @@ public class Messages extends NLS { public static String CommandCategorySelectionDialog_LabelCategoryId; + public static String BindingContextSelectionDialog_LabelContextId; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 5cc3d53b84..d978512a72 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -256,4 +256,5 @@ CategoryEditor_Name=Name CategoryEditor_Description=Description CategoryEditor_Tags=Tags -CommandCategorySelectionDialog_LabelCategoryId=Category Id \ No newline at end of file +CommandCategorySelectionDialog_LabelCategoryId=Category Id +BindingContextSelectionDialog_LabelContextId=Context Id \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index ae5292289f..bf3b9a0ff9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -22,6 +22,7 @@ import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BindingContextSelectionDialog; import org.eclipse.e4.ui.model.application.commands.MBindingTable; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MHandler; @@ -39,6 +40,7 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -164,10 +166,22 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID).observeDetail(getMaster())); - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); b.setText(Messages.ModelTooling_Common_FindEllipsis); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + BindingContextSelectionDialog dialog = new BindingContextSelectionDialog(b.getShell(), getEditor().getModelProvider()); + if (dialog.open() == BindingContextSelectionDialog.OK) { + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID, dialog.getSelectedId()); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); } { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java new file mode 100644 index 0000000000..9f7d22179d --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java @@ -0,0 +1,188 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import java.util.ArrayList; +import java.util.List; +import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; +import org.eclipse.e4.ui.model.application.commands.MBindingContext; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.viewers.AbstractTreeViewer; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public class BindingContextSelectionDialog extends TitleAreaDialog { + private IModelResource resource; + private TableViewer viewer; + private String selectedId; + + public BindingContextSelectionDialog(Shell parentShell, IModelResource resource) { + super(parentShell); + this.resource = resource; + } + + public String getSelectedId() { + return selectedId; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + getShell().setText("BindingContext Dialog"); + setTitle("BindingContext"); + setMessage("Search for a BindingContext"); + + final Image titleImage = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newexp_wiz.png")); + setTitleImage(titleImage); + getShell().addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + titleImage.dispose(); + } + }); + + Composite container = new Composite(composite, SWT.NONE); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + container.setLayout(new GridLayout(2, false)); + + Label l = new Label(container, SWT.NONE); + l.setText(Messages.BindingContextSelectionDialog_LabelContextId); + + Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); + searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + new Label(container, SWT.NONE); + viewer = new TableViewer(container); + viewer.setContentProvider(new ArrayContentProvider()); + viewer.setLabelProvider(new LabelProviderImpl()); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + viewer.addDoubleClickListener(new IDoubleClickListener() { + + public void doubleClick(DoubleClickEvent event) { + okPressed(); + } + }); + + List categories = new ArrayList(); + TreeIterator it = EcoreUtil.getAllContents((EObject) resource.getRoot().get(0), true); + while (it.hasNext()) { + EObject o = it.next(); + if (o.eClass() == CommandsPackageImpl.Literals.BINDING_CONTEXT) { + categories.add(o); + } + } + viewer.setInput(categories); + + final PatternFilter filter = new PatternFilter() { + @Override + protected boolean isParentMatch(Viewer viewer, Object element) { + return viewer instanceof AbstractTreeViewer && super.isParentMatch(viewer, element); + } + }; + viewer.addFilter(filter); + + searchText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + filter.setPattern(((Text) e.widget).getText()); + viewer.refresh(); + } + }); + + return composite; + } + + @Override + protected void okPressed() { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (!s.isEmpty()) { + selectedId = ((MBindingContext) s.getFirstElement()).getElementId(); + if (selectedId != null && selectedId.trim().length() > 0) { + super.okPressed(); + } else { + setErrorMessage("You can not reference an element without an ID"); + } + } + } + + private static class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { + + public void update(final ViewerCell cell) { + MBindingContext cmd = (MBindingContext) cell.getElement(); + + StyledString styledString = new StyledString(); + if (cmd.getName() != null) { + styledString.append(cmd.getName()); + } + + if (cmd.getElementId() != null) { + styledString.append(" (" + cmd.getElementId() + ")", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + styledString.append(" ()", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + } + + if (cmd.getDescription() != null) { + styledString.append(" - " + cmd.getDescription(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + } + + cell.setText(styledString.getString()); + cell.setStyleRanges(styledString.getStyleRanges()); + } + + public Image getImage(Object element) { + return null; + } + + public String getText(Object element) { + MBindingContext command = (MBindingContext) element; + String s = ""; //$NON-NLS-1$ + if (command.getName() != null) { + s += command.getName(); + } + + if (command.getDescription() != null) { + s += " " + command.getDescription(); //$NON-NLS-1$ + } + + if (command.getElementId() != null) { + s += " " + command.getElementId(); //$NON-NLS-1$ + } + + return s; + } + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java index 49dabd3381..a5531d2ce7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java @@ -147,12 +147,14 @@ public void update(final ViewerCell cell) { if (cmd.getName() != null) { styledString.append(cmd.getName()); } + if (cmd.getElementId() != null) { + styledString.append(" (" + cmd.getElementId() + ")", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + styledString.append(" ()", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + } if (cmd.getDescription() != null) { styledString.append(" - " + cmd.getDescription(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ } - if (cmd.getElementId() != null) { - styledString.append(" - " + cmd.getElementId(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java index 50a20e6c20..0e1d33cf22 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java @@ -50,7 +50,7 @@ public class SharedElementsDialog extends TitleAreaDialog { private MPlaceholder placeholder; private IModelResource resource; private ModelEditor editor; - + public SharedElementsDialog(Shell parentShell, ModelEditor editor, MPlaceholder placeholder, IModelResource resource) { super(parentShell); this.editor = editor; @@ -65,49 +65,48 @@ protected Control createDialogArea(Composite parent) { setTitle("Find Shared Elements"); setMessage("Find Shared Elements of an Window"); - Composite container = new Composite(comp, SWT.NONE); container.setLayout(new GridLayout(2, false)); container.setLayoutData(new GridData(GridData.FILL_BOTH)); - + Label l = new Label(container, SWT.NONE); l.setText("Name"); - + Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - + l = new Label(container, SWT.NONE); - + viewer = new TableViewer(container); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(new LabelProviderImpl()); viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - + viewer.addDoubleClickListener(new IDoubleClickListener() { - + public void doubleClick(DoubleClickEvent event) { okPressed(); } }); - - if( resource.getRoot().get(0) instanceof MApplication ) { + + if (resource.getRoot().get(0) instanceof MApplication) { List list = new ArrayList(); - for( MWindow m : ((MApplication)resource.getRoot().get(0)).getChildren() ) { + for (MWindow m : ((MApplication) resource.getRoot().get(0)).getChildren()) { list.addAll(filter(m.getSharedElements())); } viewer.setInput(list); - } else if( resource.getRoot().get(0) instanceof MModelFragments ) { + } else if (resource.getRoot().get(0) instanceof MModelFragments) { List list = new ArrayList(); - for( MModelFragment f : ((MModelFragments)resource.getRoot().get(0)).getFragments() ) { - if( f instanceof MStringModelFragment ) { - if( ((MStringModelFragment)f).getFeaturename().equals("sharedElements") ) { //$NON-NLS-1$ + for (MModelFragment f : ((MModelFragments) resource.getRoot().get(0)).getFragments()) { + if (f instanceof MStringModelFragment) { + if (((MStringModelFragment) f).getFeaturename().equals("sharedElements")) { //$NON-NLS-1$ list.addAll(filter(f.getElements())); } } } viewer.setInput(list); } - + final PatternFilter filter = new PatternFilter() { @Override protected boolean isParentMatch(Viewer viewer, Object element) { @@ -122,74 +121,74 @@ public void modifyText(ModifyEvent e) { viewer.refresh(); } }); - + return comp; } - + @Override protected void okPressed() { - if( ! viewer.getSelection().isEmpty() ) { + if (!viewer.getSelection().isEmpty()) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); Command cmd = SetCommand.create(resource.getEditingDomain(), placeholder, AdvancedPackageImpl.Literals.PLACEHOLDER__REF, s.getFirstElement()); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { resource.getEditingDomain().getCommandStack().execute(cmd); super.okPressed(); } } } - + private static List filter(List o) { List rv = new ArrayList(); - for( T i : o ) { - if( i instanceof MPart || i instanceof MPartSashContainer ) { + for (T i : o) { + if (i instanceof MPart || i instanceof MPartSashContainer) { rv.add(i); } } return rv; } - + private class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { public void update(final ViewerCell cell) { EObject o = (EObject) cell.getElement(); - + StyledString string = new StyledString(getTypename(o)); - - if( o instanceof MUILabel ) { - string.append(" - " + ((MUILabel)o).getLabel(), StyledString.DECORATIONS_STYLER); + + if (o instanceof MUILabel) { + string.append(" - " + ((MUILabel) o).getLabel(), StyledString.DECORATIONS_STYLER); } - + MApplicationElement el = (MApplicationElement) o; string.append(" - " + el.getElementId(), StyledString.DECORATIONS_STYLER); - + cell.setText(string.getString()); cell.setStyleRanges(string.getStyleRanges()); cell.setImage(getImage(o)); } - + public String getText(Object element) { EObject o = (EObject) element; MApplicationElement el = (MApplicationElement) o; - - if( el instanceof MUILabel ) { + + if (el instanceof MUILabel) { MUILabel label = (MUILabel) el; return getTypename(o) + " - " + el.getElementId() + " - " + label.getLabel(); } else { - return getTypename(o) + " - " + el.getElementId() + " - "; + return getTypename(o) + " - " + el.getElementId() + " - "; } } - + private String getTypename(EObject o) { AbstractComponentEditor editor = SharedElementsDialog.this.editor.getEditor((o).eClass()); - if( editor != null ) { + if (editor != null) { return editor.getLabel(o); } else { return o.eClass().getName(); } } - + public Image getImage(Object element) { - AbstractComponentEditor editor = SharedElementsDialog.this.editor.getEditor(((EObject)element).eClass()); - if( editor != null ) { + AbstractComponentEditor editor = SharedElementsDialog.this.editor.getEditor(((EObject) element).eClass()); + if (editor != null) { return editor.getImage(element, getShell().getDisplay()); } return null; From fc234cf73889d7a1a3e22a6f302017daf7b47358 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 16:54:07 +0000 Subject: [PATCH 0224/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * support KeyBinding Parameters --- .../e4/tools/emf/ui/internal/Messages.java | 4 +- .../tools/emf/ui/internal/Messages.properties | 5 +- .../common/component/AddonsEditor.java | 2 +- .../common/component/HandlerEditor.java | 6 +- .../common/component/KeyBindingEditor.java | 101 +++--------------- 5 files changed, 25 insertions(+), 93 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index aec6d792ea..684ba65da1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -26,6 +26,9 @@ public class Messages extends NLS { public static String ModelTooling_Context_Variables; + public static String ModelTooling_ApplicationElement_Tags; + public static String ModelTooling_Contribution_PersistedState; + public static String AbstractCommandSelectionDialog_Label_CommandId; public static String ApplicationEditor_Label; @@ -220,7 +223,6 @@ public class Messages extends NLS { public static String AddonsEditor_ClassURI; public static String AddonsEditor_TreeLabel; public static String AddonsEditor_TreeLabelDescription; - public static String AddonsEditor_PersistedState; public static String AddonsEditor_Tags; public static String ContributionClassDialog_DialogMessage; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index d978512a72..0b4672b434 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -21,6 +21,10 @@ ModelTooling_UIElement_Visible=Visible ModelTooling_Context_Variables=Variables +ModelTooling_ApplicationElement_Tags=Tags + +ModelTooling_Contribution_PersistedState=Persisted State + AbstractCommandSelectionDialog_Label_CommandId=Command-Id ApplicationEditor_Label=Application @@ -151,7 +155,6 @@ PartEditor_Tooltip=Tooltip PartEditor_IconURI=Icon URI PartEditor_ClassURI=Class URI PartEditor_Closeable=Closeable -PartEditor_PersitedState=Persisted State PartEditor_PersitedStateKey=Key PartEditor_PersitedStateValue=Value PartEditor_Menus=Menus diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index e05295ca28..ad09b3b1e6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -182,7 +182,7 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createMapProperties(parent, this, Messages.AddonsEditor_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, this, Messages.AddonsEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 3ee7dae174..f8672a3863 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -174,7 +174,7 @@ public void widgetSelected(SelectionEvent e) { final IContributionClassCreator c = getEditor().getContributionCreator(CommandsPackageImpl.Literals.HANDLER); if (project != null && c != null) { final Link l = new Link(parent, SWT.NONE); - l.setText("" + Messages.HandlerEditor_ClassURI + ""); + l.setText("" + Messages.HandlerEditor_ClassURI + ""); //$NON-NLS-1$//$NON-NLS-2$ l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); l.addSelectionListener(new SelectionAdapter() { @Override @@ -204,8 +204,8 @@ public void widgetSelected(SelectionEvent e) { } }); } - ControlFactory.createMapProperties(parent, this, "Persisted State", ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index ff1dae4a1c..27138578f4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -18,7 +18,6 @@ import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.core.databinding.validation.IValidator; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -27,6 +26,7 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.KeyBindingCommandSelectionDialog; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; @@ -47,22 +47,13 @@ import org.eclipse.jface.bindings.keys.KeySequence; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.fieldassist.ControlDecoration; import org.eclipse.jface.fieldassist.FieldDecoration; import org.eclipse.jface.fieldassist.FieldDecorationRegistry; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ColumnViewerEditor; -import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; -import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; -import org.eclipse.jface.viewers.EditingSupport; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.viewers.TableViewerEditor; -import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -83,6 +74,8 @@ public class KeyBindingEditor extends AbstractComponentEditor { private IModelResource resource; private EStackLayout stackLayout; + private IEMFEditListProperty KEY_BINDING__PARAMETERS = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS); + public KeyBindingEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource) { super(editingDomain, editor); this.resource = resource; @@ -242,81 +235,16 @@ public void widgetSelected(SelectionEvent e) { l.setText(Messages.KeyBindingEditor_Parameters); l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - final TableViewer tableviewer = new TableViewer(parent); + final TableViewer viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 120; - tableviewer.getTable().setHeaderVisible(true); - tableviewer.getControl().setLayoutData(gd); - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.KeyBindingEditor_ParametersKey); - column.getColumn().setWidth(200); - column.setEditingSupport(new EditingSupport(tableviewer) { - private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - ((MParameter) element).setName((String) value); - } - - @Override - protected Object getValue(Object element) { - String val = ((MParameter) element).getName(); - return val == null ? "" : val; //$NON-NLS-1$ - } + viewer.getControl().setLayoutData(gd); - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - - column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.KeyBindingEditor_ParametersValue); - column.getColumn().setWidth(200); - column.setEditingSupport(new EditingSupport(tableviewer) { - private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - ((MParameter) element).setValue((String) value); - } - - @Override - protected Object getValue(Object element) { - String val = ((MParameter) element).getValue(); - return val == null ? "" : val; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - - ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(tableviewer) { - @Override - protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { - boolean singleSelect = ((IStructuredSelection) tableviewer.getSelection()).size() == 1; - boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent) event.sourceEvent).button == 1; - - return singleSelect && (isLeftDoubleMouseSelect || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); - } - }; - TableViewerEditor.create(tableviewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); - - ViewerSupport.bind(tableviewer, prop.observeDetail(getMaster()), new IValueProperty[] { EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__NAME), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__VALUE) }); + viewer.setInput(KEY_BINDING__PARAMETERS.observeDetail(getMaster())); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); @@ -350,7 +278,6 @@ public void widgetSelected(SelectionEvent e) { if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } - tableviewer.editElement(param, 0); } }); @@ -359,7 +286,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { - IStructuredSelection s = (IStructuredSelection) tableviewer.getSelection(); + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (!s.isEmpty()) { MKeyBinding item = (MKeyBinding) getMaster().getValue(); Command cmd = RemoveCommand.create(getEditingDomain(), item, CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS, s.toList()); @@ -373,14 +300,14 @@ public void widgetSelected(SelectionEvent e) { b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } @Override public IObservableList getChildList(Object element) { - return null; + return KEY_BINDING__PARAMETERS.observe(element); } @Override From 0c580524fb8af08cfd71d0048979b92f5bdef74e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 16:57:49 +0000 Subject: [PATCH 0225/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * some nls stuff --- .../eclipse/e4/tools/emf/ui/internal/Messages.java | 3 +++ .../e4/tools/emf/ui/internal/Messages.properties | 5 ++++- .../ui/internal/common/ComponentLabelProvider.java | 11 +++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 684ba65da1..a59c9d10aa 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -266,6 +266,9 @@ public class Messages extends NLS { public static String BindingContextSelectionDialog_LabelContextId; + public static String ComponentLabelProvider_invisible; + public static String ComponentLabelProvider_notrendered; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 0b4672b434..2890de86d9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -260,4 +260,7 @@ CategoryEditor_Description=Description CategoryEditor_Tags=Tags CommandCategorySelectionDialog_LabelCategoryId=Category Id -BindingContextSelectionDialog_LabelContextId=Context Id \ No newline at end of file +BindingContextSelectionDialog_LabelContextId=Context Id + +ComponentLabelProvider_invisible=invisible +ComponentLabelProvider_notrendered=not rendered \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java index e12afdf246..b52a0d7617 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java @@ -11,6 +11,7 @@ package org.eclipse.e4.tools.emf.ui.internal.common; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.resource.JFaceResources; @@ -32,14 +33,16 @@ public class ComponentLabelProvider extends StyledCellLabelProvider { private ModelEditor editor; + private static final String NOT_RENDERED_KEY = "NOT_RENDERED_STYLER";//$NON-NLS-1$ + private static Styler NOT_RENDERED_STYLER = new Styler() { { - JFaceResources.getColorRegistry().put("NOT_RENDERED_STYLER", new RGB(200, 200, 200)); + JFaceResources.getColorRegistry().put(NOT_RENDERED_KEY, new RGB(200, 200, 200)); } @Override public void applyStyles(TextStyle textStyle) { - textStyle.foreground = JFaceResources.getColorRegistry().get("NOT_RENDERED_STYLER"); + textStyle.foreground = JFaceResources.getColorRegistry().get(NOT_RENDERED_KEY); } }; @@ -60,10 +63,10 @@ public void update(final ViewerCell cell) { if (o instanceof MUIElement) { if (!((MUIElement) o).isVisible()) { - label += ""; + label += "<" + Messages.ComponentLabelProvider_invisible + ">"; //$NON-NLS-1$//$NON-NLS-2$ styler = NOT_RENDERED_STYLER; } else if (!((MUIElement) o).isToBeRendered()) { - label += ""; + label += "<" + Messages.ComponentLabelProvider_notrendered + ">"; //$NON-NLS-1$ //$NON-NLS-2$ styler = NOT_RENDERED_STYLER; } } From ea55996690a27db320b8455976c07be978f3dc1b Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 16:59:13 +0000 Subject: [PATCH 0226/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed compiler warnings --- .../eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index d9fb290bc2..1474e5c633 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -674,6 +674,7 @@ public IModelResource getModelProvider() { class ClipboardHandler implements Handler { + @SuppressWarnings("unchecked") public void paste() { Clipboard clip = new Clipboard(viewer.getControl().getDisplay()); Object o = clip.getContents(MemoryTransfer.getInstance()); @@ -805,6 +806,7 @@ protected DropListener(Viewer viewer, EditingDomain domain) { this.domain = domain; } + @SuppressWarnings("unchecked") @Override public boolean performDrop(Object data) { if (getCurrentLocation() == LOCATION_ON) { @@ -945,6 +947,7 @@ public boolean validateDrop(Object target, int operation, TransferData transferT private boolean isValidDrop(Object target, MApplicationElement instance, boolean isIndex) { if (target instanceof MElementContainer) { + @SuppressWarnings("unchecked") MElementContainer container = (MElementContainer) target; if (isIndex || !container.getChildren().contains(instance)) { @@ -952,6 +955,7 @@ private boolean isValidDrop(Object target, MApplicationElement instance, boolean return classifier.isInstance(instance); } } else if (target instanceof VirtualEntry) { + @SuppressWarnings("unchecked") VirtualEntry vTarget = (VirtualEntry) target; if (isIndex || !vTarget.getList().contains(instance)) { if (vTarget.getProperty() instanceof IEMFProperty) { From 1a41cab39d5c8a8b747617a341959819f2ef6298 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 17:07:02 +0000 Subject: [PATCH 0227/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * some nls stuff --- .../e4/tools/emf/ui/internal/Messages.java | 6 ++++++ .../tools/emf/ui/internal/Messages.properties | 8 ++++++- .../component/BindingContextEditor.java | 21 ++++++++++--------- .../common/component/CommandEditor.java | 2 +- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index a59c9d10aa..f75e67fa4d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -269,6 +269,12 @@ public class Messages extends NLS { public static String ComponentLabelProvider_invisible; public static String ComponentLabelProvider_notrendered; + public static String BindingContextEditor_TreeLabel; + public static String BindingContextEditor_TreeLabelDescription; + public static String BindingContextEditor_Name; + public static String BindingContextEditor_Description; + public static String BindingContextEditor_Subcontexts; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 2890de86d9..312307b903 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -263,4 +263,10 @@ CommandCategorySelectionDialog_LabelCategoryId=Category Id BindingContextSelectionDialog_LabelContextId=Context Id ComponentLabelProvider_invisible=invisible -ComponentLabelProvider_notrendered=not rendered \ No newline at end of file +ComponentLabelProvider_notrendered=not rendered + +BindingContextEditor_TreeLabel=Binding Context +BindingContextEditor_TreeLabelDescription=Binding Context Bla Bla Bla +BindingContextEditor_Name=Name +BindingContextEditor_Description=Description +BindingContextEditor_Subcontexts=Subcontexts \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java index dc2e753cc5..043af0ead8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java @@ -19,6 +19,7 @@ import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.commands.MBindingContext; @@ -81,7 +82,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Binding Context"; + return Messages.BindingContextEditor_TreeLabel; } @Override @@ -97,7 +98,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Binding Context Bla Bla Bla"; + return Messages.BindingContextEditor_TreeLabelDescription; } @Override @@ -146,12 +147,12 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr return parent; } - ControlFactory.createTextField(parent, "Id", master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, "Name", master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME)); - ControlFactory.createTextField(parent, "Description", master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_CONTEXT__DESCRIPTION)); + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); + ControlFactory.createTextField(parent, Messages.BindingContextEditor_Name, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME)); + ControlFactory.createTextField(parent, Messages.BindingContextEditor_Description, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_CONTEXT__DESCRIPTION)); Label l = new Label(parent, SWT.NONE); - l.setText("Childcontexts"); + l.setText(Messages.BindingContextEditor_Subcontexts); l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer viewer = new TableViewer(parent); @@ -176,7 +177,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -203,7 +204,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -230,7 +231,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -249,7 +250,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove ..."); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 30c2ced40e..d49e28ca6b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -320,7 +320,7 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } From 782d58b27a52c55fd22fcda2b44a9d5d58e6c6e1 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 17:29:57 +0000 Subject: [PATCH 0228/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * some nls stuff --- .../e4/tools/emf/ui/internal/Messages.java | 21 ++++++++--------- .../tools/emf/ui/internal/Messages.properties | 23 +++++++++---------- .../component/CommandParameterEditor.java | 14 +++++------ .../common/component/ControlFactory.java | 20 ++++++++-------- .../common/component/KeyBindingEditor.java | 8 +++---- 5 files changed, 42 insertions(+), 44 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index f75e67fa4d..d2dc730037 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -19,6 +19,7 @@ public class Messages extends NLS { public static String ModelTooling_Common_Add; public static String ModelTooling_Common_Remove; public static String ModelTooling_Common_Id; + public static String ModelTooling_Common_RefId; public static String ModelTooling_Common_FindEllipsis; public static String ModelTooling_UIElement_ToBeRendered; @@ -70,11 +71,9 @@ public class Messages extends NLS { public static String DirectMenuItemEditor_Description; public static String DirectMenuItemEditor_ClassURI; - public static String ControlFactory_BindingContexts; - public static String ControlFactory_Tags; public static String ControlFactory_Key; public static String ControlFactory_Value; - public static String ControlFactory_ContextVariables; + public static String ControlFactory_KeyValueShellTitle; public static String DirectToolItemEditor_ClassURI; public static String DirectToolItemEditor_Label; @@ -107,8 +106,8 @@ public class Messages extends NLS { public static String KeyBindingEditor_Sequence; public static String KeyBindingEditor_Command; public static String KeyBindingEditor_Parameters; - public static String KeyBindingEditor_ParametersKey; - public static String KeyBindingEditor_ParametersValue; + public static String KeyBindingEditor_SequenceNotComplete; + public static String KeyBindingEditor_SequenceEmpty; public static String MenuEditor_Label; public static String MenuEditor_Description; @@ -141,9 +140,6 @@ public class Messages extends NLS { public static String PartDescriptorEditor_Closeable; public static String PartDescriptorEditor_Multiple; public static String PartDescriptorEditor_Category; - public static String PartDescriptorEditor_PersitedState; - public static String PartDescriptorEditor_PersitedStateKey; - public static String PartDescriptorEditor_PersitedStateValue; public static String PartDescriptorEditor_Variables; public static String PartDescriptorEditor_Properties; public static String PartDescriptorEditor_PropertiesKey; @@ -159,9 +155,6 @@ public class Messages extends NLS { public static String PartEditor_IconURI; public static String PartEditor_ClassURI; public static String PartEditor_Closeable; - public static String PartEditor_PersitedState; - public static String PartEditor_PersitedStateKey; - public static String PartEditor_PersitedStateValue; public static String PartEditor_Menus; public static String PartEditor_Handlers; public static String PartEditor_ContainerData; @@ -275,6 +268,12 @@ public class Messages extends NLS { public static String BindingContextEditor_Description; public static String BindingContextEditor_Subcontexts; + public static String CommandParameterEditor_TreeLabel; + public static String CommandParameterEditor_TreeLabelDescritpion; + public static String CommandParameterEditor_Name; + public static String CommandParameterEditor_TypeId; + public static String CommandParameterEditor_Optional; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 312307b903..d31f3bef29 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -14,6 +14,7 @@ ModelTooling_Common_AddEllipsis=Add ... ModelTooling_Common_Add=Add ModelTooling_Common_Remove=Remove ModelTooling_Common_Id=Id +ModelTooling_Common_RefId=Reference-Id ModelTooling_Common_FindEllipsis=Find ... ModelTooling_UIElement_ToBeRendered=To Be Rendered @@ -66,11 +67,9 @@ DirectMenuItemEditor_Label=DirectMenuItem DirectMenuItemEditor_Description=DirectMenuItem bla bla bla DirectMenuItemEditor_ClassURI=Class URI -ControlFactory_BindingContexts=Binding Contexts -ControlFactory_Tags=Tags ControlFactory_Key=Key ControlFactory_Value=Value -ControlFactory_ContextVariables=Context Variables +ControlFactory_KeyValueShellTitle=Key/Value Pair DirectToolItemEditor_ClassURI=Class URI DirectToolItemEditor_Label=Direct Tool Item @@ -103,8 +102,8 @@ KeyBindingEditor_Description=Binding bla bla bla KeyBindingEditor_Sequence=Sequence KeyBindingEditor_Command=Command KeyBindingEditor_Parameters=Parameters -KeyBindingEditor_ParametersKey=Key -KeyBindingEditor_ParametersValue=Value +KeyBindingEditor_SequenceNotComplete=Keysequence is not complete +KeyBindingEditor_SequenceEmpty=Keysequence must not be empty! MenuEditor_Label=Menu MenuEditor_Description=Menu bla bla bla @@ -137,9 +136,6 @@ PartDescriptorEditor_Dirtyable=Dirtyable PartDescriptorEditor_Closeable=Closeable PartDescriptorEditor_Multiple=Multiple PartDescriptorEditor_Category=Category -PartDescriptorEditor_PersitedState=Persited State -PartDescriptorEditor_PersitedStateKey=Key -PartDescriptorEditor_PersitedStateValue=Value PartDescriptorEditor_Variables=Variables PartDescriptorEditor_Properties=Properties PartDescriptorEditor_PropertiesKey=Key @@ -155,8 +151,6 @@ PartEditor_Tooltip=Tooltip PartEditor_IconURI=Icon URI PartEditor_ClassURI=Class URI PartEditor_Closeable=Closeable -PartEditor_PersitedStateKey=Key -PartEditor_PersitedStateValue=Value PartEditor_Menus=Menus PartEditor_Handlers=Handlers PartEditor_ContainerData=Container Data @@ -219,7 +213,6 @@ VBindingTableEditor_LabelDescription=Description AddonsEditor_ClassURI=Class URI AddonsEditor_TreeLabel=Addon AddonsEditor_TreeLabelDescription=Addon Bla Bla Bla -AddonsEditor_PersistedState=Persisted State AddonsEditor_Tags=Tags ContributionClassDialog_DialogMessage=Enter the name of the contributing class @@ -269,4 +262,10 @@ BindingContextEditor_TreeLabel=Binding Context BindingContextEditor_TreeLabelDescription=Binding Context Bla Bla Bla BindingContextEditor_Name=Name BindingContextEditor_Description=Description -BindingContextEditor_Subcontexts=Subcontexts \ No newline at end of file +BindingContextEditor_Subcontexts=Subcontexts + +CommandParameterEditor_TreeLabel=Command Parameter +CommandParameterEditor_TreeLabelDescritpion=Command Parameter Bla Bla Bla +CommandParameterEditor_Name=Name +CommandParameterEditor_TypeId=TypeId +CommandParameterEditor_Optional=Optional \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java index 8815123fe6..62bc14b19e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java @@ -17,6 +17,7 @@ import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.commands.MCommandParameter; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; @@ -65,7 +66,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Command Parameter"; + return Messages.CommandParameterEditor_TreeLabel; } @Override @@ -81,7 +82,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Command Parameter Bla Bla Bla Bla"; + return Messages.CommandParameterEditor_TreeLabelDescritpion; } @Override @@ -130,13 +131,13 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr return parent; } - ControlFactory.createTextField(parent, "Id", master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, "Name", master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__NAME)); - ControlFactory.createTextField(parent, "TypeId", master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__TYPE_ID)); + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); + ControlFactory.createTextField(parent, Messages.CommandParameterEditor_Name, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__NAME)); + ControlFactory.createTextField(parent, Messages.CommandParameterEditor_TypeId, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__TYPE_ID)); { Label l = new Label(parent, SWT.NONE); - l.setText("Optional"); + l.setText(Messages.CommandParameterEditor_Optional); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Button checkbox = new Button(parent, SWT.CHECK); @@ -153,7 +154,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 783f3d3ac0..1f73258c13 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -92,7 +92,7 @@ public static void createMapProperties(Composite parent, final AbstractComponent tableviewer.getControl().setLayoutData(gd); TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Key"); + column.getColumn().setText(Messages.ControlFactory_Key); column.getColumn().setWidth(200); column.setLabelProvider(new ColumnLabelProvider() { @SuppressWarnings("unchecked") @@ -105,7 +105,7 @@ public String getText(Object element) { // FIXME How can we react upon changes in the Map-Value? column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Value"); + column.getColumn().setText(Messages.ControlFactory_Value); column.getColumn().setWidth(200); column.setLabelProvider(new ColumnLabelProvider() { @SuppressWarnings("unchecked") @@ -170,20 +170,20 @@ public void widgetSelected(SelectionEvent e) { @Override protected Control createDialogArea(Composite parent) { - getShell().setText("Key/Value Pair"); + getShell().setText(Messages.ControlFactory_KeyValueShellTitle); Composite comp = (Composite) super.createDialogArea(parent); Composite container = new Composite(comp, SWT.NONE); container.setLayout(new GridLayout(2, false)); container.setLayoutData(new GridData(GridData.FILL_BOTH)); Label l = new Label(container, SWT.NONE); - l.setText("Key"); + l.setText(Messages.ControlFactory_Key); key = new Text(container, SWT.BORDER); key.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); l = new Label(container, SWT.NONE); - l.setText("Value"); + l.setText(Messages.ControlFactory_Value); value = new Text(container, SWT.BORDER); value.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -246,7 +246,7 @@ public static void createFindImport(Composite parent, final AbstractComponentEdi IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); Label l = new Label(parent, SWT.NONE); - l.setText("Reference-Id"); + l.setText(Messages.ModelTooling_Common_RefId); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); @@ -255,7 +255,7 @@ public static void createFindImport(Composite parent, final AbstractComponentEdi context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(editor.getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(editor.getMaster())); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText("Find ..."); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.setImage(editor.getImage(t.getDisplay(), AbstractComponentEditor.SEARCH_IMAGE)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -307,7 +307,7 @@ public String getText(Object element) { if (element instanceof MUILabel) { MUILabel label = (MUILabel) element; if (!Util.isNullOrEmpty(label.getLabel())) { - return rv + " - " + label.getLabel().trim(); + return rv + " - " + label.getLabel().trim(); //$NON-NLS-1$ } } @@ -315,11 +315,11 @@ public String getText(Object element) { if (element instanceof MApplicationElement) { MApplicationElement appEl = (MApplicationElement) element; if (!Util.isNullOrEmpty(appEl.getElementId())) { - return rv + " - " + appEl.getElementId(); + return rv + " - " + appEl.getElementId(); //$NON-NLS-1$ } } - return rv + "[" + list.indexOf(element) + "]"; + return rv + "[" + list.indexOf(element) + "]"; //$NON-NLS-1$//$NON-NLS-2$ } }); viewer.setInput(list); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 27138578f4..da37c076bd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -332,18 +332,18 @@ public IStatus validate(Object value) { try { KeySequence keySequence = KeySequence.getInstance(value.toString()); if (!keySequence.isComplete()) { - return new Status(statusCode, "org.eclipse.e4.tools.emf.ui", "Keysequence is not complete"); + return new Status(statusCode, "org.eclipse.e4.tools.emf.ui", Messages.KeyBindingEditor_SequenceNotComplete); //$NON-NLS-1$ } if (keySequence.isEmpty()) { - return new Status(statusCode, "org.eclipse.e4.tools.emf.ui", "Keysequence must not be empty!"); + return new Status(statusCode, "org.eclipse.e4.tools.emf.ui", Messages.KeyBindingEditor_SequenceEmpty); //$NON-NLS-1$ } return Status.OK_STATUS; } catch (Exception e) { - return new Status(statusCode, "org.eclipse.e4.tools.emf.ui", e.getMessage(), e); + return new Status(statusCode, "org.eclipse.e4.tools.emf.ui", e.getMessage(), e); //$NON-NLS-1$ } } - return new Status(statusCode, "org.eclipse.e4.tools.emf.ui", "Keysequence must not be empty!"); + return new Status(statusCode, "org.eclipse.e4.tools.emf.ui", Messages.KeyBindingEditor_SequenceEmpty); //$NON-NLS-1$ } } } From 61e680565cae471cc0a32ab150334d34ae899efa Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 17:50:41 +0000 Subject: [PATCH 0229/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * some nls stuff --- .../src/org/eclipse/e4/tools/emf/ui/internal/Messages.java | 4 ++++ .../eclipse/e4/tools/emf/ui/internal/Messages.properties | 4 ++++ .../internal/common/component/MenuContributionEditor.java | 6 +++--- .../tools/emf/ui/internal/common/component/MenuEditor.java | 2 +- .../emf/ui/internal/common/component/MenuItemEditor.java | 6 +++--- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index d2dc730037..01d3f75393 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -127,6 +127,8 @@ public class Messages extends NLS { public static String MenuItemEditor_Tooltip; public static String MenuItemEditor_IconURI; public static String MenuEditor_MainMenu; + public static String MenuItemEditor_Enabled; + public static String MenuItemEditor_Selected; public static String MenuSeparatorEditor_Label; @@ -232,6 +234,8 @@ public class Messages extends NLS { public static String MenuContributionEditor_DirectMenuItem; public static String MenuContributionEditor_ParentId; public static String MenuContributionEditor_Position; + public static String MenuContributionEditor_TreeLabel; + public static String MenuContributionEditor_TreeLabelDescription; public static String ModelFragmentsEditor_ModelFragments; public static String ModelFragmentsEditor_Label; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index d31f3bef29..263f901b8b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -123,6 +123,8 @@ MenuItemEditor_Type=Type MenuItemEditor_Label=Label MenuItemEditor_Tooltip=Tooltip MenuItemEditor_IconURI=Icon URI +MenuItemEditor_Enabled=Enabled +MenuItemEditor_Selected=Selected MenuSeparatorEditor_Label=Separator @@ -229,6 +231,8 @@ MenuContributionEditor_Menu=Menu MenuContributionEditor_DirectMenuItem=Direct MenuItem MenuContributionEditor_ParentId=Parent-Id MenuContributionEditor_Position=Position +MenuContributionEditor_TreeLabel=Menu Contribution +MenuContributionEditor_TreeLabelDescription=Menu Contribution Bla Bla Bla Bla ModelFragmentsEditor_ModelFragments=Model Fragements ModelFragmentsEditor_Label=Model Fragments diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index 1fdccca0c8..6b2f8c44cc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -123,7 +123,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Menu Contribution"; + return Messages.MenuContributionEditor_TreeLabel; } @Override @@ -133,7 +133,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Menu Contribution Bla Bla Bla Bla"; + return Messages.MenuContributionEditor_TreeLabelDescription; } @Override @@ -371,7 +371,7 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index cce027be2d..e6fe4f9968 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -399,7 +399,7 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index d0a8ce0f69..b2e23a046d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -242,7 +242,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); - l.setText("Enabled"); + l.setText(Messages.MenuItemEditor_Enabled); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Button b = new Button(parent, SWT.CHECK); @@ -252,7 +252,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); - l.setText("Selected"); + l.setText(Messages.MenuItemEditor_Selected); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Button b = new Button(parent, SWT.CHECK); @@ -283,7 +283,7 @@ public Object convert(Object fromObject) { ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } From 6a53a4dabf989aa02f5330722874203806c59b95 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 17 Jul 2010 18:05:57 +0000 Subject: [PATCH 0230/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * some nls stuff --- .../e4/tools/emf/ui/internal/Messages.java | 8 ++++++++ .../tools/emf/ui/internal/Messages.properties | 10 +++++++++- .../common/component/ModelFragmentsEditor.java | 12 ++++++------ .../common/component/ParameterEditor.java | 12 ++++++------ .../common/component/PartDescriptorEditor.java | 2 +- .../internal/common/component/PartEditor.java | 18 +++++++++--------- 6 files changed, 39 insertions(+), 23 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 01d3f75393..86ecb3410c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -26,6 +26,7 @@ public class Messages extends NLS { public static String ModelTooling_UIElement_Visible; public static String ModelTooling_Context_Variables; + public static String ModelTooling_Context_Properties; public static String ModelTooling_ApplicationElement_Tags; public static String ModelTooling_Contribution_PersistedState; @@ -161,6 +162,7 @@ public class Messages extends NLS { public static String PartEditor_Handlers; public static String PartEditor_ContainerData; public static String PartEditor_ToolBar; + public static String PartEditor_BindingContexts; public static String PartSashContainerEditor_Label; public static String PartSashContainerEditor_Description; @@ -240,6 +242,7 @@ public class Messages extends NLS { public static String ModelFragmentsEditor_ModelFragments; public static String ModelFragmentsEditor_Label; public static String ModelFragmentsEditor_Description; + public static String ModelFragmentsEditor_Imports; public static String StringModelFragment_Label; public static String StringModelFragment_Description; @@ -278,6 +281,11 @@ public class Messages extends NLS { public static String CommandParameterEditor_TypeId; public static String CommandParameterEditor_Optional; + public static String ParameterEditor_TreeLabel; + public static String ParameterEditor_TreeLabelDescription; + public static String ParameterEditor_Name; + public static String ParameterEditor_Value; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 263f901b8b..8e0d3568da 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -21,6 +21,7 @@ ModelTooling_UIElement_ToBeRendered=To Be Rendered ModelTooling_UIElement_Visible=Visible ModelTooling_Context_Variables=Variables +ModelTooling_Context_Properties=Context Properties ModelTooling_ApplicationElement_Tags=Tags @@ -157,6 +158,7 @@ PartEditor_Menus=Menus PartEditor_Handlers=Handlers PartEditor_ContainerData=Container Data PartEditor_ToolBar=ToolBar +PartEditor_BindingContexts=Binding Contexts PartSashContainerEditor_Label=Sash PartSashContainerEditor_Description=Sash bla bla bla @@ -237,6 +239,7 @@ MenuContributionEditor_TreeLabelDescription=Menu Contribution Bla Bla Bla Bla ModelFragmentsEditor_ModelFragments=Model Fragements ModelFragmentsEditor_Label=Model Fragments ModelFragmentsEditor_Description=Description +ModelFragmentsEditor_Imports=Imports StringModelFragment_Label=String Model Fragment StringModelFragment_Description=String Model Fragment Bla Bla Bla @@ -272,4 +275,9 @@ CommandParameterEditor_TreeLabel=Command Parameter CommandParameterEditor_TreeLabelDescritpion=Command Parameter Bla Bla Bla CommandParameterEditor_Name=Name CommandParameterEditor_TypeId=TypeId -CommandParameterEditor_Optional=Optional \ No newline at end of file +CommandParameterEditor_Optional=Optional + +ParameterEditor_TreeLabel=Parameter +ParameterEditor_TreeLabelDescription=Parameter Bla Bla Bla Bla +ParameterEditor_Name=Name +ParameterEditor_Value=Value \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java index b937f16f45..77fcc1a628 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java @@ -112,7 +112,7 @@ private Composite createForm(Composite parent) { { Label l = new Label(parent, SWT.NONE); - l.setText("Imports"); + l.setText(Messages.ModelFragmentsEditor_Imports); l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer viewer = new TableViewer(parent); @@ -135,7 +135,7 @@ private Composite createForm(Composite parent) { buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -162,7 +162,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -233,7 +233,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -387,13 +387,13 @@ public void addClasses(EPackage ePackage, List list) { @Override public IObservableList getChildList(Object element) { WritableList list = new WritableList(); - list.add(new VirtualEntry(ModelEditor.VIRTUAL_MODEL_IMPORTS, MODEL_FRAGMENTS__IMPORTS, element, "Imports") { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_MODEL_IMPORTS, MODEL_FRAGMENTS__IMPORTS, element, Messages.ModelFragmentsEditor_Imports) { @Override protected boolean accepted(Object o) { return true; } }); - list.add(new VirtualEntry(ModelEditor.VIRTUAL_MODEL_FRAGEMENTS, MODEL_FRAGMENTS__FRAGMENTS, element, "Fragments") { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_MODEL_FRAGEMENTS, MODEL_FRAGMENTS__FRAGMENTS, element, Messages.ModelFragmentsEditor_ModelFragments) { @Override protected boolean accepted(Object o) { return true; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java index d48cf40438..aa6364c9a9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java @@ -17,6 +17,7 @@ import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; @@ -61,7 +62,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Parameter"; + return Messages.ParameterEditor_TreeLabel; } @Override @@ -77,7 +78,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Parameter Bla Bla Bla Bla"; + return Messages.ParameterEditor_TreeLabelDescription; } @Override @@ -126,16 +127,15 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr return parent; } - ControlFactory.createTextField(parent, "Id", master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, "Name", master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__NAME)); - ControlFactory.createTextField(parent, "Value", master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__VALUE)); + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); + ControlFactory.createTextField(parent, Messages.ParameterEditor_Name, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__NAME)); + ControlFactory.createTextField(parent, Messages.ParameterEditor_Value, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__VALUE)); return parent; } @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index c2947039d3..b578fea993 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -342,7 +342,7 @@ public void widgetSelected(SelectionEvent e) { context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CATEGORY).observeDetail(master)); } - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 251c2aefdb..f229becc7a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -255,7 +255,7 @@ public void widgetSelected(SelectionEvent e) { final IContributionClassCreator c = getEditor().getContributionCreator(BasicPackageImpl.Literals.PART); if (project != null && c != null) { final Link l = new Link(parent, SWT.NONE); - l.setText("" + Messages.PartEditor_ClassURI + ""); + l.setText("" + Messages.PartEditor_ClassURI + ""); //$NON-NLS-1$//$NON-NLS-2$ l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); l.addSelectionListener(new SelectionAdapter() { @Override @@ -338,14 +338,14 @@ public void widgetSelected(SelectionEvent e) { } // ------------------------------------------------------------ - ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ - - ControlFactory.createStringListWidget(parent, this, "Binding Contexts", CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, this, "Persisted State", ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, this, "Context Properties", UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); + + ControlFactory.createStringListWidget(parent, this, Messages.PartEditor_BindingContexts, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } From d102c89c0348bf5f9bbe77ae928e9df1d16b548a Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 18 Jul 2010 10:12:09 +0000 Subject: [PATCH 0231/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * some nls stuff --- .../internal/common/component/PartSashContainerEditor.java | 6 +++--- .../emf/ui/internal/common/component/PartStackEditor.java | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index a41a870e12..4c04323ab2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -352,10 +352,10 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 700392d180..4444a5d2b4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -250,6 +250,7 @@ public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (s.size() == 1) { Object obj = s.getFirstElement(); + @SuppressWarnings("unchecked") MElementContainer container = (MElementContainer) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if (idx < container.getChildren().size()) { @@ -312,10 +313,10 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } From ab736896018e47ca7449f5e1512edc7a8dad9262 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 18 Jul 2010 10:21:01 +0000 Subject: [PATCH 0232/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * some nls stuff --- .../src/org/eclipse/e4/tools/emf/ui/internal/Messages.java | 4 ++++ .../eclipse/e4/tools/emf/ui/internal/Messages.properties | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 86ecb3410c..06e893293f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -194,6 +194,7 @@ public class Messages extends NLS { public static String PlaceholderEditor_Label; public static String PlaceholderEditor_Descriptor; + public static String PlaceholderEditor_Reference; public static String ToolBarEditor_Label; public static String ToolBarEditor_Description; @@ -286,6 +287,9 @@ public class Messages extends NLS { public static String ParameterEditor_Name; public static String ParameterEditor_Value; + public static String PopupMenuEditor_TreeLabel; + public static String PopupMenuEditor_TreeLabelDescription; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 8e0d3568da..a18744be25 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -191,6 +191,7 @@ PerspectiveStackEditor_Perspectives=Perspectives PlaceholderEditor_Label=Placeholder PlaceholderEditor_Descriptor=Placeholder Bla Bla Bla Bla +PlaceholderEditor_Reference=Reference ToolBarEditor_Label=Toolbar ToolBarEditor_Description=Toolbar bla bla bla @@ -280,4 +281,7 @@ CommandParameterEditor_Optional=Optional ParameterEditor_TreeLabel=Parameter ParameterEditor_TreeLabelDescription=Parameter Bla Bla Bla Bla ParameterEditor_Name=Name -ParameterEditor_Value=Value \ No newline at end of file +ParameterEditor_Value=Value + +PopupMenuEditor_TreeLabel=Popup Menu +PopupMenuEditor_TreeLabelDescription=Popup Menu Bla Bla Bla Bla \ No newline at end of file From 8c0264e2825a4dc7a25ab515036dc53ae04b00f3 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 18 Jul 2010 10:23:53 +0000 Subject: [PATCH 0233/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * some nls stuff --- .../eclipse/e4/tools/emf/ui/internal/Messages.java | 5 +++++ .../e4/tools/emf/ui/internal/Messages.properties | 7 ++++++- .../internal/common/component/PerspectiveEditor.java | 10 +++++----- .../common/component/PerspectiveStackEditor.java | 6 +++--- .../internal/common/component/PlaceholderEditor.java | 11 ++++++----- .../ui/internal/common/component/PopupMenuEditor.java | 9 +++++---- .../internal/common/component/RenderedMenuEditor.java | 3 ++- .../internal/common/component/RenderedMenuItem.java | 7 +++---- 8 files changed, 35 insertions(+), 23 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 06e893293f..10a1bc77f5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -290,6 +290,11 @@ public class Messages extends NLS { public static String PopupMenuEditor_TreeLabel; public static String PopupMenuEditor_TreeLabelDescription; + public static String RenderedMenuEditor_TreeLabel; + + public static String RenderedMenuItem_TreeLabel; + public static String RenderedMenuItem_TreeLabelDescription; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index a18744be25..3cfa66c400 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -284,4 +284,9 @@ ParameterEditor_Name=Name ParameterEditor_Value=Value PopupMenuEditor_TreeLabel=Popup Menu -PopupMenuEditor_TreeLabelDescription=Popup Menu Bla Bla Bla Bla \ No newline at end of file +PopupMenuEditor_TreeLabelDescription=Popup Menu Bla Bla Bla Bla + +RenderedMenuEditor_TreeLabel=Rendered Menu + +RenderedMenuItem_TreeLabel=Rendered MenuItem +RenderedMenuItem_TreeLabelDescription=Rendered MenuItem Bla Bla Bla Bla \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 8d2ba2e6d9..f63ecb0918 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -376,12 +376,12 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createMapProperties(parent, this, "Context Properties", UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 20eaeceacf..73446eda9b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -278,10 +278,10 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 4a7b462908..e561d2d2b6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -176,7 +176,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Reference"); + l.setText(Messages.PlaceholderEditor_Reference); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); @@ -200,11 +200,11 @@ public Object convert(Object fromObject) { if (o instanceof MUILabel) { MUILabel label = (MUILabel) o; if (!Util.isNullOrEmpty(label.getLabel())) { - return o.eClass().getName() + " - " + label.getLabel(); + return o.eClass().getName() + " - " + label.getLabel(); //$NON-NLS-1$ } } - return o.eClass().getName() + " - " + ((MUIElement) fromObject).getElementId(); + return o.eClass().getName() + " - " + ((MUIElement) fromObject).getElementId(); //$NON-NLS-1$ } return null; } @@ -223,8 +223,9 @@ public void widgetSelected(SelectionEvent e) { } }); } - ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java index 9dc6bbf464..40607cac27 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java @@ -12,6 +12,7 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; @@ -28,8 +29,8 @@ public PopupMenuEditor(EditingDomain editingDomain, IProject project, ModelEdito protected Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean rootMenu, boolean isImport) { Composite comp = super.createForm(parent, context, master, rootMenu, isImport); if (!isImport) { - ControlFactory.createMapProperties(parent, this, "Context Properties", UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(comp, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(comp, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); } return comp; @@ -37,11 +38,11 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, @Override public String getLabel(Object element) { - return "Popup Menu"; + return Messages.PopupMenuEditor_TreeLabel; } @Override public String getDescription(Object element) { - return "Popup Menu Bla Bla Bla Bla"; + return Messages.PopupMenuEditor_TreeLabelDescription; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java index fdabe40bd3..edbf6030e4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java @@ -11,6 +11,7 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.emf.edit.domain.EditingDomain; @@ -22,6 +23,6 @@ public RenderedMenuEditor(EditingDomain editingDomain, IProject project, ModelEd @Override public String getLabel(Object element) { - return "Rendered Menu"; + return Messages.RenderedMenuEditor_TreeLabel; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java index aeb169ad9b..d62c567092 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java @@ -12,6 +12,7 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.edit.domain.EditingDomain; @@ -25,18 +26,16 @@ public RenderedMenuItem(EditingDomain editingDomain, ModelEditor editor, IProjec @Override protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - // TODO Auto-generated method stub } @Override public String getLabel(Object element) { - return "Rendered MenuItem"; + return Messages.RenderedMenuItem_TreeLabel; } @Override public String getDescription(Object element) { - return "Rendered MenuItem Bla Bla Bla Bla"; + return Messages.RenderedMenuItem_TreeLabelDescription; } - } From 1d3716c5ce2de9a6bae156c240d57d0e4001032e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 18 Jul 2010 11:05:44 +0000 Subject: [PATCH 0234/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * some nls stuff --- .../e4/tools/emf/ui/internal/Messages.java | 44 +++++++++++++++++ .../tools/emf/ui/internal/Messages.properties | 46 +++++++++++++++++- .../emf/ui/internal/common/ModelEditor.java | 4 +- .../component/RenderedToolBarEditor.java | 3 +- .../component/ToolBarContributionEditor.java | 15 +++--- .../common/component/ToolControlEditor.java | 10 ++-- .../common/component/ToolItemEditor.java | 34 +++++--------- .../common/component/TrimBarEditor.java | 23 +++++---- .../component/TrimContributionEditor.java | 39 +++++---------- .../common/component/TrimmedWindowEditor.java | 5 +- .../common/component/WindowEditor.java | 47 +++++++++---------- 11 files changed, 168 insertions(+), 102 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 10a1bc77f5..c73dc5efed 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -295,6 +295,50 @@ public class Messages extends NLS { public static String RenderedMenuItem_TreeLabel; public static String RenderedMenuItem_TreeLabelDescription; + public static String RenderedToolBarEditor_TreeLabel; + + public static String ToolBarContributionEditor_TreeLabel; + public static String ToolBarContributionEditor_TreeLabelDescription; + + public static String ToolItemEditor_Type; + public static String ToolItemEditor_Label; + public static String ToolItemEditor_ToolTip; + public static String ToolItemEditor_IconURI; + public static String ToolItemEditor_Enabled; + public static String ToolItemEditor_Selected; + + public static String TrimBarEditor_TreeLabel; + public static String TrimBarEditor_TreeLabelDescription; + public static String TrimBarEditor_Side; + public static String TrimBarEditor_Controls; + + public static String TrimContributionEditor_TreeLabel; + public static String TrimContributionEditor_TreeLabelDescription; + public static String TrimContributionEditor_ParentId; + public static String TrimContributionEditor_Position; + public static String TrimContributionEditor_Controls; + + public static String TrimmedWindowEditor_TrimBars; + public static String TrimmedWindowEditor_TreeLabel; + + public static String WindowEditor_AddMainMenu; + public static String WindowEditor_TreeLabel; + public static String WindowEditor_TreeLabelDescription; + public static String WindowEditor_X; + public static String WindowEditor_Y; + public static String WindowEditor_Width; + public static String WindowEditor_Height; + public static String WindowEditor_Label; + public static String WindowEditor_Tooltip; + public static String WindowEditor_IconURI; + public static String WindowEditor_MainMenu; + public static String WindowEditor_SelectedElement; + public static String WindowEditor_BindingContexts; + public static String WindowEditor_Handlers; + public static String WindowEditor_Windows; + public static String WindowEditor_Controls; + public static String WindowEditor_SharedElements; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 3cfa66c400..924f9d57bd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -289,4 +289,48 @@ PopupMenuEditor_TreeLabelDescription=Popup Menu Bla Bla Bla Bla RenderedMenuEditor_TreeLabel=Rendered Menu RenderedMenuItem_TreeLabel=Rendered MenuItem -RenderedMenuItem_TreeLabelDescription=Rendered MenuItem Bla Bla Bla Bla \ No newline at end of file +RenderedMenuItem_TreeLabelDescription=Rendered MenuItem Bla Bla Bla Bla + +RenderedToolBarEditor_TreeLabel=Rendered ToolBar + +ToolBarContributionEditor_TreeLabel=ToolBar Contribution +ToolBarContributionEditor_TreeLabelDescription=ToolBar Contribution Bla Bla Bla Bla + +ToolItemEditor_Type=Type +ToolItemEditor_Label=Label +ToolItemEditor_ToolTip=Tooltip +ToolItemEditor_IconURI=Icon URI +ToolItemEditor_Enabled=Enabled +ToolItemEditor_Selected=Selected + +TrimBarEditor_TreeLabel=Window Trim +TrimBarEditor_TreeLabelDescription=Window Trim bla bla bla +TrimBarEditor_Side=Side +TrimBarEditor_Controls=Controls + +TrimContributionEditor_TreeLabel=Trim Contribution +TrimContributionEditor_TreeLabelDescription=Trim Contribution Bla Bla Bla Bla +TrimContributionEditor_ParentId=Parent Id +TrimContributionEditor_Position=Position +TrimContributionEditor_Controls=Controls + +TrimmedWindowEditor_TrimBars=TrimBars +TrimmedWindowEditor_TreeLabel=Trimmed Window + +WindowEditor_AddMainMenu=Add Main Menu +WindowEditor_TreeLabel=Window +WindowEditor_TreeLabelDescription=Window bla bla bla +WindowEditor_X=X +WindowEditor_Y=Y +WindowEditor_Width=Width +WindowEditor_Height=Height +WindowEditor_Label=Label +WindowEditor_Tooltip=Tooltip +WindowEditor_IconURI=Icon URI +WindowEditor_MainMenu=Main Menu +WindowEditor_SelectedElement=Selected Element +WindowEditor_BindingContexts=Binding Contexts +WindowEditor_Handlers=Handlers +WindowEditor_Windows=Windows +WindowEditor_Controls=Controls +WindowEditor_SharedElements=Shared Elements \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 1474e5c633..c26df49c18 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -584,8 +584,8 @@ private void registerDefaultEditors() { registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(MenuPackageImpl.Literals.RENDERED_MENU_ITEM, new RenderedMenuItem(modelProvider.getEditingDomain(), this, project)); registerEditor(MenuPackageImpl.Literals.MENU_CONTRIBUTION, new MenuContributionEditor(modelProvider.getEditingDomain(), project, this)); - registerEditor(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION, new ToolBarContributionEditor(modelProvider.getEditingDomain(), project, this)); - registerEditor(MenuPackageImpl.Literals.TRIM_CONTRIBUTION, new TrimContributionEditor(modelProvider.getEditingDomain(), project, this)); + registerEditor(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION, new ToolBarContributionEditor(modelProvider.getEditingDomain(), this)); + registerEditor(MenuPackageImpl.Literals.TRIM_CONTRIBUTION, new TrimContributionEditor(modelProvider.getEditingDomain(), this)); registerEditor(BasicPackageImpl.Literals.PART, new PartEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(BasicPackageImpl.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain(), this, project)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java index 4cc0c20648..9618f31d56 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java @@ -10,6 +10,7 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.emf.edit.domain.EditingDomain; @@ -21,6 +22,6 @@ public RenderedToolBarEditor(EditingDomain editingDomain, ModelEditor editor) { @Override public String getLabel(Object element) { - return "Rendered ToolBar"; + return Messages.RenderedToolBarEditor_TreeLabel; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index 4d0a999e9e..d4f709e616 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -16,7 +16,6 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -70,7 +69,6 @@ public class ToolBarContributionEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; @@ -87,9 +85,8 @@ public Struct(String label, EClass eClass, boolean separator) { } } - public ToolBarContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { + public ToolBarContributionEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); - this.project = project; } @Override @@ -118,7 +115,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "ToolBar Contribution"; + return Messages.ToolBarContributionEditor_TreeLabel; } @Override @@ -128,7 +125,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "ToolBar Contribution Bla Bla Bla Bla"; + return Messages.ToolBarContributionEditor_TreeLabelDescription; } @Override @@ -363,10 +360,10 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index 04b600aa13..7fca52fe89 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -168,7 +168,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText("Find ..."); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -178,11 +178,11 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createMapProperties(parent, this, "Persisted State", ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 94c5e62680..3b893b6162 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -21,6 +21,7 @@ import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ToolItemIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -108,22 +109,14 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr return parent; } - Label l = new Label(parent, SWT.NONE); - l.setText("Id"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); createFormSubTypeForm(parent, context, master); return parent; } - private void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, final WritableValue master) { + protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, final WritableValue master) { IValueProperty textProp = WidgetProperties.text(SWT.Modify); IWidgetValueProperty checkProp = WidgetProperties.selection(); IWidgetValueProperty enabled = WidgetProperties.enabled(); @@ -131,7 +124,7 @@ private void createFormSubTypeForm(Composite parent, EMFDataBindingContext conte // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Type"); + l.setText(Messages.ToolItemEditor_Type); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); ComboViewer viewer = new ComboViewer(parent); @@ -147,7 +140,7 @@ private void createFormSubTypeForm(Composite parent, EMFDataBindingContext conte // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Label"); + l.setText(Messages.ToolItemEditor_Label); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); @@ -160,7 +153,7 @@ private void createFormSubTypeForm(Composite parent, EMFDataBindingContext conte // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Tooltip"); + l.setText(Messages.ToolItemEditor_ToolTip); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); @@ -173,7 +166,7 @@ private void createFormSubTypeForm(Composite parent, EMFDataBindingContext conte // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Icon URI"); + l.setText(Messages.ToolItemEditor_IconURI); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); @@ -194,7 +187,7 @@ protected URI getImageURI() { }; final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText("Find ..."); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @@ -208,7 +201,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); - l.setText("Enabled"); + l.setText(Messages.ToolItemEditor_Enabled); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Button b = new Button(parent, SWT.CHECK); @@ -218,7 +211,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); - l.setText("Selected"); + l.setText(Messages.ToolItemEditor_Selected); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Button b = new Button(parent, SWT.CHECK); @@ -248,10 +241,10 @@ public Object convert(Object fromObject) { createSubTypeFormElements(parent, context, master); - ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); } protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, WritableValue master) { @@ -260,7 +253,6 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index 5040098700..304c84829c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -20,6 +20,7 @@ import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -104,12 +105,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Window Trim"; + return Messages.TrimBarEditor_TreeLabel; } @Override public String getDescription(Object element) { - return "Window Trim bla bla bla"; + return Messages.TrimBarEditor_TreeLabelDescription; } @Override @@ -161,7 +162,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); @@ -174,7 +175,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Side"); + l.setText(Messages.TrimBarEditor_Side); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); ComboViewer viewer = new ComboViewer(parent); @@ -190,7 +191,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Controls"); + l.setText(Messages.TrimBarEditor_Controls); l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer viewer = new TableViewer(parent); @@ -213,7 +214,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -237,7 +238,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -288,7 +289,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -306,8 +307,10 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); + + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index 19d3e2c1db..584f000ec1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -16,7 +16,6 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -65,26 +64,12 @@ public class TrimContributionEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; - private static class Struct { - private final String label; - private final EClass eClass; - private final boolean separator; - - public Struct(String label, EClass eClass, boolean separator) { - this.label = label; - this.eClass = eClass; - this.separator = separator; - } - } - - public TrimContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { + public TrimContributionEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); - this.project = project; } @Override @@ -113,7 +98,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Trim Contribution"; + return Messages.TrimContributionEditor_TreeLabel; } @Override @@ -123,7 +108,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Trim Contribution Bla Bla Bla Bla"; + return Messages.TrimContributionEditor_TreeLabelDescription; } @Override @@ -188,7 +173,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_ParentId); + l.setText(Messages.TrimContributionEditor_ParentId); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); @@ -201,7 +186,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_Position); + l.setText(Messages.TrimContributionEditor_Position); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); @@ -214,7 +199,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Controls"); + l.setText(Messages.TrimContributionEditor_Controls); l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer viewer = new TableViewer(parent); @@ -237,7 +222,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -261,7 +246,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -312,7 +297,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -330,10 +315,10 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java index dcf63e635c..b4fa9948df 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java @@ -14,6 +14,7 @@ import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; @@ -35,7 +36,7 @@ public IObservableList getChildList(Object element) { return list; } - list.add(new VirtualEntry(ModelEditor.VIRTUAL_TRIMMED_WINDOW_TRIMS, TRIMMED_WINDOW__TRIM_BARS, element, "TrimBars") { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_TRIMMED_WINDOW_TRIMS, TRIMMED_WINDOW__TRIM_BARS, element, Messages.TrimmedWindowEditor_TrimBars) { @Override protected boolean accepted(Object o) { @@ -48,6 +49,6 @@ protected boolean accepted(Object o) { @Override public String getLabel(Object element) { - return "Trimmed Window"; + return Messages.TrimmedWindowEditor_TreeLabel; } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 5bc5a3d190..c1d9ae441c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -26,6 +26,7 @@ import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.WindowIconDialogEditor; @@ -66,7 +67,6 @@ public class WindowEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private IProject project; @@ -79,12 +79,11 @@ public class WindowEditor extends AbstractComponentEditor { private Action addMainMenu; private Button createRemoveMainMenu; private EStackLayout stackLayout; - private Image tbrImage; public WindowEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain, editor); this.project = project; - addMainMenu = new Action("Add Main Menu") { + addMainMenu = new Action(Messages.WindowEditor_AddMainMenu) { @Override public void run() { addMenu(); @@ -118,12 +117,12 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Window"; + return Messages.WindowEditor_TreeLabel; } @Override public String getDescription(Object element) { - return "Window bla bla bla"; + return Messages.WindowEditor_TreeLabelDescription; } @Override @@ -180,7 +179,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Id"); + l.setText(Messages.ModelTooling_Common_Id); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); @@ -193,7 +192,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("X"); + l.setText(Messages.WindowEditor_X); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); @@ -206,7 +205,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Y"); + l.setText(Messages.WindowEditor_Y); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); @@ -219,7 +218,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Width"); + l.setText(Messages.WindowEditor_Width); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); @@ -232,7 +231,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Height"); + l.setText(Messages.WindowEditor_Height); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); @@ -245,7 +244,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Label"); + l.setText(Messages.WindowEditor_Label); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); @@ -258,7 +257,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Tooltip"); + l.setText(Messages.WindowEditor_Tooltip); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); @@ -271,7 +270,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText("Icon URI"); + l.setText(Messages.WindowEditor_IconURI); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); @@ -292,7 +291,7 @@ protected URI getImageURI() { }; final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText("Find ..."); + b.setText(Messages.ModelTooling_Common_FindEllipsis); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @@ -306,7 +305,7 @@ public void widgetSelected(SelectionEvent e) { { Label l = new Label(parent, SWT.NONE); - l.setText("Main Menu"); + l.setText(Messages.WindowEditor_MainMenu); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); createRemoveMainMenu = new Button(parent, SWT.CHECK); @@ -327,11 +326,11 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ - ControlFactory.createSelectedElement(parent, this, context, "Selected Element"); - ControlFactory.createStringListWidget(parent, this, "Binding Contexts", CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, this, "Context Properties", UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createSelectedElement(parent, this, context, Messages.WindowEditor_SelectedElement); + ControlFactory.createStringListWidget(parent, this, Messages.WindowEditor_BindingContexts, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } @@ -358,7 +357,7 @@ public IObservableList getChildList(final Object element) { return list; } - list.add(new VirtualEntry(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.WindowEditor_Handlers) { @Override protected boolean accepted(Object o) { @@ -367,7 +366,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry(ModelEditor.VIRTUAL_WINDOWS, WINDOW__WINDOWS, element, "Windows") { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_WINDOWS, WINDOW__WINDOWS, element, Messages.WindowEditor_Windows) { @Override protected boolean accepted(Object o) { @@ -376,7 +375,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry(ModelEditor.VIRTUAL_WINDOW_CONTROLS, ELEMENT_CONTAINER__CHILDREN, element, "Controls") { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_WINDOW_CONTROLS, ELEMENT_CONTAINER__CHILDREN, element, Messages.WindowEditor_Controls) { @Override protected boolean accepted(Object o) { @@ -385,7 +384,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry(ModelEditor.VIRTUAL_WINDOW_SHARED_ELEMENTS, SHARED_ELEMENTS, element, "Shared Elements") { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_WINDOW_SHARED_ELEMENTS, SHARED_ELEMENTS, element, Messages.WindowEditor_SharedElements) { protected boolean accepted(Object o) { return true; } From 6c0611f468d39da97c3d7d7ab96777a88c258be2 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 18 Jul 2010 11:47:59 +0000 Subject: [PATCH 0235/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * some nls stuff --- .../e4/tools/emf/ui/internal/Messages.java | 22 ++++++++ .../tools/emf/ui/internal/Messages.properties | 24 ++++++++- .../common/commands/AddAddonCommand.java | 30 ----------- .../common/commands/MoveAddonCommand.java | 20 -------- .../common/commands/RemoveAddonCommand.java | 34 ------------- .../component/virtual/VApplicationAddons.java | 51 ++++++++++++------- .../virtual/VApplicationCategoriesEditor.java | 16 +++--- .../virtual/VBindingTableEditor.java | 34 +++---------- .../component/virtual/VCommandEditor.java | 43 ++++------------ .../component/virtual/VHandlerEditor.java | 51 ++++--------------- .../virtual/VMenuContributionsEditor.java | 51 ++++--------------- 11 files changed, 122 insertions(+), 254 deletions(-) delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index c73dc5efed..efc285d57d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -217,6 +217,7 @@ public class Messages extends NLS { public static String VBindingTableEditor_Contexts; public static String VBindingTableEditor_Name; public static String VBindingTableEditor_LabelDescription; + public static String VBindingTableEditor_BindingTables; public static String AddonsEditor_ClassURI; public static String AddonsEditor_TreeLabel; @@ -339,6 +340,27 @@ public class Messages extends NLS { public static String WindowEditor_Controls; public static String WindowEditor_SharedElements; + public static String VApplicationAddons_AddAddon; + public static String VApplicationAddons_TreeLabel; + public static String VApplicationAddons_TreeLabelDescription; + public static String VApplicationAddons_Commands; + + public static String VApplicationCategoriesEditor_TreeLabel; + public static String VApplicationCategoriesEditor_TreeLabelDescription; + public static String VApplicationCategoriesEditor_Categories; + + public static String VCommandEditor_TreeLabel; + public static String VCommandEditor_TreeLabelDescription; + public static String VCommandEditor_Commands; + + public static String VHandlerEditor_TreeLabel; + public static String VHandlerEditor_TreeLabelDescription; + public static String VHandlerEditor_Handlers; + + public static String VMenuContributionsEditor_TreeLabel; + public static String VMenuContributionsEditor_TreeLabelDescription; + public static String VMenuContributionsEditor_MenuContributions; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 924f9d57bd..c43e5e8cc7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -214,6 +214,7 @@ VBindingTableEditor_Description=Binding Configuration Bla Bla Bla Bla VBindingTableEditor_Contexts=Contexts VBindingTableEditor_Name=Name VBindingTableEditor_LabelDescription=Description +VBindingTableEditor_BindingTables=Binding Tables AddonsEditor_ClassURI=Class URI AddonsEditor_TreeLabel=Addon @@ -333,4 +334,25 @@ WindowEditor_BindingContexts=Binding Contexts WindowEditor_Handlers=Handlers WindowEditor_Windows=Windows WindowEditor_Controls=Controls -WindowEditor_SharedElements=Shared Elements \ No newline at end of file +WindowEditor_SharedElements=Shared Elements + +VApplicationAddons_AddAddon=Add Addon +VApplicationAddons_TreeLabel=Addons +VApplicationAddons_TreeLabelDescription=Addons bla bla bla bla +VApplicationAddons_Commands=Commands + +VApplicationCategoriesEditor_TreeLabel=Command Categories +VApplicationCategoriesEditor_TreeLabelDescription=Command Categories bla bla bla bla +VApplicationCategoriesEditor_Categories=Categories + +VCommandEditor_TreeLabel=Commands +VCommandEditor_TreeLabelDescription=Commands Bla Bla Bla Bla Bla +VCommandEditor_Commands=Commands + +VHandlerEditor_TreeLabel=Handlers +VHandlerEditor_TreeLabelDescription=Handlers Bla Bla Bla Bla Bla +VHandlerEditor_Handlers=Handlers + +VMenuContributionsEditor_TreeLabel=Menu Contributions +VMenuContributionsEditor_TreeLabelDescription=Menu Contributions Bla Bla Bla Bla Bla +VMenuContributionsEditor_MenuContributions=Menu Contributions \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java deleted file mode 100644 index 27cf0d5164..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.commands; - -import org.eclipse.e4.ui.model.application.MAddon; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.domain.EditingDomain; - -public class AddAddonCommand { - public void execute(EditingDomain editingDomain, MApplication parent) { - MAddon command = MApplicationFactory.INSTANCE.createAddon(); - Command cmd = AddCommand.create(editingDomain, parent, ApplicationPackageImpl.Literals.APPLICATION__ADDONS, command); - - if( cmd.canExecute() ) { - editingDomain.getCommandStack().execute(cmd); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java deleted file mode 100644 index 6c3f9889de..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.commands; - -import org.eclipse.e4.ui.model.application.MAddon; -import org.eclipse.emf.edit.domain.EditingDomain; - -public class MoveAddonCommand { - public void execute(EditingDomain editingDomain, MAddon addon, boolean up) { - - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java deleted file mode 100644 index fed166cee0..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.commands; - -import java.util.List; -import org.eclipse.e4.ui.model.application.MAddon; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; - -public class RemoveAddonCommand { - public void execute(EditingDomain editingDomain, List addons) { - EObject parent = ((EObject)addons.get(0)).eContainer(); - for( MAddon a : addons ) { - if( parent != ((EObject)a).eContainer() ) { - throw new IllegalArgumentException("The addons all have to belong to the same parent container"); - } - } - Command cmd = RemoveCommand.create(editingDomain, parent, ApplicationPackageImpl.Literals.APPLICATION__ADDONS, addons); - if( cmd.canExecute() ) { - editingDomain.getCommandStack().execute(cmd); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java index 8a32545123..ee1777872b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; import java.util.ArrayList; @@ -5,17 +15,19 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.common.commands.AddAddonCommand; -import org.eclipse.e4.tools.emf.ui.internal.common.commands.RemoveAddonCommand; import org.eclipse.e4.ui.model.application.MAddon; import org.eclipse.e4.ui.model.application.MApplication; +import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -40,13 +52,9 @@ public class VApplicationAddons extends AbstractComponentEditor { private List actions = new ArrayList(); - // FIXME We need to plug this stuff into the command frameworks - private AddAddonCommand addAddonCommand = new AddAddonCommand(); - private RemoveAddonCommand removeAddonCommand = new RemoveAddonCommand(); - public VApplicationAddons(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); - actions.add(new Action("Add Addon") { + actions.add(new Action(Messages.VApplicationAddons_AddAddon) { @Override public void run() { handleAddAddon(); @@ -61,7 +69,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Addons"; + return Messages.VApplicationAddons_TreeLabel; } @Override @@ -71,7 +79,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Addons bla bla bla bla"; + return Messages.VApplicationAddons_TreeLabelDescription; } @Override @@ -94,7 +102,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); - l.setText("Commands"); + l.setText(Messages.VApplicationAddons_Commands); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); viewer = new TableViewer(parent); @@ -116,7 +124,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -143,7 +151,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -170,7 +178,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -181,7 +189,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -198,16 +206,23 @@ public void widgetSelected(SelectionEvent e) { } private void handleAddAddon() { - addAddonCommand.execute(getEditingDomain(), (MApplication) getMaster().getValue()); + MAddon command = MApplicationFactory.INSTANCE.createAddon(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__ADDONS, command); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } } - private void handleRemoveAddons(List addons) { - removeAddonCommand.execute(getEditingDomain(), addons); + private void handleRemoveAddons(List addons) { + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__ADDONS, addons); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } } @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java index a97af9b7b1..c682ea4c7f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java @@ -15,6 +15,7 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; @@ -62,7 +63,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Command Categories"; + return Messages.VApplicationCategoriesEditor_TreeLabel; } @Override @@ -72,7 +73,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Command Categories bla bla bla bla"; + return Messages.VApplicationCategoriesEditor_TreeLabelDescription; } @Override @@ -95,7 +96,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); - l.setText("Categories"); + l.setText(Messages.VApplicationCategoriesEditor_Categories); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); viewer = new TableViewer(parent); @@ -117,7 +118,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -144,7 +145,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -171,7 +172,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -188,7 +189,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -210,7 +211,6 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index 4f359ccde9..67f6ed5754 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -11,9 +11,7 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; import java.util.List; -import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; @@ -26,18 +24,14 @@ import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -53,7 +47,6 @@ public class VBindingTableEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private TableViewer bindingViewer; - private TreeViewer contextsViewer; public VBindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); @@ -99,7 +92,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); - l.setText("Binding Tables"); + l.setText(Messages.VBindingTableEditor_BindingTables); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); bindingViewer = new TableViewer(parent); @@ -120,7 +113,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -147,7 +140,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -174,7 +167,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -191,7 +184,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -213,22 +206,7 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } - private static class ObservableFactoryImpl implements IObservableFactory { - private IEMFListProperty prop = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN); - - public IObservable createObservable(Object target) { - if (target instanceof IObservableList) { - return (IObservable) target; - } - return prop.observe(target); - } - } - - private static class TreeStructureAdvisorImpl extends TreeStructureAdvisor { - - } -} +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index 0e45fe1884..551b505675 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -14,19 +14,15 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.commands.impl.CommandsFactoryImpl; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; @@ -36,7 +32,6 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -67,7 +62,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Commands"; + return Messages.VCommandEditor_TreeLabel; } @Override @@ -77,7 +72,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Commands Bla Bla Bla Bla Bla"; + return Messages.VCommandEditor_TreeLabelDescription; } @Override @@ -100,7 +95,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); - l.setText("Commands"); + l.setText(Messages.VCommandEditor_Commands); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); viewer = new TableViewer(parent); @@ -110,24 +105,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gd.heightHint = 300; viewer.getControl().setLayoutData(gd); viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Name"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Id"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); @@ -139,7 +117,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -166,7 +144,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -193,7 +171,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -210,7 +188,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -232,7 +210,6 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index e2a3d703b3..4825357548 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -14,19 +14,16 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.commands.MHandlerContainer; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; @@ -35,7 +32,6 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -63,7 +59,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Handlers"; + return Messages.VHandlerEditor_TreeLabel; } @Override @@ -73,7 +69,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Handlers Bla Bla Bla Bla Bla"; + return Messages.VHandlerEditor_TreeLabelDescription; } @Override @@ -96,7 +92,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); - l.setText("Handlers"); + l.setText(Messages.VHandlerEditor_Handlers); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); viewer = new TableViewer(parent); @@ -106,33 +102,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gd.heightHint = 300; viewer.getControl().setLayoutData(gd); viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.HANDLER__COMMAND, CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME)); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Command"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Class"); - column.getColumn().setWidth(300); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Id"); - column.getColumn().setWidth(150); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); @@ -144,7 +114,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -171,7 +141,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -198,7 +168,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -215,7 +185,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -237,7 +207,6 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java index 715b29c9b0..f7e48213f9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java @@ -14,19 +14,16 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution; import org.eclipse.e4.ui.model.application.ui.menu.MMenuContributions; import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; @@ -35,7 +32,6 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -63,7 +59,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Menu Contributions"; + return Messages.VMenuContributionsEditor_TreeLabel; } @Override @@ -73,7 +69,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Menu Contributions Bla Bla Bla Bla Bla"; + return Messages.VMenuContributionsEditor_TreeLabelDescription; } @Override @@ -96,7 +92,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); - l.setText("Menu Contributions"); + l.setText(Messages.VMenuContributionsEditor_MenuContributions); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); viewer = new TableViewer(parent); @@ -106,33 +102,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gd.heightHint = 300; viewer.getControl().setLayoutData(gd); viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Id"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__PARENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("ParentId"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__POSITION_IN_PARENT); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Position"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); @@ -144,7 +114,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -171,7 +141,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -198,7 +168,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -215,7 +185,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -237,7 +207,6 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } } From 148c2198aac35650ba4758a5ff5cece3fb887ab4 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 18 Jul 2010 12:35:04 +0000 Subject: [PATCH 0236/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * some nls stuff --- .../e4/tools/emf/ui/internal/Messages.java | 40 ++++++++++ .../tools/emf/ui/internal/Messages.properties | 42 ++++++++++- .../common/component/virtual/VMenuEditor.java | 75 +++++++++++++++---- .../virtual/VModelFragmentsEditor.java | 21 ++---- .../virtual/VModelImportsEditor.java | 14 ++-- .../component/virtual/VPartDescriptor.java | 42 +++-------- .../virtual/VToolBarContributionsEditor.java | 50 +++---------- .../virtual/VTrimContributionsEditor.java | 51 +++---------- .../virtual/VWindowControlEditor.java | 20 ++--- .../component/virtual/VWindowEditor.java | 68 +++-------------- .../virtual/VWindowSharedElementsEditor.java | 14 ++-- .../component/virtual/VWindowTrimEditor.java | 11 +-- 12 files changed, 215 insertions(+), 233 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index efc285d57d..06b182325c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -361,6 +361,46 @@ public class Messages extends NLS { public static String VMenuContributionsEditor_TreeLabelDescription; public static String VMenuContributionsEditor_MenuContributions; + public static String VMenuEditor_TreeLabel; + public static String VMenuEditor_TreeLabelDescription; + public static String VMenuEditor_Menus; + + public static String VModelFragmentsEditor_TreeLabel; + public static String VModelFragmentsEditor_TreeLabelDescription; + public static String VModelFragmentsEditor_Fragments; + + public static String VModelImportsEditor_TreeLabel; + public static String VModelImportsEditor_TreeLabelDescription; + public static String VModelImportsEditor_Imports; + + public static String VPartDescriptor_TreeLabel; + public static String VPartDescriptor_TreeLabelDescription; + public static String VPartDescriptor_Descriptors; + + public static String VToolBarContributionsEditor_Contributions; + public static String VToolBarContributionsEditor_TreeLabelDescription; + public static String VToolBarContributionsEditor_TreeLabel; + + public static String VTrimContributionsEditor_TreeLabel; + public static String VTrimContributionsEditor_TreeLabelDescription; + public static String VTrimContributionsEditor_Contributions; + + public static String VWindowControlEditor_TreeLabel; + public static String VWindowControlEditor_TreeLabelDescription; + public static String VWindowControlEditor_Controls; + + public static String VWindowEditor_TreeLabel; + public static String VWindowEditor_TreeLabelDescription; + public static String VWindowEditor_Windows; + + public static String VWindowSharedElementsEditor_TreeLabel; + public static String VWindowSharedElementsEditor_TreeLabelDescription; + public static String VWindowSharedElementsEditor_Controls; + + public static String VWindowTrimEditor_TreeLabel; + public static String VWindowTrimEditor_TreeLabelDescription; + public static String VWindowTrimEditor_Controls; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index c43e5e8cc7..2f35202a5e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -355,4 +355,44 @@ VHandlerEditor_Handlers=Handlers VMenuContributionsEditor_TreeLabel=Menu Contributions VMenuContributionsEditor_TreeLabelDescription=Menu Contributions Bla Bla Bla Bla Bla -VMenuContributionsEditor_MenuContributions=Menu Contributions \ No newline at end of file +VMenuContributionsEditor_MenuContributions=Menu Contributions + +VMenuEditor_TreeLabel=Menus +VMenuEditor_TreeLabelDescription=Menus Bla Bla Bla Bla Bla +VMenuEditor_Menus=Menus + +VModelFragmentsEditor_TreeLabel=Fragments +VModelFragmentsEditor_TreeLabelDescription=Fragments Bla Bla Bla Bla Bla +VModelFragmentsEditor_Fragments=Fragments + +VModelImportsEditor_TreeLabel=Imports +VModelImportsEditor_TreeLabelDescription=Imports Bla Bla Bla Bla Bla +VModelImportsEditor_Imports=Imports + +VPartDescriptor_TreeLabel=Part Descriptors +VPartDescriptor_TreeLabelDescription=Part Descriptors Bla Bla Bla Bla Bla +VPartDescriptor_Descriptors=Descriptors + +VToolBarContributionsEditor_TreeLabel=ToolBar Contributions +VToolBarContributionsEditor_TreeLabelDescription=ToolBar Contributions Bla Bla Bla Bla Bla +VToolBarContributionsEditor_Contributions=ToolBar Contributions + +VTrimContributionsEditor_TreeLabel=Trim Contributions +VTrimContributionsEditor_TreeLabelDescription=Trim Contributions Bla Bla Bla Bla Bla +VTrimContributionsEditor_Contributions=Trim Contributions + +VWindowControlEditor_TreeLabel=Controls +VWindowControlEditor_TreeLabelDescription=Controls Bla Bla Bla Bla Bla +VWindowControlEditor_Controls=Controls + +VWindowEditor_TreeLabel=Windows +VWindowEditor_TreeLabelDescription=Windows Bla Bla Bla Bla Bla +VWindowEditor_Windows=Windows + +VWindowSharedElementsEditor_TreeLabel=Shared Elements +VWindowSharedElementsEditor_TreeLabelDescription=Shared Elements Bla Bla Bla Bla +VWindowSharedElementsEditor_Controls=Controls + +VWindowTrimEditor_TreeLabel=Window Trims +VWindowTrimEditor_TreeLabelDescription=Window Trims Bla Bla Bla Bla Bla +VWindowTrimEditor_Controls=Controls \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java index ff13dd9f52..a7678f8990 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -14,23 +14,25 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; @@ -61,7 +63,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Menus"; + return Messages.VMenuEditor_TreeLabel; } @Override @@ -71,7 +73,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Menus Bla Bla Bla Bla Bla"; + return Messages.VMenuEditor_TreeLabelDescription; } @Override @@ -93,19 +95,17 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr parent.setLayout(gl); Label l = new Label(parent, SWT.NONE); - l.setText("Menus"); + l.setText(Messages.VMenuEditor_Menus); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - viewer.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); + viewer.getTable().setHeaderVisible(true); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); @@ -117,17 +117,62 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + EObject container = (EObject) getMaster().getValue(); + int idx = ((List) container.eGet(feature)).indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), feature, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + EObject container = (EObject) getMaster().getValue(); + List list = (List) container.eGet(feature); + int idx = list.indexOf(obj) + 1; + if (idx < list.size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -144,7 +189,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java index e5892602bd..3ed39f68a4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java @@ -14,6 +14,7 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; @@ -23,8 +24,6 @@ import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; @@ -60,7 +59,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Fragments"; + return Messages.VModelFragmentsEditor_TreeLabel; } @Override @@ -70,7 +69,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Fragments Bla Bla Bla Bla Bla"; + return Messages.VModelFragmentsEditor_TreeLabelDescription; } @Override @@ -93,7 +92,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); - l.setText("Fragments"); + l.setText(Messages.VModelFragmentsEditor_Fragments); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); viewer = new TableViewer(parent); @@ -105,9 +104,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS); - viewer.setInput(prop.observeDetail(getMaster())); - Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); gl = new GridLayout(2, false); @@ -118,7 +114,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -145,7 +141,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -172,7 +168,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add"); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @@ -191,7 +187,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -214,7 +210,6 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java index f351dc6aa2..6ccec9918d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java @@ -16,6 +16,7 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; @@ -69,7 +70,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Imports"; + return Messages.VModelImportsEditor_TreeLabel; } @Override @@ -79,7 +80,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Imports Bla Bla Bla Bla Bla"; + return Messages.VModelImportsEditor_TreeLabelDescription; } @Override @@ -102,7 +103,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); - l.setText("Imports"); + l.setText(Messages.VModelImportsEditor_Imports); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); viewer = new TableViewer(parent); @@ -122,7 +123,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -149,7 +150,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -220,7 +221,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -258,7 +259,6 @@ public void addClasses(EPackage ePackage, List list) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java index ac08e04bc6..7e92a05fd7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java @@ -14,19 +14,16 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory; import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptorContainer; import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; @@ -35,7 +32,6 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -63,7 +59,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Part Descriptors"; + return Messages.VPartDescriptor_TreeLabel; } @Override @@ -73,7 +69,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Part Descriptors Bla Bla Bla Bla Bla"; + return Messages.VPartDescriptor_TreeLabelDescription; } @Override @@ -96,7 +92,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); - l.setText("Descriptors"); + l.setText(Messages.VPartDescriptor_Descriptors); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); viewer = new TableViewer(parent); @@ -106,24 +102,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gd.heightHint = 300; viewer.getControl().setLayoutData(gd); viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Name"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CATEGORY); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Category"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); @@ -135,7 +114,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -162,7 +141,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -189,7 +168,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -206,7 +185,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -228,7 +207,6 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java index 3d1ba17b3a..67228f0d83 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java @@ -14,19 +14,16 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution; import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContributions; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; @@ -35,7 +32,6 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -63,7 +59,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "ToolBar Contributions"; + return Messages.VToolBarContributionsEditor_TreeLabel; } @Override @@ -73,7 +69,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "ToolBar Contributions Bla Bla Bla Bla Bla"; + return Messages.VToolBarContributionsEditor_TreeLabelDescription; } @Override @@ -96,7 +92,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); - l.setText("ToolBar Contributions"); + l.setText(Messages.VToolBarContributionsEditor_Contributions); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); viewer = new TableViewer(parent); @@ -106,33 +102,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gd.heightHint = 300; viewer.getControl().setLayoutData(gd); viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Id"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__PARENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("ParentId"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__POSITION_IN_PARENT); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Position"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); @@ -144,7 +114,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -171,7 +141,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -198,7 +168,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -215,7 +185,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java index 925129a5f0..6166aaf8f8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java @@ -14,19 +14,16 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.e4.ui.model.application.ui.menu.MTrimContribution; import org.eclipse.e4.ui.model.application.ui.menu.MTrimContributions; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; @@ -35,7 +32,6 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -63,7 +59,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Trim Contributions"; + return Messages.VTrimContributionsEditor_TreeLabel; } @Override @@ -73,7 +69,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Trim Contributions Bla Bla Bla Bla Bla"; + return Messages.VTrimContributionsEditor_TreeLabelDescription; } @Override @@ -96,7 +92,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); - l.setText("Trim Contributions"); + l.setText(Messages.VTrimContributionsEditor_Contributions); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); viewer = new TableViewer(parent); @@ -106,33 +102,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gd.heightHint = 300; viewer.getControl().setLayoutData(gd); viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Id"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__PARENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("ParentId"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__POSITION_IN_PARENT); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Position"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); @@ -144,7 +114,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -171,7 +141,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -198,7 +168,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -215,7 +185,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -237,7 +207,6 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index 87e5278b7d..f111c9ec46 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -15,6 +15,7 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; @@ -25,8 +26,6 @@ import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; @@ -67,7 +66,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Controls"; + return Messages.VWindowControlEditor_TreeLabel; } @Override @@ -77,7 +76,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Controls Bla Bla Bla Bla Bla"; + return Messages.VWindowControlEditor_TreeLabelDescription; } @Override @@ -100,21 +99,17 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); - l.setText("Controls"); + l.setText(Messages.VWindowControlEditor_Controls); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); gl = new GridLayout(2, false); @@ -125,7 +120,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -149,7 +144,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -206,7 +201,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -229,7 +224,6 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index bb4dbe0c9f..234af90722 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -15,18 +15,16 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; @@ -40,7 +38,6 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -68,7 +65,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Windows"; + return Messages.VWindowEditor_TreeLabel; } @Override @@ -78,7 +75,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Windows Bla Bla Bla Bla Bla"; + return Messages.VWindowEditor_TreeLabelDescription; } @Override @@ -100,62 +97,16 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr parent.setLayout(gl); Label l = new Label(parent, SWT.NONE); - l.setText("Windows"); + l.setText(Messages.VWindowEditor_Windows); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Name"); - column.getColumn().setWidth(180); - column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__X); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("X"); - column.getColumn().setWidth(80); - column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__Y); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Y"); - column.getColumn().setWidth(80); - column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__WIDTH); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Width"); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__HEIGHT); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Height"); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider(valProp.observeDetail(cp.getKnownElements()))); - } Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); @@ -168,7 +119,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -192,7 +143,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -246,7 +197,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -271,7 +222,6 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java index f8f48d06cb..076f2cdb8a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java @@ -14,6 +14,7 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; @@ -64,7 +65,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Shared Elements"; + return Messages.VWindowSharedElementsEditor_TreeLabel; } @Override @@ -74,7 +75,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Shared Elements Bla Bla Bla Bla"; + return Messages.VWindowSharedElementsEditor_TreeLabelDescription; } @Override @@ -97,7 +98,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); - l.setText("Controls"); + l.setText(Messages.VWindowSharedElementsEditor_Controls); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); viewer = new TableViewer(parent); @@ -122,7 +123,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); + b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -149,7 +150,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); + b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -210,7 +211,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @@ -233,7 +234,6 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java index f921ef902d..abc168cd8f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -14,6 +14,7 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; @@ -55,7 +56,7 @@ public Image getImage(Object element, Display display) { @Override public String getLabel(Object element) { - return "Window Trims"; + return Messages.VWindowTrimEditor_TreeLabel; } @Override @@ -65,7 +66,7 @@ public String getDetailLabel(Object element) { @Override public String getDescription(Object element) { - return "Window Trims Bla Bla Bla Bla Bla"; + return Messages.VWindowTrimEditor_TreeLabelDescription; } @Override @@ -88,7 +89,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr { Label l = new Label(parent, SWT.NONE); - l.setText("Controls"); + l.setText(Messages.VWindowTrimEditor_Controls); l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); viewer = new TableViewer(parent); @@ -110,7 +111,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add Trim"); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -127,7 +128,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); + b.setText(Messages.ModelTooling_Common_Remove); b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { From 1ccb359e3c1a560c7cbf48d5701169fa8b351661 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 18 Jul 2010 13:43:15 +0000 Subject: [PATCH 0237/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * some nls stuff --- .../tools/emf/ui/common/XMIModelResource.java | 28 +++---- .../e4/tools/emf/ui/internal/Messages.java | 64 +++++++++++++++ .../tools/emf/ui/internal/Messages.properties | 66 +++++++++++++++- .../AbstractCommandSelectionDialog.java | 68 ++++++++-------- .../component/dialogs/AbstractIconDialog.java | 25 +++--- .../BindingContextSelectionDialog.java | 10 +-- .../CommandCategorySelectionDialog.java | 8 +- .../dialogs/ContributionClassDialog.java | 79 +++++++++---------- .../dialogs/FeatureSelectionDialog.java | 1 - .../dialogs/FindImportElementDialog.java | 17 ++-- .../FindParentReferenceElementDialog.java | 21 +++-- ...HandledMenuItemCommandSelectionDialog.java | 17 ++-- ...HandledToolItemCommandSelectionDialog.java | 17 ++-- .../HandlerCommandSelectionDialog.java | 17 ++-- .../KeyBindingCommandSelectionDialog.java | 15 ++-- .../dialogs/MenuIconDialogEditor.java | 8 +- .../dialogs/MenuItemIconDialogEditor.java | 8 +- .../PartDescriptorIconDialogEditor.java | 8 +- .../dialogs/PartIconDialogEditor.java | 7 +- .../dialogs/PerspectiveIconDialogEditor.java | 8 +- 20 files changed, 310 insertions(+), 182 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java index aa8bae4b27..d6b47cfe80 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java @@ -30,32 +30,26 @@ import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -@SuppressWarnings("restriction") public class XMIModelResource implements IModelResource { private EditingDomain editingDomain; private Resource resource; private List listeners = new ArrayList(); private boolean dirty; - public XMIModelResource(URI uri) { - ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); ResourceSet resourceSet = new ResourceSetImpl(); BasicCommandStack commandStack = new BasicCommandStack(); commandStack.addCommandStackListener(new CommandStackListener() { - + public void commandStackChanged(EventObject event) { dirty = true; fireDirtyChanged(); fireCommandStackChanged(); } }); - editingDomain = new AdapterFactoryEditingDomain(adapterFactory, - commandStack, resourceSet); - resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap() - .put(Resource.Factory.Registry.DEFAULT_EXTENSION, - new E4XMIResourceFactory()); + editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, resourceSet); + resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new E4XMIResourceFactory()); resource = resourceSet.getResource(uri, true); } @@ -76,27 +70,27 @@ public boolean isSaveable() { public void addModelListener(ModelListener listener) { listeners.add(listener); } - + public void removeModelListener(ModelListener listener) { listeners.remove(listener); } - + public boolean isDirty() { return dirty && getEditingDomain().getCommandStack().canUndo(); } - + private void fireDirtyChanged() { - for( ModelListener listener : listeners ) { + for (ModelListener listener : listeners) { listener.dirtyChanged(); } } - + private void fireCommandStackChanged() { - for( ModelListener listener : listeners ) { + for (ModelListener listener : listeners) { listener.commandStackChanged(); } } - + public IStatus save() { Map map = new HashMap(); try { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 06b182325c..34cd530daa 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -401,6 +401,70 @@ public class Messages extends NLS { public static String VWindowTrimEditor_TreeLabelDescription; public static String VWindowTrimEditor_Controls; + public static String AbstractIconDialog_IconName; + + public static String BindingContextSelectionDialog_ShellTitle; + public static String BindingContextSelectionDialog_Title; + public static String BindingContextSelectionDialog_Message; + public static String BindingContextSelectionDialog_NoIdReference; + + public static String CommandCategorySelectionDialog_ShellTitle; + public static String CommandCategorySelectionDialog_Title; + public static String CommandCategorySelectionDialog_Message; + + public static String FindImportElementDialog_ShellTitle; + public static String FindImportElementDialog_Title; + public static String FindImportElementDialog_Message; + public static String FindImportElementDialog_Search; + public static String FindImportElementDialog_ClearCache; + public static String FindImportElementDialog_NoIdReference; + public static String FindImportElementDialog_noId; + + public static String FindParentReferenceElementDialog_ShellTitle; + public static String FindParentReferenceElementDialog_Title; + public static String FindParentReferenceElementDialog_Message; + public static String FindParentReferenceElementDialog_ContainerType; + public static String FindParentReferenceElementDialog_Search; + public static String FindParentReferenceElementDialog_NoId; + public static String FindParentReferenceElementDialog_ClearCache; + public static String FindParentReferenceElementDialog_NoReferenceId; + + public static String HandledMenuItemCommandSelectionDialog_ShellTitle; + public static String HandledMenuItemCommandSelectionDialog_DialogTitle; + public static String HandledMenuItemCommandSelectionDialog_DialogMessage; + + public static String HandledToolItemCommandSelectionDialog_ShellTitle; + public static String HandledToolItemCommandSelectionDialog_DialogTitle; + public static String HandledToolItemCommandSelectionDialog_DialogMessage; + + public static String HandlerCommandSelectionDialog_ShellTitle; + public static String HandlerCommandSelectionDialog_DialogTitle; + public static String HandlerCommandSelectionDialog_DialogMessage; + + public static String KeyBindingCommandSelectionDialog_ShellTitle; + public static String KeyBindingCommandSelectionDialog_DialogTitle; + public static String KeyBindingCommandSelectionDialog_DialogMessage; + + public static String MenuIconDialogEditor_ShellTitle; + public static String MenuIconDialogEditor_DialogTitle; + public static String MenuIconDialogEditor_DialogMessage; + + public static String MenuItemIconDialogEditor_ShellTitle; + public static String MenuItemIconDialogEditor_DialogTitle; + public static String MenuItemIconDialogEditor_DialogMessage; + + public static String PartDescriptorIconDialogEditor_ShellTitle; + public static String PartDescriptorIconDialogEditor_DialogTitle; + public static String PartDescriptorIconDialogEditor_DialogMessage; + + public static String PartIconDialogEditor_ShellTitle; + public static String PartIconDialogEditor_DialogTitle; + public static String PartIconDialogEditor_DialogMessage; + + public static String PerspectiveIconDialogEditor_ShellTitle; + public static String PerspectiveIconDialogEditor_DialogTitle; + public static String PerspectiveIconDialogEditor_DialogMessage; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 2f35202a5e..44be9b210d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -395,4 +395,68 @@ VWindowSharedElementsEditor_Controls=Controls VWindowTrimEditor_TreeLabel=Window Trims VWindowTrimEditor_TreeLabelDescription=Window Trims Bla Bla Bla Bla Bla -VWindowTrimEditor_Controls=Controls \ No newline at end of file +VWindowTrimEditor_Controls=Controls + +AbstractIconDialog_IconName=IconName + +BindingContextSelectionDialog_ShellTitle=BindingContext Dialog +BindingContextSelectionDialog_Title=BindingContext +BindingContextSelectionDialog_Message=Search for a BindingContext +BindingContextSelectionDialog_NoIdReference=You can not reference an element without an ID + +CommandCategorySelectionDialog_ShellTitle=Command Category Dialog +CommandCategorySelectionDialog_Title=Command Category +CommandCategorySelectionDialog_Message=Search for a Command Category + +FindImportElementDialog_ShellTitle=Find Import Elements +FindImportElementDialog_Title=Find Import Elements +FindImportElementDialog_Message=Search for an elements whose ID you'd like to import +FindImportElementDialog_Search=Search +FindImportElementDialog_noId=no id +FindImportElementDialog_ClearCache=Clear Cache +FindImportElementDialog_NoIdReference=You can not import an element without an ID + +FindParentReferenceElementDialog_ShellTitle=Find Parent Elements +FindParentReferenceElementDialog_Title=Find Parent Elements +FindParentReferenceElementDialog_Message=Search for an elements who you like to references as parent +FindParentReferenceElementDialog_ContainerType=Container-Type +FindParentReferenceElementDialog_Search=Search +FindParentReferenceElementDialog_ClearCache=Clear Cache +FindParentReferenceElementDialog_NoReferenceId=You can not reference an element without an ID +FindParentReferenceElementDialog_NoId=no id + +HandledMenuItemCommandSelectionDialog_ShellTitle=MenuItem Command +HandledMenuItemCommandSelectionDialog_DialogTitle=MenuItem-Command +HandledMenuItemCommandSelectionDialog_DialogMessage=Connect the MenuItem to a command + +HandledToolItemCommandSelectionDialog_ShellTitle=ToolItem Command +HandledToolItemCommandSelectionDialog_DialogTitle=ToolItem-Command +HandledToolItemCommandSelectionDialog_DialogMessage=Connect the ToolItem to a command + +HandlerCommandSelectionDialog_ShellTitle=Handler Command +HandlerCommandSelectionDialog_DialogTitle=Handler-Command +HandlerCommandSelectionDialog_DialogMessage=Connect the handler to a command + +KeyBindingCommandSelectionDialog_ShellTitle=Keybinding Command +KeyBindingCommandSelectionDialog_DialogTitle=Keybinding-Command +KeyBindingCommandSelectionDialog_DialogMessage=Connect the keybinding to a command + +MenuIconDialogEditor_ShellTitle=Menu Icon Search +MenuIconDialogEditor_DialogTitle=Menu Icon Search +MenuIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project + +MenuItemIconDialogEditor_ShellTitle=Menu Item Icon Search +MenuItemIconDialogEditor_DialogTitle=Menu Item Icon Search +MenuItemIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project + +PartDescriptorIconDialogEditor_ShellTitle=Part Descriptor Icon Search +PartDescriptorIconDialogEditor_DialogTitle=Part Descriptor Icon Search +PartDescriptorIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project + +PartIconDialogEditor_ShellTitle=Part Icon Search +PartIconDialogEditor_DialogTitle=Part Icon Search +PartIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project + +PerspectiveIconDialogEditor_ShellTitle=Perspective Icon Search +PerspectiveIconDialogEditor_DialogTitle=Perspective Icon Search +PerspectiveIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java index d0ae2cab10..9968650d51 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java @@ -58,25 +58,27 @@ public AbstractCommandSelectionDialog(Shell parentShell, IModelResource resource } protected abstract String getShellTitle(); + protected abstract String getDialogTitle(); + protected abstract String getDialogMessage(); - + @Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); - getShell().setText( getShellTitle()); - setTitle( getDialogTitle() ); - setMessage( getDialogMessage() ); - - final Image titleImage = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newexp_wiz.png")); + getShell().setText(getShellTitle()); + setTitle(getDialogTitle()); + setMessage(getDialogMessage()); + + final Image titleImage = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newexp_wiz.png")); //$NON-NLS-1$ setTitleImage(titleImage); getShell().addDisposeListener(new DisposeListener() { - + public void widgetDisposed(DisposeEvent e) { titleImage.dispose(); } }); - + Composite container = new Composite(composite, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); container.setLayout(new GridLayout(2, false)); @@ -93,22 +95,22 @@ public void widgetDisposed(DisposeEvent e) { viewer.setLabelProvider(new LabelProviderImpl()); viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); viewer.addDoubleClickListener(new IDoubleClickListener() { - + public void doubleClick(DoubleClickEvent event) { okPressed(); } }); - + List commands = new ArrayList(); - TreeIterator it = EcoreUtil.getAllContents((EObject)resource.getRoot().get(0), true); - while( it.hasNext() ) { + TreeIterator it = EcoreUtil.getAllContents((EObject) resource.getRoot().get(0), true); + while (it.hasNext()) { EObject o = it.next(); - if( o.eClass() == CommandsPackageImpl.Literals.COMMAND ) { + if (o.eClass() == CommandsPackageImpl.Literals.COMMAND) { commands.add(o); } } viewer.setInput(commands); - + final PatternFilter filter = new PatternFilter() { @Override protected boolean isParentMatch(Viewer viewer, Object element) { @@ -130,31 +132,31 @@ public void modifyText(ModifyEvent e) { @Override protected void okPressed() { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if( ! s.isEmpty() ) { - Command cmd = createStoreCommand( resource.getEditingDomain(), (MCommand) s.getFirstElement() ); - if( cmd.canExecute() ) { + if (!s.isEmpty()) { + Command cmd = createStoreCommand(resource.getEditingDomain(), (MCommand) s.getFirstElement()); + if (cmd.canExecute()) { resource.getEditingDomain().getCommandStack().execute(cmd); super.okPressed(); } } } - - protected abstract Command createStoreCommand( EditingDomain editingDomain, MCommand command); - + + protected abstract Command createStoreCommand(EditingDomain editingDomain, MCommand command); + private static class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { - + public void update(final ViewerCell cell) { MCommand cmd = (MCommand) cell.getElement(); - + StyledString styledString = new StyledString(); - if( cmd.getCommandName() != null ) { + if (cmd.getCommandName() != null) { styledString.append(cmd.getCommandName()); } - if( cmd.getDescription() != null ) { - styledString.append(" - " + cmd.getDescription(),StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + if (cmd.getDescription() != null) { + styledString.append(" - " + cmd.getDescription(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ } - if( cmd.getElementId() != null ) { - styledString.append(" - " + cmd.getElementId(),StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + if (cmd.getElementId() != null) { + styledString.append(" - " + cmd.getElementId(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ } cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); @@ -167,18 +169,18 @@ public Image getImage(Object element) { public String getText(Object element) { MCommand command = (MCommand) element; String s = ""; //$NON-NLS-1$ - if( command.getCommandName() != null ) { + if (command.getCommandName() != null) { s += command.getCommandName(); } - - if( command.getDescription() != null ) { + + if (command.getDescription() != null) { s += " " + command.getDescription(); //$NON-NLS-1$ } - - if( command.getElementId() != null ) { + + if (command.getElementId() != null) { s += " " + command.getElementId(); //$NON-NLS-1$ } - + return s; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java index a054c2c764..7e72bc38db 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java @@ -16,6 +16,7 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceVisitor; import org.eclipse.core.runtime.CoreException; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.StringMatcher; import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.emf.common.command.Command; @@ -80,7 +81,7 @@ protected Control createDialogArea(Composite parent) { container.setLayout(new GridLayout(2, false)); Label l = new Label(container, SWT.NONE); - l.setText("IconName"); + l.setText(Messages.AbstractIconDialog_IconName); final Text t = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -118,12 +119,12 @@ public void update(ViewerCell cell) { } } } - + String bundle = getBundle(file); - if( bundle != null ) { + if (bundle != null) { styledString.append(" - " + bundle, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ } - + cell.setImage(img); cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); @@ -133,7 +134,7 @@ public void update(ViewerCell cell) { final WritableList list = new WritableList(); viewer.setInput(list); viewer.addDoubleClickListener(new IDoubleClickListener() { - + public void doubleClick(DoubleClickEvent event) { okPressed(); } @@ -152,7 +153,7 @@ public void modifyText(ModifyEvent e) { task.cancel(); } list.clear(); - + clearImages(); callback = new IconMatchCallback(list); @@ -170,23 +171,23 @@ public void widgetDisposed(DisposeEvent e) { return comp; } - + private void clearImages() { for (Image img : icons.values()) { img.dispose(); } icons.clear(); } - + @Override protected void okPressed() { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if( ! s.isEmpty() ) { + if (!s.isEmpty()) { IFile file = (IFile) s.getFirstElement(); String bundle = getBundle(file); - String uri = "platform:/plugin/"+bundle+"/"+file.getProjectRelativePath().toString(); + String uri = "platform:/plugin/" + bundle + "/" + file.getProjectRelativePath().toString(); //$NON-NLS-1$//$NON-NLS-2$ Command cmd = SetCommand.create(editingDomain, element, feature, uri); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { editingDomain.getCommandStack().execute(cmd); super.okPressed(); } @@ -232,7 +233,7 @@ private String getBundle(IFile file) { } return null; } - + private class IconMatchCallback { private volatile boolean cancel; private IObservableList list; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java index 9f7d22179d..559841a18b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java @@ -63,11 +63,11 @@ public String getSelectedId() { @Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); - getShell().setText("BindingContext Dialog"); - setTitle("BindingContext"); - setMessage("Search for a BindingContext"); + getShell().setText(Messages.BindingContextSelectionDialog_ShellTitle); + setTitle(Messages.BindingContextSelectionDialog_Title); + setMessage(Messages.BindingContextSelectionDialog_Message); - final Image titleImage = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newexp_wiz.png")); + final Image titleImage = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newexp_wiz.png")); //$NON-NLS-1$ setTitleImage(titleImage); getShell().addDisposeListener(new DisposeListener() { @@ -134,7 +134,7 @@ protected void okPressed() { if (selectedId != null && selectedId.trim().length() > 0) { super.okPressed(); } else { - setErrorMessage("You can not reference an element without an ID"); + setErrorMessage(Messages.BindingContextSelectionDialog_NoIdReference); } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java index a5531d2ce7..4c6d63ed1c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java @@ -63,11 +63,11 @@ public CommandCategorySelectionDialog(Shell parentShell, IModelResource resource @Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); - getShell().setText("Command Category Dialog"); - setTitle("Command Category"); - setMessage("Search for a Command Category"); + getShell().setText(Messages.CommandCategorySelectionDialog_ShellTitle); + setTitle(Messages.CommandCategorySelectionDialog_Title); + setMessage(Messages.CommandCategorySelectionDialog_Message); - final Image titleImage = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newexp_wiz.png")); + final Image titleImage = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newexp_wiz.png")); //$NON-NLS-1$ setTitleImage(titleImage); getShell().addDisposeListener(new DisposeListener() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java index 005cba0506..dc9338fdbd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -57,10 +57,10 @@ public class ContributionClassDialog extends TitleAreaDialog { private EditingDomain editingDomain; private TableViewer viewer; private EStructuralFeature feature; - + public ContributionClassDialog(Shell parentShell, IProject project, EditingDomain editingDomain, MApplicationElement contribution, EStructuralFeature feature) { super(parentShell); - this.project = project; + this.project = project; this.contribution = contribution; this.editingDomain = editingDomain; this.feature = feature; @@ -69,36 +69,36 @@ public ContributionClassDialog(Shell parentShell, IProject project, EditingDomai @Override protected Control createDialogArea(Composite parent) { Composite comp = (Composite) super.createDialogArea(parent); - + getShell().setText(Messages.ContributionClassDialog_ShellTitle); setTitle(Messages.ContributionClassDialog_DialogTitle); setMessage(Messages.ContributionClassDialog_DialogMessage); - - final Image titleImage = new Image(comp.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newclass_wiz.png")); + + final Image titleImage = new Image(comp.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newclass_wiz.png")); //$NON-NLS-1$ setTitleImage(titleImage); - + getShell().addDisposeListener(new DisposeListener() { - + public void widgetDisposed(DisposeEvent e) { javaClassImage.dispose(); titleImage.dispose(); } }); - + javaClassImage = new Image(getShell().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/class_obj.gif")); //$NON-NLS-1$ - + Composite container = new Composite(comp, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(2,false)); - + container.setLayout(new GridLayout(2, false)); + Label l = new Label(container, SWT.NONE); l.setText(Messages.ContributionClassDialog_Label_Classname); - + final Text t = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - new Label(container,SWT.NONE); - + + new Label(container, SWT.NONE); + viewer = new TableViewer(container); GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); @@ -108,42 +108,41 @@ public void widgetDisposed(DisposeEvent e) { public void update(ViewerCell cell) { ContributionData data = (ContributionData) cell.getElement(); StyledString styledString = new StyledString(data.className, null); - - if( data.bundleName != null ) { + + if (data.bundleName != null) { styledString.append(" - " + data.bundleName, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ } - - if( data.sourceType != null ) { + + if (data.sourceType != null) { styledString.append(" - ", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ styledString.append(data.sourceType + "", StyledString.COUNTER_STYLER); //$NON-NLS-1$ } - - if( data.iconPath == null ) { + + if (data.iconPath == null) { cell.setImage(javaClassImage); } - + cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); } }); viewer.addDoubleClickListener(new IDoubleClickListener() { - + public void doubleClick(DoubleClickEvent event) { okPressed(); } }); - - + final WritableList list = new WritableList(); viewer.setInput(list); - + final ClassContributionCollector collector = getCollector(); - + t.addModifyListener(new ModifyListener() { private ContributionResultHandlerImpl currentResultHandler; - + public void modifyText(ModifyEvent e) { - if( currentResultHandler != null ) { + if (currentResultHandler != null) { currentResultHandler.cancled = true; } list.clear(); @@ -152,47 +151,47 @@ public void modifyText(ModifyEvent e) { collector.findContributions(filter, currentResultHandler); } }); - + return comp; } - + @Override protected void okPressed() { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if( ! s.isEmpty() ) { + if (!s.isEmpty()) { ContributionData cd = (ContributionData) s.getFirstElement(); String uri = "platform:/plugin/" + cd.bundleName + "/" + cd.className; //$NON-NLS-1$ //$NON-NLS-2$ Command cmd = SetCommand.create(editingDomain, contribution, feature, uri); - if( cmd.canExecute() ) { + if (cmd.canExecute()) { editingDomain.getCommandStack().execute(cmd); super.okPressed(); } } } - + private ClassContributionCollector getCollector() { Bundle bundle = FrameworkUtil.getBundle(ContributionClassDialog.class); BundleContext context = bundle.getBundleContext(); ServiceReference ref = context.getServiceReference(ClassContributionCollector.class.getName()); - if( ref != null ) { + if (ref != null) { return (ClassContributionCollector) context.getService(ref); } return null; } - + private static class ContributionResultHandlerImpl implements ContributionResultHandler { private boolean cancled = false; private IObservableList list; - + public ContributionResultHandlerImpl(IObservableList list) { this.list = list; } - + public void result(ContributionData data) { - if( ! cancled ) { + if (!cancled) { list.add(data); } } - + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java index ee2036a230..2b8028996a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java @@ -54,7 +54,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -@SuppressWarnings("restriction") public class FeatureSelectionDialog extends TitleAreaDialog { private TreeViewer viewer; private MStringModelFragment fragment; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java index 085fc44bf0..f8a88bcd13 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java @@ -5,6 +5,7 @@ import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.Filter; import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.ModelResultHandler; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -57,7 +58,7 @@ public FindImportElementDialog(Shell parentShell, AbstractComponentEditor editor protected Control createDialogArea(Composite parent) { Composite comp = (Composite) super.createDialogArea(parent); - final Image titleImage = new Image(parent.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/import_wiz.png")); + final Image titleImage = new Image(parent.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/import_wiz.png")); //$NON-NLS-1$ setTitleImage(titleImage); getShell().addDisposeListener(new DisposeListener() { @@ -66,16 +67,16 @@ public void widgetDisposed(DisposeEvent e) { } }); - getShell().setText("Find Import Elements"); - setTitle("Find Import Elements"); - setMessage("Search for an elements whose ID you'd like to import"); + getShell().setText(Messages.FindImportElementDialog_ShellTitle); + setTitle(Messages.FindImportElementDialog_Title); + setMessage(Messages.FindImportElementDialog_Message); Composite container = new Composite(comp, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); container.setLayout(new GridLayout(2, false)); Label l = new Label(container, SWT.NONE); - l.setText("Search"); + l.setText(Messages.FindImportElementDialog_Search); final Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -94,7 +95,7 @@ public void update(ViewerCell cell) { cell.setImage(editor.getImage(o, searchText.getDisplay())); MApplicationElement appEl = (MApplicationElement) o; - StyledString styledString = new StyledString(editor.getLabel(o) + " (" + appEl.getElementId() + ")", null); + StyledString styledString = new StyledString(editor.getLabel(o) + " (" + (appEl.getElementId() == null ? "<" + Messages.FindImportElementDialog_noId + ">" : appEl.getElementId()) + ")", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ String detailLabel = editor.getDetailLabel(o); if (detailLabel != null && !detailLabel.equals(appEl.getElementId())) { styledString.append(" - " + detailLabel, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ @@ -133,7 +134,7 @@ public void modifyText(ModifyEvent e) { }); Button button = new Button(container, SWT.PUSH); - button.setText("Clear Cache"); + button.setText(Messages.FindImportElementDialog_ClearCache); button.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false, 2, 1)); button.addSelectionListener(new SelectionAdapter() { @Override @@ -157,7 +158,7 @@ protected void okPressed() { super.okPressed(); } } else { - setErrorMessage("You can not import an element without an ID"); + setErrorMessage(Messages.FindImportElementDialog_NoIdReference); } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java index c38bc0257a..0173faafee 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java @@ -9,6 +9,7 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.Util.InternalPackage; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.e4.ui.model.fragment.MStringModelFragment; @@ -68,7 +69,7 @@ public FindParentReferenceElementDialog(Shell parentShell, AbstractComponentEdit protected Control createDialogArea(Composite parent) { Composite comp = (Composite) super.createDialogArea(parent); - final Image titleImage = new Image(parent.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/import_wiz.png")); + final Image titleImage = new Image(parent.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/import_wiz.png")); //$NON-NLS-1$ setTitleImage(titleImage); getShell().addDisposeListener(new DisposeListener() { @@ -77,16 +78,16 @@ public void widgetDisposed(DisposeEvent e) { } }); - getShell().setText("Find Parent Elements"); - setTitle("Find Parent Elements"); - setMessage("Search for an elements who you like to references as parent"); + getShell().setText(Messages.FindParentReferenceElementDialog_ShellTitle); + setTitle(Messages.FindParentReferenceElementDialog_Title); + setMessage(Messages.FindParentReferenceElementDialog_Message); Composite container = new Composite(comp, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); container.setLayout(new GridLayout(2, false)); Label l = new Label(container, SWT.NONE); - l.setText("Container-Type"); + l.setText(Messages.FindParentReferenceElementDialog_ContainerType); final ComboViewer eClassViewer = new ComboViewer(container); eClassViewer.setLabelProvider(new LabelProvider() { @@ -113,7 +114,7 @@ public int compare(Viewer viewer, Object e1, Object e2) { eClassViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); l = new Label(container, SWT.NONE); - l.setText("Search"); + l.setText(Messages.FindParentReferenceElementDialog_Search); final Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -134,7 +135,7 @@ public void update(ViewerCell cell) { MApplicationElement appEl = (MApplicationElement) o; - StyledString styledString = new StyledString(editor.getLabel(o) + " (" + (appEl.getElementId() == null ? "" : appEl.getElementId()) + ")", null); + StyledString styledString = new StyledString(editor.getLabel(o) + " (" + (appEl.getElementId() == null ? "<" + Messages.FindParentReferenceElementDialog_NoId + ">" : appEl.getElementId()) + ")", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ String detailLabel = editor.getDetailLabel(o); if (detailLabel != null && !detailLabel.equals(appEl.getElementId())) { styledString.append(" - " + detailLabel, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ @@ -175,7 +176,7 @@ public void modifyText(ModifyEvent e) { }); Button button = new Button(container, SWT.PUSH); - button.setText("Clear Cache"); + button.setText(Messages.FindParentReferenceElementDialog_ClearCache); button.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false, 2, 1)); button.addSelectionListener(new SelectionAdapter() { @Override @@ -199,7 +200,7 @@ protected void okPressed() { super.okPressed(); } } else { - setErrorMessage("You can not reference an element without an ID"); + setErrorMessage(Messages.FindParentReferenceElementDialog_NoReferenceId); } } } @@ -221,8 +222,6 @@ private static class ModelResultHandlerImpl implements ModelResultHandler { private AbstractComponentEditor editor; private Resource resource; - private List noId = new ArrayList(); - public ModelResultHandlerImpl(IObservableList list, Filter filter, AbstractComponentEditor editor, Resource resource) { this.list = list; this.filter = filter; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java index 39f72ebd90..778fb9b94d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java @@ -11,6 +11,7 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.commands.MCommand; import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; @@ -21,29 +22,29 @@ public class HandledMenuItemCommandSelectionDialog extends AbstractCommandSelectionDialog { private MHandledItem handler; - + public HandledMenuItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource) { super(parentShell, resource); this.handler = handler; } - + @Override protected String getShellTitle() { - return "MenuItem Command"; + return Messages.HandledMenuItemCommandSelectionDialog_ShellTitle; } - + @Override protected String getDialogTitle() { - return "MenuItem-Command"; + return Messages.HandledMenuItemCommandSelectionDialog_DialogTitle; } - + @Override protected String getDialogMessage() { - return "Connect the MenuItem to a command"; + return Messages.HandledMenuItemCommandSelectionDialog_DialogMessage; } @Override - protected Command createStoreCommand( EditingDomain editingDomain, MCommand command) { + protected Command createStoreCommand(EditingDomain editingDomain, MCommand command) { return SetCommand.create(editingDomain, handler, MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND, command); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java index 8f9b0345d5..67b3ebc5ed 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java @@ -11,6 +11,7 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.commands.MCommand; import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; @@ -21,29 +22,29 @@ public class HandledToolItemCommandSelectionDialog extends AbstractCommandSelectionDialog { private MHandledItem handler; - + public HandledToolItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource) { super(parentShell, resource); this.handler = handler; } - + @Override protected String getShellTitle() { - return "ToolItem Command"; + return Messages.HandledToolItemCommandSelectionDialog_ShellTitle; } - + @Override protected String getDialogTitle() { - return "ToolItem-Command"; + return Messages.HandledToolItemCommandSelectionDialog_DialogTitle; } - + @Override protected String getDialogMessage() { - return "Connect the ToolItem to a command"; + return Messages.HandledToolItemCommandSelectionDialog_DialogMessage; } @Override - protected Command createStoreCommand( EditingDomain editingDomain, MCommand command) { + protected Command createStoreCommand(EditingDomain editingDomain, MCommand command) { return SetCommand.create(editingDomain, handler, MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND, command); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java index ace3d85758..de38caa972 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java @@ -11,6 +11,7 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.commands.MCommand; import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; @@ -21,29 +22,29 @@ public class HandlerCommandSelectionDialog extends AbstractCommandSelectionDialog { private MHandler handler; - + public HandlerCommandSelectionDialog(Shell parentShell, MHandler handler, IModelResource resource) { super(parentShell, resource); this.handler = handler; } - + @Override protected String getShellTitle() { - return "Handler Command"; + return Messages.HandlerCommandSelectionDialog_ShellTitle; } - + @Override protected String getDialogTitle() { - return "Handler-Command"; + return Messages.HandlerCommandSelectionDialog_DialogTitle; } - + @Override protected String getDialogMessage() { - return "Connect the handler to a command"; + return Messages.HandlerCommandSelectionDialog_DialogMessage; } @Override - protected Command createStoreCommand( EditingDomain editingDomain, MCommand command) { + protected Command createStoreCommand(EditingDomain editingDomain, MCommand command) { return SetCommand.create(editingDomain, handler, CommandsPackageImpl.Literals.HANDLER__COMMAND, command); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java index bda337ad84..a2c1405fc3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java @@ -11,6 +11,7 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.commands.MCommand; import org.eclipse.e4.ui.model.application.commands.MKeyBinding; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; @@ -29,21 +30,21 @@ public KeyBindingCommandSelectionDialog(Shell parentShell, MKeyBinding binding, @Override protected String getShellTitle() { - return "Keybinding Command"; + return Messages.KeyBindingCommandSelectionDialog_ShellTitle; } - + @Override protected String getDialogTitle() { - return "Keybinding-Command"; + return Messages.KeyBindingCommandSelectionDialog_DialogTitle; } - + @Override protected String getDialogMessage() { - return "Connect the keybinding to a command"; + return Messages.KeyBindingCommandSelectionDialog_DialogMessage; } - + @Override - protected Command createStoreCommand( EditingDomain editingDomain, MCommand command) { + protected Command createStoreCommand(EditingDomain editingDomain, MCommand command) { return SetCommand.create(editingDomain, binding, CommandsPackageImpl.Literals.KEY_BINDING__COMMAND, command); } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java index 704470cc14..353fe44267 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java @@ -1,6 +1,7 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.emf.edit.domain.EditingDomain; @@ -14,17 +15,16 @@ public MenuIconDialogEditor(Shell parentShell, IProject project, EditingDomain e @Override protected String getShellTitle() { - return "Menu Icon Search"; + return Messages.MenuIconDialogEditor_ShellTitle; } @Override protected String getDialogTitle() { - return "Menu Icon Search"; + return Messages.MenuIconDialogEditor_DialogTitle; } @Override protected String getDialogMessage() { - return "Search for GIF, PNG and JPG icons in the current project"; + return Messages.MenuIconDialogEditor_DialogMessage; } - } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java index b35362f402..84d77b61c6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java @@ -1,6 +1,7 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem; import org.eclipse.emf.edit.domain.EditingDomain; @@ -14,17 +15,16 @@ public MenuItemIconDialogEditor(Shell parentShell, IProject project, EditingDoma @Override protected String getShellTitle() { - return "Menu Item Icon Search"; + return Messages.MenuItemIconDialogEditor_ShellTitle; } @Override protected String getDialogTitle() { - return "Menu Item Icon Search"; + return Messages.MenuItemIconDialogEditor_DialogTitle; } @Override protected String getDialogMessage() { - return "Search for GIF, PNG and JPG icons in the current project"; + return Messages.MenuItemIconDialogEditor_DialogMessage; } - } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java index 165cb83a7f..dcec7abad4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java @@ -1,6 +1,7 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.edit.domain.EditingDomain; @@ -14,17 +15,16 @@ public PartDescriptorIconDialogEditor(Shell parentShell, IProject project, Editi @Override protected String getShellTitle() { - return "Part Descriptor Icon Search"; + return Messages.PartDescriptorIconDialogEditor_ShellTitle; } @Override protected String getDialogTitle() { - return "Part Descriptor Icon Search"; + return Messages.PartDescriptorIconDialogEditor_DialogTitle; } @Override protected String getDialogMessage() { - return "Search for GIF, PNG and JPG icons in the current project"; + return Messages.PartDescriptorIconDialogEditor_DialogMessage; } - } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java index d2c0e3f8e1..29d47148cf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java @@ -1,6 +1,7 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.edit.domain.EditingDomain; @@ -14,17 +15,17 @@ public PartIconDialogEditor(Shell parentShell, IProject project, EditingDomain e @Override protected String getShellTitle() { - return "Part Icon Search"; + return Messages.PartIconDialogEditor_ShellTitle; } @Override protected String getDialogTitle() { - return "Part Icon Search"; + return Messages.PartIconDialogEditor_DialogTitle; } @Override protected String getDialogMessage() { - return "Search for GIF, PNG and JPG icons in the current project"; + return Messages.PartIconDialogEditor_DialogMessage; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java index fecfb28384..2992f550f8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java @@ -1,6 +1,7 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.edit.domain.EditingDomain; @@ -14,17 +15,16 @@ public PerspectiveIconDialogEditor(Shell parentShell, IProject project, EditingD @Override protected String getShellTitle() { - return "Perspective Icon Search"; + return Messages.PerspectiveIconDialogEditor_ShellTitle; } @Override protected String getDialogTitle() { - return "Perspective Icon Search"; + return Messages.PerspectiveIconDialogEditor_DialogTitle; } @Override protected String getDialogMessage() { - return "Search for GIF, PNG and JPG icons in the current project"; + return Messages.PerspectiveIconDialogEditor_DialogMessage; } - } From a182af3cdec4cda6742a137eb5e9ae86e7f9c043 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 18 Jul 2010 15:25:08 +0000 Subject: [PATCH 0238/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * some nls stuff --- .../e4/tools/emf/ui/internal/Messages.java | 13 +++++++++++++ .../e4/tools/emf/ui/internal/Messages.properties | 15 ++++++++++++++- .../component/dialogs/SharedElementsDialog.java | 16 +++++++++------- .../dialogs/ToolItemIconDialogEditor.java | 7 ++++--- .../dialogs/WindowIconDialogEditor.java | 8 ++++---- 5 files changed, 44 insertions(+), 15 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 34cd530daa..c077fc4c8a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -465,6 +465,19 @@ public class Messages extends NLS { public static String PerspectiveIconDialogEditor_DialogTitle; public static String PerspectiveIconDialogEditor_DialogMessage; + public static String SharedElementsDialog_ShellTitle; + public static String SharedElementsDialog_Title; + public static String SharedElementsDialog_Message; + public static String SharedElementsDialog_Name; + + public static String ToolItemIconDialogEditor_ShellTitle; + public static String ToolItemIconDialogEditor_DialogTitle; + public static String ToolItemIconDialogEditor_DialogMessage; + + public static String WindowIconDialogEditor_ShellTitle; + public static String WindowIconDialogEditor_DialogTitle; + public static String WindowIconDialogEditor_DialogMessage; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 44be9b210d..46a848d619 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -459,4 +459,17 @@ PartIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the curr PerspectiveIconDialogEditor_ShellTitle=Perspective Icon Search PerspectiveIconDialogEditor_DialogTitle=Perspective Icon Search -PerspectiveIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project \ No newline at end of file +PerspectiveIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project + +SharedElementsDialog_ShellTitle=Find Shared Elements +SharedElementsDialog_Title=Find Shared Elements +SharedElementsDialog_Message=Find Shared Elements of an Window +SharedElementsDialog_Name=Name + +ToolItemIconDialogEditor_ShellTitle=ToolItem Icon Search +ToolItemIconDialogEditor_DialogTitle=ToolItem Icon Search +ToolItemIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project + +WindowIconDialogEditor_ShellTitle=Menu Icon Search +WindowIconDialogEditor_DialogTitle=Menu Icon Search +WindowIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java index 0e1d33cf22..042cf486c3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java @@ -4,6 +4,7 @@ import java.util.List; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.MApplication; @@ -62,15 +63,16 @@ public SharedElementsDialog(Shell parentShell, ModelEditor editor, MPlaceholder protected Control createDialogArea(Composite parent) { Composite comp = (Composite) super.createDialogArea(parent); - setTitle("Find Shared Elements"); - setMessage("Find Shared Elements of an Window"); + getShell().setText(Messages.SharedElementsDialog_ShellTitle); + setTitle(Messages.SharedElementsDialog_Title); + setMessage(Messages.SharedElementsDialog_Message); Composite container = new Composite(comp, SWT.NONE); container.setLayout(new GridLayout(2, false)); container.setLayoutData(new GridData(GridData.FILL_BOTH)); Label l = new Label(container, SWT.NONE); - l.setText("Name"); + l.setText(Messages.SharedElementsDialog_Name); Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); @@ -154,11 +156,11 @@ public void update(final ViewerCell cell) { StyledString string = new StyledString(getTypename(o)); if (o instanceof MUILabel) { - string.append(" - " + ((MUILabel) o).getLabel(), StyledString.DECORATIONS_STYLER); + string.append(" - " + ((MUILabel) o).getLabel(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ } MApplicationElement el = (MApplicationElement) o; - string.append(" - " + el.getElementId(), StyledString.DECORATIONS_STYLER); + string.append(" - " + el.getElementId(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ cell.setText(string.getString()); cell.setStyleRanges(string.getStyleRanges()); @@ -171,9 +173,9 @@ public String getText(Object element) { if (el instanceof MUILabel) { MUILabel label = (MUILabel) el; - return getTypename(o) + " - " + el.getElementId() + " - " + label.getLabel(); + return getTypename(o) + " - " + el.getElementId() + " - " + label.getLabel(); //$NON-NLS-1$ //$NON-NLS-2$ } else { - return getTypename(o) + " - " + el.getElementId() + " - "; + return getTypename(o) + " - " + el.getElementId() + " - "; //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java index d11e1b3188..6f8f5d480e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java @@ -1,6 +1,7 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MToolItem; import org.eclipse.emf.edit.domain.EditingDomain; @@ -14,17 +15,17 @@ public ToolItemIconDialogEditor(Shell parentShell, IProject project, EditingDoma @Override protected String getShellTitle() { - return "ToolItem Icon Search"; + return Messages.ToolItemIconDialogEditor_ShellTitle; } @Override protected String getDialogTitle() { - return "ToolItem Icon Search"; + return Messages.ToolItemIconDialogEditor_DialogTitle; } @Override protected String getDialogMessage() { - return "Search for GIF, PNG and JPG icons in the current project"; + return Messages.ToolItemIconDialogEditor_DialogMessage; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java index af108df53d..1db725693b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java @@ -1,6 +1,7 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.edit.domain.EditingDomain; @@ -14,17 +15,16 @@ public WindowIconDialogEditor(Shell parentShell, IProject project, EditingDomain @Override protected String getShellTitle() { - return "Menu Icon Search"; + return Messages.WindowIconDialogEditor_ShellTitle; } @Override protected String getDialogTitle() { - return "Menu Icon Search"; + return Messages.WindowIconDialogEditor_DialogTitle; } @Override protected String getDialogMessage() { - return "Search for GIF, PNG and JPG icons in the current project"; + return Messages.WindowIconDialogEditor_DialogMessage; } - } From 2f27e1c4fbcf7e357e02d06e7c4f7e6e2faeb1d6 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 18 Jul 2010 15:32:27 +0000 Subject: [PATCH 0239/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * some nls stuff --- .../emf/ui/common/IModelElementProvider.java | 2 +- .../e4/tools/emf/ui/common/ImageTooltip.java | 99 ++++++++++--------- .../e4/tools/emf/ui/internal/Messages.java | 7 ++ .../tools/emf/ui/internal/Messages.properties | 9 +- 4 files changed, 66 insertions(+), 51 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java index a3c01b1645..ef5a1b0c54 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java @@ -13,7 +13,7 @@ public class Filter { public Filter(EClass eClass, String elementId) { this.eClass = eClass; this.elementId = elementId; - this.elementIdPattern = Pattern.compile(".*" + elementId.replaceAll("\\.", "\\\\.").replaceAll("\\*", ".*") + ".*"); + this.elementIdPattern = Pattern.compile(".*" + elementId.replaceAll("\\.", "\\\\.").replaceAll("\\*", ".*") + ".*"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java index 2c3a30ce8a..c5c51b36ac 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java @@ -8,6 +8,8 @@ import java.net.MalformedURLException; import java.net.URL; import java.text.DecimalFormat; +import java.text.MessageFormat; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.emf.common.util.URI; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.window.ToolTip; @@ -21,7 +23,7 @@ public abstract class ImageTooltip extends ToolTip { private Image image; - + public ImageTooltip(Control control) { super(control); @@ -29,12 +31,12 @@ public ImageTooltip(Control control) { @Override protected boolean shouldCreateToolTip(Event event) { - if( getImageURI() != null ) { - return super.shouldCreateToolTip(event); + if (getImageURI() != null) { + return super.shouldCreateToolTip(event); } return false; } - + @Override protected Composite createToolTipContentArea(Event event, Composite parent) { clearResources(); @@ -43,43 +45,43 @@ protected Composite createToolTipContentArea(Event event, Composite parent) { parent.setBackgroundMode(SWT.INHERIT_DEFAULT); parent.setLayout(new GridLayout(2, false)); - URI uri = getImageURI(); - - if( uri != null ) { + URI uri = getImageURI(); + + if (uri != null) { int fileSize = -1; ByteArrayOutputStream out = null; InputStream stream = null; InputStream bStream = null; - String errorMessage = ""; + String errorMessage = "<" + Messages.ImageTooltip_UnknownError + ">"; //$NON-NLS-1$ //$NON-NLS-2$ try { URL url = new URL(uri.toString()); stream = url.openStream(); - - if( stream != null ) { + + if (stream != null) { out = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int length; - while( ( length = stream.read(buf)) != -1 ) { - out.write(buf,0,length); + while ((length = stream.read(buf)) != -1) { + out.write(buf, 0, length); } fileSize = out.size(); bStream = new ByteArrayInputStream(out.toByteArray()); - image = new Image(parent.getDisplay(),bStream); + image = new Image(parent.getDisplay(), bStream); } } catch (MalformedURLException e) { errorMessage = e.getMessage(); } catch (FileNotFoundException e) { - if( uri.isPlatform() ) { - errorMessage = "File '" + e.getMessage() + "' not found in bundle '"+uri.segment(1)+"'"; + if (uri.isPlatform()) { + errorMessage = MessageFormat.format(Messages.ImageTooltip_FileNotFound, e.getMessage(), uri.segment(1)); } else { errorMessage = e.getMessage(); } } catch (IOException e) { errorMessage = e.getMessage(); - } catch(Exception e) { + } catch (Exception e) { errorMessage = e.getMessage(); - }finally { - if(out != null) { + } finally { + if (out != null) { try { out.close(); } catch (IOException e) { @@ -87,8 +89,8 @@ protected Composite createToolTipContentArea(Event event, Composite parent) { e.printStackTrace(); } } - - if( bStream != null ) { + + if (bStream != null) { try { bStream.close(); } catch (IOException e) { @@ -96,8 +98,8 @@ protected Composite createToolTipContentArea(Event event, Composite parent) { e.printStackTrace(); } } - - if( stream != null ) { + + if (stream != null) { try { stream.close(); } catch (IOException e) { @@ -106,14 +108,14 @@ protected Composite createToolTipContentArea(Event event, Composite parent) { } } } - + // --------------------------------- Label l = new Label(parent, SWT.NONE); l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); - l.setText("Icon:"); - - l = new Label(parent,SWT.NONE); - if( image == null ) { + l.setText(Messages.ImageTooltip_Icon + ":"); //$NON-NLS-1$ + + l = new Label(parent, SWT.NONE); + if (image == null) { System.err.println(errorMessage); l.setText(errorMessage); } else { @@ -121,38 +123,37 @@ protected Composite createToolTipContentArea(Event event, Composite parent) { } // --------------------------------- - + l = new Label(parent, SWT.NONE); l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); - l.setText("Name:"); - - l = new Label(parent,SWT.NONE); + l.setText(Messages.ImageTooltip_Name + ":"); //$NON-NLS-1$ + + l = new Label(parent, SWT.NONE); l.setText(uri.lastSegment()); - + // --------------------------------- - + l = new Label(parent, SWT.NONE); l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); - l.setText("Dimensions:"); - - l = new Label(parent,SWT.NONE); - if( image != null ) { - l.setText(image.getBounds().width + "x" + image.getBounds().height+" px"); + l.setText(Messages.ImageTooltip_Dimension + ":"); //$NON-NLS-1$ + + l = new Label(parent, SWT.NONE); + if (image != null) { + l.setText(image.getBounds().width + "x" + image.getBounds().height + " px"); //$NON-NLS-1$ //$NON-NLS-2$ } else { - l.setText("0x0 px"); + l.setText("0x0 px"); //$NON-NLS-1$ } - // --------------------------------- - + l = new Label(parent, SWT.NONE); l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); - l.setText("File-Size:"); - - l = new Label(parent,SWT.NONE); - l.setText( new DecimalFormat("#,##0.00").format((fileSize / 1024.0)) + "KB" ); + l.setText(Messages.ImageTooltip_FileSize + ":"); //$NON-NLS-1$ + + l = new Label(parent, SWT.NONE); + l.setText(new DecimalFormat("#,##0.00").format((fileSize / 1024.0)) + "KB"); //$NON-NLS-1$ //$NON-NLS-2$ } - + return parent; } @@ -161,11 +162,11 @@ protected void afterHideToolTip(Event event) { super.afterHideToolTip(event); clearResources(); } - + protected abstract URI getImageURI(); - + private void clearResources() { - if( image != null ) { + if (image != null) { image.dispose(); image = null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index c077fc4c8a..b84981ee0f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -478,6 +478,13 @@ public class Messages extends NLS { public static String WindowIconDialogEditor_DialogTitle; public static String WindowIconDialogEditor_DialogMessage; + public static String ImageTooltip_UnknownError; + public static String ImageTooltip_FileNotFound; + public static String ImageTooltip_Icon; + public static String ImageTooltip_Name; + public static String ImageTooltip_Dimension; + public static String ImageTooltip_FileSize; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 46a848d619..1d290945fc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -472,4 +472,11 @@ ToolItemIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the WindowIconDialogEditor_ShellTitle=Menu Icon Search WindowIconDialogEditor_DialogTitle=Menu Icon Search -WindowIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project \ No newline at end of file +WindowIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project + +ImageTooltip_UnknownError=Unknown Error +ImageTooltip_FileNotFound=File ''{0}'' not found in bundle ''{1}'' +ImageTooltip_Icon=Icon +ImageTooltip_Name=Name +ImageTooltip_Dimension=Dimensions +ImageTooltip_FileSize=File-Size \ No newline at end of file From 01316c8efb958c2db0d465109aae3b2c6a9ed27d Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 18 Jul 2010 15:39:30 +0000 Subject: [PATCH 0240/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed copyrights --- .../emf/ui/common/IContributionClassCreator.java | 10 ++++++++++ .../e4/tools/emf/ui/common/IEditorDescriptor.java | 11 +++++++++++ .../e4/tools/emf/ui/common/IEditorFeature.java | 13 ++++++++++++- .../tools/emf/ui/common/IModelElementProvider.java | 10 ++++++++++ .../emf/ui/common/ISelectionProviderService.java | 10 ++++++++++ .../e4/tools/emf/ui/common/ImageTooltip.java | 10 ++++++++++ .../org/eclipse/e4/tools/emf/ui/common/Util.java | 10 ++++++++++ .../component/dialogs/AbstractIconDialog.java | 10 ++++++++++ .../component/dialogs/FindImportElementDialog.java | 10 ++++++++++ .../dialogs/FindParentReferenceElementDialog.java | 10 ++++++++++ .../component/dialogs/MenuIconDialogEditor.java | 10 ++++++++++ .../component/dialogs/MenuItemIconDialogEditor.java | 10 ++++++++++ .../dialogs/PartDescriptorIconDialogEditor.java | 10 ++++++++++ .../component/dialogs/PartIconDialogEditor.java | 10 ++++++++++ .../dialogs/PerspectiveIconDialogEditor.java | 10 ++++++++++ .../component/dialogs/SharedElementsDialog.java | 10 ++++++++++ .../component/dialogs/ToolItemIconDialogEditor.java | 10 ++++++++++ .../component/dialogs/WindowIconDialogEditor.java | 10 ++++++++++ 18 files changed, 183 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IContributionClassCreator.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IContributionClassCreator.java index d60729a6bc..bbe72fed83 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IContributionClassCreator.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IContributionClassCreator.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.common; import org.eclipse.core.resources.IProject; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorDescriptor.java index de57bc4ae2..2d5fd342fb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorDescriptor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorDescriptor.java @@ -1,8 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.common; import org.eclipse.emf.ecore.EClass; public interface IEditorDescriptor { public EClass getEClass(); + public Class getEditorClass(); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java index 3771b73976..530f7b017b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.common; import java.util.List; @@ -8,11 +18,12 @@ public interface IEditorFeature { public class FeatureClass { public final String label; public final EClass eClass; - + public FeatureClass(String label, EClass eClass) { this.label = label; this.eClass = eClass; } } + public List getFeatureClasses(EClass eClass, EStructuralFeature feature); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java index ef5a1b0c54..a276bdc834 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.common; import java.util.regex.Pattern; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ISelectionProviderService.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ISelectionProviderService.java index 3c1d3d5fcd..f4769f1377 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ISelectionProviderService.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ISelectionProviderService.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.common; public interface ISelectionProviderService { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java index c5c51b36ac..255cbb728f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.common; import java.io.ByteArrayInputStream; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java index b7addc99de..755836fc0e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.common; import java.util.ArrayList; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java index 7e72bc38db..3dbefb247f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import java.io.BufferedReader; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java index f8a88bcd13..f5673911af 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.databinding.observable.list.IObservableList; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java index 0173faafee..b6823e6aba 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import java.util.ArrayList; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java index 353fe44267..e27843d1af 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java index 84d77b61c6..9e1812800e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java index dcec7abad4..6abf5c6d3a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java index 29d47148cf..7b7b48a632 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java index 2992f550f8..3e380367c2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java index 042cf486c3..4ffc8cb35c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import java.util.ArrayList; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java index 6f8f5d480e..0966feb280 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java index 1db725693b..a112f7a30b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; From d4289023d515573ee3f04fb73d65b5ebc309c698 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 19 Jul 2010 07:25:30 +0000 Subject: [PATCH 0241/1286] Bug 320218 - Improve .product-File generated by e4 Project Wizard * added mac specific settings --- .../templates/common/$projectName$.product | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bundles/org.eclipse.e4.tools/templates/common/$projectName$.product b/bundles/org.eclipse.e4.tools/templates/common/$projectName$.product index d91c3d09e2..75ff15ff61 100644 --- a/bundles/org.eclipse.e4.tools/templates/common/$projectName$.product +++ b/bundles/org.eclipse.e4.tools/templates/common/$projectName$.product @@ -13,13 +13,13 @@ - + + - @@ -29,6 +29,7 @@ + @@ -36,15 +37,18 @@ + + + - - + + @@ -64,12 +68,11 @@ - + - From f7c988533bbcdc442e881aa87c8c4700339c859d Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 19 Jul 2010 10:41:31 +0000 Subject: [PATCH 0242/1286] Bug 320218 - Improve .product-File generated by e4 Project Wizard --- .../templates/common/$projectName$.product | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools/templates/common/$projectName$.product b/bundles/org.eclipse.e4.tools/templates/common/$projectName$.product index 75ff15ff61..1c236dcff2 100644 --- a/bundles/org.eclipse.e4.tools/templates/common/$projectName$.product +++ b/bundles/org.eclipse.e4.tools/templates/common/$projectName$.product @@ -13,7 +13,7 @@ - + @@ -29,6 +29,7 @@ + @@ -72,6 +73,7 @@ + From 98d731c12079e1b96f2c99eb01ec3e256beb5ea5 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 19 Jul 2010 17:33:19 +0000 Subject: [PATCH 0243/1286] Bug 320218 - Improve .product-File generated by e4 Project Wizard * support all available platforms --- .../templates/common/$projectName$.product | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/bundles/org.eclipse.e4.tools/templates/common/$projectName$.product b/bundles/org.eclipse.e4.tools/templates/common/$projectName$.product index 1c236dcff2..4d69f3c61f 100644 --- a/bundles/org.eclipse.e4.tools/templates/common/$projectName$.product +++ b/bundles/org.eclipse.e4.tools/templates/common/$projectName$.product @@ -29,9 +29,15 @@ + + + + + + @@ -72,9 +78,24 @@ + + + + + + + + + + + + + + + From 3360a9df61ed796483d14d2cbc17dd2014279112 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 20 Jul 2010 18:04:21 +0000 Subject: [PATCH 0244/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * add support for autogenerating the elementId * make it configurable through perferences --- .../plugin.xml | 8 ++ .../editor3x/ModelEditorPreferencePage.java | 74 +++++++++++++++++++ .../META-INF/MANIFEST.MF | 3 +- .../eclipse/e4/tools/emf/ui/common/Util.java | 52 +++++++++++++ .../component/AbstractComponentEditor.java | 12 +++ .../emf/ui/internal/common/ModelEditor.java | 13 ++++ .../component/BindingContextEditor.java | 1 + .../common/component/BindingTableEditor.java | 34 +-------- .../common/component/CommandEditor.java | 2 + .../component/HandledMenuItemEditor.java | 2 + .../component/HandledToolItemEditor.java | 3 +- .../common/component/KeyBindingEditor.java | 48 ++++++++++++ .../component/MenuContributionEditor.java | 22 +----- .../internal/common/component/MenuEditor.java | 26 +------ .../common/component/MenuSeparatorEditor.java | 6 +- .../component/PartDescriptorEditor.java | 2 + .../internal/common/component/PartEditor.java | 2 + .../component/PartSashContainerEditor.java | 1 + .../common/component/PartStackEditor.java | 1 + .../common/component/PerspectiveEditor.java | 1 + .../component/PerspectiveStackEditor.java | 1 + .../component/ToolBarContributionEditor.java | 27 +------ .../common/component/ToolBarEditor.java | 27 +------ .../component/ToolBarSeparatorEditor.java | 1 + .../common/component/TrimBarEditor.java | 2 + .../component/TrimContributionEditor.java | 2 + .../common/component/WindowEditor.java | 2 + .../component/virtual/VApplicationAddons.java | 7 +- .../virtual/VApplicationCategoriesEditor.java | 3 +- .../virtual/VBindingTableEditor.java | 2 + .../component/virtual/VCommandEditor.java | 3 +- .../component/virtual/VHandlerEditor.java | 3 +- .../virtual/VMenuContributionsEditor.java | 3 +- .../common/component/virtual/VMenuEditor.java | 3 +- .../component/virtual/VPartDescriptor.java | 3 +- .../virtual/VToolBarContributionsEditor.java | 3 +- .../virtual/VTrimContributionsEditor.java | 3 +- .../virtual/VWindowControlEditor.java | 2 + .../component/virtual/VWindowEditor.java | 1 + .../virtual/VWindowSharedElementsEditor.java | 2 +- .../component/virtual/VWindowTrimEditor.java | 2 + 41 files changed, 272 insertions(+), 143 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml index e232671bfb..389ebccf38 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml @@ -24,5 +24,13 @@ class="org.eclipse.e4.tools.emf.editor3x.extension.AddonContributionEditor"> + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java new file mode 100644 index 0000000000..22c0eb0d41 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java @@ -0,0 +1,74 @@ +package org.eclipse.e4.tools.emf.editor3x; + +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.osgi.service.prefs.BackingStoreException; + +public class ModelEditorPreferencePage extends PreferencePage implements + IWorkbenchPreferencePage { + private boolean autoCreateElementId; + private IEclipsePreferences node; + + public ModelEditorPreferencePage() { + } + + public ModelEditorPreferencePage(String title) { + super(title); + } + + public ModelEditorPreferencePage(String title, ImageDescriptor image) { + super(title, image); + } + + public void init(IWorkbench workbench) { + node = new InstanceScope().getNode("org.eclipse.e4.tools.emf.ui"); + autoCreateElementId = node.getBoolean("autoCreateElementId", false); + } + + @Override + protected Control createContents(Composite parent) { + Composite result= new Composite(parent, SWT.NONE); + result.setLayout(new GridLayout(2,false)); + + Label l = new Label(result, SWT.NONE); + l.setText("Autogenerate Element-Id"); + final Button b = new Button(result, SWT.CHECK); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + autoCreateElementId = b.getSelection(); + } + }); + + return result; + } + + @Override + public boolean performOk() { + node.putBoolean("autoCreateElementId", autoCreateElementId); + try { + node.flush(); + } catch (BackingStoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return super.performOk(); + } + + @Override + public void dispose() { + super.dispose(); + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 49f07ca6d0..ca0ea06334 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -27,7 +27,8 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.e4.core.contexts;bundle-version="0.9.0", org.eclipse.e4.ui.di;bundle-version="0.9.0", javax.annotation;bundle-version="1.0.0", - org.eclipse.e4.tools.services;bundle-version="1.0.0" + org.eclipse.e4.tools.services;bundle-version="1.0.0", + org.eclipse.e4.core.di.extensions;bundle-version="0.9.0" Bundle-ActivationPolicy: lazy Import-Package: javax.inject;version="1.0.0", org.eclipse.core.runtime.jobs, diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java index 755836fc0e..b23df112d2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java @@ -13,19 +13,25 @@ import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; +import java.util.SortedSet; +import java.util.TreeSet; +import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; +import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; @@ -53,6 +59,52 @@ public static final void addClasses(EPackage ePackage, List list) } } + // TODO In future support different name formats something like + // ${project}.${classname}.${counter} + public static final String getDefaultElementId(Resource resource, MApplicationElement element, IProject project) { + try { + EObject o = (EObject) element; + String className = o.eClass().getName(); + String projectName = project.getName(); + + String prefix = projectName + "." + className; //$NON-NLS-1$ + + TreeIterator it = resource.getAllContents(); + SortedSet numbers = new TreeSet(); + + while (it.hasNext()) { + EObject tmp = it.next(); + if (tmp instanceof MApplicationElement) { + String elementId = ((MApplicationElement) tmp).getElementId(); + if (elementId != null && elementId.length() > prefix.length() && elementId.startsWith(prefix)) { + String suffix = elementId.substring(prefix.length()); + if (suffix.startsWith(".") && suffix.length() > 1) { //$NON-NLS-1$ + try { + numbers.add(Integer.parseInt(suffix.substring(1))); + } catch (Exception e) { + // TODO: handle exception + } + } + } + } + } + + int lastNumber = -1; + for (Integer number : numbers) { + if ((lastNumber + 1) != number) { + break; + } + lastNumber = number; + } + + return prefix + "." + ++lastNumber; //$NON-NLS-1$ + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + return null; + } + public static List loadPackages() { List packs = new ArrayList(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index ab6a55b6b1..9b51f06d82 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -18,8 +18,11 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.runtime.FileLocator; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.resource.ImageRegistry; @@ -70,6 +73,15 @@ public WritableValue getMaster() { return master; } + protected void setElementId(Object element) { + if (getEditor().isAutoCreateElementId() && element instanceof MApplicationElement) { + MApplicationElement el = (MApplicationElement) element; + if (el.getElementId() == null || el.getElementId().trim().length() == 0) { + el.setElementId(Util.getDefaultElementId(((EObject) getMaster().getValue()).eResource(), el, getEditor().getProject())); + } + } + } + public Image getImage(Display d, int id) { Image img = IMG_REG.get(IMAGES[id]); if (img == null) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index c26df49c18..227ce0a9a9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -35,6 +35,7 @@ import org.eclipse.core.runtime.RegistryFactory; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.core.di.annotations.Optional; +import org.eclipse.e4.core.di.extensions.Preference; import org.eclipse.e4.core.services.contributions.IContributionFactory; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; @@ -203,6 +204,10 @@ public class ModelEditor { @Optional private IClipboardService clipboardService; + @Inject + @Preference(nodePath = "org.eclipse.e4.tools.emf.ui", value = "autoCreateElementId") + private boolean autoCreateElementId; + public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project) { this.modelProvider = modelProvider; this.project = project; @@ -348,6 +353,14 @@ public void menuAboutToShow(IMenuManager manager) { viewer.getControl().setMenu(mgr.createContextMenu(viewer.getControl())); } + public boolean isAutoCreateElementId() { + return autoCreateElementId && project != null; + } + + public IProject getProject() { + return project; + } + private void loadContributionCreators() { IExtensionRegistry registry = RegistryFactory.getRegistry(); IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java index 043af0ead8..d41b449ecf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java @@ -238,6 +238,7 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { MBindingContext eObject = MCommandsFactory.INSTANCE.createBindingContext(); + setElementId(eObject); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN, eObject); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index bf3b9a0ff9..27f0ddb38b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -20,12 +20,11 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BindingContextSelectionDialog; import org.eclipse.e4.ui.model.application.commands.MBindingTable; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.commands.MKeyBinding; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -35,7 +34,6 @@ import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; @@ -48,7 +46,6 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -196,34 +193,7 @@ public void widgetSelected(SelectionEvent e) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_SEQUENCE__KEY_SEQUENCE); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.BindingTableEditor_KeySequence); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.KEY_BINDING__COMMAND, CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME)); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.BindingTableEditor_Command); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.ModelTooling_Common_Id); - column.getColumn().setWidth(170); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); IEMFListProperty prop = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS); viewer.setInput(prop.observeDetail(getMaster())); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index d49e28ca6b..66eb2063ad 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -293,6 +293,8 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { MCommandParameter param = MCommandsFactory.INSTANCE.createCommandParameter(); + setElementId(param); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.COMMAND__PARAMETERS, param); if (cmd.canExecute()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index 9e0edd8d72..a39b73c52d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -215,6 +215,8 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { MHandledItem item = (MHandledItem) master.getValue(); MParameter param = MCommandsFactory.INSTANCE.createParameter(); + setElementId(param); + Command cmd = AddCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, param); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index df026640db..2b6131f23f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -122,7 +122,6 @@ public void widgetSelected(SelectionEvent e) { final TableViewer viewer = new TableViewer(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 120; - viewer.getTable().setHeaderVisible(true); viewer.getControl().setLayoutData(gd); ObservableListContentProvider cp = new ObservableListContentProvider(); @@ -182,6 +181,8 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { MHandledItem item = (MHandledItem) master.getValue(); MParameter param = MCommandsFactory.INSTANCE.createParameter(); + setElementId(param); + Command cmd = AddCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, param); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index da37c076bd..a36f5ca915 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -42,6 +42,7 @@ import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.bindings.keys.KeySequence; @@ -52,6 +53,7 @@ import org.eclipse.jface.fieldassist.FieldDecoration; import org.eclipse.jface.fieldassist.FieldDecorationRegistry; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; @@ -259,11 +261,55 @@ public void widgetSelected(SelectionEvent e) { b.setText(Messages.ModelTooling_Common_Up); b.setImage(getImage(b.getDisplay(), ARROW_UP)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MKeyBinding container = (MKeyBinding) getMaster().getValue(); + int idx = container.getParameters().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MKeyBinding container = (MKeyBinding) getMaster().getValue(); + int idx = container.getParameters().indexOf(obj) + 1; + if (idx < container.getParameters().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); @@ -274,6 +320,8 @@ public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) { MKeyBinding item = (MKeyBinding) getMaster().getValue(); MParameter param = MCommandsFactory.INSTANCE.createParameter(); + setElementId(param); + Command cmd = AddCommand.create(getEditingDomain(), item, CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS, param); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index 6b2f8c44cc..51d3505992 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -21,10 +21,8 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -37,7 +35,6 @@ import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; @@ -53,7 +50,6 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -230,27 +226,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.MenuContributionEditor_MenuItemType); - column.getColumn().setWidth(300); - column.setLabelProvider(new ComponentLabelProvider(getEditor())); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.MenuContributionEditor_MenuItemItemType); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(master)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index e6fe4f9968..1c1dd4cc72 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -22,11 +22,9 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; -import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -43,7 +41,6 @@ import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; @@ -59,7 +56,6 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -258,27 +254,7 @@ public void widgetSelected(SelectionEvent e) { final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.MenuEditor_MenuItemType); - column.getColumn().setWidth(300); - column.setLabelProvider(new ComponentLabelProvider(getEditor())); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.MenuEditor_MenuItemItemType); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(master)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index 2671fd8573..4c4dd2d581 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -20,6 +20,7 @@ import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; @@ -134,7 +135,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - // TODO Should we add visible to mimic a GroupMarker of 3.x + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index b578fea993..c87f6e3a0d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -349,6 +349,8 @@ public void widgetSelected(SelectionEvent e) { private void addToolBar() { MToolBar menu = MMenuFactory.INSTANCE.createToolBar(); + setElementId(menu); + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR__TOOLBAR, menu); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index f229becc7a..687678bc29 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -352,6 +352,8 @@ public void widgetSelected(SelectionEvent e) { private void addToolBar() { MToolBar menu = MMenuFactory.INSTANCE.createToolBar(); + setElementId(menu); + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART__TOOLBAR, menu); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 4c04323ab2..d46b44c844 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -322,6 +322,7 @@ public void widgetSelected(SelectionEvent e) { if (!childrenDropDown.getSelection().isEmpty()) { EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); EObject eObject = EcoreUtil.create(eClass); + setElementId(eObject); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 4444a5d2b4..1e78ab803b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -284,6 +284,7 @@ public String getText(Object element) { public void widgetSelected(SelectionEvent e) { EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); EObject eObject = EcoreUtil.create(eClass); + setElementId(eObject); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index f63ecb0918..cc84bf9516 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -346,6 +346,7 @@ public void widgetSelected(SelectionEvent e) { if (!childrenDropDown.getSelection().isEmpty()) { EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); EObject eObject = EcoreUtil.create(eClass); + setElementId(eObject); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 73446eda9b..213e53fd36 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -249,6 +249,7 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { MPerspective eObject = MAdvancedFactory.INSTANCE.createPerspective(); + setElementId(eObject); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index d4f709e616..dbb39e9740 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -20,10 +20,8 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -36,7 +34,6 @@ import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; @@ -52,7 +49,6 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -222,27 +218,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.ToolBarEditor_ToolbarItemsType); - column.getColumn().setWidth(300); - column.setLabelProvider(new ComponentLabelProvider(getEditor())); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.ToolBarEditor_ToolbarItemsItemType); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(master)); @@ -329,6 +305,7 @@ public void widgetSelected(SelectionEvent e) { Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); EClass eClass = struct.eClass; MToolBarElement eObject = (MToolBarElement) EcoreUtil.create(eClass); + setElementId(eObject); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index b5c390acf9..91775b5e02 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -20,10 +20,8 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -36,7 +34,6 @@ import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; @@ -52,7 +49,6 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -192,27 +188,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.ToolBarEditor_ToolbarItemsType); - column.getColumn().setWidth(300); - column.setLabelProvider(new ComponentLabelProvider(getEditor())); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.ToolBarEditor_ToolbarItemsItemType); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider(prop.observeDetail(cp.getKnownElements()))); - } + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(master)); @@ -299,6 +275,7 @@ public void widgetSelected(SelectionEvent e) { Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); EClass eClass = struct.eClass; MToolBarElement eObject = (MToolBarElement) EcoreUtil.create(eClass); + setElementId(eObject); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index b4688cb37b..f8bf808911 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -148,6 +148,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index 304c84829c..eeb430d81d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -279,6 +279,8 @@ public String getText(Object element) { @Override public void widgetSelected(SelectionEvent e) { EObject toolbar = EcoreUtil.create((EClass) ((IStructuredSelection) typeViewer.getSelection()).getFirstElement()); + setElementId(toolbar); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar); if (cmd.canExecute()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index 584f000ec1..a3d12e2a05 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -287,6 +287,8 @@ public String getText(Object element) { @Override public void widgetSelected(SelectionEvent e) { EObject toolbar = EcoreUtil.create((EClass) ((IStructuredSelection) typeViewer.getSelection()).getFirstElement()); + setElementId(toolbar); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar); if (cmd.canExecute()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index c1d9ae441c..b825ff1624 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -344,6 +344,8 @@ void removeMenu() { void addMenu() { MMenu menu = MMenuFactory.INSTANCE.createMenu(); + setElementId(menu); + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__MAIN_MENU, menu); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java index ee1777872b..f06206cdc1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java @@ -111,7 +111,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -206,8 +205,10 @@ public void widgetSelected(SelectionEvent e) { } private void handleAddAddon() { - MAddon command = MApplicationFactory.INSTANCE.createAddon(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__ADDONS, command); + MAddon addon = MApplicationFactory.INSTANCE.createAddon(); + setElementId(addon); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__ADDONS, addon); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java index c682ea4c7f..dc92ad7eb2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java @@ -105,7 +105,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -179,6 +178,8 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { MCategory command = CommandsFactoryImpl.eINSTANCE.createCategory(); + setElementId(command); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__CATEGORIES, command); if (cmd.canExecute()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index 67f6ed5754..6c09652695 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -174,6 +174,8 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { MBindingTable command = MCommandsFactory.INSTANCE.createBindingTable(); + setElementId(command); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES, command); if (cmd.canExecute()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index 551b505675..1646f41202 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -104,7 +104,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -178,6 +177,8 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { MCommand command = CommandsFactoryImpl.eINSTANCE.createCommand(); + setElementId(command); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, command); if (cmd.canExecute()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index 4825357548..2f5f7a6972 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -101,7 +101,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -175,6 +174,8 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { MHandler handler = MCommandsFactory.INSTANCE.createHandler(); + setElementId(handler); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, handler); if (cmd.canExecute()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java index f7e48213f9..4443cf1ce7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java @@ -101,7 +101,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -175,6 +174,8 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { MMenuContribution command = MMenuFactory.INSTANCE.createMenuContribution(); + setElementId(command); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, command); if (cmd.canExecute()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java index a7678f8990..537f5a7626 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -104,7 +104,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -179,6 +178,8 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { MMenu handler = MMenuFactory.INSTANCE.createMenu(); + setElementId(handler); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), feature, handler); if (cmd.canExecute()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java index 7e92a05fd7..cd3e2cb025 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java @@ -101,7 +101,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -175,6 +174,8 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { MPartDescriptor command = MBasicFactory.INSTANCE.createPartDescriptor(); + setElementId(command); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, command); if (cmd.canExecute()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java index 67228f0d83..f5e196921b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java @@ -101,7 +101,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -175,6 +174,8 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { MToolBarContribution command = MMenuFactory.INSTANCE.createToolBarContribution(); + setElementId(command); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, command); if (cmd.canExecute()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java index 6166aaf8f8..84de2e6b21 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java @@ -101,7 +101,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); Composite buttonComp = new Composite(parent, SWT.NONE); @@ -175,6 +174,8 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { MTrimContribution command = MMenuFactory.INSTANCE.createTrimContribution(); + setElementId(command); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, command); if (cmd.canExecute()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index f111c9ec46..4f4e3b9783 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -190,6 +190,8 @@ public void widgetSelected(SelectionEvent e) { EObject eObject = EcoreUtil.create(eClass); + setElementId(eObject); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); if (cmd.canExecute()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index 234af90722..b8995ff341 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -186,6 +186,7 @@ public String getText(Object element) { public void widgetSelected(SelectionEvent e) { EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); EObject handler = EcoreUtil.create(eClass); + setElementId(handler); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, handler); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java index 076f2cdb8a..5a1d061c68 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java @@ -197,8 +197,8 @@ public String getText(Object element) { public void widgetSelected(SelectionEvent e) { if (!childrenDropDown.getSelection().isEmpty()) { EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - EObject eObject = EcoreUtil.create(eClass); + setElementId(eObject); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, eObject); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java index abc168cd8f..2e3a6a0be9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -118,6 +118,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr @Override public void widgetSelected(SelectionEvent e) { MTrimBar handler = MBasicFactory.INSTANCE.createTrimBar(); + setElementId(handler); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS, handler); if (cmd.canExecute()) { From 6f4c947de49d466c9ebacea1e459ad7e09fba011 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 20 Jul 2010 18:24:01 +0000 Subject: [PATCH 0245/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed overwriting existing model files --- .../tools/wizards/model/BaseApplicationModelWizard.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java index ff59f7ef20..d6b5699180 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java @@ -75,6 +75,12 @@ public boolean performFinish() { // Remember the file. // final IFile modelFile = getModelFile(); + + if( modelFile.exists() ) { + if( ! MessageDialog.openQuestion(getShell(), "File exists", "The file already exists. Would you like to overwrite?")) { + return false; + } + } // Do the work within an operation. // @@ -90,7 +96,7 @@ protected void execute(IProgressMonitor progressMonitor) { // Get the URI of the model file. // URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); - + // Create a resource for this file. // Resource resource = resourceSet.createResource(fileURI); From 852d975bf7dcb65c8b9b0833548bcbcda2952fdd Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 20 Jul 2010 18:27:30 +0000 Subject: [PATCH 0246/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed layout --- .../common/component/virtual/VModelFragmentsEditor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java index 3ed39f68a4..e67f9f8a4a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java @@ -170,7 +170,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { From 091a8fae7dc71701287092b47a4b03cf6a4eb63d Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 20 Jul 2010 19:15:53 +0000 Subject: [PATCH 0247/1286] Bug 319687 - [ModelTooling] Feature Description and Copyright incorrect * adding Soyatec to the copyright --- .../org.eclipse.e4.core.tools.feature/feature.properties | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/features/org.eclipse.e4.core.tools.feature/feature.properties b/features/org.eclipse.e4.core.tools.feature/feature.properties index 70a37cf4d4..41626957c0 100755 --- a/features/org.eclipse.e4.core.tools.feature/feature.properties +++ b/features/org.eclipse.e4.core.tools.feature/feature.properties @@ -32,14 +32,15 @@ description=Eclipse e4 Modeltooling # "copyright" property - text of the "Feature Update Copyright" copyright=\ -Copyright (c) 2000, 2009 BestSolution.at and others.\n\ +Copyright (c) 2010 BestSolution.at, Soyatec and others.\n\ All rights reserved. This program and the accompanying materials\n\ are made available under the terms of the Eclipse Public License v1.0\n\ which accompanies this distribution, and is available at\n\ http://www.eclipse.org/legal/epl-v10.html\n\ \n\ Contributors:\n\ - BestSolution.at - initial API and implementation\n + BestSolution.at - initial API and implementation\n\ + Soytec - initial API and implementation\n ################ end of copyright property #################################### # "licenseURL" property - URL of the "Feature License" From 15ad9f9885da5fa59ea86ba5f04f141222854241 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 20 Jul 2010 19:33:27 +0000 Subject: [PATCH 0248/1286] Bug 319687 - [ModelTooling] Feature Description and Copyright incorrect * fixed listener leaking * fixed problem of setting selection on disposed control --- .../emf/ui/internal/common/ModelEditor.java | 48 ++++++++++++++----- .../component/PartDescriptorEditor.java | 4 +- .../internal/common/component/PartEditor.java | 11 +++-- .../common/component/WindowEditor.java | 4 +- 4 files changed, 49 insertions(+), 18 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 227ce0a9a9..ad1a20a069 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -15,7 +15,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.annotation.PreDestroy; import javax.inject.Inject; +import org.eclipse.core.databinding.ObservablesManager; import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.map.IMapChangeListener; @@ -208,11 +210,14 @@ public class ModelEditor { @Preference(nodePath = "org.eclipse.e4.tools.emf.ui", value = "autoCreateElementId") private boolean autoCreateElementId; + private ObservablesManager obsManager; + public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project) { this.modelProvider = modelProvider; this.project = project; this.context = context; this.context.set(ModelEditor.class, this); + this.obsManager = new ObservablesManager(); registerDefaultEditors(); registerVirtualEditors(); @@ -283,28 +288,39 @@ public void controlResized(ControlEvent e) { public void selectionChanged(SelectionChangedEvent event) { if (!event.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) event.getSelection(); + final IStructuredSelection s = (IStructuredSelection) event.getSelection(); if (s.getFirstElement() instanceof EObject) { EObject obj = (EObject) s.getFirstElement(); - AbstractComponentEditor editor = getEditor(obj.eClass()); + final AbstractComponentEditor editor = getEditor(obj.eClass()); if (editor != null) { textLabel.setText(editor.getLabel(obj)); iconLabel.setImage(editor.getImage(obj, iconLabel.getDisplay())); - Composite comp = editor.getEditor(contentContainer, s.getFirstElement()); - comp.setBackgroundMode(SWT.INHERIT_DEFAULT); - layout.topControl = comp; - contentContainer.layout(true); + obsManager.runAndCollect(new Runnable() { + + public void run() { + Composite comp = editor.getEditor(contentContainer, s.getFirstElement()); + comp.setBackgroundMode(SWT.INHERIT_DEFAULT); + layout.topControl = comp; + contentContainer.layout(true); + } + }); } } else { VirtualEntry entry = (VirtualEntry) s.getFirstElement(); - AbstractComponentEditor editor = virtualEditors.get(entry.getId()); + final AbstractComponentEditor editor = virtualEditors.get(entry.getId()); if (editor != null) { textLabel.setText(editor.getLabel(entry)); iconLabel.setImage(editor.getImage(entry, iconLabel.getDisplay())); - Composite comp = editor.getEditor(contentContainer, s.getFirstElement()); - comp.setBackgroundMode(SWT.INHERIT_DEFAULT); - layout.topControl = comp; - contentContainer.layout(true); + obsManager.runAndCollect(new Runnable() { + + public void run() { + Composite comp = editor.getEditor(contentContainer, s.getFirstElement()); + comp.setBackgroundMode(SWT.INHERIT_DEFAULT); + layout.topControl = comp; + contentContainer.layout(true); + } + + }); } } @@ -681,6 +697,16 @@ public void setFocus() { viewer.getControl().setFocus(); } + @PreDestroy + void dispose() { + try { + obsManager.dispose(); + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + } + public IModelResource getModelProvider() { return modelProvider; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index c87f6e3a0d..c765096636 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -400,7 +400,7 @@ protected boolean accepted(Object o) { public void handleValueChange(ValueChangeEvent event) { if (event.diff.getOldValue() != null) { list.remove(event.diff.getOldValue()); - if (getMaster().getValue() == element) { + if (getMaster().getValue() == element && !createRemoveToolBar.isDisposed()) { createRemoveToolBar.setSelection(false); } @@ -408,7 +408,7 @@ public void handleValueChange(ValueChangeEvent event) { if (event.diff.getNewValue() != null) { list.add(0, event.diff.getNewValue()); - if (getMaster().getValue() == element) { + if (getMaster().getValue() == element && !createRemoveToolBar.isDisposed()) { createRemoveToolBar.setSelection(true); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 687678bc29..3404c41ee2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -372,7 +372,7 @@ protected void createSubformElements(Composite parent, EMFDataBindingContext con } @Override - public IObservableList getChildList(Object element) { + public IObservableList getChildList(final Object element) { final WritableList list = new WritableList(); if (getEditor().isModelFragment() && Util.isImport((EObject) element)) { @@ -407,12 +407,17 @@ protected boolean accepted(Object o) { public void handleValueChange(ValueChangeEvent event) { if (event.diff.getOldValue() != null) { list.remove(event.diff.getOldValue()); - createRemoveToolBar.setSelection(false); + if (getMaster().getValue() == element && !createRemoveToolBar.isDisposed()) { + createRemoveToolBar.setSelection(false); + } + } if (event.diff.getNewValue() != null) { list.add(0, event.diff.getNewValue()); - createRemoveToolBar.setSelection(true); + if (getMaster().getValue() == element && !createRemoveToolBar.isDisposed()) { + createRemoveToolBar.setSelection(true); + } } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index b825ff1624..9af16c8c58 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -402,14 +402,14 @@ protected boolean accepted(Object o) { public void handleValueChange(ValueChangeEvent event) { if (event.diff.getOldValue() != null) { list.remove(event.diff.getOldValue()); - if (getMaster().getValue() == element) { + if (getMaster().getValue() == element && !createRemoveMainMenu.isDisposed()) { createRemoveMainMenu.setSelection(false); } } if (event.diff.getNewValue() != null) { list.add(0, event.diff.getNewValue()); - if (getMaster().getValue() == element) { + if (getMaster().getValue() == element && !createRemoveMainMenu.isDisposed()) { createRemoveMainMenu.setSelection(true); } } From b8a24dbff552faae14dd06f63862d3c3033281c7 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 20 Jul 2010 21:42:39 +0000 Subject: [PATCH 0249/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixing copyrights --- .../org.eclipse.e4.tools.compat/about.html | 28 ++++++++++++ .../build.properties | 3 +- .../build.properties | 4 +- .../org.eclipse.e4.tools.services/about.html | 28 ++++++++++++ .../build.properties | 3 +- bundles/org.eclipse.e4.tools/about.html | 45 +++++++++++++++++++ bundles/org.eclipse.e4.tools/build.properties | 3 +- 7 files changed, 109 insertions(+), 5 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.compat/about.html create mode 100644 bundles/org.eclipse.e4.tools.services/about.html create mode 100644 bundles/org.eclipse.e4.tools/about.html diff --git a/bundles/org.eclipse.e4.tools.compat/about.html b/bundles/org.eclipse.e4.tools.compat/about.html new file mode 100644 index 0000000000..824948673d --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    December 3, 2009

    +

    License

    + +

    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 http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    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 http://www.eclipse.org.

    + + + \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/build.properties b/bundles/org.eclipse.e4.tools.compat/build.properties index 4975ca25a1..b4866ecf76 100644 --- a/bundles/org.eclipse.e4.tools.compat/build.properties +++ b/bundles/org.eclipse.e4.tools.compat/build.properties @@ -2,5 +2,6 @@ output.. = bin/ bin.includes = META-INF/,\ .,\ plugin.xml,\ - OSGI-INF/selectionproviderfunction.xml + OSGI-INF/,\ + about.html source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/build.properties b/bundles/org.eclipse.e4.tools.emf.ui/build.properties index 0ab8a4447f..e0bc710666 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/build.properties @@ -3,9 +3,9 @@ bin.includes = .,\ plugin.properties,\ icons/,\ about.html,\ - OSGI-INF/contributioncollector.xml,\ plugin.xml,\ - css/ + css/,\ + OSGI-INF/ output.. = bin/ jars.compile.order = . source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.services/about.html b/bundles/org.eclipse.e4.tools.services/about.html new file mode 100644 index 0000000000..824948673d --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    December 3, 2009

    +

    License

    + +

    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 http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    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 http://www.eclipse.org.

    + + + \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.services/build.properties b/bundles/org.eclipse.e4.tools.services/build.properties index 34d2e4d2da..17daa5b49c 100644 --- a/bundles/org.eclipse.e4.tools.services/build.properties +++ b/bundles/org.eclipse.e4.tools.services/build.properties @@ -1,4 +1,5 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ - . + .,\ + about.html diff --git a/bundles/org.eclipse.e4.tools/about.html b/bundles/org.eclipse.e4.tools/about.html new file mode 100644 index 0000000000..c1343aa318 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/about.html @@ -0,0 +1,45 @@ + + + + +About + + +

    About This Content

    + +

    December 3, 2009

    +

    License

    + +

    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 http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    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 http://www.eclipse.org.

    + +

    Third Party Content

    + +

    The Content includes items from third parties as set out below. If you did not +receive this Content directly from the Eclipse Foundation, the following is provided for informational +purposes only, and you should look to the Redistributor’s license for terms and conditions of use.

    + +

    Silk icon set Version 1.3

    +

    +This plugin contains icons from the Silk icon set created by Mark James. The original files can +be found at: +

    +

    The license can be found at:

    + + + + \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/build.properties b/bundles/org.eclipse.e4.tools/build.properties index 02422f7fd3..31b79e8de6 100644 --- a/bundles/org.eclipse.e4.tools/build.properties +++ b/bundles/org.eclipse.e4.tools/build.properties @@ -4,4 +4,5 @@ bin.includes = META-INF/,\ .,\ plugin.xml,\ icons/,\ - templates/ + templates/,\ + about.html From d7dc08a92a4bb060828aa577995b4d30a56fd96e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 20 Jul 2010 21:48:47 +0000 Subject: [PATCH 0250/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * externalizing MANIFEST and plugin.xml informations --- .../META-INF/MANIFEST.MF | 2 +- .../OSGI-INF/l10n/bundle.properties | 2 ++ .../build.properties | 4 ++-- .../META-INF/MANIFEST.MF | 2 +- .../OSGI-INF/l10n/bundle.properties | 4 ++++ .../build.properties | 3 ++- .../plugin.xml | 4 ++-- .../plugin.properties | 4 +++- bundles/org.eclipse.e4.tools.emf.ui/plugin.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../OSGI-INF/l10n/bundle.properties | 2 ++ .../build.properties | 3 ++- .../org.eclipse.e4.tools/META-INF/MANIFEST.MF | 2 +- .../OSGI-INF/l10n/bundle.properties | 11 +++++++++++ bundles/org.eclipse.e4.tools/build.properties | 3 ++- bundles/org.eclipse.e4.tools/plugin.xml | 18 +++++++++--------- 16 files changed, 46 insertions(+), 22 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.compat/OSGI-INF/l10n/bundle.properties create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/l10n/bundle.properties create mode 100644 bundles/org.eclipse.e4.tools.services/OSGI-INF/l10n/bundle.properties create mode 100644 bundles/org.eclipse.e4.tools/OSGI-INF/l10n/bundle.properties diff --git a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF index 4225c5064e..db28661cb9 100644 --- a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF @@ -1,6 +1,6 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: Compat +Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.e4.tools.compat;singleton:=true Bundle-Version: 1.0.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/bundles/org.eclipse.e4.tools.compat/OSGI-INF/l10n/bundle.properties b/bundles/org.eclipse.e4.tools.compat/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000000..b630aa038e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,2 @@ +#Properties file for org.eclipse.e4.tools.compat +Bundle-Name = Compat \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/build.properties b/bundles/org.eclipse.e4.tools.compat/build.properties index b4866ecf76..aac269a41e 100644 --- a/bundles/org.eclipse.e4.tools.compat/build.properties +++ b/bundles/org.eclipse.e4.tools.compat/build.properties @@ -2,6 +2,6 @@ output.. = bin/ bin.includes = META-INF/,\ .,\ plugin.xml,\ - OSGI-INF/,\ - about.html + about.html,\ + OSGI-INF/ source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index a521ba15df..444ded1a21 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -1,6 +1,6 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: Editor3x +Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.e4.tools.emf.editor3x;singleton:=true Bundle-Version: 0.9.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/l10n/bundle.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000000..565e1cd2af --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,4 @@ +#Properties file for org.eclipse.e4.tools.emf.editor3x +editor.name = e4 Workbenchmodel Editor +page.name = Model Editor +Bundle-Name = Editor3x \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties index 4f0aef779f..72fab184b7 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties @@ -3,5 +3,6 @@ bin.includes = META-INF/,\ .,\ plugin.xml,\ icons/,\ - OSGI-INF/ + OSGI-INF/,\ + about.html source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml index 389ebccf38..0ca898f300 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml @@ -9,7 +9,7 @@ extensions="e4xmi" icon="icons/full/obj16/application_view_tile.png" id="org.eclipse.e4.tools.emf.editor3x.e4wbm" - name="e4 Workbenchmodel Editor"> + name="%editor.name"> + name="%page.name"> diff --git a/bundles/org.eclipse.e4.tools.emf.ui/plugin.properties b/bundles/org.eclipse.e4.tools.emf.ui/plugin.properties index 14a799fbca..3d72871770 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/plugin.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/plugin.properties @@ -2,7 +2,9 @@ # # # -# $Id$ +# $Id: plugin.properties,v 1.1 2010/03/03 21:12:20 tschindl Exp $ pluginName = EMFUI Model providerName = www.example.org + +extension-point.name = Editors \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml b/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml index b3cd9703c8..b532b6c1b4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml +++ b/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml @@ -1,7 +1,7 @@ - + + name="%category.name"> + name="%wizard.name.0"> + name="%wizard.name.1"> + name="%wizard.name.2"> + name="%wizard.name.3"> + name="%wizard.name.4"> From af954c602a09b8a1c67fa4b8090c4f6aa0d703b5 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 20 Jul 2010 21:53:48 +0000 Subject: [PATCH 0251/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * externalizing MANIFEST and plugin.xml informations --- bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF | 1 + .../OSGI-INF/l10n/bundle.properties | 3 ++- .../org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF | 1 + .../OSGI-INF/l10n/bundle.properties | 3 ++- bundles/org.eclipse.e4.tools.emf.ui/plugin.properties | 6 +++--- bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF | 1 + .../OSGI-INF/l10n/bundle.properties | 3 ++- bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF | 1 + .../org.eclipse.e4.tools/OSGI-INF/l10n/bundle.properties | 3 ++- 9 files changed, 15 insertions(+), 7 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF index db28661cb9..0b4aea4d40 100644 --- a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF @@ -17,3 +17,4 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", Service-Component: OSGI-INF/selectionproviderfunction.xml Export-Package: org.eclipse.e4.tools.compat.parts Bundle-ActivationPolicy: lazy +Bundle-Vendor: %Bundle-Vendor diff --git a/bundles/org.eclipse.e4.tools.compat/OSGI-INF/l10n/bundle.properties b/bundles/org.eclipse.e4.tools.compat/OSGI-INF/l10n/bundle.properties index b630aa038e..767d1e6f4b 100644 --- a/bundles/org.eclipse.e4.tools.compat/OSGI-INF/l10n/bundle.properties +++ b/bundles/org.eclipse.e4.tools.compat/OSGI-INF/l10n/bundle.properties @@ -1,2 +1,3 @@ #Properties file for org.eclipse.e4.tools.compat -Bundle-Name = Compat \ No newline at end of file +Bundle-Name = Compat +Bundle-Vendor = Eclipse.org \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index 444ded1a21..5fa115467f 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -29,3 +29,4 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.jdt.ui;bundle-version="3.6.0" Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/xmiresourcecontextfunction.xml, OSGI-INF/projectfunction.xml, OSGI-INF/pdee4xmiprovider.xml Bundle-ActivationPolicy: lazy +Bundle-Vendor: %Bundle-Vendor diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/l10n/bundle.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/l10n/bundle.properties index 565e1cd2af..9042b1e4e4 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/l10n/bundle.properties +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/l10n/bundle.properties @@ -1,4 +1,5 @@ #Properties file for org.eclipse.e4.tools.emf.editor3x editor.name = e4 Workbenchmodel Editor page.name = Model Editor -Bundle-Name = Editor3x \ No newline at end of file +Bundle-Name = Editor3x +Bundle-Vendor = Eclipse.org \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/plugin.properties b/bundles/org.eclipse.e4.tools.emf.ui/plugin.properties index 3d72871770..a43449c01e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/plugin.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/plugin.properties @@ -2,9 +2,9 @@ # # # -# $Id: plugin.properties,v 1.1 2010/03/03 21:12:20 tschindl Exp $ +# $Id: plugin.properties,v 1.2 2010/07/20 21:48:42 tschindl Exp $ -pluginName = EMFUI Model -providerName = www.example.org +pluginName = EMF ModelTooling UI +providerName = Eclipse.org extension-point.name = Editors \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF index f4af0416bf..08d062afb0 100644 --- a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF @@ -5,3 +5,4 @@ Bundle-SymbolicName: org.eclipse.e4.tools.services Bundle-Version: 1.0.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 Export-Package: org.eclipse.e4.tools.services +Bundle-Vendor: %Bundle-Vendor diff --git a/bundles/org.eclipse.e4.tools.services/OSGI-INF/l10n/bundle.properties b/bundles/org.eclipse.e4.tools.services/OSGI-INF/l10n/bundle.properties index b08f86c6c2..190cbb9640 100644 --- a/bundles/org.eclipse.e4.tools.services/OSGI-INF/l10n/bundle.properties +++ b/bundles/org.eclipse.e4.tools.services/OSGI-INF/l10n/bundle.properties @@ -1,2 +1,3 @@ #Properties file for org.eclipse.e4.tools.services -Bundle-Name = Services \ No newline at end of file +Bundle-Name = Services +Bundle-Vendor = Eclipse.org \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF index 5906598513..3e8068527a 100644 --- a/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF @@ -23,3 +23,4 @@ Bundle-Activator: org.eclipse.e4.internal.tools.ToolsPlugin Export-Package: org.eclipse.e4.internal.tools.wizards.classes;x-internal:=true, org.eclipse.e4.internal.tools.wizards.model;x-internal:=true, org.eclipse.e4.internal.tools.wizards.project;x-internal:=true +Bundle-Vendor: %Bundle-Vendor diff --git a/bundles/org.eclipse.e4.tools/OSGI-INF/l10n/bundle.properties b/bundles/org.eclipse.e4.tools/OSGI-INF/l10n/bundle.properties index c9513f64d2..af034d7e3f 100644 --- a/bundles/org.eclipse.e4.tools/OSGI-INF/l10n/bundle.properties +++ b/bundles/org.eclipse.e4.tools/OSGI-INF/l10n/bundle.properties @@ -8,4 +8,5 @@ wizard.name.1 = New Model Fragment wizard.name.2 = New Handler Class wizard.name.3 = New Part Class wizard.name.4 = New Addon Class -Bundle-Name = Tools \ No newline at end of file +Bundle-Name = Tools +Bundle-Vendor = Eclipse.org \ No newline at end of file From 8f06e956941be8eb892c0d2fb3b1562e3e9d2482 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 21 Jul 2010 21:26:30 +0000 Subject: [PATCH 0252/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed tooling dialog title --- .../e4/internal/tools/wizards/model/NewModelFilePage.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java index b0e8fc0cdf..4cb85960be 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java @@ -53,8 +53,8 @@ public class NewModelFilePage extends WizardPage { */ public NewModelFilePage(ISelection selection, String defaultFilename) { super("wizardPage"); - setTitle("Multi-page Editor File"); - setDescription("This wizard creates a new file with *.e4xmi extension that can be opened by a multi-page editor."); + setTitle("New application model"); + setDescription("This wizard creates a new e4 application model"); this.selection = selection; this.defaultFilename = defaultFilename; } From 708faf7a93bc82555582167a6539f532ae155b15 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 21 Jul 2010 21:33:39 +0000 Subject: [PATCH 0253/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * code layouting --- .../e4/tools/emf/ui/common/EStackLayout.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/EStackLayout.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/EStackLayout.java index dee6098e7b..f416113015 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/EStackLayout.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/EStackLayout.java @@ -17,18 +17,18 @@ public class EStackLayout extends StackLayout { private boolean onlyVisible; - + public EStackLayout() { this(true); } - + public EStackLayout(boolean onlyVisible) { this.onlyVisible = onlyVisible; } - + @Override protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) { - if( topControl != null && onlyVisible ) { + if (topControl != null && onlyVisible) { int maxWidth = 0; int maxHeight = 0; Point size = topControl.computeSize(wHint, hHint, flushCache); @@ -36,8 +36,10 @@ protected Point computeSize(Composite composite, int wHint, int hHint, boolean f maxHeight = Math.max(size.y, maxHeight); int width = maxWidth + 2 * marginWidth; int height = maxHeight + 2 * marginHeight; - if (wHint != SWT.DEFAULT) width = wHint; - if (hHint != SWT.DEFAULT) height = hHint; + if (wHint != SWT.DEFAULT) + width = wHint; + if (hHint != SWT.DEFAULT) + height = hHint; return new Point(width, height); } return super.computeSize(composite, wHint, hHint, flushCache); From 336cc5b11f3ac0f39443a97912ef708e15849b99 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 22 Jul 2010 14:02:59 +0000 Subject: [PATCH 0254/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * set the name of the file --- .../e4/tools/emf/editor3x/E4WorkbenchModelEditor.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java index 38b089228d..dd2194036f 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java @@ -13,6 +13,7 @@ import org.eclipse.e4.tools.compat.parts.DIEditorPart; import org.eclipse.e4.tools.emf.ui.common.IModelResource.ModelListener; import org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor; +import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.actions.ActionFactory; @SuppressWarnings("restriction") @@ -36,6 +37,12 @@ public E4WorkbenchModelEditor() { super(ApplicationModelEditor.class, COPY|CUT|PASTE); } + @Override + public void createPartControl(Composite parent) { + super.createPartControl(parent); + setPartName(getEditorInput().getName()); + } + protected void makeActions() { super.makeActions(); undoAction = new UndoAction(getComponent().getModelProvider()); From 5549602499bc084d9fb285a730a12bc66b83b5af Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 23 Jul 2010 12:41:50 +0000 Subject: [PATCH 0255/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed layout problem --- .../e4/tools/emf/ui/internal/common/component/MenuEditor.java | 4 ++++ .../internal/common/component/ToolBarContributionEditor.java | 4 ++++ .../tools/emf/ui/internal/common/component/ToolBarEditor.java | 4 ++++ .../common/component/virtual/VBindingTableEditor.java | 2 +- .../common/component/virtual/VModelImportsEditor.java | 2 +- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 1c1dd4cc72..907cf6c162 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -254,6 +254,10 @@ public void widgetSelected(SelectionEvent e) { final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 120; + viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index dbb39e9740..557fb7ed13 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -218,6 +218,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 120; + viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 91775b5e02..ae4e0998b1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -188,6 +188,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 120; + viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index 6c09652695..6f806c1bf7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -99,7 +99,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr ObservableListContentProvider cp = new ObservableListContentProvider(); bindingViewer.setContentProvider(cp); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 180; + gd.heightHint = 300; bindingViewer.getControl().setLayoutData(gd); bindingViewer.setLabelProvider(new ComponentLabelProvider(getEditor())); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java index 6ccec9918d..582d95e2b2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java @@ -110,7 +110,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer.setContentProvider(new ObservableListContentProvider()); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 200; + gd.heightHint = 300; viewer.getControl().setLayoutData(gd); Composite buttonComp = new Composite(parent, SWT.NONE); From cf511351f47410a4c2fa0d8af69c4ab134ebc02b Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 23 Jul 2010 13:16:37 +0000 Subject: [PATCH 0256/1286] Bug 304584 - [Tooling] Implement Workbench-Model-Tooling * fixed problem with not updating package root --- .../e4/internal/tools/wizards/classes/AbstractNewClassPage.java | 1 + 1 file changed, 1 insertion(+) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java index fe4d7f7178..91584d662d 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java @@ -161,6 +161,7 @@ public void widgetDisposed(DisposeEvent e) { public void widgetSelected(SelectionEvent e) { IPackageFragmentRoot root = choosePackageRoot(); if( root != null ) { + froot = root; clazz.setFragmentRoot(root); } bd.updateModelToTarget(); //TODO Find out why this is needed From 99cf31d21173b03cb0ef1f9a4bb013d361240d75 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 24 Jul 2010 08:58:50 +0000 Subject: [PATCH 0257/1286] Bug 320788 - [Model] The model misses the possibility to define mnemonics for Menu-Elements --- .../eclipse/e4/tools/emf/ui/internal/Messages.java | 1 + .../e4/tools/emf/ui/internal/Messages.properties | 1 + .../internal/common/component/MenuItemEditor.java | 13 +++++++++++++ 3 files changed, 15 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index b84981ee0f..e66cdca324 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -130,6 +130,7 @@ public class Messages extends NLS { public static String MenuEditor_MainMenu; public static String MenuItemEditor_Enabled; public static String MenuItemEditor_Selected; + public static String MenuItemEditor_Mnemonics; public static String MenuSeparatorEditor_Label; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 1d290945fc..595bb5a4d2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -126,6 +126,7 @@ MenuItemEditor_Tooltip=Tooltip MenuItemEditor_IconURI=Icon URI MenuItemEditor_Enabled=Enabled MenuItemEditor_Selected=Selected +MenuItemEditor_Mnemonics=Mnemonics MenuSeparatorEditor_Label=Separator diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index b2e23a046d..23d606399d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -191,6 +191,19 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); } + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.MenuItemEditor_Mnemonics); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_ITEM__MNEMONICS).observeDetail(master)); + } + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); From fe2c728948431e2713ddbc83c10496be032fb661 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 24 Jul 2010 17:54:58 +0000 Subject: [PATCH 0258/1286] Bug 320819 - [ModelTooling] Generated canExecute() should return value --- .../tools/wizards/classes/templates/HandlerTemplate.java | 2 +- bundles/org.eclipse.e4.tools/templates/handler.txtjet | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/HandlerTemplate.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/HandlerTemplate.java index ddf80d9149..70ec397a07 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/HandlerTemplate.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/HandlerTemplate.java @@ -21,7 +21,7 @@ public static synchronized HandlerTemplate create(String lineSeparator) protected final String TEXT_5 = " {" + NL + "\t@Execute" + NL + "\tpublic void "; protected final String TEXT_6 = "() {" + NL + "\t\t//TODO Your code goes here" + NL + "\t}" + NL + "\t"; protected final String TEXT_7 = NL + "\t" + NL + "\t@CanExecute" + NL + "\tpublic boolean "; - protected final String TEXT_8 = "() {" + NL + "\t\t//TODO Your code goes here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_8 = "() {" + NL + "\t\t//TODO Your code goes here" + NL + "\t\treturn true;" + NL + "\t}" + NL + "\t"; protected final String TEXT_9 = "\t" + NL + "}"; public String generate(Object argument) diff --git a/bundles/org.eclipse.e4.tools/templates/handler.txtjet b/bundles/org.eclipse.e4.tools/templates/handler.txtjet index 27c7d75d51..7dfd8fd6e6 100644 --- a/bundles/org.eclipse.e4.tools/templates/handler.txtjet +++ b/bundles/org.eclipse.e4.tools/templates/handler.txtjet @@ -17,6 +17,7 @@ public class <%= domainClass.getName() %> { @CanExecute public boolean <%= domainClass.getCanExecuteMethodName() %>() { //TODO Your code goes here + return true; } <% } %> } \ No newline at end of file From 1999748cbe445d8c23b0ecaf075a0779b529bc05 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 24 Jul 2010 23:08:20 +0000 Subject: [PATCH 0259/1286] Bug 320617 - [ModelTooling] Undo/Redo not working in 4.0 --- .../eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java index dd2194036f..eff3aa3a7d 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java @@ -14,6 +14,7 @@ import org.eclipse.e4.tools.emf.ui.common.IModelResource.ModelListener; import org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor; import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IWorkbenchCommandConstants; import org.eclipse.ui.actions.ActionFactory; @SuppressWarnings("restriction") @@ -46,7 +47,10 @@ public void createPartControl(Composite parent) { protected void makeActions() { super.makeActions(); undoAction = new UndoAction(getComponent().getModelProvider()); + undoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_UNDO); + redoAction = new RedoAction(getComponent().getModelProvider()); + redoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_REDO); getEditorSite().getActionBars().setGlobalActionHandler( ActionFactory.UNDO.getId(), undoAction); From d0a13a8d2d4ad5b71841948e6b0cc4ca47cc9799 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 25 Jul 2010 13:47:11 +0000 Subject: [PATCH 0260/1286] Bug 320842 - [ModelTooling] Editing of Expressions not available --- .../full/modelelements/CoreExpression.png | Bin 0 -> 603 bytes .../e4/tools/emf/ui/internal/Messages.java | 8 + .../tools/emf/ui/internal/Messages.properties | 10 +- .../emf/ui/internal/common/ModelEditor.java | 6 + .../component/CoreExpressionEditor.java | 104 +++++++++ .../component/DirectMenuItemEditor.java | 33 +++ .../component/DirectToolItemEditor.java | 33 +++ .../component/HandledMenuItemEditor.java | 160 +++---------- .../component/HandledToolItemEditor.java | 121 +--------- .../virtual/VItemParametersEditor.java | 217 ++++++++++++++++++ 10 files changed, 453 insertions(+), 239 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CoreExpression.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CoreExpression.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CoreExpression.png new file mode 100644 index 0000000000000000000000000000000000000000..0c76bd1297751b66230f74719504b2adb02b1615 GIT binary patch literal 603 zcmV-h0;K(kP)^~*-1fljz_B$LUvK}k?BNXe#Y!m=zM!!V#}8bncK5m;8VP zw86G*RI63?Cd%b9bX|ueNlZ|wR6rj|r_)VIP@r2imh3?SN+^{|kY%~8B{maJ@F*OK z&VH9LwOeGt#DRjj0~v~8`>iO7!Ybi;zE$va`A^T#yW`y44;k^#O~K5*jD=qcUhPSc zvyy~q;5H_1WT1l~cqje9yfa+l!hu6xjdOJ8s;8E^+=QQ$tw p?%p!Hy#YapB=@+^9(46X{{RQg%9y;OKjr`c002ovPDHLkV1g7l326WT literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index e66cdca324..cf1c9ddab8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -486,6 +486,14 @@ public class Messages extends NLS { public static String ImageTooltip_Dimension; public static String ImageTooltip_FileSize; + public static String VItemParametersEditor_TreeLabel; + public static String VItemParametersEditor_TreeLabelDescription; + public static String VItemParametersEditor_Parameters; + + public static String CoreExpressionEditor_TreeLabel; + public static String CoreExpressionEditor_TreeLabelDescription; + public static String CoreExpressionEditor_ExpressionId; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 595bb5a4d2..094bc6f80a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -480,4 +480,12 @@ ImageTooltip_FileNotFound=File ''{0}'' not found in bundle ''{1}'' ImageTooltip_Icon=Icon ImageTooltip_Name=Name ImageTooltip_Dimension=Dimensions -ImageTooltip_FileSize=File-Size \ No newline at end of file +ImageTooltip_FileSize=File-Size + +VItemParametersEditor_TreeLabel=Parameters +VItemParametersEditor_TreeLabelDescription=Parameters Bla Bla Bla +VItemParametersEditor_Parameters=Parameters + +CoreExpressionEditor_TreeLabel=Core Expression +CoreExpressionEditor_TreeLabelDescription=Core Expression Bla Bla Bla +CoreExpressionEditor_ExpressionId=Expression Id \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index ad1a20a069..35c0cd19ac 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -57,6 +57,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.CategoryEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.CommandEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.CommandParameterEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.CoreExpressionEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.DirectMenuItemEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.DirectToolItemEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.HandledMenuItemEditor; @@ -94,6 +95,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VBindingTableEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VCommandEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VItemParametersEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuContributionsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelFragmentsEditor; @@ -187,6 +189,7 @@ public class ModelEditor { public static final String VIRTUAL_MODEL_FRAGEMENTS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_FRAGEMENTS"; //$NON-NLS-1$ public static final String VIRTUAL_MODEL_IMPORTS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_IMPORTS"; //$NON-NLS-1$ public static final String VIRTUAL_CATEGORIES = ModelEditor.class.getName() + ".VIRTUAL_CATEGORIES"; //$NON-NLS-1$ + public static final String VIRTUAL_PARAMETERS = ModelEditor.class.getName() + ".VIRTUAL_PARAMETERS"; //$NON-NLS-1$ private Map editorMap = new HashMap(); private Map virtualEditors = new HashMap(); @@ -553,6 +556,7 @@ private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_MODEL_FRAGEMENTS, new VModelFragmentsEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_MODEL_IMPORTS, new VModelImportsEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_CATEGORIES, new VApplicationCategoriesEditor(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_PARAMETERS, new VItemParametersEditor(modelProvider.getEditingDomain(), this)); } private void registerVirtualEditor(String id, AbstractComponentEditor editor) { @@ -616,6 +620,8 @@ private void registerDefaultEditors() { registerEditor(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION, new ToolBarContributionEditor(modelProvider.getEditingDomain(), this)); registerEditor(MenuPackageImpl.Literals.TRIM_CONTRIBUTION, new TrimContributionEditor(modelProvider.getEditingDomain(), this)); + registerEditor(UiPackageImpl.Literals.CORE_EXPRESSION, new CoreExpressionEditor(modelProvider.getEditingDomain(), this)); + registerEditor(BasicPackageImpl.Literals.PART, new PartEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(BasicPackageImpl.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(BasicPackageImpl.Literals.TRIMMED_WINDOW, new TrimmedWindowEditor(modelProvider.getEditingDomain(), this, project)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java new file mode 100644 index 0000000000..91eff9ede5 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java @@ -0,0 +1,104 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import java.net.MalformedURLException; +import java.net.URL; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.ui.model.application.ui.MCoreExpression; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class CoreExpressionEditor extends AbstractComponentEditor { + private Composite composite; + private Image image; + private EMFDataBindingContext context; + + public CoreExpressionEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain, editor); + } + + @Override + public Image getImage(Object element, Display display) { + if (image == null) { + try { + image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CoreExpression.png")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return image; + } + + @Override + public String getLabel(Object element) { + return Messages.CoreExpressionEditor_TreeLabel; + } + + @Override + public String getDetailLabel(Object element) { + if (((MCoreExpression) element).getCoreExpressionId() != null && ((MCoreExpression) element).getCoreExpressionId().trim().length() > 0) { + return ((MCoreExpression) element).getCoreExpressionId(); + } + return null; + } + + @Override + public String getDescription(Object element) { + return Messages.CoreExpressionEditor_TreeLabelDescription; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + composite = new Composite(parent, SWT.NONE); + composite.setLayout(new FillLayout()); + createForm(composite, context, getMaster()); + } + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + ControlFactory.createTextField(parent, Messages.CoreExpressionEditor_ExpressionId, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.CORE_EXPRESSION__CORE_EXPRESSION_ID)); + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return null; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index 2b06123e4d..b51f905d0e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -12,6 +12,10 @@ import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; @@ -21,8 +25,12 @@ import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -40,6 +48,7 @@ import org.eclipse.swt.widgets.Text; public class DirectMenuItemEditor extends MenuItemEditor { + private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain, editor, project); @@ -119,4 +128,28 @@ public void widgetSelected(SelectionEvent e) { }); } } + + @Override + public IObservableList getChildList(Object element) { + final WritableList list = new WritableList(); + + if (((MHandledMenuItem) element).getVisibleWhen() != null) { + list.add(0, ((MHandledMenuItem) element).getVisibleWhen()); + } + + UI_ELEMENT__VISIBLE_WHEN.observe(element).addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + if (event.diff.getOldValue() != null) { + list.remove(event.diff.getOldValue()); + } + + if (event.diff.getNewValue() != null) { + list.add(0, event.diff.getNewValue()); + } + } + }); + + return list; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index 6f6bb09643..edd8257c25 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -12,6 +12,10 @@ import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; @@ -21,8 +25,12 @@ import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -40,6 +48,7 @@ import org.eclipse.swt.widgets.Text; public class DirectToolItemEditor extends ToolItemEditor { + private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); public DirectToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { super(editingDomain, editor, project); @@ -116,4 +125,28 @@ public String getLabel(Object element) { public String getDescription(Object element) { return Messages.DirectToolItemEditor_Description; } + + @Override + public IObservableList getChildList(Object element) { + final WritableList list = new WritableList(); + + if (((MHandledMenuItem) element).getVisibleWhen() != null) { + list.add(0, ((MHandledMenuItem) element).getVisibleWhen()); + } + + UI_ELEMENT__VISIBLE_WHEN.observe(element).addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + if (event.diff.getOldValue() != null) { + list.remove(event.diff.getOldValue()); + } + + if (event.diff.getNewValue() != null) { + list.add(0, event.diff.getNewValue()); + } + } + }); + + return list; + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index a39b73c52d..f3c933dfa2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -13,40 +13,37 @@ import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledMenuItemCommandSelectionDialog; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; +import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; @@ -57,6 +54,7 @@ public class HandledMenuItemEditor extends MenuItemEditor { private IModelResource resource; private IEMFEditListProperty HANDLED_ITEM__PARAMETERS = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); + private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); public HandledMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource) { super(editingDomain, editor, project); @@ -124,130 +122,36 @@ public void widgetSelected(SelectionEvent e) { } }); } + } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.HandledMenuItemEditor_Parameters); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer viewer = new TableViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 120; - viewer.getControl().setLayoutData(gd); - - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); - viewer.setInput(prop.observeDetail(master)); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MHandledItem container = (MHandledItem) getMaster().getValue(); - int idx = container.getParameters().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); + @Override + public IObservableList getChildList(Object element) { + final WritableList list = new WritableList(); - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MHandledItem container = (MHandledItem) getMaster().getValue(); - int idx = container.getParameters().indexOf(obj) + 1; - if (idx < container.getParameters().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); + if (((MHandledMenuItem) element).getVisibleWhen() != null) { + list.add(0, ((MHandledMenuItem) element).getVisibleWhen()); + } - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MHandledItem item = (MHandledItem) master.getValue(); - MParameter param = MCommandsFactory.INSTANCE.createParameter(); - setElementId(param); - - Command cmd = AddCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, param); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(param); - } - } - }); + UI_ELEMENT__VISIBLE_WHEN.observe(element).addValueChangeListener(new IValueChangeListener() { - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Remove); - b.addSelectionListener(new SelectionAdapter() { + public void handleValueChange(ValueChangeEvent event) { + if (event.diff.getOldValue() != null) { + list.remove(event.diff.getOldValue()); + } - public void widgetSelected(SelectionEvent e) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (!s.isEmpty()) { - MHandledItem item = (MHandledItem) master.getValue(); - Command cmd = RemoveCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, s.toList()); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } + if (event.diff.getNewValue() != null) { + list.add(0, event.diff.getNewValue()); } + } + }); - }); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - } - } + list.add(new VirtualEntry(ModelEditor.VIRTUAL_PARAMETERS, HANDLED_ITEM__PARAMETERS, element, Messages.HandledMenuItemEditor_Parameters) { + @Override + protected boolean accepted(MParameter o) { + return true; + } + }); - @Override - public IObservableList getChildList(Object element) { - return HANDLED_ITEM__PARAMETERS.observe(element); + return list; } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index 2b6131f23f..b07ababcc3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -13,40 +13,31 @@ import java.net.MalformedURLException; import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledToolItemCommandSelectionDialog; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; @@ -112,104 +103,6 @@ public void widgetSelected(SelectionEvent e) { } }); } - - // ------------------------------------------------------------ - - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.HandledToolItemEditor_Parameters); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer viewer = new TableViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 120; - viewer.getControl().setLayoutData(gd); - - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); - viewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MHandledItem container = (MHandledItem) getMaster().getValue(); - int idx = container.getParameters().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MHandledItem item = (MHandledItem) master.getValue(); - MParameter param = MCommandsFactory.INSTANCE.createParameter(); - setElementId(param); - - Command cmd = AddCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, param); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(param); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Remove); - b.addSelectionListener(new SelectionAdapter() { - - public void widgetSelected(SelectionEvent e) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (!s.isEmpty()) { - MHandledItem item = (MHandledItem) master.getValue(); - Command cmd = RemoveCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, s.toList()); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - - }); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - } @Override @@ -224,7 +117,15 @@ public String getDescription(Object element) { @Override public IObservableList getChildList(Object element) { - return HANDLED_ITEM__PARAMETERS.observe(element); + WritableList list = new WritableList(); + list.add(new VirtualEntry(ModelEditor.VIRTUAL_PARAMETERS, HANDLED_ITEM__PARAMETERS, element, Messages.HandledToolItemEditor_Parameters) { + @Override + protected boolean accepted(MParameter o) { + return true; + } + }); + + return list; } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java new file mode 100644 index 0000000000..de21d72f1b --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java @@ -0,0 +1,217 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; +import org.eclipse.e4.ui.model.application.commands.MParameter; +import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VItemParametersEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private TableViewer viewer; + + private IEMFListProperty HANDLED_ITEM__PARAMETERS = EMFProperties.list(MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); + + public VItemParametersEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain, editor); + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return Messages.VItemParametersEditor_TreeLabel; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return Messages.VItemParametersEditor_TreeLabelDescription; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + composite = createForm(parent, context, getMaster()); + } + VirtualEntry o = (VirtualEntry) object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); + + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.VItemParametersEditor_Parameters); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Up); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MHandledItem container = (MHandledItem) getMaster().getValue(); + int idx = container.getParameters().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Down); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MHandledItem container = (MHandledItem) getMaster().getValue(); + int idx = container.getParameters().indexOf(obj) + 1; + if (idx < container.getParameters().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_AddEllipsis); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MParameter handler = MCommandsFactory.INSTANCE.createParameter(); + setElementId(handler); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(handler); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Remove); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List handlers = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, handlers); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return HANDLED_ITEM__PARAMETERS.observe(element); + } +} From 118c62134a7f93a00e5429d874b01a427ed14808 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 25 Jul 2010 14:35:50 +0000 Subject: [PATCH 0261/1286] Bug 320842 - [ModelTooling] Editing of Expressions not available --- .../e4/tools/emf/ui/internal/Messages.java | 3 + .../tools/emf/ui/internal/Messages.properties | 3 + .../component/DirectMenuItemEditor.java | 6 +- .../component/DirectToolItemEditor.java | 6 +- .../component/HandledToolItemEditor.java | 28 ++++++++- .../common/component/MenuItemEditor.java | 63 ++++++++++++++++++- .../common/component/ToolItemEditor.java | 58 +++++++++++++++++ 7 files changed, 158 insertions(+), 9 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index cf1c9ddab8..11b3de3d1c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -24,6 +24,7 @@ public class Messages extends NLS { public static String ModelTooling_UIElement_ToBeRendered; public static String ModelTooling_UIElement_Visible; + public static String ModelTooling_UIElement_VisibleWhen; public static String ModelTooling_Context_Variables; public static String ModelTooling_Context_Properties; @@ -131,6 +132,7 @@ public class Messages extends NLS { public static String MenuItemEditor_Enabled; public static String MenuItemEditor_Selected; public static String MenuItemEditor_Mnemonics; + public static String MenuItemEditor_NoExpression; public static String MenuSeparatorEditor_Label; @@ -308,6 +310,7 @@ public class Messages extends NLS { public static String ToolItemEditor_IconURI; public static String ToolItemEditor_Enabled; public static String ToolItemEditor_Selected; + public static String ToolItemEditor_NoExpression; public static String TrimBarEditor_TreeLabel; public static String TrimBarEditor_TreeLabelDescription; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 094bc6f80a..c3bd06e041 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -19,6 +19,7 @@ ModelTooling_Common_FindEllipsis=Find ... ModelTooling_UIElement_ToBeRendered=To Be Rendered ModelTooling_UIElement_Visible=Visible +ModelTooling_UIElement_VisibleWhen=Visible-When Expression ModelTooling_Context_Variables=Variables ModelTooling_Context_Properties=Context Properties @@ -127,6 +128,7 @@ MenuItemEditor_IconURI=Icon URI MenuItemEditor_Enabled=Enabled MenuItemEditor_Selected=Selected MenuItemEditor_Mnemonics=Mnemonics +MenuItemEditor_NoExpression= MenuSeparatorEditor_Label=Separator @@ -304,6 +306,7 @@ ToolItemEditor_ToolTip=Tooltip ToolItemEditor_IconURI=Icon URI ToolItemEditor_Enabled=Enabled ToolItemEditor_Selected=Selected +ToolItemEditor_NoExpression= TrimBarEditor_TreeLabel=Window Trim TrimBarEditor_TreeLabelDescription=Window Trim bla bla bla diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index b51f905d0e..c8b5e32363 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -26,7 +26,7 @@ import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; +import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; @@ -133,8 +133,8 @@ public void widgetSelected(SelectionEvent e) { public IObservableList getChildList(Object element) { final WritableList list = new WritableList(); - if (((MHandledMenuItem) element).getVisibleWhen() != null) { - list.add(0, ((MHandledMenuItem) element).getVisibleWhen()); + if (((MDirectMenuItem) element).getVisibleWhen() != null) { + list.add(0, ((MDirectMenuItem) element).getVisibleWhen()); } UI_ELEMENT__VISIBLE_WHEN.observe(element).addValueChangeListener(new IValueChangeListener() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index edd8257c25..5370368e8c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -26,7 +26,7 @@ import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; +import org.eclipse.e4.ui.model.application.ui.menu.MDirectToolItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; @@ -130,8 +130,8 @@ public String getDescription(Object element) { public IObservableList getChildList(Object element) { final WritableList list = new WritableList(); - if (((MHandledMenuItem) element).getVisibleWhen() != null) { - list.add(0, ((MHandledMenuItem) element).getVisibleWhen()); + if (((MDirectToolItem) element).getVisibleWhen() != null) { + list.add(0, ((MDirectToolItem) element).getVisibleWhen()); } UI_ELEMENT__VISIBLE_WHEN.observe(element).addValueChangeListener(new IValueChangeListener() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index b07ababcc3..4b81e066f2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -14,6 +14,8 @@ import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.IModelResource; @@ -24,10 +26,14 @@ import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; +import org.eclipse.e4.ui.model.application.ui.menu.MHandledToolItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.edit.domain.EditingDomain; @@ -46,7 +52,9 @@ public class HandledToolItemEditor extends ToolItemEditor { private IModelResource resource; + private IEMFEditListProperty HANDLED_ITEM__PARAMETERS = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); + private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); public HandledToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource) { super(editingDomain, editor, project); @@ -117,7 +125,25 @@ public String getDescription(Object element) { @Override public IObservableList getChildList(Object element) { - WritableList list = new WritableList(); + final WritableList list = new WritableList(); + + if (((MHandledToolItem) element).getVisibleWhen() != null) { + list.add(0, ((MHandledToolItem) element).getVisibleWhen()); + } + + UI_ELEMENT__VISIBLE_WHEN.observe(element).addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + if (event.diff.getOldValue() != null) { + list.remove(event.diff.getOldValue()); + } + + if (event.diff.getNewValue() != null) { + list.add(0, event.diff.getNewValue()); + } + } + }); + list.add(new VirtualEntry(ModelEditor.VIRTUAL_PARAMETERS, HANDLED_ITEM__PARAMETERS, element, Messages.HandledToolItemEditor_Parameters) { @Override protected boolean accepted(MParameter o) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 23d606399d..b02b02c7ca 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -12,6 +12,8 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; +import java.util.List; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.conversion.Converter; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -36,13 +38,16 @@ import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerProperties; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -291,10 +296,37 @@ public Object convert(Object fromObject) { } + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.ModelTooling_UIElement_VisibleWhen); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + ComboViewer combo = new ComboViewer(parent); + combo.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + combo.setContentProvider(new ArrayContentProvider()); + combo.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + if (element instanceof EClass) { + EClass eClass = (EClass) element; + return eClass.getName(); + } + + return super.getText(element); + } + }); + List list = new ArrayList(); + list.add(Messages.MenuItemEditor_NoExpression); + list.add(UiPackageImpl.Literals.CORE_EXPRESSION); + list.addAll(getEditor().getFeatureClasses(UiPackageImpl.Literals.EXPRESSION, UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN)); + combo.setInput(list); + context.bindValue(ViewerProperties.singleSelection().observe(combo), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN).observeDetail(getMaster()), new UpdateValueStrategy().setConverter(new EClass2EObject()), new UpdateValueStrategy().setConverter(new EObject2EClass())); + } + createFormSubTypeForm(parent, context, master); - ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); @@ -321,4 +353,31 @@ public String getDetailLabel(Object element) { public FeaturePath[] getLabelProperties() { return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } + + static class EObject2EClass extends Converter { + public EObject2EClass() { + super(EObject.class, EClass.class); + } + + public Object convert(Object fromObject) { + if (fromObject == null) { + return Messages.MenuItemEditor_NoExpression; + } + return ((EObject) fromObject).eClass(); + } + } + + static class EClass2EObject extends Converter { + + public EClass2EObject() { + super(EClass.class, EObject.class); + } + + public Object convert(Object fromObject) { + if (fromObject == null || fromObject.toString().equals(Messages.MenuItemEditor_NoExpression)) { + return null; + } + return EcoreUtil.create((EClass) fromObject); + } + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 3b893b6162..598b692249 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import java.util.ArrayList; +import java.util.List; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.conversion.Converter; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -34,13 +36,16 @@ import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerProperties; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -237,6 +242,32 @@ public Object convert(Object fromObject) { } + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.ModelTooling_UIElement_VisibleWhen); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + ComboViewer combo = new ComboViewer(parent); + combo.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + combo.setContentProvider(new ArrayContentProvider()); + combo.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + if (element instanceof EClass) { + EClass eClass = (EClass) element; + return eClass.getName(); + } + + return super.getText(element); + } + }); + List list = new ArrayList(); + list.add(Messages.ToolItemEditor_NoExpression); + list.add(UiPackageImpl.Literals.CORE_EXPRESSION); + list.addAll(getEditor().getFeatureClasses(UiPackageImpl.Literals.EXPRESSION, UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN)); + combo.setInput(list); + context.bindValue(ViewerProperties.singleSelection().observe(combo), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN).observeDetail(getMaster()), new UpdateValueStrategy().setConverter(new EClass2EObject()), new UpdateValueStrategy().setConverter(new EObject2EClass())); + } // ------------------------------------------------------------ createSubTypeFormElements(parent, context, master); @@ -271,4 +302,31 @@ public String getDetailLabel(Object element) { public FeaturePath[] getLabelProperties() { return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__TOOLTIP), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } + + static class EObject2EClass extends Converter { + public EObject2EClass() { + super(EObject.class, EClass.class); + } + + public Object convert(Object fromObject) { + if (fromObject == null) { + return Messages.MenuItemEditor_NoExpression; + } + return ((EObject) fromObject).eClass(); + } + } + + static class EClass2EObject extends Converter { + + public EClass2EObject() { + super(EClass.class, EObject.class); + } + + public Object convert(Object fromObject) { + if (fromObject == null || fromObject.toString().equals(Messages.MenuItemEditor_NoExpression)) { + return null; + } + return EcoreUtil.create((EClass) fromObject); + } + } } From e5ccc124c6dac384d02e2bdeba1a980931f45d7c Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 25 Jul 2010 15:09:45 +0000 Subject: [PATCH 0262/1286] Bug 320842 - [ModelTooling] Editing of Expressions not available --- .../e4/tools/emf/ui/internal/Messages.java | 5 + .../tools/emf/ui/internal/Messages.properties | 7 +- .../emf/ui/internal/common/ModelEditor.java | 3 + .../internal/common/component/MenuEditor.java | 203 ++++---------- .../virtual/VMenuElementsEditor.java | 248 ++++++++++++++++++ 5 files changed, 318 insertions(+), 148 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 11b3de3d1c..ac2bd8eea2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -123,6 +123,7 @@ public class Messages extends NLS { public static String MenuEditor_LabelLabel; public static String MenuEditor_Tooltip; public static String MenuEditor_IconURI; + public static String MenuEditor_Children; public static String MenuItemEditor_Type; public static String MenuItemEditor_Label; @@ -497,6 +498,10 @@ public class Messages extends NLS { public static String CoreExpressionEditor_TreeLabelDescription; public static String CoreExpressionEditor_ExpressionId; + public static String VMenuElementsEditor_TreeLabel; + public static String VMenuElementsEditor_TreeLabelDescription; + public static String VMenuElementsEditor_Children; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index c3bd06e041..220a454f1c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -120,6 +120,7 @@ MenuEditor_LabelLabel=Label MenuEditor_Tooltip=Tooltip MenuEditor_IconURI=Icon URI MenuEditor_MainMenu=Main Menu +MenuEditor_Children=Children MenuItemEditor_Type=Type MenuItemEditor_Label=Label @@ -491,4 +492,8 @@ VItemParametersEditor_Parameters=Parameters CoreExpressionEditor_TreeLabel=Core Expression CoreExpressionEditor_TreeLabelDescription=Core Expression Bla Bla Bla -CoreExpressionEditor_ExpressionId=Expression Id \ No newline at end of file +CoreExpressionEditor_ExpressionId=Expression Id + +VMenuElementsEditor_TreeLabel=Children +VMenuElementsEditor_TreeLabelDescription=Children Bla Bla Bla +VMenuElementsEditor_Children=Children \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 35c0cd19ac..4158827582 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -98,6 +98,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VItemParametersEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuContributionsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuElementsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelFragmentsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelImportsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptor; @@ -190,6 +191,7 @@ public class ModelEditor { public static final String VIRTUAL_MODEL_IMPORTS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_IMPORTS"; //$NON-NLS-1$ public static final String VIRTUAL_CATEGORIES = ModelEditor.class.getName() + ".VIRTUAL_CATEGORIES"; //$NON-NLS-1$ public static final String VIRTUAL_PARAMETERS = ModelEditor.class.getName() + ".VIRTUAL_PARAMETERS"; //$NON-NLS-1$ + public static final String VIRTUAL_MENUELEMENTS = ModelEditor.class.getName() + ".VIRTUAL_MENUELEMENTS"; //$NON-NLS-1$ private Map editorMap = new HashMap(); private Map virtualEditors = new HashMap(); @@ -557,6 +559,7 @@ private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_MODEL_IMPORTS, new VModelImportsEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_CATEGORIES, new VApplicationCategoriesEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_PARAMETERS, new VItemParametersEditor(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_MENUELEMENTS, new VMenuElementsEditor(modelProvider.getEditingDomain(), this)); } private void registerVirtualEditor(String id, AbstractComponentEditor editor) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 907cf6c162..888a19128f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -12,8 +12,13 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.List; +import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.resources.IProject; @@ -22,40 +27,33 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor.EClass2EObject; +import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor.EObject2EClass; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.databinding.viewers.ViewerProperties; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -76,20 +74,9 @@ public class MenuEditor extends AbstractComponentEditor { private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); private EStackLayout stackLayout; - private static class Struct { - private final String label; - private final EClass eClass; - private final boolean separator; - - public Struct(String label, EClass eClass, boolean separator) { - this.label = label; - this.eClass = eClass; - this.separator = separator; - } - } - public MenuEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { super(editingDomain, editor); this.project = project; @@ -245,139 +232,35 @@ public void widgetSelected(SelectionEvent e) { }); } - // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuEditor_MenuItems); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 120; - viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - - IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(master)); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer container = (MElementContainer) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; - if (idx >= 0) { - if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer container = (MElementContainer) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if (idx < container.getChildren().size()) { - if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); + l.setText(Messages.ModelTooling_UIElement_VisibleWhen); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { + ComboViewer combo = new ComboViewer(parent); + combo.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + combo.setContentProvider(new ArrayContentProvider()); + combo.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { - Struct struct = (Struct) element; - return struct.label; - } - }); - - Struct defaultStruct = new Struct(Messages.MenuEditor_HandledMenuItem, MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false); - childrenDropDown.setInput(new Struct[] { new Struct(Messages.MenuEditor_Separator, MenuPackageImpl.Literals.MENU_SEPARATOR, true), new Struct(Messages.MenuEditor_Menu, MenuPackageImpl.Literals.MENU, false), defaultStruct, new Struct(Messages.MenuEditor_DirectMenuItem, MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false) }); - childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!childrenDropDown.getSelection().isEmpty()) { - Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - EClass eClass = struct.eClass; - MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - if (!struct.separator) { - getEditor().setSelection(eObject); - } - } + if (element instanceof EClass) { + EClass eClass = (EClass) element; + return eClass.getName(); } - } - }); - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } + return super.getText(element); } }); + List list = new ArrayList(); + list.add(Messages.MenuItemEditor_NoExpression); + list.add(UiPackageImpl.Literals.CORE_EXPRESSION); + list.addAll(getEditor().getFeatureClasses(UiPackageImpl.Literals.EXPRESSION, UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN)); + combo.setInput(list); + context.bindValue(ViewerProperties.singleSelection().observe(combo), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN).observeDetail(getMaster()), new UpdateValueStrategy().setConverter(new EClass2EObject()), new UpdateValueStrategy().setConverter(new EObject2EClass())); } - ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); @@ -386,7 +269,33 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); + final WritableList list = new WritableList(); + + if (((MUIElement) element).getVisibleWhen() != null) { + list.add(0, ((MUIElement) element).getVisibleWhen()); + } + + UI_ELEMENT__VISIBLE_WHEN.observe(element).addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + if (event.diff.getOldValue() != null) { + list.remove(event.diff.getOldValue()); + } + + if (event.diff.getNewValue() != null) { + list.add(0, event.diff.getNewValue()); + } + } + }); + + list.add(new VirtualEntry(ModelEditor.VIRTUAL_MENUELEMENTS, ELEMENT_CONTAINER__CHILDREN, element, Messages.MenuEditor_Children) { + @Override + protected boolean accepted(MMenuElement o) { + return true; + } + }); + + return list; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java new file mode 100644 index 0000000000..02e44a4ebf --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java @@ -0,0 +1,248 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VMenuElementsEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private TableViewer viewer; + + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + + public VMenuElementsEditor(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain, editor); + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return Messages.VMenuElementsEditor_TreeLabel; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return Messages.VMenuElementsEditor_TreeLabelDescription; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + composite = createForm(parent, context, getMaster()); + } + VirtualEntry o = (VirtualEntry) object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); + + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.VMenuElementsEditor_Children); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 120; + viewer.getControl().setLayoutData(gd); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Up); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if (idx >= 0) { + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Down); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if (idx < container.getChildren().size()) { + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + Struct struct = (Struct) element; + return struct.label; + } + }); + + Struct defaultStruct = new Struct(Messages.MenuEditor_HandledMenuItem, MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false); + childrenDropDown.setInput(new Struct[] { new Struct(Messages.MenuEditor_Separator, MenuPackageImpl.Literals.MENU_SEPARATOR, true), new Struct(Messages.MenuEditor_Menu, MenuPackageImpl.Literals.MENU, false), defaultStruct, new Struct(Messages.MenuEditor_DirectMenuItem, MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false) }); + childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!childrenDropDown.getSelection().isEmpty()) { + Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); + EClass eClass = struct.eClass; + MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + if (!struct.separator) { + getEditor().setSelection(eObject); + } + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Remove); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return ELEMENT_CONTAINER__CHILDREN.observe(element); + } + + private static class Struct { + private final String label; + private final EClass eClass; + private final boolean separator; + + public Struct(String label, EClass eClass, boolean separator) { + this.label = label; + this.eClass = eClass; + this.separator = separator; + } + } + +} From 59a07d7f5d1bc77fa369d60617fb9bdec2cdea96 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 25 Jul 2010 15:36:55 +0000 Subject: [PATCH 0263/1286] Bug 320848 - [ModelTooling] No command information displayed without an id --- .../ui/common/CommandToStringConverter.java | 48 +++++++++++++++++++ .../component/HandledMenuItemEditor.java | 6 +-- .../component/HandledToolItemEditor.java | 6 +-- .../common/component/HandlerEditor.java | 4 +- .../common/component/KeyBindingEditor.java | 3 +- 5 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/CommandToStringConverter.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/CommandToStringConverter.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/CommandToStringConverter.java new file mode 100644 index 0000000000..5df8932322 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/CommandToStringConverter.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.common; + +import org.eclipse.core.databinding.conversion.Converter; +import org.eclipse.e4.ui.internal.workbench.E4XMIResource; +import org.eclipse.e4.ui.model.application.commands.MCommand; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; + +public class CommandToStringConverter extends Converter { + + public CommandToStringConverter() { + super(MCommand.class, String.class); + } + + public Object convert(Object fromObject) { + MCommand cmd = (MCommand) fromObject; + String elementId = null; + if (cmd != null && cmd.getElementId() != null && cmd.getElementId().trim().length() > 0) { + elementId = cmd.getElementId(); + } + if (cmd == null) { + return ""; + } else if (cmd.getCommandName() != null && cmd.getCommandName().trim().length() > 0) { + return cmd.getCommandName() + (elementId != null ? " - " + elementId : ""); //$NON-NLS-1$//$NON-NLS-2$ + } else if (elementId != null) { + return elementId; + } else { + Resource res = ((EObject) cmd).eResource(); + if (res instanceof E4XMIResource) { + String v = ((E4XMIResource) res).getID((EObject) cmd); + if (v != null && v.trim().length() > 0) { + return v; + } + } + return cmd.getClass().getSimpleName() + "@" + cmd.hashCode(); //$NON-NLS-1$ + } + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index f3c933dfa2..5aaa4afc6f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -12,19 +12,20 @@ import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.CommandToStringConverter; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledMenuItemCommandSelectionDialog; import org.eclipse.e4.ui.model.application.commands.MParameter; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; @@ -32,7 +33,6 @@ import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; @@ -108,7 +108,7 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEnabled(false); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND).observeDetail(master), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter())); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index 4b81e066f2..4b11f9fb64 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -12,19 +12,20 @@ import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.CommandToStringConverter; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledToolItemCommandSelectionDialog; import org.eclipse.e4.ui.model.application.commands.MParameter; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; @@ -32,7 +33,6 @@ import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; @@ -97,7 +97,7 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEnabled(false); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND).observeDetail(master), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter())); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index f8672a3863..7e14fabe21 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -12,9 +12,11 @@ import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.CommandToStringConverter; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.common.IModelResource; @@ -154,7 +156,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEnabled(false); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.HANDLER__COMMAND, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.HANDLER__COMMAND).observeDetail(getMaster()), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter())); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index a36f5ca915..1cd26d842d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -21,6 +21,7 @@ import org.eclipse.core.databinding.validation.IValidator; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.e4.tools.emf.ui.common.CommandToStringConverter; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.Util; @@ -218,7 +219,7 @@ public void handleValueChange(ValueChangeEvent event) { Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEnabled(false); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.KEY_BINDING__COMMAND, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(getMaster())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_BINDING__COMMAND).observeDetail(getMaster()), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter())); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); From 5e55064571fb04bd8b9b7a36fb6011c0131108d2 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 25 Jul 2010 16:06:21 +0000 Subject: [PATCH 0264/1286] Bug 320850 - [ModelTooling] Should be able to show the XMI:ID --- .../editor3x/ModelEditorPreferencePage.java | 18 +++++++++++ .../emf/ui/internal/common/ModelEditor.java | 8 +++++ .../common/component/AddonsEditor.java | 4 +++ .../common/component/ApplicationEditor.java | 4 +++ .../component/BindingContextEditor.java | 4 +++ .../common/component/BindingTableEditor.java | 4 +++ .../common/component/CategoryEditor.java | 4 +++ .../common/component/CommandEditor.java | 4 +++ .../component/CommandParameterEditor.java | 4 +++ .../common/component/ControlFactory.java | 30 +++++++++++++++++++ .../component/CoreExpressionEditor.java | 4 +++ .../component/HandledMenuItemEditor.java | 2 +- .../component/HandledToolItemEditor.java | 2 +- .../common/component/HandlerEditor.java | 6 +++- .../common/component/KeyBindingEditor.java | 6 +++- .../component/MenuContributionEditor.java | 4 +++ .../internal/common/component/MenuEditor.java | 4 +++ .../common/component/MenuItemEditor.java | 4 +++ .../common/component/MenuSeparatorEditor.java | 4 +++ .../component/ModelFragmentsEditor.java | 4 +++ .../common/component/ParameterEditor.java | 4 +++ .../component/PartDescriptorEditor.java | 4 +++ .../internal/common/component/PartEditor.java | 4 +++ .../component/PartSashContainerEditor.java | 4 +++ .../common/component/PartStackEditor.java | 4 +++ .../common/component/PerspectiveEditor.java | 4 +++ .../component/PerspectiveStackEditor.java | 4 +++ .../common/component/PlaceholderEditor.java | 4 +++ .../common/component/StringModelFragment.java | 4 +++ .../component/ToolBarContributionEditor.java | 4 +++ .../common/component/ToolBarEditor.java | 4 +++ .../component/ToolBarSeparatorEditor.java | 4 +++ .../common/component/ToolControlEditor.java | 4 +++ .../common/component/ToolItemEditor.java | 4 +++ .../common/component/TrimBarEditor.java | 4 +++ .../component/TrimContributionEditor.java | 4 +++ .../common/component/WindowEditor.java | 4 +++ 37 files changed, 188 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java index 22c0eb0d41..7bb2547f74 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java @@ -19,6 +19,8 @@ public class ModelEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { private boolean autoCreateElementId; + private boolean showXMIId; + private IEclipsePreferences node; public ModelEditorPreferencePage() { @@ -35,6 +37,7 @@ public ModelEditorPreferencePage(String title, ImageDescriptor image) { public void init(IWorkbench workbench) { node = new InstanceScope().getNode("org.eclipse.e4.tools.emf.ui"); autoCreateElementId = node.getBoolean("autoCreateElementId", false); + showXMIId = node.getBoolean("showXMIId", false); } @Override @@ -42,6 +45,7 @@ protected Control createContents(Composite parent) { Composite result= new Composite(parent, SWT.NONE); result.setLayout(new GridLayout(2,false)); + { Label l = new Label(result, SWT.NONE); l.setText("Autogenerate Element-Id"); final Button b = new Button(result, SWT.CHECK); @@ -51,6 +55,19 @@ public void widgetSelected(SelectionEvent e) { autoCreateElementId = b.getSelection(); } }); + } + + { + Label l = new Label(result, SWT.NONE); + l.setText("Show XMI:ID"); + final Button b = new Button(result, SWT.CHECK); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + showXMIId = b.getSelection(); + } + }); + } return result; } @@ -58,6 +75,7 @@ public void widgetSelected(SelectionEvent e) { @Override public boolean performOk() { node.putBoolean("autoCreateElementId", autoCreateElementId); + node.putBoolean("showXMIId", showXMIId); try { node.flush(); } catch (BackingStoreException e) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 4158827582..870097b6b0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -215,6 +215,10 @@ public class ModelEditor { @Preference(nodePath = "org.eclipse.e4.tools.emf.ui", value = "autoCreateElementId") private boolean autoCreateElementId; + @Inject + @Preference(nodePath = "org.eclipse.e4.tools.emf.ui", value = "showXMIId") + private boolean showXMIId; + private ObservablesManager obsManager; public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project) { @@ -382,6 +386,10 @@ public IProject getProject() { return project; } + public boolean isShowXMIId() { + return showXMIId; + } + private void loadContributionCreators() { IExtensionRegistry registry = RegistryFactory.getRegistry(); IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index ad09b3b1e6..5536794a0b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -130,6 +130,10 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + if (getEditor().isModelFragment() && isImport) { ControlFactory.createFindImport(parent, this, context); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index a0728c30da..c6067d22ad 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -138,6 +138,10 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ModelTooling_Common_Id); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java index d41b449ecf..228b5e5200 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java @@ -142,6 +142,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + if (isImport) { ControlFactory.createFindImport(parent, this, context); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index 27f0ddb38b..2e28f5e6c3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -137,6 +137,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + if (isImport) { ControlFactory.createFindImport(parent, this, context); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java index fd1aa52211..723fada6ca 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java @@ -115,6 +115,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + if (isImport) { ControlFactory.createFindImport(parent, this, context); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 66eb2063ad..d02ecb8f42 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -134,6 +134,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + if (isImport) { ControlFactory.createFindImport(parent, this, context); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java index 62bc14b19e..4ff5987e07 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java @@ -126,6 +126,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + if (isImport) { ControlFactory.createFindImport(parent, this, context); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 1f73258c13..1d972ce537 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -23,6 +23,7 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.e4.ui.internal.workbench.E4XMIResource; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.e4.ui.model.application.impl.ApplicationFactoryImpl; @@ -40,6 +41,7 @@ import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; @@ -75,6 +77,34 @@ import org.eclipse.swt.widgets.Text; public class ControlFactory { + public static void createXMIId(Composite parent, AbstractComponentEditor editor) { + Label l = new Label(parent, SWT.NONE); + l.setText("XMI:ID"); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + final Text t = new Text(parent, SWT.BORDER); + t.setEditable(false); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + + editor.getMaster().addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + Object val = event.diff.getNewValue(); + if (val != null && val instanceof EObject && !t.isDisposed()) { + Resource res = ((EObject) val).eResource(); + if (res instanceof E4XMIResource) { + String v = ((E4XMIResource) res).getID((EObject) val); + if (v != null && v.trim().length() > 0) { + t.setText(v); + } + } + } + } + }); + } + public static void createMapProperties(Composite parent, final AbstractComponentEditor editor, String label, final EStructuralFeature feature, int vIndent) { Label l = new Label(parent, SWT.NONE); l.setText(label); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java index 91eff9ede5..13b99b7721 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java @@ -90,6 +90,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); ControlFactory.createTextField(parent, Messages.CoreExpressionEditor_ExpressionId, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.CORE_EXPRESSION__CORE_EXPRESSION_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index 5aaa4afc6f..a9034ec830 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -107,7 +107,7 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setEnabled(false); + t.setEditable(false); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND).observeDetail(master), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter())); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index 4b11f9fb64..42bb48319d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -96,7 +96,7 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setEnabled(false); + t.setEditable(false); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND).observeDetail(master), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter())); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 7e14fabe21..ecd43fca67 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -129,6 +129,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + if (isImport) { ControlFactory.createFindImport(parent, this, context); return parent; @@ -155,7 +159,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setEnabled(false); + t.setEditable(false); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.HANDLER__COMMAND).observeDetail(getMaster()), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter())); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 1cd26d842d..965654a901 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -147,6 +147,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { @@ -218,7 +222,7 @@ public void handleValueChange(ValueChangeEvent event) { Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setEnabled(false); + t.setEditable(false); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_BINDING__COMMAND).observeDetail(getMaster()), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter())); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index 51d3505992..895ff7a569 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -171,6 +171,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 888a19128f..ad8cd4ec7f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -150,6 +150,10 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index b02b02c7ca..edbaacbf4c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -147,6 +147,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty checkProp = WidgetProperties.selection(); IWidgetValueProperty enabled = WidgetProperties.enabled(); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + if (isImport) { ControlFactory.createFindImport(parent, this, context); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index 4c4dd2d581..404c728281 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -115,6 +115,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java index 77fcc1a628..62f129c019 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java @@ -110,6 +110,10 @@ private Composite createForm(Composite parent) { gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ModelFragmentsEditor_Imports); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java index aa6364c9a9..0bd741eb47 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java @@ -120,6 +120,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index c765096636..41d83b481d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -147,6 +147,10 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 3404c41ee2..d8e1372d5e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -168,6 +168,10 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index d46b44c844..d361b01a85 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -170,6 +170,10 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 1e78ab803b..483d560201 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -155,6 +155,10 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index cc84bf9516..1f672a26dc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -169,6 +169,10 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 213e53fd36..13cbfe7962 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -146,6 +146,10 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index e561d2d2b6..0c6b200eb8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -153,6 +153,10 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index b698d3ecde..1be39cdb77 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -118,6 +118,10 @@ private Composite createForm(Composite parent) { gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index 557fb7ed13..a87504ea62 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -163,6 +163,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index ae4e0998b1..9676e5c6e0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -159,6 +159,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index f8bf808911..390e53cca2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -126,6 +126,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index 7fca52fe89..1e6743fe2d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -135,6 +135,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 598b692249..cb090993db 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -107,6 +107,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index eeb430d81d..f874386af9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -152,6 +152,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index a3d12e2a05..f2f004b06f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -150,6 +150,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 9af16c8c58..2d17e9e863 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -169,6 +169,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr gl.horizontalSpacing = 10; parent.setLayout(gl); + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { From 612e9dd13e034cf0651537297f1eb0ca267cb919 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 25 Jul 2010 16:11:51 +0000 Subject: [PATCH 0265/1286] Bug 320850 - [ModelTooling] Should be able to show the XMI:ID --- .../e4/tools/emf/ui/internal/common/ModelEditor.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 870097b6b0..9ab19f4b00 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -15,6 +15,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.inject.Inject; import org.eclipse.core.databinding.ObservablesManager; @@ -347,7 +348,6 @@ public void run() { }); form.setWeights(new int[] { 1, 2 }); - viewer.setSelection(new StructuredSelection(modelProvider.getRoot())); MenuManager mgr = new MenuManager(); mgr.setRemoveAllWhenShown(true); @@ -378,6 +378,11 @@ public void menuAboutToShow(IMenuManager manager) { viewer.getControl().setMenu(mgr.createContextMenu(viewer.getControl())); } + @PostConstruct + void postCreate() { + viewer.setSelection(new StructuredSelection(modelProvider.getRoot())); + } + public boolean isAutoCreateElementId() { return autoCreateElementId && project != null; } From 98a79605b4c8d322dce3d157356684b99c52c68e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 25 Jul 2010 16:56:54 +0000 Subject: [PATCH 0266/1286] Bug 320849 - No workspace chooser dialog after installing e4 tools --- .../OSGI-INF/pdee4xmiprovider.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdee4xmiprovider.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdee4xmiprovider.xml index 54795752ac..f1e7b737da 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdee4xmiprovider.xml +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdee4xmiprovider.xml @@ -1,5 +1,5 @@ - + From 6768fd0926d8329939984246fbfa5a109f4e06c1 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 25 Jul 2010 18:41:27 +0000 Subject: [PATCH 0267/1286] Bug 320842 - [ModelTooling] Editing of Expressions not available --- .../META-INF/MANIFEST.MF | 2 +- .../OSGI-INF/pdeextensionlookup.xml | 7 + .../build.properties | 3 +- .../emf/editor3x/PDEExtensionLookup.java | 24 +++ .../ui/common/CommandToStringConverter.java | 3 +- .../tools/emf/ui/common/IExtensionLookup.java | 17 ++ .../e4/tools/emf/ui/internal/Messages.java | 7 + .../tools/emf/ui/internal/Messages.properties | 8 +- .../emf/ui/internal/common/ModelEditor.java | 9 ++ .../component/CoreExpressionEditor.java | 33 +++- .../component/dialogs/ExpressionIdDialog.java | 150 ++++++++++++++++++ 11 files changed, 258 insertions(+), 5 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdeextensionlookup.xml create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEExtensionLookup.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IExtensionLookup.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index 5fa115467f..1691e76e64 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -27,6 +27,6 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.tools.services;bundle-version="1.0.0", org.eclipse.e4.tools;bundle-version="0.9.0", org.eclipse.jdt.ui;bundle-version="3.6.0" -Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/xmiresourcecontextfunction.xml, OSGI-INF/projectfunction.xml, OSGI-INF/pdee4xmiprovider.xml +Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/xmiresourcecontextfunction.xml, OSGI-INF/projectfunction.xml, OSGI-INF/pdee4xmiprovider.xml, OSGI-INF/pdeextensionlookup.xml Bundle-ActivationPolicy: lazy Bundle-Vendor: %Bundle-Vendor diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdeextensionlookup.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdeextensionlookup.xml new file mode 100644 index 0000000000..759090b939 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdeextensionlookup.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties index 72fab184b7..13160ee89d 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties @@ -4,5 +4,6 @@ bin.includes = META-INF/,\ plugin.xml,\ icons/,\ OSGI-INF/,\ - about.html + about.html,\ + OSGI-INF/pdeextensionlookup.xml source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEExtensionLookup.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEExtensionLookup.java new file mode 100644 index 0000000000..4cce764f8f --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEExtensionLookup.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.editor3x; + +import org.eclipse.core.runtime.IExtension; +import org.eclipse.e4.tools.emf.ui.common.IExtensionLookup; +import org.eclipse.pde.internal.core.PDEExtensionRegistry; + +public class PDEExtensionLookup implements IExtensionLookup { + + public IExtension[] findExtensions(String extensionPointId) { + PDEExtensionRegistry reg = new PDEExtensionRegistry(); + return reg.findExtensions(extensionPointId, true); + } + +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/CommandToStringConverter.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/CommandToStringConverter.java index 5df8932322..16f2a454a5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/CommandToStringConverter.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/CommandToStringConverter.java @@ -11,6 +11,7 @@ package org.eclipse.e4.tools.emf.ui.common; import org.eclipse.core.databinding.conversion.Converter; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.internal.workbench.E4XMIResource; import org.eclipse.e4.ui.model.application.commands.MCommand; import org.eclipse.emf.ecore.EObject; @@ -29,7 +30,7 @@ public Object convert(Object fromObject) { elementId = cmd.getElementId(); } if (cmd == null) { - return ""; + return Messages.CommandToStringConverter_None; } else if (cmd.getCommandName() != null && cmd.getCommandName().trim().length() > 0) { return cmd.getCommandName() + (elementId != null ? " - " + elementId : ""); //$NON-NLS-1$//$NON-NLS-2$ } else if (elementId != null) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IExtensionLookup.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IExtensionLookup.java new file mode 100644 index 0000000000..71b6a1e18c --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IExtensionLookup.java @@ -0,0 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.common; + +import org.eclipse.core.runtime.IExtension; + +public interface IExtensionLookup { + public IExtension[] findExtensions(String extensionPointId); +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index ac2bd8eea2..58f47fc184 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -502,6 +502,13 @@ public class Messages extends NLS { public static String VMenuElementsEditor_TreeLabelDescription; public static String VMenuElementsEditor_Children; + public static String ExpressionIdDialog_ShellTitle; + public static String ExpressionIdDialog_DialogTitle; + public static String ExpressionIdDialog_DialogMessage; + public static String ExpressionIdDialog_Id; + + public static String CommandToStringConverter_None; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 220a454f1c..78e4dd5ede 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -496,4 +496,10 @@ CoreExpressionEditor_ExpressionId=Expression Id VMenuElementsEditor_TreeLabel=Children VMenuElementsEditor_TreeLabelDescription=Children Bla Bla Bla -VMenuElementsEditor_Children=Children \ No newline at end of file +VMenuElementsEditor_Children=Children + +ExpressionIdDialog_ShellTitle=Find Expression Id +ExpressionIdDialog_DialogTitle=Find Expression Id +ExpressionIdDialog_DialogMessage=Find the expression id defined through the 'org.eclipse.core.expressions.definitions' extension point +ExpressionIdDialog_Id=Id +CommandToStringConverter_None= \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 9ab19f4b00..91103d16f3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -45,6 +45,7 @@ import org.eclipse.e4.tools.emf.ui.common.IEditorDescriptor; import org.eclipse.e4.tools.emf.ui.common.IEditorFeature; import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; +import org.eclipse.e4.tools.emf.ui.common.IExtensionLookup; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.ISelectionProviderService; import org.eclipse.e4.tools.emf.ui.common.MemoryTransfer; @@ -220,6 +221,10 @@ public class ModelEditor { @Preference(nodePath = "org.eclipse.e4.tools.emf.ui", value = "showXMIId") private boolean showXMIId; + @Inject + @Optional + private IExtensionLookup extensionLookup; + private ObservablesManager obsManager; public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project) { @@ -383,6 +388,10 @@ void postCreate() { viewer.setSelection(new StructuredSelection(modelProvider.getRoot())); } + public IExtensionLookup getExtensionLookup() { + return extensionLookup; + } + public boolean isAutoCreateElementId() { return autoCreateElementId && project != null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java index 13b99b7721..f8924c947d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java @@ -17,6 +17,7 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ExpressionIdDialog; import org.eclipse.e4.ui.model.application.ui.MCoreExpression; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; @@ -25,11 +26,17 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class CoreExpressionEditor extends AbstractComponentEditor { private Composite composite; @@ -95,7 +102,31 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - ControlFactory.createTextField(parent, Messages.CoreExpressionEditor_ExpressionId, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.CORE_EXPRESSION__CORE_EXPRESSION_ID)); + + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.CoreExpressionEditor_ExpressionId); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + final Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.CORE_EXPRESSION__CORE_EXPRESSION_ID).observeDetail(getMaster())); + + if (getEditor().getExtensionLookup() == null) { + gd.horizontalSpan = 2; + } else { + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_FindEllipsis); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ExpressionIdDialog dialog = new ExpressionIdDialog(t.getShell(), getEditor().getExtensionLookup(), (MCoreExpression) getMaster().getValue(), getEditingDomain()); + dialog.open(); + } + }); + } + } return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java new file mode 100644 index 0000000000..f146843358 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java @@ -0,0 +1,150 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import java.util.ArrayList; +import java.util.List; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.e4.tools.emf.ui.common.IExtensionLookup; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; +import org.eclipse.e4.ui.model.application.ui.MCoreExpression; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.viewers.AbstractTreeViewer; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public class ExpressionIdDialog extends TitleAreaDialog { + private IExtensionLookup lookup; + private TableViewer viewer; + private EditingDomain domain; + private MCoreExpression expression; + + public ExpressionIdDialog(Shell parentShell, IExtensionLookup lookup, MCoreExpression expression, EditingDomain domain) { + super(parentShell); + this.lookup = lookup; + this.expression = expression; + this.domain = domain; + } + + @Override + protected Control createDialogArea(Composite parent) { + getShell().setText(Messages.ExpressionIdDialog_ShellTitle); + setTitle(Messages.ExpressionIdDialog_DialogTitle); + setMessage(Messages.ExpressionIdDialog_DialogMessage); + Composite comp = (Composite) super.createDialogArea(parent); + Composite container = new Composite(comp, SWT.NONE); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + container.setLayout(new GridLayout(2, false)); + + Label l = new Label(container, SWT.NONE); + l.setText(Messages.ExpressionIdDialog_Id); + + Text idField = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); + idField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + final PatternFilter filter = new PatternFilter() { + @Override + protected boolean isParentMatch(Viewer viewer, Object element) { + return viewer instanceof AbstractTreeViewer && super.isParentMatch(viewer, element); + } + }; + idField.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + filter.setPattern(((Text) e.widget).getText()); + viewer.refresh(); + } + }); + + l = new Label(container, SWT.NONE); + viewer = new TableViewer(container); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + viewer.setContentProvider(new ArrayContentProvider()); + viewer.setLabelProvider(new LabelProviderImpl()); + viewer.addFilter(filter); + viewer.setInput(getElements(lookup)); + viewer.addDoubleClickListener(new IDoubleClickListener() { + + public void doubleClick(DoubleClickEvent event) { + okPressed(); + } + }); + + return comp; + } + + @Override + protected void okPressed() { + if (!viewer.getSelection().isEmpty()) { + IConfigurationElement el = (IConfigurationElement) ((IStructuredSelection) viewer.getSelection()).getFirstElement(); + Command cmd = SetCommand.create(domain, expression, UiPackageImpl.Literals.CORE_EXPRESSION__CORE_EXPRESSION_ID, el.getAttribute("id")); //$NON-NLS-1$ + if (cmd.canExecute()) { + domain.getCommandStack().execute(cmd); + super.okPressed(); + } + } + } + + private List getElements(IExtensionLookup lookup) { + List list = new ArrayList(); + for (IExtension ext : lookup.findExtensions("org.eclipse.core.expressions.definitions")) { //$NON-NLS-1$ + for (IConfigurationElement el : ext.getConfigurationElements()) { + list.add(el); + } + } + return list; + } + + static class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { + @Override + public void update(ViewerCell cell) { + IConfigurationElement el = (IConfigurationElement) cell.getElement(); + StyledString str = new StyledString(el.getAttribute("id")); //$NON-NLS-1$ + str.append(" - " + el.getContributor().getName(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + cell.setText(str.getString()); + cell.setStyleRanges(str.getStyleRanges()); + } + + public Image getImage(Object element) { + return null; + } + + public String getText(Object element) { + IConfigurationElement el = (IConfigurationElement) element; + return el.getAttribute("id") + " " + el.getContributor().getName(); //$NON-NLS-1$//$NON-NLS-2$ + } + } +} \ No newline at end of file From b2c9f23b392f92212b4036a9692072ffc2977976 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 25 Jul 2010 19:18:25 +0000 Subject: [PATCH 0268/1286] Bug 320842 - [ModelTooling] Editing of Expressions not available --- .../OSGI-INF/pdeextensionlookup.xml | 1 + .../e4/tools/emf/editor3x/PDEExtensionLookup.java | 13 ++++++++++--- .../e4/tools/emf/ui/common/IExtensionLookup.java | 2 +- .../common/component/CoreExpressionEditor.java | 2 +- .../component/dialogs/ExpressionIdDialog.java | 6 ++++-- .../component/virtual/VMenuElementsEditor.java | 2 +- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdeextensionlookup.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdeextensionlookup.xml index 759090b939..cad2595f2c 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdeextensionlookup.xml +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdeextensionlookup.xml @@ -4,4 +4,5 @@ + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEExtensionLookup.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEExtensionLookup.java index 4cce764f8f..88c4114e12 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEExtensionLookup.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEExtensionLookup.java @@ -11,14 +11,21 @@ package org.eclipse.e4.tools.emf.editor3x; import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.RegistryFactory; import org.eclipse.e4.tools.emf.ui.common.IExtensionLookup; import org.eclipse.pde.internal.core.PDEExtensionRegistry; public class PDEExtensionLookup implements IExtensionLookup { - public IExtension[] findExtensions(String extensionPointId) { - PDEExtensionRegistry reg = new PDEExtensionRegistry(); - return reg.findExtensions(extensionPointId, true); + public IExtension[] findExtensions(String extensionPointId, boolean liveModel) { + if( liveModel ) { + IExtensionRegistry registry = RegistryFactory.getRegistry(); + return registry.getExtensionPoint(extensionPointId).getExtensions(); + } else { + PDEExtensionRegistry reg = new PDEExtensionRegistry(); + return reg.findExtensions(extensionPointId, true); + } } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IExtensionLookup.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IExtensionLookup.java index 71b6a1e18c..24a2ebb11e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IExtensionLookup.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IExtensionLookup.java @@ -13,5 +13,5 @@ import org.eclipse.core.runtime.IExtension; public interface IExtensionLookup { - public IExtension[] findExtensions(String extensionPointId); + public IExtension[] findExtensions(String extensionPointId, boolean liveModel); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java index f8924c947d..99c47c8f55 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java @@ -121,7 +121,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ExpressionIdDialog dialog = new ExpressionIdDialog(t.getShell(), getEditor().getExtensionLookup(), (MCoreExpression) getMaster().getValue(), getEditingDomain()); + ExpressionIdDialog dialog = new ExpressionIdDialog(t.getShell(), getEditor().getExtensionLookup(), (MCoreExpression) getMaster().getValue(), getEditingDomain(), getEditor().isLiveModel()); dialog.open(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java index f146843358..abdeb0b8cf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java @@ -51,12 +51,14 @@ public class ExpressionIdDialog extends TitleAreaDialog { private TableViewer viewer; private EditingDomain domain; private MCoreExpression expression; + private boolean liveModel; - public ExpressionIdDialog(Shell parentShell, IExtensionLookup lookup, MCoreExpression expression, EditingDomain domain) { + public ExpressionIdDialog(Shell parentShell, IExtensionLookup lookup, MCoreExpression expression, EditingDomain domain, boolean liveModel) { super(parentShell); this.lookup = lookup; this.expression = expression; this.domain = domain; + this.liveModel = liveModel; } @Override @@ -120,7 +122,7 @@ protected void okPressed() { private List getElements(IExtensionLookup lookup) { List list = new ArrayList(); - for (IExtension ext : lookup.findExtensions("org.eclipse.core.expressions.definitions")) { //$NON-NLS-1$ + for (IExtension ext : lookup.findExtensions("org.eclipse.core.expressions.definitions", liveModel)) { //$NON-NLS-1$ for (IConfigurationElement el : ext.getConfigurationElements()) { list.add(el); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java index 02e44a4ebf..baebd34556 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java @@ -109,7 +109,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer.setContentProvider(cp); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 120; + gd.heightHint = 300; viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); From b66db8f7c14a92458ad95df3bce5e9c8ef3f1094 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 26 Jul 2010 14:55:06 +0000 Subject: [PATCH 0269/1286] Bug 320909 - [ModelTooling] Label displayed to add KeyBindingTable is wrong --- .../internal/common/component/virtual/VBindingTableEditor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index 6f806c1bf7..7705e08ec2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -167,7 +167,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Down); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { From 697b5996dcc3a4448f315eade3bf35121fb89b55 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 29 Jul 2010 10:52:53 +0000 Subject: [PATCH 0270/1286] Bug 320938, 320954, 320938 - Merging back changes from branch --- .../e4/tools/emf/ui/common/ImageTooltip.java | 20 +++++++++++++++++-- .../component/BindingContextEditor.java | 4 ++-- .../common/component/ControlFactory.java | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java index 255cbb728f..e9d75fe16e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java @@ -64,8 +64,24 @@ protected Composite createToolTipContentArea(Event event, Composite parent) { InputStream bStream = null; String errorMessage = "<" + Messages.ImageTooltip_UnknownError + ">"; //$NON-NLS-1$ //$NON-NLS-2$ try { - URL url = new URL(uri.toString()); - stream = url.openStream(); + URL url; + try { + url = new URL(uri.toString()); + stream = url.openStream(); + } catch (Exception e) { + // FIXME Temporary fix to show icon + // If not found in runtime search in workspace + if (stream == null) { + String[] segments = uri.segments(); + URI tmpUri = URI.createPlatformResourceURI(segments[1], true); + for (int i = 2; i < segments.length; i++) { + tmpUri = tmpUri.appendSegment(segments[i]); + } + + url = new URL(tmpUri.toString()); + stream = url.openStream(); + } + } if (stream != null) { out = new ByteArrayOutputStream(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java index 228b5e5200..5619fded8a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java @@ -236,7 +236,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -256,7 +256,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 1d972ce537..4ff3ef894e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -377,7 +377,7 @@ public static void createStringListWidget(Composite parent, final AbstractCompon @Override public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { - handleAddText(editor, UiPackageImpl.Literals.CONTEXT__VARIABLES, t); + handleAddText(editor, feature, t); } } }); From ccda26a13e82f1b74e7f76e304cf11e2ce901baa Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 29 Jul 2010 13:39:38 +0000 Subject: [PATCH 0271/1286] Bug 321181 - [ModelTooling] ArrayIndexOutOfBoundException * added validation to avoid entering incorrect URIs * added support when no Java-class is found to launch the wizard --- .../ui/common/ContributionURIValidator.java | 39 ++++++++++++++++++ .../eclipse/e4/tools/emf/ui/common/Util.java | 41 +++++++++++++++++++ .../common/component/AddonsEditor.java | 6 ++- .../component/DirectMenuItemEditor.java | 7 +++- .../component/DirectToolItemEditor.java | 7 +++- .../common/component/HandlerEditor.java | 5 ++- .../common/component/KeyBindingEditor.java | 36 +--------------- .../internal/common/component/PartEditor.java | 6 ++- 8 files changed, 107 insertions(+), 40 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ContributionURIValidator.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ContributionURIValidator.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ContributionURIValidator.java new file mode 100644 index 0000000000..77f9dc4c92 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ContributionURIValidator.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.common; + +import org.eclipse.core.databinding.validation.IValidator; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.common.util.URI; + +public class ContributionURIValidator implements IValidator { + + public IStatus validate(Object value) { + if (value == null) { + return new Status(IStatus.ERROR, "org.eclipse.e4.tools.emf.ui", "The URI must not be empty!"); + } else if (!value.toString().startsWith("platform:/plugin")) { + return new Status(IStatus.ERROR, "org.eclipse.e4.tools.emf.ui", "The URI has to start with 'platform:/plugin'"); + } else { + try { + URI uri = URI.createURI(value.toString()); + if (uri.segmentCount() != 3) { + return new Status(IStatus.ERROR, "org.eclipse.e4.tools.emf.ui", "The uri has to have the format 'platform:/plugin/$$bundleId$$/$$className$$'"); + } + } catch (Exception e) { + return new Status(IStatus.ERROR, "org.eclipse.e4.tools.emf.ui", e.getMessage()); + } + + } + + return Status.OK_STATUS; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java index b23df112d2..9c41f212c4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java @@ -15,7 +15,11 @@ import java.util.Map.Entry; import java.util.SortedSet; import java.util.TreeSet; +import org.eclipse.core.databinding.Binding; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IStatus; import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -34,6 +38,11 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.fieldassist.ControlDecoration; +import org.eclipse.jface.fieldassist.FieldDecoration; +import org.eclipse.jface.fieldassist.FieldDecorationRegistry; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Control; public class Util { public static final boolean isNullOrEmpty(String element) { @@ -162,6 +171,38 @@ public static boolean moveElementByIndex(EditingDomain editingDomain, MUIElement } } + public static final void addDecoration(Control control, Binding binding) { + final ControlDecoration dec = new ControlDecoration(control, SWT.BOTTOM); + binding.getValidationStatus().addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + IStatus s = (IStatus) event.getObservableValue().getValue(); + if (s.isOK()) { + dec.setDescriptionText(null); + dec.setImage(null); + } else { + dec.setDescriptionText(s.getMessage()); + + String fieldDecorationID = null; + switch (s.getSeverity()) { + case IStatus.INFO: + fieldDecorationID = FieldDecorationRegistry.DEC_INFORMATION; + break; + case IStatus.WARNING: + fieldDecorationID = FieldDecorationRegistry.DEC_WARNING; + break; + case IStatus.ERROR: + case IStatus.CANCEL: + fieldDecorationID = FieldDecorationRegistry.DEC_ERROR; + break; + } + FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(fieldDecorationID); + dec.setImage(fieldDecoration == null ? null : fieldDecoration.getImage()); + } + } + }); + } + public static class InternalPackage { public final EPackage ePackage; public List classes = new ArrayList(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index 5536794a0b..67df8d015e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -12,9 +12,12 @@ import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.core.databinding.Binding; +import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.ContributionURIValidator; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.common.Util; @@ -172,7 +175,8 @@ public void widgetSelected(SelectionEvent e) { Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster())); + Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster()), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy()); + Util.addDecoration(t, binding); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index c8b5e32363..ee46377fd1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -12,13 +12,17 @@ import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.core.databinding.Binding; +import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.ContributionURIValidator; import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; @@ -113,7 +117,8 @@ public void widgetSelected(SelectionEvent e) { Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); + Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy()); + Util.addDecoration(t, binding); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index 5370368e8c..da548c44ce 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -12,13 +12,17 @@ import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.core.databinding.Binding; +import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.ContributionURIValidator; import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; +import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; @@ -101,7 +105,8 @@ public void widgetSelected(SelectionEvent e) { Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); + Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy()); + Util.addDecoration(t, binding); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index ecd43fca67..a9995f307e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -12,11 +12,13 @@ import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.CommandToStringConverter; +import org.eclipse.e4.tools.emf.ui.common.ContributionURIValidator; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.common.IModelResource; @@ -196,7 +198,8 @@ public void widgetSelected(SelectionEvent e) { Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster())); + Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster()), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy()); + Util.addDecoration(t, binding); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 965654a901..10908af671 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -16,8 +16,6 @@ import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.validation.IValidator; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -50,9 +48,6 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.fieldassist.ControlDecoration; -import org.eclipse.jface.fieldassist.FieldDecoration; -import org.eclipse.jface.fieldassist.FieldDecorationRegistry; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; @@ -182,36 +177,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO gd.horizontalSpan = 2; t.setLayoutData(gd); Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_SEQUENCE__KEY_SEQUENCE).observeDetail(getMaster()), new UpdateValueStrategy().setBeforeSetValidator(new BindingValidator()), new UpdateValueStrategy()); - - final ControlDecoration dec = new ControlDecoration(t, SWT.BOTTOM); - binding.getValidationStatus().addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - IStatus s = (IStatus) event.getObservableValue().getValue(); - if (s.isOK()) { - dec.setDescriptionText(null); - dec.setImage(null); - } else { - dec.setDescriptionText(s.getMessage()); - - String fieldDecorationID = null; - switch (s.getSeverity()) { - case IStatus.INFO: - fieldDecorationID = FieldDecorationRegistry.DEC_INFORMATION; - break; - case IStatus.WARNING: - fieldDecorationID = FieldDecorationRegistry.DEC_WARNING; - break; - case IStatus.ERROR: - case IStatus.CANCEL: - fieldDecorationID = FieldDecorationRegistry.DEC_ERROR; - break; - } - FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(fieldDecorationID); - dec.setImage(fieldDecoration == null ? null : fieldDecoration.getImage()); - } - } - }); + Util.addDecoration(t, binding); } // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index d8e1372d5e..09976ca157 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -12,6 +12,8 @@ import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.core.databinding.Binding; +import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IObservableValue; @@ -20,6 +22,7 @@ import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.ContributionURIValidator; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; @@ -275,7 +278,8 @@ public void widgetSelected(SelectionEvent e) { Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); + Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy()); + Util.addDecoration(t, binding); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); From 580aa8e552754dfbc21f470a082a0aa3eaec8cb0 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 29 Jul 2010 14:44:36 +0000 Subject: [PATCH 0272/1286] Bug 321233 - [ModelTooling] Improve ModelTooling in 4.1 * presenting virtual nodes in an ITALIC-Font --- .../common/ComponentLabelProvider.java | 50 ++++++------------- 1 file changed, 14 insertions(+), 36 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java index b52a0d7617..22653dd83e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java @@ -19,22 +19,20 @@ import org.eclipse.jface.viewers.StyledString; import org.eclipse.jface.viewers.StyledString.Styler; import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.TextStyle; public class ComponentLabelProvider extends StyledCellLabelProvider { - private Image modelComponentsImage; - private Image modelComonentImage; - private Image partsImage; - private Image menusImage; - private Image partImage; - private Image partDescriptorImage; private ModelEditor editor; private static final String NOT_RENDERED_KEY = "NOT_RENDERED_STYLER";//$NON-NLS-1$ + private Font font; + private static Styler NOT_RENDERED_STYLER = new Styler() { { JFaceResources.getColorRegistry().put(NOT_RENDERED_KEY, new RGB(200, 200, 200)); @@ -87,6 +85,11 @@ public void update(final ViewerCell cell) { } } else if (cell.getElement() instanceof VirtualEntry) { String s = cell.getElement().toString(); + if (font == null) { + FontData[] data = cell.getControl().getFont().getFontData(); + font = new Font(cell.getControl().getDisplay(), new FontData(data[0].getName(), data[0].getHeight(), SWT.ITALIC)); + } + cell.setFont(font); cell.setText(s); } else { cell.setText(cell.getElement().toString()); @@ -95,35 +98,10 @@ public void update(final ViewerCell cell) { @Override public void dispose() { - if (modelComponentsImage != null) { - modelComponentsImage.dispose(); - modelComponentsImage = null; - } - - if (modelComonentImage != null) { - modelComonentImage.dispose(); - modelComonentImage = null; - } - - if (partsImage != null) { - partsImage.dispose(); - partsImage = null; - } - - if (menusImage != null) { - menusImage.dispose(); - menusImage = null; - } - - if (partImage != null) { - partImage.dispose(); - partImage = null; - } - - if (partDescriptorImage != null) { - partDescriptorImage.dispose(); - partDescriptorImage = null; + if (font != null) { + font.dispose(); + font = null; } super.dispose(); } -} +} \ No newline at end of file From dd3a521e75149ad41212103279bbedb3a564a784 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 29 Jul 2010 14:46:12 +0000 Subject: [PATCH 0273/1286] Bug 321181 - [ModelTooling] ArrayIndexOutOfBoundException * added validation to avoid entering incorrect URIs * added support when no Java-class is found to launch the wizard --- .../extension/AddonContributionEditor.java | 50 +++++++++++------ .../extension/HandlerContributionEditor.java | 49 +++++++++++------ .../extension/PartContributionEditor.java | 53 +++++++++++++------ 3 files changed, 105 insertions(+), 47 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java index dee4f6bdcc..19f4ec5122 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java @@ -28,6 +28,7 @@ import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.ui.JavaUI; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Shell; @@ -38,10 +39,15 @@ public class AddonContributionEditor implements IContributionClassCreator { public boolean isSupported(EClass element) { return Util.isTypeOrSuper(ApplicationPackageImpl.Literals.ADDON, element); } - + public void createOpen(MContribution contribution, EditingDomain domain, IProject project, Shell shell) { - if( contribution.getContributionURI() == null || contribution.getContributionURI().trim().length() == 0 ) { + createOpen(contribution, domain, project, shell, false); + } + + private void createOpen(MContribution contribution, EditingDomain domain, + IProject project, Shell shell, boolean forceNew) { + if( forceNew || contribution.getContributionURI() == null || contribution.getContributionURI().trim().length() == 0 || !contribution.getContributionURI().startsWith("platform:") ) { NewAddonClassWizard wizard = new NewAddonClassWizard(); wizard.init( null, new StructuredSelection(project)); WizardDialog dialog = new WizardDialog(shell, wizard); @@ -62,20 +68,34 @@ public void createOpen(MContribution contribution, EditingDomain domain, } } else { URI uri = URI.createURI(contribution.getContributionURI()); - IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(uri.segment(1)); - //TODO If this is not a WS-Resource we need to open differently - if( p != null ) { - IJavaProject jp = JavaCore.create(p); - try { - IType t = jp.findType(uri.segment(2)); - JavaUI.openInEditor(t); - } catch (JavaModelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (PartInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (uri.segmentCount() == 3) { + IProject p = ResourcesPlugin.getWorkspace().getRoot() + .getProject(uri.segment(1)); + // TODO If this is not a WS-Resource we need to open differently + if (p != null) { + IJavaProject jp = JavaCore.create(p); + try { + IType t = jp.findType(uri.segment(2)); + if( t != null ) { + JavaUI.openInEditor(t); + } else { + if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+uri.segment(2)+"' was not found. Would you like to start the class creation wizard?") ) { + createOpen(contribution, domain, project, shell, true); + } + } + } catch (JavaModelException e) { + if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+uri.segment(2)+"' was not found. Would you like to start the class creation wizard?") ) { + createOpen(contribution, domain, project, shell, true); + } + } catch (PartInitException e) { + MessageDialog.openError(shell, "Failed to open editor", e.getMessage()); + // TODO Auto-generated catch block + e.printStackTrace(); + } } + } else { + MessageDialog.openError(shell, "Invalid URL", + "The current url is invalid"); } } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java index 4ebf9a28d5..56c9933235 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java @@ -30,15 +30,20 @@ import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.ui.JavaUI; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PartInitException; public class HandlerContributionEditor implements IContributionClassCreator { - public void createOpen(MContribution contribution, EditingDomain domain, IProject project, Shell shell) { - if( contribution.getContributionURI() == null || contribution.getContributionURI().trim().length() == 0 ) { + createOpen(contribution, domain, project, shell, false); + } + + private void createOpen(MContribution contribution, EditingDomain domain, IProject project, Shell shell, boolean forceNew) { + if( contribution.getContributionURI() == null || contribution.getContributionURI().trim().length() == 0 || !contribution.getContributionURI().startsWith("platform:") ) { NewHandlerClassWizard wizard = new NewHandlerClassWizard(); wizard.init( null, new StructuredSelection(project)); WizardDialog dialog = new WizardDialog(shell, wizard); @@ -59,20 +64,34 @@ public void createOpen(MContribution contribution, EditingDomain domain, IProjec } } else { URI uri = URI.createURI(contribution.getContributionURI()); - IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(uri.segment(1)); - //TODO If this is not a WS-Resource we need to open differently - if( p != null ) { - IJavaProject jp = JavaCore.create(p); - try { - IType t = jp.findType(uri.segment(2)); - JavaUI.openInEditor(t); - } catch (JavaModelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (PartInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (uri.segmentCount() == 3) { + IProject p = ResourcesPlugin.getWorkspace().getRoot() + .getProject(uri.segment(1)); + // TODO If this is not a WS-Resource we need to open differently + if (p != null) { + IJavaProject jp = JavaCore.create(p); + try { + IType t = jp.findType(uri.segment(2)); + if( t != null ) { + JavaUI.openInEditor(t); + } else { + if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+uri.segment(2)+"' was not found. Would you like to start the class creation wizard?") ) { + createOpen(contribution, domain, project, shell, true); + } + } + } catch (JavaModelException e) { + if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+uri.segment(2)+"' was not found. Would you like to start the class creation wizard?") ) { + createOpen(contribution, domain, project, shell, true); + } + } catch (PartInitException e) { + MessageDialog.openError(shell, "Failed to open editor", e.getMessage()); + // TODO Auto-generated catch block + e.printStackTrace(); + } } + } else { + MessageDialog.openError(shell, "Invalid URL", + "The current url is invalid"); } } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java index c6f5c3a32d..8fea74032d 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java @@ -29,17 +29,23 @@ import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.ui.JavaUI; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PartInitException; public class PartContributionEditor implements IContributionClassCreator { - public void createOpen(MContribution contribution, EditingDomain domain, IProject project, Shell shell) { - if (contribution.getContributionURI() == null - || contribution.getContributionURI().trim().length() == 0) { + createOpen(contribution, domain, project, shell, false); + } + + private void createOpen(MContribution contribution, EditingDomain domain, + IProject project, Shell shell, boolean forceNew) { + if ( forceNew || contribution.getContributionURI() == null + || contribution.getContributionURI().trim().length() == 0 + || !contribution.getContributionURI().startsWith("platform:")) { NewPartClassWizard wizard = new NewPartClassWizard(); wizard.init(null, new StructuredSelection(project)); WizardDialog dialog = new WizardDialog(shell, wizard); @@ -67,21 +73,34 @@ public void createOpen(MContribution contribution, EditingDomain domain, } } else { URI uri = URI.createURI(contribution.getContributionURI()); - IProject p = ResourcesPlugin.getWorkspace().getRoot() - .getProject(uri.segment(1)); - // TODO If this is not a WS-Resource we need to open differently - if (p != null) { - IJavaProject jp = JavaCore.create(p); - try { - IType t = jp.findType(uri.segment(2)); - JavaUI.openInEditor(t); - } catch (JavaModelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (PartInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (uri.segmentCount() == 3) { + IProject p = ResourcesPlugin.getWorkspace().getRoot() + .getProject(uri.segment(1)); + // TODO If this is not a WS-Resource we need to open differently + if (p != null) { + IJavaProject jp = JavaCore.create(p); + try { + IType t = jp.findType(uri.segment(2)); + if( t != null ) { + JavaUI.openInEditor(t); + } else { + if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+uri.segment(2)+"' was not found. Would you like to start the class creation wizard?") ) { + createOpen(contribution, domain, project, shell, true); + } + } + } catch (JavaModelException e) { + if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+uri.segment(2)+"' was not found. Would you like to start the class creation wizard?") ) { + createOpen(contribution, domain, project, shell, true); + } + } catch (PartInitException e) { + MessageDialog.openError(shell, "Failed to open editor", e.getMessage()); + // TODO Auto-generated catch block + e.printStackTrace(); + } } + } else { + MessageDialog.openError(shell, "Invalid URL", + "The current url is invalid"); } } } From 650011720c0f615244d1796a056cf5a28d01836f Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 10 Sep 2010 13:16:27 +0000 Subject: [PATCH 0274/1286] Bug 323310 - [ModelTooling] Rename Sash in the tree to PartSashContainer? --- .../org/eclipse/e4/tools/emf/ui/internal/Messages.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 78e4dd5ede..0ce26469e1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -164,7 +164,7 @@ PartEditor_ContainerData=Container Data PartEditor_ToolBar=ToolBar PartEditor_BindingContexts=Binding Contexts -PartSashContainerEditor_Label=Sash +PartSashContainerEditor_Label=PartSashContainer PartSashContainerEditor_Description=Sash bla bla bla PartSashContainerEditor_Orientation=Orientation PartSashContainerEditor_Vertical=Vertical From 928d676161fcee12a986b80e201ed74a05a169aa Mon Sep 17 00:00:00 2001 From: Paul Webster Date: Mon, 29 Nov 2010 20:13:34 +0000 Subject: [PATCH 0275/1286] Bug 329646 - Keybindings aren't found or shown when run from .jars context restructuring without binding restructuring --- .../e4/internal/tools/wizards/project/E4NewProjectWizard.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java index 85a29bf619..e2375e5f80 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java @@ -360,7 +360,7 @@ public void createApplicationResources(IProject project, childContext.setName("In Dialogs"); rootContext.getChildren().add(childContext); - application.setRootContext(rootContext); + application.getRootContext().add(rootContext); application.getBindingContexts().add("org.eclipse.ui.contexts.dialogAndWindow"); resource.getContents().add((EObject) application); From 9d4350de236a3ce8f93687bdcce3cf0171a8a705 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 11 Dec 2010 15:46:32 +0000 Subject: [PATCH 0276/1286] Bug 332362 - [ModelTooling] Update model to use multiple root contexts --- .../e4/tools/emf/ui/internal/Messages.java | 8 +- .../tools/emf/ui/internal/Messages.properties | 9 +- .../emf/ui/internal/common/ModelEditor.java | 3 + .../common/component/ApplicationEditor.java | 118 +++------ .../virtual/VRootBindingContexts.java | 236 ++++++++++++++++++ 5 files changed, 292 insertions(+), 82 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 58f47fc184..1c41e70b7b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -13,6 +13,7 @@ import org.eclipse.osgi.util.NLS; public class Messages extends NLS { + public static String ModelTooling_Common_Up; public static String ModelTooling_Common_Down; public static String ModelTooling_Common_AddEllipsis; @@ -45,7 +46,7 @@ public class Messages extends NLS { public static String ApplicationEditor_MenuContributions; public static String ApplicationEditor_ToolBarContributions; public static String ApplicationEditor_TrimContributions; - public static String ApplicationEditor_RootContext; + public static String ApplicationEditor_RootContexts; public static String ApplicationEditor_BindingContexts; public static String ApplicationEditor_Categories; @@ -509,6 +510,11 @@ public class Messages extends NLS { public static String CommandToStringConverter_None; + public static String VRootBindingContexts_AddContext; + public static String VRootBindingContexts_TreeLabel; + public static String VRootBindingContexts_TreeLabelDescription; + public static String VRootBindingContexts_Contexts; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 0ce26469e1..26e7868f99 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -41,7 +41,7 @@ ApplicationEditor_Addons=Addons ApplicationEditor_MenuContributions=Menu Contributions ApplicationEditor_ToolBarContributions=Toolbar Contributions ApplicationEditor_TrimContributions=Trim Contributions -ApplicationEditor_RootContext=Root Context +ApplicationEditor_RootContexts=Binding Contexts ApplicationEditor_BindingContexts=Binding Contexts ApplicationEditor_Categories=Command Categories @@ -502,4 +502,9 @@ ExpressionIdDialog_ShellTitle=Find Expression Id ExpressionIdDialog_DialogTitle=Find Expression Id ExpressionIdDialog_DialogMessage=Find the expression id defined through the 'org.eclipse.core.expressions.definitions' extension point ExpressionIdDialog_Id=Id -CommandToStringConverter_None= \ No newline at end of file +CommandToStringConverter_None= + +VRootBindingContexts_AddContext=Add Binding Context +VRootBindingContexts_TreeLabel=Binding Context +VRootBindingContexts_TreeLabelDescription=Binding Context Bla Bla Bla +VRootBindingContexts_Contexts=Binding Contexts \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 91103d16f3..efe9305e42 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -104,6 +104,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelFragmentsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelImportsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VRootBindingContexts; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VToolBarContributionsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VTrimContributionsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowControlEditor; @@ -194,6 +195,7 @@ public class ModelEditor { public static final String VIRTUAL_CATEGORIES = ModelEditor.class.getName() + ".VIRTUAL_CATEGORIES"; //$NON-NLS-1$ public static final String VIRTUAL_PARAMETERS = ModelEditor.class.getName() + ".VIRTUAL_PARAMETERS"; //$NON-NLS-1$ public static final String VIRTUAL_MENUELEMENTS = ModelEditor.class.getName() + ".VIRTUAL_MENUELEMENTS"; //$NON-NLS-1$ + public static final String VIRTUAL_ROOT_CONTEXTS = ModelEditor.class.getName() + ".VIRTUAL_ROOT_CONTEXTS"; //$NON-NLS-1$ private Map editorMap = new HashMap(); private Map virtualEditors = new HashMap(); @@ -582,6 +584,7 @@ private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_CATEGORIES, new VApplicationCategoriesEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_PARAMETERS, new VItemParametersEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_MENUELEMENTS, new VMenuElementsEditor(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_ROOT_CONTEXTS, new VRootBindingContexts(modelProvider.getEditingDomain(), this)); } private void registerVirtualEditor(String id, AbstractComponentEditor editor) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index c6067d22ad..5b4730b769 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -14,39 +14,28 @@ import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.commands.MBindingContext; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; @@ -58,7 +47,7 @@ public class ApplicationEditor extends AbstractComponentEditor { private Image image; private Image tbrImage; private EMFDataBindingContext context; - private Button createRemoveRootContext; + // private Button createRemoveRootContext; private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES); @@ -71,7 +60,7 @@ public class ApplicationEditor extends AbstractComponentEditor { private IListProperty TRIM_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS); private IListProperty APPLICATION__CATEGORIES = EMFProperties.list(ApplicationPackageImpl.Literals.APPLICATION__CATEGORIES); - private IValueProperty BINDING_TABLE_CONTAINER__ROOT_CONTEXT = EMFProperties.value(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT); + private IListProperty BINDING_TABLE_CONTAINER__ROOT_CONTEXT = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT); public ApplicationEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); @@ -123,10 +112,6 @@ public Composite getEditor(Composite parent, Object object) { } getMaster().setValue(object); - if (createRemoveRootContext != null) { - createRemoveRootContext.setSelection(((MApplication) object).getRootContext() != null); - } - return composite; } @@ -154,26 +139,6 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ApplicationEditor_RootContext); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - createRemoveRootContext = new Button(parent, SWT.CHECK); - createRemoveRootContext.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MApplication app = (MApplication) getMaster().getValue(); - if (app.getRootContext() == null) { - addContext(); - } else { - removeContext(); - } - } - }); - createRemoveRootContext.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - } - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); @@ -183,21 +148,6 @@ public void widgetSelected(SelectionEvent e) { return parent; } - void removeContext() { - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT, null); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - void addContext() { - MBindingContext context = MCommandsFactory.INSTANCE.createBindingContext(); - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT, context); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - @Override public IObservableList getChildList(final Object element) { final WritableList list = new WritableList(); @@ -210,7 +160,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.ApplicationEditor_Handlers) { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_ROOT_CONTEXTS, BINDING_TABLE_CONTAINER__ROOT_CONTEXT, element, Messages.ApplicationEditor_RootContexts) { @Override protected boolean accepted(Object o) { @@ -219,7 +169,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry(ModelEditor.VIRTUAL_PART_DESCRIPTORS, PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, element, Messages.ApplicationEditor_PartDescriptors) { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_BINDING_TABLE, BINDING_CONTAINER__BINDINGS, element, Messages.ApplicationEditor_BindingTables) { @Override protected boolean accepted(Object o) { @@ -228,7 +178,16 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry(ModelEditor.VIRTUAL_BINDING_TABLE, BINDING_CONTAINER__BINDINGS, element, Messages.ApplicationEditor_BindingTables) { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.ApplicationEditor_Handlers) { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); + + list.add(new VirtualEntry(ModelEditor.VIRTUAL_PART_DESCRIPTORS, PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, element, Messages.ApplicationEditor_PartDescriptors) { @Override protected boolean accepted(Object o) { @@ -284,30 +243,31 @@ protected boolean accepted(Object o) { return true; } }); - - MApplication application = (MApplication) element; - if (application.getRootContext() != null) { - list.add(0, application.getRootContext()); - } - - BINDING_TABLE_CONTAINER__ROOT_CONTEXT.observe(element).addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - if (event.diff.getOldValue() != null) { - list.remove(event.diff.getOldValue()); - if (getMaster().getValue() == element) { - createRemoveRootContext.setSelection(false); - } - } - - if (event.diff.getNewValue() != null) { - list.add(0, event.diff.getNewValue()); - if (getMaster().getValue() == element) { - createRemoveRootContext.setSelection(true); - } - } - } - }); + // + // MApplication application = (MApplication) element; + // if (application.getRootContext() != null) { + // list.add(0, application.getRootContext()); + // } + + // BINDING_TABLE_CONTAINER__ROOT_CONTEXT.observe(element).addValueChangeListener(new + // IValueChangeListener() { + // + // public void handleValueChange(ValueChangeEvent event) { + // if (event.diff.getOldValue() != null) { + // list.remove(event.diff.getOldValue()); + // if (getMaster().getValue() == element) { + // createRemoveRootContext.setSelection(false); + // } + // } + // + // if (event.diff.getNewValue() != null) { + // list.add(0, event.diff.getNewValue()); + // if (getMaster().getValue() == element) { + // createRemoveRootContext.setSelection(true); + // } + // } + // } + // }); return list; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java new file mode 100644 index 0000000000..3bc2433b20 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java @@ -0,0 +1,236 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import java.util.ArrayList; +import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.MApplication; +import org.eclipse.e4.ui.model.application.commands.MBindingContext; +import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VRootBindingContexts extends AbstractComponentEditor { + private Composite composite; + private TableViewer viewer; + private EMFDataBindingContext context; + + private List actions = new ArrayList(); + + public VRootBindingContexts(EditingDomain editingDomain, ModelEditor editor) { + super(editingDomain, editor); + actions.add(new Action(Messages.VRootBindingContexts_AddContext) { + @Override + public void run() { + handleAddContext(); + } + }); + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return Messages.VRootBindingContexts_TreeLabel; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return Messages.VRootBindingContexts_TreeLabelDescription; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + composite = createForm(parent, context, getMaster()); + } + VirtualEntry o = (VirtualEntry) object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); + + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.VRootBindingContexts_Contexts); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Up); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MApplication container = (MApplication) getMaster().getValue(); + int idx = container.getAddons().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Down); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MApplication container = (MApplication) getMaster().getValue(); + int idx = container.getAddons().indexOf(obj) + 1; + if (idx < container.getAddons().size()) { + Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT, obj, idx); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_AddEllipsis); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + handleAddContext(); + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Remove); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + handleRemoveContexts(((IStructuredSelection) viewer.getSelection()).toList()); + } + } + }); + } + + return parent; + } + + private void handleAddContext() { + MBindingContext context = MCommandsFactory.INSTANCE.createBindingContext(); + setElementId(context); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT, context); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + private void handleRemoveContexts(List contexts) { + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT, contexts); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + @Override + public IObservableList getChildList(Object element) { + return null; + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } +} From a8875157f75dab6c5c2110ac5a300d04dbe1f5e5 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 17 Dec 2010 09:48:58 +0000 Subject: [PATCH 0277/1286] Bug 332712 - After creating the skeleton e4-Application with the wizward provided by E4 Tools the generated projects doesn't work because of missing Addons etc --- .../wizards/project/E4NewProjectWizard.java | 31 +++++++++++++++++++ .../templates/src/handlers/SaveHandler.java | 7 ++--- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java index e2375e5f80..50ef617d8d 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java @@ -30,6 +30,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Platform; +import org.eclipse.e4.ui.model.application.MAddon; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.e4.ui.model.application.commands.MBindingContext; @@ -346,6 +347,36 @@ public void createApplicationResources(IProject project, application.setElementId("org.eclipse.e4.ide.application"); + MAddon addon = MApplicationFactory.INSTANCE.createAddon(); + addon.setElementId("org.eclipse.e4.core.commands.service"); + addon.setContributionURI("platform:/plugin/org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"); + application.getAddons().add(addon); + + addon = MApplicationFactory.INSTANCE.createAddon(); + addon.setElementId("org.eclipse.e4.ui.contexts.service"); + addon.setContributionURI("platform:/plugin/org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"); + application.getAddons().add(addon); + + addon = MApplicationFactory.INSTANCE.createAddon(); + addon.setElementId("org.eclipse.e4.ui.bindings.service"); + addon.setContributionURI("platform:/plugin/org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"); + application.getAddons().add(addon); + + addon = MApplicationFactory.INSTANCE.createAddon(); + addon.setElementId("org.eclipse.e4.ui.workbench.commands.model"); + addon.setContributionURI("platform:/plugin/org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon"); + application.getAddons().add(addon); + + addon = MApplicationFactory.INSTANCE.createAddon(); + addon.setElementId("org.eclipse.e4.ui.workbench.contexts.model"); + addon.setContributionURI("platform:/plugin/org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon"); + application.getAddons().add(addon); + + addon = MApplicationFactory.INSTANCE.createAddon(); + addon.setElementId("org.eclipse.e4.ui.workbench.bindings.model"); + addon.setContributionURI("platform:/plugin/org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon"); + application.getAddons().add(addon); + MBindingContext rootContext = MCommandsFactory.INSTANCE.createBindingContext(); rootContext.setElementId("org.eclipse.ui.contexts.dialogAndWindow"); rootContext.setName("In Dialog and Windows"); diff --git a/bundles/org.eclipse.e4.tools/templates/src/handlers/SaveHandler.java b/bundles/org.eclipse.e4.tools/templates/src/handlers/SaveHandler.java index c1e49cdf9a..02963726ef 100644 --- a/bundles/org.eclipse.e4.tools/templates/src/handlers/SaveHandler.java +++ b/bundles/org.eclipse.e4.tools/templates/src/handlers/SaveHandler.java @@ -17,7 +17,6 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.e4.core.contexts.ContextInjectionFactory; import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.IDisposable; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.core.di.annotations.CanExecute; import org.eclipse.e4.ui.model.application.MContribution; @@ -59,9 +58,7 @@ public void run(IProgressMonitor monitor) } } }); - - if (pmContext instanceof IDisposable) { - ((IDisposable) pmContext).dispose(); - } + + pmContext.dispose(); } } From 5f346169f3f0473d4a6efeba17a802856d641f82 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 18 Dec 2010 08:58:19 +0000 Subject: [PATCH 0278/1286] Bug 320788 - [Model] The model misses the possibility to define mnemonics for Menu-Elements --- .../eclipse/e4/tools/emf/ui/internal/Messages.java | 1 + .../e4/tools/emf/ui/internal/Messages.properties | 1 + .../ui/internal/common/component/MenuEditor.java | 14 ++++++++++++++ .../internal/common/component/MenuItemEditor.java | 2 +- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 1c41e70b7b..9e56336bfd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -125,6 +125,7 @@ public class Messages extends NLS { public static String MenuEditor_Tooltip; public static String MenuEditor_IconURI; public static String MenuEditor_Children; + public static String MenuEditor_Mnemonics; public static String MenuItemEditor_Type; public static String MenuItemEditor_Label; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 26e7868f99..3cc6f3c170 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -121,6 +121,7 @@ MenuEditor_Tooltip=Tooltip MenuEditor_IconURI=Icon URI MenuEditor_MainMenu=Main Menu MenuEditor_Children=Children +MenuEditor_Mnemonics=Mnemonics MenuItemEditor_Type=Type MenuItemEditor_Label=Label diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index ad8cd4ec7f..fb03422c2a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -39,6 +39,7 @@ import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; @@ -187,6 +188,19 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); } + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.MenuEditor_Mnemonics); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_ELEMENT__MNEMONICS).observeDetail(master)); + } + // ------------------------------------------------------------ if (!rootMenu) { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index edbaacbf4c..7ee365e256 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -210,7 +210,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_ITEM__MNEMONICS).observeDetail(master)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_ELEMENT__MNEMONICS).observeDetail(master)); } // ------------------------------------------------------------ From ea60da54efd87fe780ce032c51ec9da6ee3f68a1 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 23 Dec 2010 20:20:18 +0000 Subject: [PATCH 0279/1286] [ModelTooling] Add support for UIElement#accessibilityPhrase --- .../e4/tools/emf/ui/internal/Messages.java | 1 + .../tools/emf/ui/internal/Messages.properties | 1 + .../common/component/ApplicationEditor.java | 2 + .../component/MenuContributionEditor.java | 2 + .../internal/common/component/MenuEditor.java | 2 + .../common/component/MenuItemEditor.java | 2 + .../common/component/MenuSeparatorEditor.java | 2 + .../internal/common/component/PartEditor.java | 71 ++----------------- .../component/PartSashContainerEditor.java | 2 + .../common/component/PartStackEditor.java | 2 + .../common/component/PerspectiveEditor.java | 2 + .../component/PerspectiveStackEditor.java | 2 + .../common/component/PlaceholderEditor.java | 2 + .../component/ToolBarContributionEditor.java | 2 + .../common/component/ToolBarEditor.java | 2 + .../component/ToolBarSeparatorEditor.java | 2 +- .../common/component/ToolControlEditor.java | 2 + .../common/component/ToolItemEditor.java | 5 +- .../common/component/TrimBarEditor.java | 2 + .../component/TrimContributionEditor.java | 2 + .../common/component/WindowEditor.java | 2 + 21 files changed, 44 insertions(+), 68 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 9e56336bfd..996576d94d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -26,6 +26,7 @@ public class Messages extends NLS { public static String ModelTooling_UIElement_ToBeRendered; public static String ModelTooling_UIElement_Visible; public static String ModelTooling_UIElement_VisibleWhen; + public static String ModelTooling_UIElement_AccessibilityPhrase; public static String ModelTooling_Context_Variables; public static String ModelTooling_Context_Properties; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 3cc6f3c170..c185ac9c28 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -20,6 +20,7 @@ ModelTooling_Common_FindEllipsis=Find ... ModelTooling_UIElement_ToBeRendered=To Be Rendered ModelTooling_UIElement_Visible=Visible ModelTooling_UIElement_VisibleWhen=Visible-When Expression +ModelTooling_UIElement_AccessibilityPhrase=Accessibility Phrase ModelTooling_Context_Variables=Variables ModelTooling_Context_Properties=Context Properties diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 5b4730b769..2e71b5d521 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -139,6 +139,8 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index 895ff7a569..b697f587c0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -195,6 +195,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index fb03422c2a..0cc20dd488 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -188,6 +188,8 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); } + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 7ee365e256..941e92dfda 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -200,6 +200,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); } + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index 404c728281..c290dd50f1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -139,6 +139,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 09976ca157..1a92e757c8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -49,7 +49,6 @@ import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; @@ -182,44 +181,10 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_LabelLabel); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_Tooltip); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); - } + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); + ControlFactory.createTextField(parent, Messages.PartEditor_LabelLabel, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL)); + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + ControlFactory.createTextField(parent, Messages.PartEditor_Tooltip, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP)); // ------------------------------------------------------------ { @@ -315,35 +280,11 @@ public void widgetSelected(SelectionEvent e) { createRemoveToolBar.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_ContainerData); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); - } + ControlFactory.createTextField(parent, Messages.PartEditor_ContainerData, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA)); createSubformElements(parent, context, master); - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_Closeable); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Button checkbox = new Button(parent, SWT.CHECK); - checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); - - IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART__CLOSEABLE); - IWidgetValueProperty uiProp = WidgetProperties.selection(); - - context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); - } + ControlFactory.createCheckBox(parent, Messages.PartEditor_Closeable, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART__CLOSEABLE)); // ------------------------------------------------------------ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index d361b01a85..fb7562e8a5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -194,6 +194,8 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 483d560201..1f998a1d57 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -179,6 +179,8 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + ControlFactory.createSelectedElement(parent, this, context, Messages.PartStackEditor_SelectedElement); // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 1f672a26dc..4543a3b154 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -193,6 +193,8 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + ControlFactory.createSelectedElement(parent, this, context, Messages.PerspectiveEditor_SelectedElement); // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 13cbfe7962..1d35f67951 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -170,6 +170,8 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + ControlFactory.createSelectedElement(parent, this, context, Messages.PerspectiveStackEditor_SelectedElement); // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 0c6b200eb8..baf4f5e92f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -177,6 +177,8 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index a87504ea62..115ca1b9ed 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -187,6 +187,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 9676e5c6e0..b72494d501 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -183,6 +183,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index 390e53cca2..9a81ba392c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -149,7 +149,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index 1e6743fe2d..4383f6e165 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -159,6 +159,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); } + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index cb090993db..e7f2e09831 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -17,7 +17,6 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; @@ -126,7 +125,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, final WritableValue master) { - IValueProperty textProp = WidgetProperties.text(SWT.Modify); + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); IWidgetValueProperty checkProp = WidgetProperties.selection(); IWidgetValueProperty enabled = WidgetProperties.enabled(); @@ -159,6 +158,8 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); } + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index f874386af9..8ad1916d4d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -176,6 +176,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index f2f004b06f..3452ce1a1d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -174,6 +174,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 2d17e9e863..37598cdf8a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -258,6 +258,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); } + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); From 44db22444806e23ac0a0e16b446fba8fa6a5ea8e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 23 Dec 2010 20:50:40 +0000 Subject: [PATCH 0280/1286] Bug 325864 - [ModelTooling] Add support for MArea --- .../e4/tools/emf/ui/internal/Messages.java | 16 + .../tools/emf/ui/internal/Messages.properties | 18 +- .../emf/ui/internal/common/ModelEditor.java | 2 + .../internal/common/component/AreaEditor.java | 432 ++++++++++++++++++ .../component/PartSashContainerEditor.java | 2 +- .../dialogs/AreaIconDialogEditor.java | 41 ++ .../virtual/VWindowControlEditor.java | 2 +- 7 files changed, 510 insertions(+), 3 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 996576d94d..db5e2faf69 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -517,6 +517,22 @@ public class Messages extends NLS { public static String VRootBindingContexts_TreeLabelDescription; public static String VRootBindingContexts_Contexts; + public static String AreaEditor_Label; + public static String AreaEditor_Description; + public static String AreaEditor_Orientation; + public static String AreaEditor_Horizontal; + public static String AreaEditor_SelectedElement; + public static String AreaEditor_ContainerData; + public static String AreaEditor_Controls; + public static String AreaEditor_Vertical; + public static String AreaEditor_LabelLabel; + public static String AreaEditor_Tooltip; + public static String AreaEditor_IconURI; + + public static String AreaIconDialogEditor_ShellTitle; + public static String AreaIconDialogEditor_DialogTitle; + public static String AreaIconDialogEditor_DialogMessage; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index c185ac9c28..9d41de5620 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -509,4 +509,20 @@ CommandToStringConverter_None= VRootBindingContexts_AddContext=Add Binding Context VRootBindingContexts_TreeLabel=Binding Context VRootBindingContexts_TreeLabelDescription=Binding Context Bla Bla Bla -VRootBindingContexts_Contexts=Binding Contexts \ No newline at end of file +VRootBindingContexts_Contexts=Binding Contexts + +AreaEditor_Label=Area +AreaEditor_Description=Area Bla Bla Bla +AreaEditor_Orientation=Orientation +AreaEditor_Horizontal=Horizontal +AreaEditor_SelectedElement=Selected Element +AreaEditor_ContainerData=Container Data +AreaEditor_Controls=Controls +AreaEditor_Vertical=Vertical +AreaEditor_LabelLabel=Label +AreaEditor_Tooltip=Tooltip +AreaEditor_IconURI=Icon URI + +AreaIconDialogEditor_ShellTitle=Area Icon Search +AreaIconDialogEditor_DialogTitle=Area Icon Search +AreaIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index efe9305e42..df16938bea 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -54,6 +54,7 @@ import org.eclipse.e4.tools.emf.ui.internal.ShadowComposite; import org.eclipse.e4.tools.emf.ui.internal.common.component.AddonsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ApplicationEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.AreaEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.BindingContextEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.BindingTableEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.CategoryEditor; @@ -654,6 +655,7 @@ private void registerDefaultEditors() { registerEditor(BasicPackageImpl.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(BasicPackageImpl.Literals.TRIMMED_WINDOW, new TrimmedWindowEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(BasicPackageImpl.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor(modelProvider.getEditingDomain(), this)); + registerEditor(AdvancedPackageImpl.Literals.AREA, new AreaEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(BasicPackageImpl.Literals.PART_STACK, new PartStackEditor(modelProvider.getEditingDomain(), this)); registerEditor(BasicPackageImpl.Literals.INPUT_PART, new InputPartEditor(modelProvider.getEditingDomain(), this, project)); registerEditor(BasicPackageImpl.Literals.TRIM_BAR, new TrimBarEditor(modelProvider.getEditingDomain(), this)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java new file mode 100644 index 0000000000..b0227e57ed --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java @@ -0,0 +1,432 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.common.EStackLayout; +import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.AreaIconDialogEditor; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; +import org.eclipse.e4.ui.model.application.ui.MUILabel; +import org.eclipse.e4.ui.model.application.ui.advanced.MArea; +import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; +import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFListProperty; +import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.databinding.swt.IWidgetValueProperty; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.IViewerValueProperty; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.databinding.viewers.ViewerProperties; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class AreaEditor extends AbstractComponentEditor { + + private Composite composite; + private EMFDataBindingContext context; + + private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + private EStackLayout stackLayout; + private IProject project; + + public AreaEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { + super(editingDomain, editor); + this.project = project; + } + + @Override + public Image getImage(Object element, Display display) { + boolean horizontal = ((MPartSashContainer) element).isHorizontal(); + + if (!horizontal) { + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer_vertical.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + if (horizontal) { + MUIElement uiElement = (MUIElement) element; + if (uiElement.isToBeRendered() && uiElement.isVisible()) { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + try { + return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer.gif")); //$NON-NLS-1$ + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + return null; + } + + @Override + public String getLabel(Object element) { + return Messages.AreaEditor_Label; + } + + @Override + public String getDescription(Object element) { + return Messages.AreaEditor_Description; + } + + @Override + public Composite getEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + if (getEditor().isModelFragment()) { + composite = new Composite(parent, SWT.NONE); + stackLayout = new EStackLayout(); + composite.setLayout(stackLayout); + createForm(composite, context, getMaster(), false); + createForm(composite, context, getMaster(), true); + } else { + composite = createForm(parent, context, getMaster(), false); + } + } + + if (getEditor().isModelFragment()) { + Control topControl; + if (Util.isImport((EObject) object)) { + topControl = composite.getChildren()[1]; + } else { + topControl = composite.getChildren()[0]; + } + + if (stackLayout.topControl != topControl) { + stackLayout.topControl = topControl; + composite.layout(true, true); + } + } + + getMaster().setValue(object); + return composite; + } + + private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { + parent = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + parent.setLayout(gl); + + if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { + ControlFactory.createXMIId(parent, this); + } + + IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); + + if (isImport) { + ControlFactory.createFindImport(parent, this, context); + return parent; + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.ModelTooling_Common_Id); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); + } + + ControlFactory.createTextField(parent, Messages.AreaEditor_LabelLabel, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL)); + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + ControlFactory.createTextField(parent, Messages.AreaEditor_Tooltip, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP)); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.AreaEditor_IconURI); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + final Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); + + new ImageTooltip(t) { + + @Override + protected URI getImageURI() { + MUILabel part = (MUILabel) getMaster().getValue(); + String uri = part.getIconURI(); + if (uri == null || uri.trim().length() == 0) { + return null; + } + return URI.createURI(part.getIconURI()); + } + }; + + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setText(Messages.ModelTooling_Common_FindEllipsis); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + AreaIconDialogEditor dialog = new AreaIconDialogEditor(b.getShell(), project, getEditingDomain(), (MPart) getMaster().getValue()); + dialog.open(); + } + }); + } + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.AreaEditor_Orientation); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + ComboViewer viewer = new ComboViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + viewer.getControl().setLayoutData(gd); + viewer.setContentProvider(new ArrayContentProvider()); + viewer.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + return ((Boolean) element).booleanValue() ? Messages.AreaEditor_Horizontal : Messages.AreaEditor_Vertical; + } + }); + viewer.setInput(new Boolean[] { Boolean.TRUE, Boolean.FALSE }); + IViewerValueProperty vProp = ViewerProperties.singleSelection(); + context.bindValue(vProp.observe(viewer), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL).observeDetail(getMaster())); + } + + ControlFactory.createSelectedElement(parent, this, context, Messages.AreaEditor_SelectedElement); + + // ------------------------------------------------------------ + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.AreaEditor_ContainerData); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); + } + + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.AreaEditor_Controls); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); + + final TableViewer viewer = new TableViewer(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 200; + viewer.getControl().setLayoutData(gd); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + + IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + viewer.setInput(prop.observeDetail(getMaster())); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Up); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if (idx >= 0) { + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Down); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if (idx < container.getChildren().size()) { + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + EClass eclass = (EClass) element; + return eclass.getName(); + } + }); + childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, AdvancedPackageImpl.Literals.AREA, AdvancedPackageImpl.Literals.PLACEHOLDER }); + childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!childrenDropDown.getSelection().isEmpty()) { + EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); + EObject eObject = EcoreUtil.create(eClass); + setElementId(eObject); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(eObject); + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Remove); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List elements = ((IStructuredSelection) viewer.getSelection()).toList(); + + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); + + ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + return parent; + } + + @Override + public IObservableList getChildList(Object element) { + return ELEMENT_CONTAINER__CHILDREN.observe(element); + } + + @Override + public String getDetailLabel(Object element) { + MArea o = (MArea) element; + return o.getLabel(); + } + + @Override + public FeaturePath[] getLabelProperties() { + return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index fb7562e8a5..9835cbce4c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -316,7 +316,7 @@ public String getText(Object element) { return eclass.getName(); } }); - childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, AdvancedPackageImpl.Literals.PLACEHOLDER }); + childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, AdvancedPackageImpl.Literals.AREA, AdvancedPackageImpl.Literals.PLACEHOLDER }); childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java new file mode 100644 index 0000000000..e918099acb --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; + +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.widgets.Shell; + +public class AreaIconDialogEditor extends AbstractIconDialog { + + public AreaIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MPart element) { + super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); + } + + @Override + protected String getShellTitle() { + return Messages.AreaIconDialogEditor_ShellTitle; + } + + @Override + protected String getDialogTitle() { + return Messages.AreaIconDialogEditor_DialogTitle; + } + + @Override + protected String getDialogMessage() { + return Messages.AreaIconDialogEditor_DialogMessage; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index 4f4e3b9783..dd3531951f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -176,7 +176,7 @@ public String getText(Object element) { return eclass.getName(); } }); - childrenDropDown.setInput(new EClass[] { AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART }); + childrenDropDown.setInput(new EClass[] { AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, AdvancedPackageImpl.Literals.AREA }); childrenDropDown.setSelection(new StructuredSelection(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); From 88401ae8eac59d5d96977b2c190af499611588f2 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 23 Dec 2010 23:32:52 +0000 Subject: [PATCH 0281/1286] Bug 323309 - [ModelTooling] Add Elements via the right mouse button * adds generic remove --- .../e4/tools/emf/ui/internal/Messages.java | 2 ++ .../tools/emf/ui/internal/Messages.properties | 4 +++- .../emf/ui/internal/common/ModelEditor.java | 20 +++++++++++++++---- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index db5e2faf69..60c00abafe 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -533,6 +533,8 @@ public class Messages extends NLS { public static String AreaIconDialogEditor_DialogTitle; public static String AreaIconDialogEditor_DialogMessage; + public static String ModelEditor_Delete; + static { NLS.initializeMessages(Messages.class.getName(), Messages.class); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 9d41de5620..efc3c629ae 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -525,4 +525,6 @@ AreaEditor_IconURI=Icon URI AreaIconDialogEditor_ShellTitle=Area Icon Search AreaIconDialogEditor_DialogTitle=Area Icon Search -AreaIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project \ No newline at end of file +AreaIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project + +ModelEditor_Delete=Remove \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index df16938bea..6b8071d163 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -11,7 +11,6 @@ package org.eclipse.e4.tools.emf.ui.internal.common; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -51,6 +50,7 @@ import org.eclipse.e4.tools.emf.ui.common.MemoryTransfer; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ShadowComposite; import org.eclipse.e4.tools.emf.ui.internal.common.component.AddonsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ApplicationEditor; @@ -368,13 +368,25 @@ public void menuAboutToShow(IMenuManager manager) { if (s.getFirstElement() instanceof VirtualEntry) { actions = virtualEditors.get(((VirtualEntry) s.getFirstElement()).getId()).getActions(s.getFirstElement()); } else { - EObject o = (EObject) s.getFirstElement(); + final EObject o = (EObject) s.getFirstElement(); AbstractComponentEditor editor = getEditor(o.eClass()); if (editor != null) { - actions = editor.getActions(s.getFirstElement()); + actions = new ArrayList(editor.getActions(s.getFirstElement())); } else { - actions = Collections.emptyList(); + actions = new ArrayList(); } + + if (o.eContainer() != null) { + actions.add(new Action(Messages.ModelEditor_Delete) { + public void run() { + Command cmd = RemoveCommand.create(ModelEditor.this.modelProvider.getEditingDomain(), o.eContainer(), o.eContainingFeature(), o); + if (cmd.canExecute()) { + ModelEditor.this.modelProvider.getEditingDomain().getCommandStack().execute(cmd); + } + } + }); + } + } for (Action a : actions) { From 1437c83541e6207dba90c7fce2b43b5edc5dfa2f Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 24 Dec 2010 14:21:02 +0000 Subject: [PATCH 0282/1286] Bug 323309 - [ModelTooling] Add Elements via the right mouse button * adds context actions for virtual elements --- .../icons/full/modelelements/Area.gif | Bin 0 -> 378 bytes .../full/modelelements/Area_vertical.gif | Bin 0 -> 347 bytes .../icons/full/modelelements/tbr/Area.gif | Bin 0 -> 969 bytes .../full/modelelements/tbr/Area_vertical.gif | Bin 0 -> 937 bytes .../icons/full/obj16/cross.png | Bin 0 -> 655 bytes .../component/AbstractComponentEditor.java | 5 ++ .../e4/tools/emf/ui/internal/Messages.java | 26 ++++++ .../tools/emf/ui/internal/Messages.properties | 26 ++++++ .../emf/ui/internal/common/ModelEditor.java | 8 +- .../internal/common/component/AreaEditor.java | 8 +- .../component/virtual/VApplicationAddons.java | 19 ++-- .../virtual/VApplicationCategoriesEditor.java | 35 ++++++-- .../virtual/VBindingTableEditor.java | 44 ++++++++-- .../component/virtual/VCommandEditor.java | 44 ++++++++-- .../component/virtual/VHandlerEditor.java | 45 ++++++++-- .../virtual/VItemParametersEditor.java | 45 ++++++++-- .../virtual/VMenuContributionsEditor.java | 46 ++++++++-- .../common/component/virtual/VMenuEditor.java | 46 +++++++--- .../virtual/VMenuElementsEditor.java | 65 +++++++++++--- .../component/virtual/VPartDescriptor.java | 45 ++++++++-- .../virtual/VRootBindingContexts.java | 19 ++-- .../virtual/VToolBarContributionsEditor.java | 46 +++++++--- .../virtual/VTrimContributionsEditor.java | 45 ++++++++-- .../virtual/VWindowControlEditor.java | 83 +++++++++++++++--- .../component/virtual/VWindowEditor.java | 54 +++++++++--- .../virtual/VWindowSharedElementsEditor.java | 59 +++++++++++-- .../component/virtual/VWindowTrimEditor.java | 44 ++++++++-- 27 files changed, 698 insertions(+), 159 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area_vertical.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area_vertical.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/cross.png diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif new file mode 100644 index 0000000000000000000000000000000000000000..bbbdd559a918bb27921ae8feb93d597c3c4cfb75 GIT binary patch literal 378 zcmZ?wbhEHb6krfwxXQrr^Vh#0KmUIF@$cJ@zcmwfCsnV`Y1vfJzNNf(XZ@7DP1E+b z%s7})HtGH6-(SA}O{iL#TDLZ{ab0ouw(N=t`BlAdKK}an_0O}nKTB%6UVixXQD%Ty=D{`L=jry~!AaOm5~t@6>9J7(sa^L<>ggUVxK&9nue2_s@MWCw)qRi)SZ-7`Bw7@u3E#V z;v}ug#Kg=juyy+m2`3R%DJe!q)`N$Sh&TzWGMr=JKYN}**oo)*jhi>!?zlKISOWmH C)28qM literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area_vertical.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area_vertical.gif new file mode 100644 index 0000000000000000000000000000000000000000..013e818ecb54b04fe97baea83dc819b9688b2c24 GIT binary patch literal 347 zcmZ?wbhEHb6krfwSZd7h^Vh#0KmUIF@$cJ@zcmwfCsnV`Y1vfJzNNf(XZ@7DP1E+b z%s7})HtGH6-(SA}O{iL#TDLZ{ab0ouw(N=t`BlAdKK}an_0O}nKTB%6UVixX6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000Q40RIUbNU)&5O$ZYzR46bLx`z)hL4=q| zphR{U*;PW95#uF+lsK|$*G`g1lIoFDuurg9QFTcdzWdv1ZHu5y%G}zPI?= r!hOp}U>s}Ij$!gmDLS6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~A^8LW00930EC2ui01yBW000Pv0RIUbNU)$mf{GkPqI42oVdp)|=FJu6nNS&0+} LU2K%mVL$*oB|pUA literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/cross.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/cross.png new file mode 100644 index 0000000000000000000000000000000000000000..1514d51a3cf1b67e1c5b9ada36f1fd474e2d214a GIT binary patch literal 655 zcmV;A0&x9_P)uEoyT++I zn$b9r%cFfhHe2K68PkBu*@^<$y+7xQ$wJ~;c5aBx$R=xq*41Wo zhwQus_VOgm0hughj}MhOvs#{>Vg09Y8WxjWUJY5YW zJ?&8eG!59Cz=|E%Ns@013KLWOLV)CObIIj_5{>{#k%TEAMs_GbdDV`x-iYsGH z#=Z{USAQA>NY(}X7=3{K8# getActions(Object element) { ArrayList l = new ArrayList(super.getActions(element)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index 7705e08ec2..857a361ee0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -28,6 +31,7 @@ import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; @@ -47,9 +51,21 @@ public class VBindingTableEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private TableViewer bindingViewer; + private List actions = new ArrayList(); public VBindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + actions.add(new Action(Messages.VBindingTableEditor_AddBindingTable, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingTable.png"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -173,15 +189,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MBindingTable command = MCommandsFactory.INSTANCE.createBindingTable(); - setElementId(command); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES, command); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(command); - } + handleAdd(); } }); @@ -206,9 +214,27 @@ public void widgetSelected(SelectionEvent e) { return parent; } + protected void handleAdd() { + MBindingTable command = MCommandsFactory.INSTANCE.createBindingTable(); + setElementId(command); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES, command); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(command); + } + } + @Override public IObservableList getChildList(Object element) { return null; } + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index 1646f41202..81a39e6350 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -28,6 +31,7 @@ import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; @@ -49,10 +53,22 @@ public class VCommandEditor extends AbstractComponentEditor { private TableViewer viewer; private EStructuralFeature commandsFeature; + private List actions = new ArrayList(); public VCommandEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature commandsFeature) { super(editingDomain, editor); this.commandsFeature = commandsFeature; + try { + actions.add(new Action(Messages.VCommandEditor_AddCommand, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.png"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -176,15 +192,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MCommand command = CommandsFactoryImpl.eINSTANCE.createCommand(); - setElementId(command); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, command); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(command); - } + handleAdd(); } }); @@ -209,9 +217,27 @@ public void widgetSelected(SelectionEvent e) { return parent; } + protected void handleAdd() { + MCommand command = CommandsFactoryImpl.eINSTANCE.createCommand(); + setElementId(command); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, command); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(command); + } + } + @Override public IObservableList getChildList(Object element) { return null; } + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index 2f5f7a6972..9ccbd4d087 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -28,6 +31,7 @@ import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; @@ -47,9 +51,21 @@ public class VHandlerEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private TableViewer viewer; + private List actions = new ArrayList(); public VHandlerEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + actions.add(new Action(Messages.VHandlerEditor_AddHandler, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.png"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -173,15 +189,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MHandler handler = MCommandsFactory.INSTANCE.createHandler(); - setElementId(handler); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, handler); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } + handleAdd(); } }); @@ -210,4 +218,23 @@ public void widgetSelected(SelectionEvent e) { public IObservableList getChildList(Object element) { return null; } + + protected void handleAdd() { + MHandler handler = MCommandsFactory.INSTANCE.createHandler(); + setElementId(handler); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(handler); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java index de21d72f1b..08f398a673 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -30,6 +33,7 @@ import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; @@ -49,11 +53,23 @@ public class VItemParametersEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private TableViewer viewer; + private List actions = new ArrayList(); private IEMFListProperty HANDLED_ITEM__PARAMETERS = EMFProperties.list(MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); public VItemParametersEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + actions.add(new Action(Messages.VItemParametersEditor_AddParameter, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.png"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -177,15 +193,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MParameter handler = MCommandsFactory.INSTANCE.createParameter(); - setElementId(handler); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, handler); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } + handleAdd(); } }); @@ -214,4 +222,23 @@ public void widgetSelected(SelectionEvent e) { public IObservableList getChildList(Object element) { return HANDLED_ITEM__PARAMETERS.observe(element); } + + protected void handleAdd() { + MParameter handler = MCommandsFactory.INSTANCE.createParameter(); + setElementId(handler); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(handler); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java index 4443cf1ce7..346ad2a7d9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -28,6 +31,7 @@ import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; @@ -48,8 +52,21 @@ public class VMenuContributionsEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private TableViewer viewer; + private List actions = new ArrayList(); + public VMenuContributionsEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + actions.add(new Action(Messages.VMenuContributionsEditor_AddMenuContribution, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -173,15 +190,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MMenuContribution command = MMenuFactory.INSTANCE.createMenuContribution(); - setElementId(command); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, command); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(command); - } + handleAdd(); } }); @@ -210,4 +219,23 @@ public void widgetSelected(SelectionEvent e) { public IObservableList getChildList(Object element) { return null; } + + protected void handleAdd() { + MMenuContribution command = MMenuFactory.INSTANCE.createMenuContribution(); + setElementId(command); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, command); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(command); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java index 537f5a7626..596bce56d1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -30,6 +33,7 @@ import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; @@ -50,10 +54,22 @@ public class VMenuEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private TableViewer viewer; private EStructuralFeature feature; + private List actions = new ArrayList(); public VMenuEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature feature) { super(editingDomain, editor); this.feature = feature; + try { + actions.add(new Action(Messages.VMenuEditor_AddMenuContribution, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -177,15 +193,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MMenu handler = MMenuFactory.INSTANCE.createMenu(); - setElementId(handler); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), feature, handler); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } + handleAdd(); } }); @@ -211,7 +219,25 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } + + protected void handleAdd() { + MMenu handler = MMenuFactory.INSTANCE.createMenu(); + setElementId(handler); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), feature, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(handler); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java index baebd34556..1610a95c7f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -33,6 +36,7 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; @@ -55,11 +59,42 @@ public class VMenuElementsEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private TableViewer viewer; + private List actions = new ArrayList(); private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); public VMenuElementsEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + actions.add(new Action(Messages.VMenuElementsEditor_AddHandledMenuItem, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false); + } + }); + actions.add(new Action(Messages.VMenuElementsEditor_AddMenu, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(MenuPackageImpl.Literals.MENU, false); + } + }); + actions.add(new Action(Messages.VMenuElementsEditor_AddDirectMenuItem, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false); + } + }); + actions.add(new Action(Messages.VMenuElementsEditor_AddSeparator, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuSeparator.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(MenuPackageImpl.Literals.MENU_SEPARATOR, true); + } + }); + + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -194,16 +229,7 @@ public void widgetSelected(SelectionEvent e) { if (!childrenDropDown.getSelection().isEmpty()) { Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); EClass eClass = struct.eClass; - MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - if (!struct.separator) { - getEditor().setSelection(eObject); - } - } + handleAdd(eClass, struct.separator); } } }); @@ -245,4 +271,23 @@ public Struct(String label, EClass eClass, boolean separator) { } } + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } + + protected void handleAdd(EClass eClass, boolean separator) { + MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + if (!separator) { + getEditor().setSelection(eObject); + } + } + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java index cd3e2cb025..e0a5fdc69a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -28,6 +31,7 @@ import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; @@ -47,9 +51,21 @@ public class VPartDescriptor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private TableViewer viewer; + private List actions = new ArrayList(); public VPartDescriptor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + actions.add(new Action(Messages.VPartDescriptor_AddPartDescriptor, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -173,15 +189,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MPartDescriptor command = MBasicFactory.INSTANCE.createPartDescriptor(); - setElementId(command); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, command); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(command); - } + handleAdd(); } }); @@ -210,4 +218,23 @@ public void widgetSelected(SelectionEvent e) { public IObservableList getChildList(Object element) { return null; } + + protected void handleAdd() { + MPartDescriptor command = MBasicFactory.INSTANCE.createPartDescriptor(); + setElementId(command); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, command); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(command); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java index 3bc2433b20..8629943ab6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.net.MalformedURLException; +import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -54,12 +56,17 @@ public class VRootBindingContexts extends AbstractComponentEditor { public VRootBindingContexts(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); - actions.add(new Action(Messages.VRootBindingContexts_AddContext) { - @Override - public void run() { - handleAddContext(); - } - }); + try { + actions.add(new Action(Messages.VRootBindingContexts_AddContext, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingContext.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddContext(); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java index f5e196921b..34b558e9bb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -28,6 +31,7 @@ import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; @@ -47,9 +51,21 @@ public class VToolBarContributionsEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private TableViewer viewer; + private List actions = new ArrayList(); public VToolBarContributionsEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + actions.add(new Action(Messages.VToolBarContributionsEditor_AddToolBarContribution, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -173,15 +189,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MToolBarContribution command = MMenuFactory.INSTANCE.createToolBarContribution(); - setElementId(command); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, command); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(command); - } + handleAdd(); } }); @@ -208,7 +216,25 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } + + protected void handleAdd() { + MToolBarContribution command = MMenuFactory.INSTANCE.createToolBarContribution(); + setElementId(command); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, command); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(command); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java index 84de2e6b21..6aec00c547 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -28,6 +31,7 @@ import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; @@ -47,9 +51,21 @@ public class VTrimContributionsEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private TableViewer viewer; + private List actions = new ArrayList(); public VTrimContributionsEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + actions.add(new Action(Messages.VTrimContributionsEditor_AddTrimContribution, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -173,15 +189,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MTrimContribution command = MMenuFactory.INSTANCE.createTrimContribution(); - setElementId(command); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, command); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(command); - } + handleAdd(); } }); @@ -210,4 +218,23 @@ public void widgetSelected(SelectionEvent e) { public IObservableList getChildList(Object element) { return null; } + + protected void handleAdd() { + MTrimContribution command = MMenuFactory.INSTANCE.createTrimContribution(); + setElementId(command); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, command); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(command); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index dd3531951f..c0277478ab 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -32,6 +35,7 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; @@ -54,9 +58,57 @@ public class VWindowControlEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private TableViewer viewer; + private List actions = new ArrayList(); public VWindowControlEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + actions.add(new Action(Messages.VWindowControlEditor_AddPerspectiveStack, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddPartSashContainer, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART_SASH_CONTAINER); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddPartStack, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART_STACK); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddInputPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddArea, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(AdvancedPackageImpl.Literals.AREA); + } + }); + + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -187,17 +239,7 @@ public String getText(Object element) { public void widgetSelected(SelectionEvent e) { if (!childrenDropDown.getSelection().isEmpty()) { EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - - EObject eObject = EcoreUtil.create(eClass); - - setElementId(eObject); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } + handleAdd(eClass); } } }); @@ -229,4 +271,23 @@ public IObservableList getChildList(Object element) { return null; } + private void handleAdd(EClass eClass) { + EObject eObject = EcoreUtil.create(eClass); + + setElementId(eObject); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(eObject); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index b8995ff341..462628b329 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -31,6 +34,7 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; @@ -53,9 +57,27 @@ public class VWindowEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private TableViewer viewer; + private List actions = new ArrayList(); public VWindowEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + actions.add(new Action(Messages.VWindowEditor_AddTrimmedWindow, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.TRIMMED_WINDOW); + } + }); + actions.add(new Action(Messages.VWindowEditor_AddWindow, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.WINDOW); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -175,8 +197,8 @@ public String getText(Object element) { return eclass.getName(); } }); - childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.WINDOW, BasicPackageImpl.Literals.TRIMMED_WINDOW }); - childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.WINDOW)); + childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.TRIMMED_WINDOW, BasicPackageImpl.Literals.WINDOW }); + childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.TRIMMED_WINDOW)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); @@ -185,15 +207,7 @@ public String getText(Object element) { @Override public void widgetSelected(SelectionEvent e) { EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - EObject handler = EcoreUtil.create(eClass); - setElementId(handler); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, handler); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } + handleAdd(eClass); } }); @@ -226,4 +240,22 @@ public IObservableList getChildList(Object element) { return null; } + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } + + protected void handleAdd(EClass eClass) { + EObject handler = EcoreUtil.create(eClass); + setElementId(handler); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(handler); + } + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java index 5a1d061c68..99be98eb6d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -31,6 +34,7 @@ import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; @@ -53,9 +57,36 @@ public class VWindowSharedElementsEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private TableViewer viewer; + private List actions = new ArrayList(); public VWindowSharedElementsEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + + try { + actions.add(new Action(Messages.VWindowSharedElementsEditor_AddPartSashContainer, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART_SASH_CONTAINER); + } + }); + + actions.add(new Action(Messages.VWindowSharedElementsEditor_AddPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART); + } + }); + + actions.add(new Action(Messages.VWindowSharedElementsEditor_AddInputPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.INPUT_PART); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -197,15 +228,7 @@ public String getText(Object element) { public void widgetSelected(SelectionEvent e) { if (!childrenDropDown.getSelection().isEmpty()) { EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - EObject eObject = EcoreUtil.create(eClass); - setElementId(eObject); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } + handleAdd(eClass); } } }); @@ -237,4 +260,22 @@ public IObservableList getChildList(Object element) { return null; } + protected void handleAdd(EClass eClass) { + EObject eObject = EcoreUtil.create(eClass); + setElementId(eObject); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(eObject); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java index 2e3a6a0be9..f6ae8da45c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -10,6 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -26,6 +29,7 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableViewer; @@ -44,9 +48,21 @@ public class VWindowTrimEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private TableViewer viewer; + private List actions = new ArrayList(); public VWindowTrimEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + actions.add(new Action(Messages.VWindowTrimEditor_AddWindowTrim, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -117,15 +133,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MTrimBar handler = MBasicFactory.INSTANCE.createTrimBar(); - setElementId(handler); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS, handler); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } + handleAdd(); } }); @@ -156,4 +164,22 @@ public IObservableList getChildList(Object element) { return null; } + protected void handleAdd() { + MTrimBar handler = MBasicFactory.INSTANCE.createTrimBar(); + setElementId(handler); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(handler); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } \ No newline at end of file From d414990fd8b19ec02e80e12f391892fb2144eb49 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 30 Dec 2010 23:09:06 +0000 Subject: [PATCH 0283/1286] Bug 323309 - [ModelTooling] Add Elements via the right mouse button * adds context actions for rest of elements --- .../e4/tools/emf/ui/internal/Messages.java | 26 +++++++ .../tools/emf/ui/internal/Messages.properties | 28 +++++++ .../component/BindingContextEditor.java | 45 ++++++++--- .../common/component/BindingTableEditor.java | 40 ++++++++-- .../common/component/CommandEditor.java | 42 +++++++--- .../common/component/KeyBindingEditor.java | 42 ++++++++-- .../component/PartSashContainerEditor.java | 74 +++++++++++++++--- .../common/component/PartStackEditor.java | 55 +++++++++++--- .../common/component/PerspectiveEditor.java | 76 ++++++++++++++++--- .../component/PerspectiveStackEditor.java | 44 ++++++++--- .../common/component/ToolBarEditor.java | 65 +++++++++++++--- .../common/component/TrimBarEditor.java | 49 +++++++++--- 12 files changed, 494 insertions(+), 92 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index fbf1fc223d..be5bae1c54 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -57,6 +57,7 @@ public class Messages extends NLS { public static String BindingTableEditor_Keybindings; public static String BindingTableEditor_KeySequence; public static String BindingTableEditor_Command; + public static String BindingTableEditor_AddKeyBinding; public static String CommandEditor_Label; public static String CommandEditor_Description; @@ -70,6 +71,7 @@ public class Messages extends NLS { public static String CommandEditor_ParameterOptional_Yes; public static String CommandEditor_ParameterId; public static String CommandEditor_Category; + public static String CommandEditor_AddCommandParameter; public static String DirectMenuItemEditor_Label; public static String DirectMenuItemEditor_Description; @@ -112,6 +114,7 @@ public class Messages extends NLS { public static String KeyBindingEditor_Parameters; public static String KeyBindingEditor_SequenceNotComplete; public static String KeyBindingEditor_SequenceEmpty; + public static String KeyBindingEditor_AddParameter; public static String MenuEditor_Label; public static String MenuEditor_Description; @@ -179,12 +182,21 @@ public class Messages extends NLS { public static String PartSashContainerEditor_SelectedElement; public static String PartSashContainerEditor_Controls; public static String PartSashContainerEditor_ContainerData; + public static String PartSashContainerEditor_AddPartSashContainer; + public static String PartSashContainerEditor_AddPartStack; + public static String PartSashContainerEditor_AddPart; + public static String PartSashContainerEditor_AddInputPart; + public static String PartSashContainerEditor_AddArea; + public static String PartSashContainerEditor_AddPlaceholder; public static String PartStackEditor_Label; public static String PartStackEditor_Description; public static String PartStackEditor_SelectedElement; public static String PartStackEditor_Parts; public static String PartStackEditor_ContainerData; + public static String PartStackEditor_AddPart; + public static String PartStackEditor_AddInputPart; + public static String PartStackEditor_AddPlaceholder; public static String PerspectiveEditor_Label; public static String PerspectiveEditor_Description; @@ -193,11 +205,18 @@ public class Messages extends NLS { public static String PerspectiveEditor_Tooltip; public static String PerspectiveEditor_IconURI; public static String PerspectiveEditor_Controls; + public static String PerspectiveEditor_AddPartSashContainer; + public static String PerspectiveEditor_AddPartStack; + public static String PerspectiveEditor_AddPart; + public static String PerspectiveEditor_AddInputPart; + public static String PerspectiveEditor_AddArea; + public static String PerspectiveEditor_AddPlaceholder; public static String PerspectiveStackEditor_Perspectives; public static String PerspectiveStackEditor_Label; public static String PerspectiveStackEditor_Description; public static String PerspectiveStackEditor_SelectedElement; + public static String PerspectiveStackEditor_AddPerspective; public static String PlaceholderEditor_Label; public static String PlaceholderEditor_Descriptor; @@ -212,6 +231,10 @@ public class Messages extends NLS { public static String ToolBarEditor_DirectToolItem; public static String ToolBarEditor_ToolControl; public static String ToolBarEditor_Separator; + public static String ToolBarEditor_AddHandledToolItem; + public static String ToolBarEditor_AddDirectToolItem; + public static String ToolBarEditor_AddToolControl; + public static String ToolBarEditor_AddToolBarSeparator; public static String ToolBarSeparatorEditor_Label; @@ -284,6 +307,7 @@ public class Messages extends NLS { public static String BindingContextEditor_Name; public static String BindingContextEditor_Description; public static String BindingContextEditor_Subcontexts; + public static String BindingContextEditor_AddContext; public static String CommandParameterEditor_TreeLabel; public static String CommandParameterEditor_TreeLabelDescritpion; @@ -321,6 +345,8 @@ public class Messages extends NLS { public static String TrimBarEditor_TreeLabelDescription; public static String TrimBarEditor_Side; public static String TrimBarEditor_Controls; + public static String TrimBarEditor_AddToolBar; + public static String TrimBarEditor_AddToolControl; public static String TrimContributionEditor_TreeLabel; public static String TrimContributionEditor_TreeLabelDescription; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 2ee8972a0a..690ea2d3fc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -52,6 +52,7 @@ BindingTableEditor_ContextId=Context Id BindingTableEditor_Keybindings=Keybindings BindingTableEditor_KeySequence=KeySequence BindingTableEditor_Command=Command +BindingTableEditor_AddKeyBinding=Add Keybinding CommandEditor_Label=Command CommandEditor_Description=Command bla bla bla @@ -65,6 +66,7 @@ CommandEditor_ParameterOptional_Yes=yes CommandEditor_ParameterOptional_No=no CommandEditor_ParameterId=Id CommandEditor_Category=Category +CommandEditor_AddCommandParameter=Add Command Parameter DirectMenuItemEditor_Label=DirectMenuItem DirectMenuItemEditor_Description=DirectMenuItem bla bla bla @@ -107,6 +109,7 @@ KeyBindingEditor_Command=Command KeyBindingEditor_Parameters=Parameters KeyBindingEditor_SequenceNotComplete=Keysequence is not complete KeyBindingEditor_SequenceEmpty=Keysequence must not be empty! +KeyBindingEditor_AddParameter=Add Parameter MenuEditor_Label=Menu MenuEditor_Description=Menu bla bla bla @@ -174,12 +177,21 @@ PartSashContainerEditor_Horizontal=Horizontal PartSashContainerEditor_SelectedElement=Selected Element PartSashContainerEditor_Controls=Controls PartSashContainerEditor_ContainerData=Container Data +PartSashContainerEditor_AddPartSashContainer=Add PartSashContainer +PartSashContainerEditor_AddPartStack=Add PartStack +PartSashContainerEditor_AddPart=Add Part +PartSashContainerEditor_AddInputPart=Add Input Part +PartSashContainerEditor_AddArea=Add Area +PartSashContainerEditor_AddPlaceholder=Add Placeholder PartStackEditor_Label=Part Stack PartStackEditor_Description=Stack bla bla bla PartStackEditor_SelectedElement=Selected Element PartStackEditor_Parts=Parts PartStackEditor_ContainerData=Container Data +PartStackEditor_AddPart=Add Part +PartStackEditor_AddInputPart=Add Input Part +PartStackEditor_AddPlaceholder=Add Placeholder PerspectiveEditor_Label=Perspective PerspectiveEditor_Description=Perspective Bla Bla Bla @@ -189,11 +201,19 @@ PerspectiveEditor_Label=Label PerspectiveEditor_Tooltip=Tooltip PerspectiveEditor_IconURI=Icon URI PerspectiveEditor_Controls=Controls +PerspectiveEditor_AddPartSashContainer=Add PartSashContainer +PerspectiveEditor_AddPartStack=Add PartStack +PerspectiveEditor_AddPart=Add Part +PerspectiveEditor_AddInputPart=Add InputPart +PerspectiveEditor_AddArea=Add Area +PerspectiveEditor_AddPlaceholder=Add Placeholder + PerspectiveStackEditor_Label=Perspective Stack PerspectiveStackEditor_Description=Perspective Stack Bla Bla Bla PerspectiveStackEditor_SelectedElement=Selected Element PerspectiveStackEditor_Perspectives=Perspectives +PerspectiveStackEditor_AddPerspective=Add Perspective PlaceholderEditor_Label=Placeholder PlaceholderEditor_Descriptor=Placeholder Bla Bla Bla Bla @@ -208,6 +228,10 @@ ToolBarEditor_HandledToolItem=Handled ToolItem ToolBarEditor_DirectToolItem=Direct ToolItem ToolBarEditor_ToolControl=Tool Control ToolBarEditor_Separator=Separator +ToolBarEditor_AddHandledToolItem=Add Handled ToolItem +ToolBarEditor_AddDirectToolItem=Add Direct ToolItem +ToolBarEditor_AddToolControl=Add Toolcontrol +ToolBarEditor_AddToolBarSeparator=Add Sepatator ToolBarSeparatorEditor_Label=Separator @@ -279,6 +303,7 @@ BindingContextEditor_TreeLabelDescription=Binding Context Bla Bla Bla BindingContextEditor_Name=Name BindingContextEditor_Description=Description BindingContextEditor_Subcontexts=Subcontexts +BindingContextEditor_AddContext=Add Binding Context CommandParameterEditor_TreeLabel=Command Parameter CommandParameterEditor_TreeLabelDescritpion=Command Parameter Bla Bla Bla @@ -316,6 +341,9 @@ TrimBarEditor_TreeLabel=Window Trim TrimBarEditor_TreeLabelDescription=Window Trim bla bla bla TrimBarEditor_Side=Side TrimBarEditor_Controls=Controls +TrimBarEditor_AddToolBar=Add Toolbar +TrimBarEditor_AddToolControl=Add Toolcontrol + TrimContributionEditor_TreeLabel=Trim Contribution TrimContributionEditor_TreeLabelDescription=Trim Contribution Bla Bla Bla Bla diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java index 5619fded8a..a792889f48 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java @@ -12,6 +12,7 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -36,6 +37,7 @@ import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -62,8 +64,21 @@ public class BindingContextEditor extends AbstractComponentEditor { private EStackLayout stackLayout; private IListProperty BINDING_CONTEXT__CHILDREN = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN); + private List actions = new ArrayList(); + public BindingContextEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + actions.add(new Action(Messages.BindingContextEditor_AddContext, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingContext.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddContext(); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -241,16 +256,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MBindingContext eObject = MCommandsFactory.INSTANCE.createBindingContext(); - setElementId(eObject); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - - } + handleAddContext(); } }); @@ -279,4 +285,23 @@ public IObservableList getChildList(Object element) { return BINDING_CONTEXT__CHILDREN.observe(element); } + protected void handleAddContext() { + MBindingContext eObject = MCommandsFactory.INSTANCE.createBindingContext(); + setElementId(eObject); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(eObject); + + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index 2e28f5e6c3..324098119c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -12,6 +12,7 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; @@ -40,6 +41,7 @@ import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -67,9 +69,21 @@ public class BindingTableEditor extends AbstractComponentEditor { private IListProperty BINDING_TABLE__BINDINGS = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS); private EStackLayout stackLayout; + private List actions = new ArrayList(); public BindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + actions.add(new Action(Messages.BindingTableEditor_AddKeyBinding, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.png"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddKeyBinding(); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -272,14 +286,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MKeyBinding handler = MCommandsFactory.INSTANCE.createKeyBinding(); - System.err.println(getMaster().getValue()); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS, handler); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } + handleAddKeyBinding(); } }); @@ -323,4 +330,21 @@ public String getDetailLabel(Object element) { public FeaturePath[] getLabelProperties() { return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID) }; } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } + + protected void handleAddKeyBinding() { + MKeyBinding handler = MCommandsFactory.INSTANCE.createKeyBinding(); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(handler); + } + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index d02ecb8f42..77fcd742cd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -12,6 +12,7 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; @@ -37,6 +38,7 @@ import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -62,11 +64,23 @@ public class CommandEditor extends AbstractComponentEditor { private Image image; private EMFDataBindingContext context; private EStackLayout stackLayout; + private List actions = new ArrayList(); private IEMFEditListProperty COMMAND__PARAMETERS = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__PARAMETERS); public CommandEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + actions.add(new Action(Messages.CommandEditor_AddCommandParameter, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CommandParameter.png"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddCommandParameter(); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -296,15 +310,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MCommandParameter param = MCommandsFactory.INSTANCE.createCommandParameter(); - setElementId(param); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.COMMAND__PARAMETERS, param); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(param); - } + handleAddCommandParameter(); } }); @@ -351,4 +357,22 @@ public FeaturePath[] getLabelProperties() { return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME) }; } + protected void handleAddCommandParameter() { + MCommandParameter param = MCommandsFactory.INSTANCE.createCommandParameter(); + setElementId(param); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.COMMAND__PARAMETERS, param); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(param); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 10908af671..df1f3ba0ce 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -12,6 +12,8 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; +import java.util.List; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -44,6 +46,7 @@ import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.bindings.keys.KeySequence; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -71,12 +74,24 @@ public class KeyBindingEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IModelResource resource; private EStackLayout stackLayout; + private List actions = new ArrayList(); private IEMFEditListProperty KEY_BINDING__PARAMETERS = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS); public KeyBindingEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource) { super(editingDomain, editor); this.resource = resource; + try { + actions.add(new Action(Messages.KeyBindingEditor_AddParameter, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.png"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddParameter(); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -289,14 +304,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MKeyBinding item = (MKeyBinding) getMaster().getValue(); - MParameter param = MCommandsFactory.INSTANCE.createParameter(); - setElementId(param); - - Command cmd = AddCommand.create(getEditingDomain(), item, CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS, param); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } + handleAddParameter(); } }); @@ -365,4 +373,22 @@ public IStatus validate(Object value) { return new Status(statusCode, "org.eclipse.e4.tools.emf.ui", Messages.KeyBindingEditor_SequenceEmpty); //$NON-NLS-1$ } } + + protected void handleAddParameter() { + MKeyBinding item = (MKeyBinding) getMaster().getValue(); + MParameter param = MCommandsFactory.INSTANCE.createParameter(); + setElementId(param); + + Command cmd = AddCommand.create(getEditingDomain(), item, CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS, param); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 9835cbce4c..d3ecac257f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -12,6 +12,7 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -41,6 +42,7 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; @@ -72,9 +74,52 @@ public class PartSashContainerEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; + private List actions = new ArrayList(); public PartSashContainerEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + actions.add(new Action(Messages.PartSashContainerEditor_AddPartSashContainer, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.PART_SASH_CONTAINER); + } + }); + actions.add(new Action(Messages.PartSashContainerEditor_AddPartStack, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.PART_STACK); + } + }); + actions.add(new Action(Messages.PartSashContainerEditor_AddPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.PART); + } + }); + actions.add(new Action(Messages.PartSashContainerEditor_AddInputPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.INPUT_PART); + } + }); + actions.add(new Action(Messages.PartSashContainerEditor_AddArea, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(AdvancedPackageImpl.Literals.AREA); + } + }); + actions.add(new Action(Messages.PartSashContainerEditor_AddPlaceholder, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Placeholder.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER); + } + }); + + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -327,15 +372,7 @@ public String getText(Object element) { public void widgetSelected(SelectionEvent e) { if (!childrenDropDown.getSelection().isEmpty()) { EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - EObject eObject = EcoreUtil.create(eClass); - setElementId(eObject); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } + handleAddChild(eClass); } } }); @@ -381,4 +418,23 @@ public String getDetailLabel(Object element) { public FeaturePath[] getLabelProperties() { return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } + + protected void handleAddChild(EClass eClass) { + EObject eObject = EcoreUtil.create(eClass); + setElementId(eObject); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(eObject); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 1f998a1d57..0061885ba1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -12,6 +12,7 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -40,6 +41,7 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -72,9 +74,33 @@ public class PartStackEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private StackLayout stackLayout; private Image tbrImage; + private List actions = new ArrayList(); public PartStackEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + actions.add(new Action(Messages.PartStackEditor_AddPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.PART); + } + }); + actions.add(new Action(Messages.PartStackEditor_AddInputPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.INPUT_PART); + } + }); + actions.add(new Action(Messages.PartStackEditor_AddPlaceholder, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Placeholder.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -289,15 +315,7 @@ public String getText(Object element) { @Override public void widgetSelected(SelectionEvent e) { EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - EObject eObject = EcoreUtil.create(eClass); - setElementId(eObject); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } + handleAddChild(eClass); } }); @@ -342,4 +360,23 @@ public String getDetailLabel(Object element) { public FeaturePath[] getLabelProperties() { return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } + + protected void handleAddChild(EClass eClass) { + EObject eObject = EcoreUtil.create(eClass); + setElementId(eObject); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(eObject); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 4543a3b154..2ee16ccea9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -12,6 +12,7 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -46,6 +47,7 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -75,10 +77,53 @@ public class PerspectiveEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; + private List actions = new ArrayList(); public PerspectiveEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { super(editingDomain, editor); this.project = project; + try { + actions.add(new Action(Messages.PerspectiveEditor_AddPartSashContainer, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.PART_SASH_CONTAINER); + } + }); + actions.add(new Action(Messages.PerspectiveEditor_AddPartStack, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.PART_STACK); + } + }); + actions.add(new Action(Messages.PerspectiveEditor_AddPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.PART); + } + }); + actions.add(new Action(Messages.PerspectiveEditor_AddInputPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.INPUT_PART); + } + }); + actions.add(new Action(Messages.PerspectiveEditor_AddArea, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(AdvancedPackageImpl.Literals.AREA); + } + }); + actions.add(new Action(Messages.PerspectiveEditor_AddPlaceholder, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Placeholder.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER); + } + }); + + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -340,7 +385,7 @@ public String getText(Object element) { return eclass.getName(); } }); - childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, AdvancedPackageImpl.Literals.PLACEHOLDER }); + childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, AdvancedPackageImpl.Literals.AREA, AdvancedPackageImpl.Literals.PLACEHOLDER }); childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); @@ -351,15 +396,7 @@ public String getText(Object element) { public void widgetSelected(SelectionEvent e) { if (!childrenDropDown.getSelection().isEmpty()) { EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - EObject eObject = EcoreUtil.create(eClass); - setElementId(eObject); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } + handleAddChild(eClass); } } }); @@ -397,4 +434,23 @@ public void widgetSelected(SelectionEvent e) { public IObservableList getChildList(Object element) { return ELEMENT_CONTAINER__CHILDREN.observe(element); } + + protected void handleAddChild(EClass eClass) { + EObject eObject = EcoreUtil.create(eClass); + setElementId(eObject); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(eObject); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 1d35f67951..792cd25fbb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -12,6 +12,7 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -38,6 +39,7 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -63,9 +65,22 @@ public class PerspectiveStackEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; + private List actions = new ArrayList(); public PerspectiveStackEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + + actions.add(new Action(Messages.PerspectiveStackEditor_AddPerspective, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Perspective.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddPerspective(); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -254,15 +269,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MPerspective eObject = MAdvancedFactory.INSTANCE.createPerspective(); - setElementId(eObject); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } + handleAddPerspective(); } }); @@ -302,4 +309,23 @@ public IObservableList getChildList(Object element) { public FeaturePath[] getLabelProperties() { return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } + + protected void handleAddPerspective() { + MPerspective eObject = MAdvancedFactory.INSTANCE.createPerspective(); + setElementId(eObject); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(eObject); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index b72494d501..07e16f5cd5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -12,6 +12,7 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -40,6 +41,7 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -69,6 +71,7 @@ public class ToolBarEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; + private List actions = new ArrayList(); private static class Struct { private final String label; @@ -84,6 +87,35 @@ public Struct(String label, EClass eClass, boolean separator) { public ToolBarEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); + try { + actions.add(new Action(Messages.ToolBarEditor_AddHandledToolItem, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledToolItem.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, false); + } + }); + actions.add(new Action(Messages.ToolBarEditor_AddDirectToolItem, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, false); + } + }); + actions.add(new Action(Messages.ToolBarEditor_AddToolControl, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(MenuPackageImpl.Literals.TOOL_CONTROL, false); + } + }); + actions.add(new Action(Messages.ToolBarEditor_AddToolBarSeparator, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, true); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -284,17 +316,7 @@ public void widgetSelected(SelectionEvent e) { if (!childrenDropDown.getSelection().isEmpty()) { Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); EClass eClass = struct.eClass; - MToolBarElement eObject = (MToolBarElement) EcoreUtil.create(eClass); - setElementId(eObject); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - if (!struct.separator) { - getEditor().setSelection(eObject); - } - } + handleAddChild(eClass, struct.separator); } } }); @@ -337,4 +359,25 @@ public String getDetailLabel(Object element) { public FeaturePath[] getLabelProperties() { return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } + + protected void handleAddChild(EClass eClass, boolean separator) { + MToolBarElement eObject = (MToolBarElement) EcoreUtil.create(eClass); + setElementId(eObject); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + if (!separator) { + getEditor().setSelection(eObject); + } + } + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index 8ad1916d4d..5622e4cc83 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -12,6 +12,7 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; @@ -42,6 +43,7 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -73,10 +75,28 @@ public class TrimBarEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; + private List actions = new ArrayList(); public TrimBarEditor(EditingDomain editingDomain, ModelEditor editor) { super(editingDomain, editor); this.editor = editor; + try { + actions.add(new Action(Messages.TrimBarEditor_AddToolBar, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Toolbar.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(MenuPackageImpl.Literals.TOOL_BAR); + } + }); + actions.add(new Action(Messages.TrimBarEditor_AddToolControl, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAddChild(MenuPackageImpl.Literals.TOOL_CONTROL); + } + }); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -284,15 +304,8 @@ public String getText(Object element) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - EObject toolbar = EcoreUtil.create((EClass) ((IStructuredSelection) typeViewer.getSelection()).getFirstElement()); - setElementId(toolbar); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(toolbar); - } + EClass eClass = (EClass) ((IStructuredSelection) typeViewer.getSelection()).getFirstElement(); + handleAddChild(eClass); } }); @@ -344,4 +357,22 @@ public FeaturePath[] getLabelProperties() { return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TRIM_CONTAINER__SIDE), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } + protected void handleAddChild(EClass eClass) { + EObject toolbar = EcoreUtil.create(eClass); + setElementId(toolbar); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + editor.setSelection(toolbar); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } From 0b0c937bcdd675daa7d727776de57d752e9b1d6a Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 30 Dec 2010 23:40:57 +0000 Subject: [PATCH 0284/1286] Bug 321159 - [ModelTooling] Remove the children attributes in the Menus --- .../e4/tools/emf/ui/internal/Messages.java | 12 +- .../tools/emf/ui/internal/Messages.properties | 13 +- .../emf/ui/internal/common/ModelEditor.java | 16 +- .../internal/common/component/MenuEditor.java | 221 ++++++++++++- .../virtual/VMenuElementsEditor.java | 293 ------------------ 5 files changed, 236 insertions(+), 319 deletions(-) delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index be5bae1c54..ee83fd605c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -130,6 +130,10 @@ public class Messages extends NLS { public static String MenuEditor_IconURI; public static String MenuEditor_Children; public static String MenuEditor_Mnemonics; + public static String MenuEditor_AddHandledMenuItem; + public static String MenuEditor_AddMenu; + public static String MenuEditor_AddDirectMenuItem; + public static String MenuEditor_AddSeparator; public static String MenuItemEditor_Type; public static String MenuItemEditor_Label; @@ -549,14 +553,6 @@ public class Messages extends NLS { public static String CoreExpressionEditor_TreeLabelDescription; public static String CoreExpressionEditor_ExpressionId; - public static String VMenuElementsEditor_TreeLabel; - public static String VMenuElementsEditor_TreeLabelDescription; - public static String VMenuElementsEditor_Children; - public static String VMenuElementsEditor_AddHandledMenuItem; - public static String VMenuElementsEditor_AddMenu; - public static String VMenuElementsEditor_AddDirectMenuItem; - public static String VMenuElementsEditor_AddSeparator; - public static String ExpressionIdDialog_ShellTitle; public static String ExpressionIdDialog_DialogTitle; public static String ExpressionIdDialog_DialogMessage; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 690ea2d3fc..163b7d2c33 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -126,6 +126,11 @@ MenuEditor_IconURI=Icon URI MenuEditor_MainMenu=Main Menu MenuEditor_Children=Children MenuEditor_Mnemonics=Mnemonics +MenuEditor_AddHandledMenuItem=Add HandledMenuItem +MenuEditor_AddMenu=Add Menu +MenuEditor_AddDirectMenuItem=Add DirectMenuItem +MenuEditor_AddSeparator=Add Separator + MenuItemEditor_Type=Type MenuItemEditor_Label=Label @@ -546,14 +551,6 @@ CoreExpressionEditor_TreeLabel=Core Expression CoreExpressionEditor_TreeLabelDescription=Core Expression Bla Bla Bla CoreExpressionEditor_ExpressionId=Expression Id -VMenuElementsEditor_TreeLabel=Children -VMenuElementsEditor_TreeLabelDescription=Children Bla Bla Bla -VMenuElementsEditor_Children=Children -VMenuElementsEditor_AddHandledMenuItem=Add Handled Menu Item -VMenuElementsEditor_AddMenu=Add Menu -VMenuElementsEditor_AddDirectMenuItem=Add Direct Menu Item -VMenuElementsEditor_AddSeparator=Add Separator - ExpressionIdDialog_ShellTitle=Find Expression Id ExpressionIdDialog_DialogTitle=Find Expression Id ExpressionIdDialog_DialogMessage=Find the expression id defined through the 'org.eclipse.core.expressions.definitions' extension point diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 5c6e4c7955..06a142326b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -101,7 +101,6 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VItemParametersEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuContributionsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuElementsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelFragmentsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelImportsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptor; @@ -141,6 +140,7 @@ import org.eclipse.emf.edit.command.CommandParameter; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IMenuListener; @@ -384,9 +384,16 @@ public void menuAboutToShow(IMenuManager manager) { if (o.eContainer() != null) { actions.add(new Action(Messages.ModelEditor_Delete, ImageDescriptor.createFromImage(removeIcon)) { public void run() { - Command cmd = RemoveCommand.create(ModelEditor.this.modelProvider.getEditingDomain(), o.eContainer(), o.eContainingFeature(), o); - if (cmd.canExecute()) { - ModelEditor.this.modelProvider.getEditingDomain().getCommandStack().execute(cmd); + if (o.eContainingFeature().isMany()) { + Command cmd = RemoveCommand.create(ModelEditor.this.modelProvider.getEditingDomain(), o.eContainer(), o.eContainingFeature(), o); + if (cmd.canExecute()) { + ModelEditor.this.modelProvider.getEditingDomain().getCommandStack().execute(cmd); + } + } else { + Command cmd = SetCommand.create(ModelEditor.this.modelProvider.getEditingDomain(), o.eContainer(), o.eContainingFeature(), null); + if (cmd.canExecute()) { + ModelEditor.this.modelProvider.getEditingDomain().getCommandStack().execute(cmd); + } } } }); @@ -601,7 +608,6 @@ private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_MODEL_IMPORTS, new VModelImportsEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_CATEGORIES, new VApplicationCategoriesEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_PARAMETERS, new VItemParametersEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_MENUELEMENTS, new VMenuElementsEditor(modelProvider.getEditingDomain(), this)); registerVirtualEditor(VIRTUAL_ROOT_CONTEXTS, new VRootBindingContexts(modelProvider.getEditingDomain(), this)); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 0cc20dd488..2891bf9438 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -15,7 +15,10 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.UpdateValueStrategy; +import org.eclipse.core.databinding.observable.list.IListChangeListener; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.ListChangeEvent; +import org.eclipse.core.databinding.observable.list.ListDiffVisitor; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; @@ -27,12 +30,13 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor.EClass2EObject; import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor.EObject2EClass; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; @@ -40,21 +44,31 @@ import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; +import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.databinding.viewers.ViewerProperties; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -77,10 +91,53 @@ public class MenuEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); private EStackLayout stackLayout; + private List actions = new ArrayList(); + + private static class Struct { + private final String label; + private final EClass eClass; + private final boolean separator; + + public Struct(String label, EClass eClass, boolean separator) { + this.label = label; + this.eClass = eClass; + this.separator = separator; + } + } public MenuEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { super(editingDomain, editor); this.project = project; + try { + actions.add(new Action(Messages.MenuEditor_AddHandledMenuItem, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false); + } + }); + actions.add(new Action(Messages.MenuEditor_AddMenu, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(MenuPackageImpl.Literals.MENU, false); + } + }); + actions.add(new Action(Messages.MenuEditor_AddDirectMenuItem, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false); + } + }); + actions.add(new Action(Messages.MenuEditor_AddSeparator, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuSeparator.gif"))) { //$NON-NLS-1$ + @Override + public void run() { + handleAdd(MenuPackageImpl.Literals.MENU_SEPARATOR, true); + } + }); + + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Override @@ -203,6 +260,127 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_ELEMENT__MNEMONICS).observeDetail(master)); } + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.MenuEditor_Children); + l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); + + final TableViewer viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.heightHint = 300; + viewer.getControl().setLayoutData(gd); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + + IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + viewer.setInput(prop.observeDetail(master)); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Up); + b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if (idx >= 0) { + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Down); + b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if (idx < container.getChildren().size()) { + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + Struct struct = (Struct) element; + return struct.label; + } + }); + + Struct defaultStruct = new Struct(Messages.MenuEditor_HandledMenuItem, MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false); + childrenDropDown.setInput(new Struct[] { new Struct(Messages.MenuEditor_Separator, MenuPackageImpl.Literals.MENU_SEPARATOR, true), new Struct(Messages.MenuEditor_Menu, MenuPackageImpl.Literals.MENU, false), defaultStruct, new Struct(Messages.MenuEditor_DirectMenuItem, MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false) }); + childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!childrenDropDown.getSelection().isEmpty()) { + Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); + EClass eClass = struct.eClass; + handleAdd(eClass, struct.separator); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Remove); + b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + // ------------------------------------------------------------ if (!rootMenu) { Label l = new Label(parent, SWT.NONE); @@ -308,12 +486,25 @@ public void handleValueChange(ValueChangeEvent event) { } }); - list.add(new VirtualEntry(ModelEditor.VIRTUAL_MENUELEMENTS, ELEMENT_CONTAINER__CHILDREN, element, Messages.MenuEditor_Children) { - @Override - protected boolean accepted(MMenuElement o) { - return true; + IObservableList l = ELEMENT_CONTAINER__CHILDREN.observe(element); + l.addListChangeListener(new IListChangeListener() { + + public void handleListChange(ListChangeEvent event) { + event.diff.accept(new ListDiffVisitor() { + + @Override + public void handleRemove(int index, Object element) { + list.remove(element); + } + + @Override + public void handleAdd(int index, Object element) { + list.add(element); + } + }); } }); + list.addAll(l); return list; } @@ -344,4 +535,24 @@ public String getDetailLabel(Object element) { public FeaturePath[] getLabelProperties() { return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } + + protected void handleAdd(EClass eClass, boolean separator) { + MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + if (!separator) { + getEditor().setSelection(eObject); + } + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java deleted file mode 100644 index 1610a95c7f..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java +++ /dev/null @@ -1,293 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class VMenuElementsEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - private List actions = new ArrayList(); - - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - - public VMenuElementsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.VMenuElementsEditor_AddHandledMenuItem, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false); - } - }); - actions.add(new Action(Messages.VMenuElementsEditor_AddMenu, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.MENU, false); - } - }); - actions.add(new Action(Messages.VMenuElementsEditor_AddDirectMenuItem, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false); - } - }); - actions.add(new Action(Messages.VMenuElementsEditor_AddSeparator, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuSeparator.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.MENU_SEPARATOR, true); - } - }); - - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VMenuElementsEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VMenuElementsEditor_TreeLabelDescription; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - VirtualEntry o = (VirtualEntry) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); - - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VMenuElementsEditor_Children); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer container = (MElementContainer) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; - if (idx >= 0) { - if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer container = (MElementContainer) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if (idx < container.getChildren().size()) { - if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - Struct struct = (Struct) element; - return struct.label; - } - }); - - Struct defaultStruct = new Struct(Messages.MenuEditor_HandledMenuItem, MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false); - childrenDropDown.setInput(new Struct[] { new Struct(Messages.MenuEditor_Separator, MenuPackageImpl.Literals.MENU_SEPARATOR, true), new Struct(Messages.MenuEditor_Menu, MenuPackageImpl.Literals.MENU, false), defaultStruct, new Struct(Messages.MenuEditor_DirectMenuItem, MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false) }); - childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!childrenDropDown.getSelection().isEmpty()) { - Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - EClass eClass = struct.eClass; - handleAdd(eClass, struct.separator); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - - private static class Struct { - private final String label; - private final EClass eClass; - private final boolean separator; - - public Struct(String label, EClass eClass, boolean separator) { - this.label = label; - this.eClass = eClass; - this.separator = separator; - } - } - - @Override - public List getActions(Object element) { - ArrayList l = new ArrayList(super.getActions(element)); - l.addAll(actions); - return l; - } - - protected void handleAdd(EClass eClass, boolean separator) { - MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - if (!separator) { - getEditor().setSelection(eObject); - } - } - } -} From e21857e07bc4ef7f6b6bffc7d9b3f6a529d81d24 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 30 Dec 2010 23:55:47 +0000 Subject: [PATCH 0285/1286] Bug 321159 - [ModelTooling] Remove the children attributes in the Menus --- .../emf/ui/internal/common/component/MenuEditor.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 2891bf9438..441de33382 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -37,6 +37,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MExpression; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; @@ -497,6 +498,15 @@ public void handleRemove(int index, Object element) { list.remove(element); } + @Override + public void handleMove(int oldIndex, int newIndex, Object element) { + if (list.get(0) instanceof MExpression) { + oldIndex += 1; + newIndex += 1; + } + list.move(oldIndex, newIndex); + } + @Override public void handleAdd(int index, Object element) { list.add(element); From 577720d2c82f48f3c292bd04ef8c92e23d2d557b Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 8 Jan 2011 13:10:36 +0000 Subject: [PATCH 0286/1286] Bug 321132 - [ModelTooling] AbstractComponentEditor needs to dispose its images on bundle shutdown --- .../META-INF/MANIFEST.MF | 2 +- .../OSGI-INF/images.properties | 89 ++++ .../OSGI-INF/resourceprovider.xml | 8 + .../build.properties | 3 +- .../component/AbstractComponentEditor.java | 64 +-- .../emf/ui/internal/ResourceProvider.java | 106 +++++ .../emf/ui/internal/common/ModelEditor.java | 142 +++---- .../common/component/AddonsEditor.java | 22 +- .../common/component/ApplicationEditor.java | 31 +- .../internal/common/component/AreaEditor.java | 46 +-- .../component/BindingContextEditor.java | 45 +- .../common/component/BindingTableEditor.java | 47 +-- .../common/component/CategoryEditor.java | 20 +- .../common/component/CommandEditor.java | 47 +-- .../component/CommandParameterEditor.java | 20 +- .../common/component/ControlFactory.java | 15 +- .../component/CoreExpressionEditor.java | 20 +- .../component/DirectMenuItemEditor.java | 24 +- .../component/DirectToolItemEditor.java | 24 +- .../component/HandledMenuItemEditor.java | 24 +- .../component/HandledToolItemEditor.java | 24 +- .../common/component/HandlerEditor.java | 23 +- .../common/component/InputPartEditor.java | 5 +- .../common/component/KeyBindingEditor.java | 47 +-- .../component/MenuContributionEditor.java | 38 +- .../internal/common/component/MenuEditor.java | 86 ++-- .../common/component/MenuItemEditor.java | 32 +- .../common/component/MenuSeparatorEditor.java | 20 +- .../component/ModelFragmentsEditor.java | 35 +- .../common/component/ParameterEditor.java | 20 +- .../component/PartDescriptorEditor.java | 24 +- .../internal/common/component/PartEditor.java | 34 +- .../component/PartSashContainerEditor.java | 122 +++--- .../common/component/PartStackEditor.java | 79 ++-- .../common/component/PerspectiveEditor.java | 108 +++-- .../component/PerspectiveStackEditor.java | 48 +-- .../common/component/PlaceholderEditor.java | 22 +- .../common/component/PopupMenuEditor.java | 5 +- .../common/component/RenderedMenuEditor.java | 5 +- .../common/component/RenderedMenuItem.java | 5 +- .../component/RenderedToolBarEditor.java | 5 +- .../common/component/StringModelFragment.java | 32 +- .../component/ToolBarContributionEditor.java | 30 +- .../common/component/ToolBarEditor.java | 83 ++-- .../component/ToolBarSeparatorEditor.java | 22 +- .../common/component/ToolControlEditor.java | 24 +- .../common/component/ToolItemEditor.java | 8 +- .../common/component/TrimBarEditor.java | 59 +-- .../component/TrimContributionEditor.java | 30 +- .../common/component/TrimmedWindowEditor.java | 5 +- .../common/component/WindowEditor.java | 24 +- .../component/virtual/VApplicationAddons.java | 33 +- .../virtual/VApplicationCategoriesEditor.java | 33 +- .../virtual/VBindingTableEditor.java | 33 +- .../component/virtual/VCommandEditor.java | 33 +- .../component/virtual/VHandlerEditor.java | 33 +- .../virtual/VItemParametersEditor.java | 33 +- .../virtual/VMenuContributionsEditor.java | 33 +- .../common/component/virtual/VMenuEditor.java | 33 +- .../virtual/VModelFragmentsEditor.java | 14 +- .../virtual/VModelImportsEditor.java | 14 +- .../component/virtual/VPartDescriptor.java | 33 +- .../virtual/VRootBindingContexts.java | 33 +- .../virtual/VToolBarContributionsEditor.java | 33 +- .../virtual/VWindowControlEditor.java | 104 +++-- .../component/virtual/VWindowEditor.java | 45 +- .../virtual/VWindowSharedElementsEditor.java | 62 ++- .../component/virtual/VWindowTrimEditor.java | 30 +- .../org.eclipse.e4.tools.services/.project | 5 + .../META-INF/MANIFEST.MF | 9 + .../OSGI-INF/resourcepoolfunction.xml | 8 + .../OSGI-INF/resourceservice.xml | 7 + .../build.properties | 6 +- .../AbstractBundleResourceProvider.java | 47 +++ .../e4/tools/services/IResourcePool.java | 17 + .../services/IResourceProviderService.java | 10 + .../e4/tools/services/IResourceService.java | 35 ++ .../services/impl/ResourcePoolFactory.java | 26 ++ .../tools/services/impl/ResourceService.java | 389 ++++++++++++++++++ 79 files changed, 1632 insertions(+), 1462 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/images.properties create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resourceprovider.xml create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java create mode 100644 bundles/org.eclipse.e4.tools.services/OSGI-INF/resourcepoolfunction.xml create mode 100644 bundles/org.eclipse.e4.tools.services/OSGI-INF/resourceservice.xml create mode 100644 bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/AbstractBundleResourceProvider.java create mode 100644 bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourcePool.java create mode 100644 bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceProviderService.java create mode 100644 bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceService.java create mode 100644 bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourcePoolFactory.java create mode 100644 bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index ca0ea06334..252f2ad402 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -40,4 +40,4 @@ Export-Package: org.eclipse.e4.tools.emf.ui.common, org.eclipse.e4.tools.emf.ui.internal.common.component;x-internal:=true, org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;x-internal:=true, org.eclipse.e4.tools.emf.ui.internal.wbm;x-friends:="org.eclipse.e4.tools.emf.editor" -Service-Component: OSGI-INF/contributioncollector.xml +Service-Component: OSGI-INF/contributioncollector.xml, OSGI-INF/resourceprovider.xml diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/images.properties b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/images.properties new file mode 100644 index 0000000000..f38970e7fb --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/images.properties @@ -0,0 +1,89 @@ +IMG_org.eclipse.e4.tools.emf.ui.modelelements.Addons=/icons/full/modelelements/Addons.png +IMG_org.eclipse.e4.tools.emf.ui.modelelements.Application=/icons/full/modelelements/Application.png +IMG_org.eclipse.e4.tools.emf.ui.modelelements.Area_vertical=/icons/full/modelelements/Area_vertical.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.Area=/icons/full/modelelements/Area.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.BindingContext=/icons/full/modelelements/BindingContext.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.BindingTable=/icons/full/modelelements/BindingTable.png +IMG_org.eclipse.e4.tools.emf.ui.modelelements.Category=/icons/full/modelelements/Category.png +IMG_org.eclipse.e4.tools.emf.ui.modelelements.Command=/icons/full/modelelements/Command.png +IMG_org.eclipse.e4.tools.emf.ui.modelelements.CommandParameter=/icons/full/modelelements/CommandParameter.png +IMG_org.eclipse.e4.tools.emf.ui.modelelements.CoreExpression=/icons/full/modelelements/CoreExpression.png +IMG_org.eclipse.e4.tools.emf.ui.modelelements.DirectMenuItem=/icons/full/modelelements/DirectMenuItem.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.DirectToolItem=/icons/full/modelelements/DirectToolItem.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.HandledMenuItem=/icons/full/modelelements/HandledMenuItem.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.HandledToolItem=/icons/full/modelelements/HandledToolItem.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.Handler=/icons/full/modelelements/Handler.png +IMG_org.eclipse.e4.tools.emf.ui.modelelements.KeyBinding=/icons/full/modelelements/KeyBinding.png +IMG_org.eclipse.e4.tools.emf.ui.modelelements.Menu=/icons/full/modelelements/Menu.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.MenuContribution=/icons/full/modelelements/MenuContribution.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.MenuItem=/icons/full/modelelements/MenuItem.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.MenuSeparator=/icons/full/modelelements/MenuSeparator.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.ModelFragments=/icons/full/modelelements/ModelFragments.png +IMG_org.eclipse.e4.tools.emf.ui.modelelements.Parameter=/icons/full/modelelements/Parameter.png +IMG_org.eclipse.e4.tools.emf.ui.modelelements.Part=/icons/full/modelelements/Part.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.PartDescriptor=/icons/full/modelelements/PartDescriptor.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.PartSashContainer_vertical=/icons/full/modelelements/PartSashContainer_vertical.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.PartSashContainer=/icons/full/modelelements/PartSashContainer.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.PartStack=/icons/full/modelelements/PartStack.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.Perspective=/icons/full/modelelements/Perspective.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.PerspectiveStack=/icons/full/modelelements/PerspectiveStack.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.Placeholder=/icons/full/modelelements/Placeholder.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.StringModelFragment=/icons/full/modelelements/StringModelFragment.png +IMG_org.eclipse.e4.tools.emf.ui.modelelements.ToolBar=/icons/full/modelelements/ToolBar.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.ToolBarContribution=/icons/full/modelelements/ToolBarContribution.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.ToolBarSeparator=/icons/full/modelelements/ToolBarSeparator.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.ToolControl=/icons/full/modelelements/ToolControl.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.TrimContribution=/icons/full/modelelements/TrimContribution.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.Window=/icons/full/modelelements/Window.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.WindowTrim=/icons/full/modelelements/WindowTrim.gif + +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Addons=/icons/full/modelelements/tbr/Addons.png +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Application=/icons/full/modelelements/tbr/Application.png +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Area_vertical=/icons/full/modelelements/tbr/Area_vertical.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Area=/icons/full/modelelements/tbr/Area.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.BindingContext=/icons/full/modelelements/tbr/BindingContext.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.BindingTable=/icons/full/modelelements/tbr/BindingTable.png +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.CommandParameter=/icons/full/modelelements/tbr/CommandParameter.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.DirectMenuItem=/icons/full/modelelements/tbr/DirectMenuItem.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.DirectToolItem=/icons/full/modelelements/tbr/DirectToolItem.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.HandledMenuItem=/icons/full/modelelements/tbr/HandledMenuItem.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.HandledToolItem=/icons/full/modelelements/tbr/HandledToolItem.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Menu=/icons/full/modelelements/tbr/Menu.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.MenuContribution=/icons/full/modelelements/tbr/MenuContribution.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.MenuItem=/icons/full/modelelements/tbr/MenuItem.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.MenuSeparator=/icons/full/modelelements/tbr/MenuSeparator.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ModelFragments=/icons/full/modelelements/tbr/ModelFragments.png +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Parameter=/icons/full/modelelements/tbr/Parameter.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Part=/icons/full/modelelements/tbr/Part.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PartDescriptor=/icons/full/modelelements/tbr/PartDescriptor.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PartSashContainer_vertical=/icons/full/modelelements/tbr/PartSashContainer_vertical.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PartSashContainer=/icons/full/modelelements/tbr/PartSashContainer.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PartStack=/icons/full/modelelements/tbr/PartStack.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Perspective=/icons/full/modelelements/tbr/Perspective.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PerspectiveStack=/icons/full/modelelements/tbr/PerspectiveStack.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Placeholder=/icons/full/modelelements/tbr/Placeholder.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.StringModelFragment=/icons/full/modelelements/tbr/StringModelFragment.png +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ToolBar=/icons/full/modelelements/tbr/ToolBar.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ToolBarContribution=/icons/full/modelelements/tbr/ToolBarContribution.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ToolBarSeparator=/icons/full/modelelements/tbr/ToolBarSeparator.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ToolControl=/icons/full/modelelements/tbr/ToolControl.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.TrimContribution=/icons/full/modelelements/tbr/TrimContribution.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Window=/icons/full/modelelements/tbr/Window.gif +IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.WindowTrim=/icons/full/modelelements/tbr/WindowTrim.gif + +IMG_org.eclipse.e4.tools.emf.ui.obj16.arrow_down=/icons/full/obj16/arrow_down.png +IMG_org.eclipse.e4.tools.emf.ui.obj16.arrow_up=/icons/full/obj16/arrow_up.png +IMG_org.eclipse.e4.tools.emf.ui.obj16.class_obj=/icons/full/obj16/class_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.obj16.cross=/icons/full/obj16/cross.png +IMG_org.eclipse.e4.tools.emf.ui.obj16.EPackage=/icons/full/obj16/EPackage.gif +IMG_org.eclipse.e4.tools.emf.ui.obj16.field_public_obj=/icons/full/obj16/field_public_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.obj16.headermenu=/icons/full/obj16/headermenu.png +IMG_org.eclipse.e4.tools.emf.ui.obj16.table_add=/icons/full/obj16/table_add.png +IMG_org.eclipse.e4.tools.emf.ui.obj16.table_delete=/icons/full/obj16/table_delete.png +IMG_org.eclipse.e4.tools.emf.ui.obj16.zoom=/icons/full/obj16/zoom.png + +IMG_org.eclipse.e4.tools.emf.ui.wizban.fieldrefact_wiz=/icons/full/wizban/fieldrefact_wiz.png +IMG_org.eclipse.e4.tools.emf.ui.wizban.import_wiz=/icons/full/wizban/import_wiz.png +IMG_org.eclipse.e4.tools.emf.ui.wizban.newclass_wiz=/icons/full/wizban/newclass_wiz.png +IMG_org.eclipse.e4.tools.emf.ui.wizban.newexp_wiz=/icons/full/wizban/newexp_wiz.png +IMG_org.eclipse.e4.tools.emf.ui.wizban.typerefact_wiz=/icons/full/wizban/typerefact_wiz.png \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resourceprovider.xml b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resourceprovider.xml new file mode 100644 index 0000000000..fc93362838 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resourceprovider.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.ui/build.properties b/bundles/org.eclipse.e4.tools.emf.ui/build.properties index e0bc710666..b51da18453 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/build.properties @@ -5,7 +5,8 @@ bin.includes = .,\ about.html,\ plugin.xml,\ css/,\ - OSGI-INF/ + OSGI-INF/,\ + OSGI-INF/resourceprovider.xml output.. = bin/ jars.compile.order = . source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index 42670618b6..d1971b58cd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -10,23 +10,19 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.common.component; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; import java.util.Collections; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.runtime.FileLocator; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; @@ -34,17 +30,6 @@ public abstract class AbstractComponentEditor { private EditingDomain editingDomain; - private static ImageRegistry IMG_REG = new ImageRegistry(); - // private static Map IMAGE_MAP = new HashMap(); - - private static final String[] IMAGES = { "/icons/full/obj16/zoom.png", //$NON-NLS-1$ - "/icons/full/obj16/table_add.png", //$NON-NLS-1$ - "/icons/full/obj16/table_delete.png", //$NON-NLS-1$ - "/icons/full/obj16/arrow_up.png", //$NON-NLS-1$ - "/icons/full/obj16/arrow_down.png" //$NON-NLS-1$ - }; - private WritableValue master = new WritableValue(); public static final int SEARCH_IMAGE = 0; @@ -56,10 +41,12 @@ public abstract class AbstractComponentEditor { protected static final int VERTICAL_LIST_WIDGET_INDENT = 10; private ModelEditor editor; + private final IResourcePool resourcePool; - public AbstractComponentEditor(EditingDomain editingDomain, ModelEditor editor) { + public AbstractComponentEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { this.editingDomain = editingDomain; this.editor = editor; + this.resourcePool = resourcePool; } public EditingDomain getEditingDomain() { @@ -83,21 +70,12 @@ protected void setElementId(Object element) { } } - public Image getImage(Display d, int id) { - Image img = IMG_REG.get(IMAGES[id]); - if (img == null) { - try { - InputStream in = AbstractComponentEditor.class.getClassLoader().getResourceAsStream(IMAGES[id]); - img = new Image(d, in); - IMG_REG.put(IMAGES[id], img); - in.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } + public Image createImage(String key) { + return resourcePool.getImageUnchecked(key); + } - return img; + public ImageDescriptor createImageDescriptor(String key) { + return ImageDescriptor.createFromImage(createImage(key)); } public abstract Image getImage(Object element, Display display); @@ -112,30 +90,6 @@ public Image getImage(Display d, int id) { public abstract IObservableList getChildList(Object element); - protected Image loadSharedImage(Display d, URL path) { - Image img = IMG_REG.get(path.toString()); - if (img == null) { - try { - URL url = FileLocator.resolve(path); - if (url != null) { - InputStream in = url.openStream(); - img = new Image(d, in); - IMG_REG.put(path.toString(), img); - in.close(); - } - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return img; - } - - protected ImageDescriptor loadSharedDescriptor(Display d, URL path) { - return ImageDescriptor.createFromImage(loadSharedImage(d, path)); - } - public FeaturePath[] getLabelProperties() { return new FeaturePath[] {}; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java new file mode 100644 index 0000000000..e1ca66fdc5 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java @@ -0,0 +1,106 @@ +package org.eclipse.e4.tools.emf.ui.internal; + +import org.eclipse.e4.tools.services.AbstractBundleResourceProvider; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; + +public class ResourceProvider extends AbstractBundleResourceProvider { + public static final String IMG_Addons = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Addons"; //$NON-NLS-1$ + public static final String IMG_Application = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Application"; //$NON-NLS-1$ + public static final String IMG_Area_vertical = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Area_vertical"; //$NON-NLS-1$ + public static final String IMG_Area = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Area"; //$NON-NLS-1$ + public static final String IMG_BindingContext = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.BindingContext"; //$NON-NLS-1$ + public static final String IMG_BindingTable = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.BindingTable"; //$NON-NLS-1$ + public static final String IMG_Category = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Category"; //$NON-NLS-1$ + public static final String IMG_Command = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Command"; //$NON-NLS-1$ + public static final String IMG_CommandParameter = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.CommandParameter"; //$NON-NLS-1$ + public static final String IMG_CoreExpression = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.CoreExpression"; //$NON-NLS-1$ + public static final String IMG_DirectMenuItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.DirectMenuItem"; //$NON-NLS-1$ + public static final String IMG_DirectToolItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.DirectToolItem"; //$NON-NLS-1$ + public static final String IMG_HandledMenuItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.HandledMenuItem"; //$NON-NLS-1$ + public static final String IMG_HandledToolItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.HandledToolItem"; //$NON-NLS-1$ + public static final String IMG_Handler = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Handler"; //$NON-NLS-1$ + public static final String IMG_KeyBinding = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.KeyBinding"; //$NON-NLS-1$ + public static final String IMG_Menu = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Menu"; //$NON-NLS-1$ + public static final String IMG_MenuContribution = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.MenuContribution"; //$NON-NLS-1$ + public static final String IMG_MenuItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.MenuItem"; //$NON-NLS-1$ + public static final String IMG_MenuSeparator = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.MenuSeparator"; //$NON-NLS-1$ + public static final String IMG_ModelFragments = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.ModelFragments"; //$NON-NLS-1$ + public static final String IMG_Parameter = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Parameter"; //$NON-NLS-1$ + public static final String IMG_Part = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Part"; //$NON-NLS-1$ + public static final String IMG_PartDescriptor = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.PartDescriptor"; //$NON-NLS-1$ + public static final String IMG_PartSashContainer_vertical = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.PartSashContainer_vertical"; //$NON-NLS-1$ + public static final String IMG_PartSashContainer = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.PartSashContainer"; //$NON-NLS-1$ + public static final String IMG_PartStack = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.PartStack"; //$NON-NLS-1$ + public static final String IMG_Perspective = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Perspective"; //$NON-NLS-1$ + public static final String IMG_PerspectiveStack = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.PerspectiveStack"; //$NON-NLS-1$ + public static final String IMG_Placeholder = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Placeholder"; //$NON-NLS-1$ + public static final String IMG_StringModelFragment = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.StringModelFragment"; //$NON-NLS-1$ + public static final String IMG_ToolBar = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.ToolBar"; //$NON-NLS-1$ + public static final String IMG_ToolBarContribution = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.ToolBarContribution"; //$NON-NLS-1$ + public static final String IMG_ToolBarSeparator = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.ToolBarSeparator"; //$NON-NLS-1$ + public static final String IMG_ToolControl = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.ToolControl"; //$NON-NLS-1$ + public static final String IMG_TrimContribution = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.TrimContribution"; //$NON-NLS-1$ + public static final String IMG_Window = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Window"; //$NON-NLS-1$ + public static final String IMG_WindowTrim = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.WindowTrim"; //$NON-NLS-1$ + + public static final String IMG_Tbr_Addons = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Addons"; //$NON-NLS-1$ + public static final String IMG_Tbr_Application = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Application"; //$NON-NLS-1$ + public static final String IMG_Tbr_Area_vertical = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Area_vertical"; //$NON-NLS-1$ + public static final String IMG_Tbr_Area = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Area"; //$NON-NLS-1$ + public static final String IMG_Tbr_BindingContext = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.BindingContext"; //$NON-NLS-1$ + public static final String IMG_Tbr_BindingTable = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.BindingTable"; //$NON-NLS-1$ + public static final String IMG_Tbr_CommandParameter = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.CommandParameter"; //$NON-NLS-1$ + public static final String IMG_Tbr_DirectMenuItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.DirectMenuItem"; //$NON-NLS-1$ + public static final String IMG_Tbr_DirectToolItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.DirectToolItem"; //$NON-NLS-1$ + public static final String IMG_Tbr_HandledMenuItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.HandledMenuItem"; //$NON-NLS-1$ + public static final String IMG_Tbr_HandledToolItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.HandledToolItem"; //$NON-NLS-1$ + public static final String IMG_Tbr_Menu = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Menu"; //$NON-NLS-1$ + public static final String IMG_Tbr_MenuContribution = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.MenuContribution"; //$NON-NLS-1$ + public static final String IMG_Tbr_MenuItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.MenuItem"; //$NON-NLS-1$ + public static final String IMG_Tbr_MenuSeparator = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.MenuSeparator"; //$NON-NLS-1$ + public static final String IMG_Tbr_ModelFragments = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ModelFragments"; //$NON-NLS-1$ + public static final String IMG_Tbr_Parameter = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Parameter"; //$NON-NLS-1$ + public static final String IMG_Tbr_Part = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Part"; //$NON-NLS-1$ + public static final String IMG_Tbr_PartDescriptor = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PartDescriptor"; //$NON-NLS-1$ + public static final String IMG_Tbr_PartSashContainer_vertical = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PartSashContainer_vertical"; //$NON-NLS-1$ + public static final String IMG_Tbr_PartSashContainer = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PartSashContainer"; //$NON-NLS-1$ + public static final String IMG_Tbr_PartStack = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PartStack"; //$NON-NLS-1$ + public static final String IMG_Tbr_Perspective = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Perspective"; //$NON-NLS-1$ + public static final String IMG_Tbr_PerspectiveStack = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PerspectiveStack"; //$NON-NLS-1$ + public static final String IMG_Tbr_Placeholder = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Placeholder"; //$NON-NLS-1$ + public static final String IMG_Tbr_StringModelFragment = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.StringModelFragment"; //$NON-NLS-1$ + public static final String IMG_Tbr_ToolBar = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ToolBar"; //$NON-NLS-1$ + public static final String IMG_Tbr_ToolBarContribution = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ToolBarContribution"; //$NON-NLS-1$ + public static final String IMG_Tbr_ToolBarSeparator = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ToolBarSeparator"; //$NON-NLS-1$ + public static final String IMG_Tbr_ToolControl = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ToolControl"; //$NON-NLS-1$ + public static final String IMG_Tbr_TrimContribution = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.TrimContribution"; //$NON-NLS-1$ + public static final String IMG_Tbr_Window = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Window"; //$NON-NLS-1$ + public static final String IMG_Tbr_WindowTrim = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.WindowTrim"; //$NON-NLS-1$ + + public static final String IMG_Obj16_arrow_down = "IMG_org.eclipse.e4.tools.emf.ui.obj16.arrow_down"; //$NON-NLS-1$ + public static final String IMG_Obj16_arrow_up = "IMG_org.eclipse.e4.tools.emf.ui.obj16.arrow_up"; //$NON-NLS-1$ + public static final String IMG_Obj16_class_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.class_obj"; //$NON-NLS-1$ + public static final String IMG_Obj16_cross = "IMG_org.eclipse.e4.tools.emf.ui.obj16.cross"; //$NON-NLS-1$ + public static final String IMG_Obj16_EPackage = "IMG_org.eclipse.e4.tools.emf.ui.obj16.EPackage"; //$NON-NLS-1$ + public static final String IMG_Obj16_field_public_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.field_public_obj"; //$NON-NLS-1$ + public static final String IMG_Obj16_headermenu = "IMG_org.eclipse.e4.tools.emf.ui.obj16.headermenu"; //$NON-NLS-1$ + public static final String IMG_Obj16_table_add = "IMG_org.eclipse.e4.tools.emf.ui.obj16.table_add"; //$NON-NLS-1$ + public static final String IMG_Obj16_table_delete = "IMG_org.eclipse.e4.tools.emf.ui.obj16.table_delete"; //$NON-NLS-1$ + public static final String IMG_Obj16_zoom = "IMG_org.eclipse.e4.tools.emf.ui.obj16.zoom"; //$NON-NLS-1$ + + public static final String IMG_Wizban16_fieldrefact_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.fieldrefact_wiz"; //$NON-NLS-1$ + public static final String IMG_Wizban16_import_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.import_wiz"; //$NON-NLS-1$ + public static final String IMG_Wizban16_newclass_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.newclass_wiz"; //$NON-NLS-1$ + public static final String IMG_Wizban16_newexp_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.newexp_wiz"; //$NON-NLS-1$ + public static final String IMG_Wizban16_typerefact_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.typerefact_wiz"; //$NON-NLS-1$ + + public Image getFont(Display display, String key) { + return null; + } + + public Image getColor(Display display, String key) { + return null; + } + +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 06a142326b..7e44276b50 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -113,6 +113,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor; import org.eclipse.e4.tools.services.IClipboardService; import org.eclipse.e4.tools.services.IClipboardService.Handler; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.di.Focus; import org.eclipse.e4.ui.di.Persist; import org.eclipse.e4.ui.model.application.MApplicationElement; @@ -234,7 +235,10 @@ public class ModelEditor { private ObservablesManager obsManager; - public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project) { + private final IResourcePool resourcePool; + + public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project, IResourcePool resourcePool) { + this.resourcePool = resourcePool; this.modelProvider = modelProvider; this.project = project; this.context = context; @@ -590,25 +594,25 @@ private void registerContributedVirtualEditors() { } private void registerVirtualEditors() { - registerVirtualEditor(VIRTUAL_PART_MENU, new VMenuEditor(modelProvider.getEditingDomain(), this, BasicPackageImpl.Literals.PART__MENUS)); - registerVirtualEditor(VIRTUAL_HANDLER, new VHandlerEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_BINDING_TABLE, new VBindingTableEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_COMMAND, new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.APPLICATION__COMMANDS)); - registerVirtualEditor(VIRTUAL_WINDOWS, new VWindowEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_WINDOW_CONTROLS, new VWindowControlEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_PART_DESCRIPTORS, new VPartDescriptor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_PARTDESCRIPTOR_MENU, new VMenuEditor(modelProvider.getEditingDomain(), this, org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS)); - registerVirtualEditor(VIRTUAL_TRIMMED_WINDOW_TRIMS, new VWindowTrimEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_ADDONS, new VApplicationAddons(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_MENU_CONTRIBUTIONS, new VMenuContributionsEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_TOOLBAR_CONTRIBUTIONS, new VToolBarContributionsEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_TRIM_CONTRIBUTIONS, new VTrimContributionsEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_WINDOW_SHARED_ELEMENTS, new VWindowSharedElementsEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_MODEL_FRAGEMENTS, new VModelFragmentsEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_MODEL_IMPORTS, new VModelImportsEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_CATEGORIES, new VApplicationCategoriesEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_PARAMETERS, new VItemParametersEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_ROOT_CONTEXTS, new VRootBindingContexts(modelProvider.getEditingDomain(), this)); + registerVirtualEditor(VIRTUAL_PART_MENU, new VMenuEditor(modelProvider.getEditingDomain(), this, BasicPackageImpl.Literals.PART__MENUS, resourcePool)); + registerVirtualEditor(VIRTUAL_HANDLER, new VHandlerEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerVirtualEditor(VIRTUAL_BINDING_TABLE, new VBindingTableEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerVirtualEditor(VIRTUAL_COMMAND, new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.APPLICATION__COMMANDS, resourcePool)); + registerVirtualEditor(VIRTUAL_WINDOWS, new VWindowEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerVirtualEditor(VIRTUAL_WINDOW_CONTROLS, new VWindowControlEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerVirtualEditor(VIRTUAL_PART_DESCRIPTORS, new VPartDescriptor(modelProvider.getEditingDomain(), this, resourcePool)); + registerVirtualEditor(VIRTUAL_PARTDESCRIPTOR_MENU, new VMenuEditor(modelProvider.getEditingDomain(), this, org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS, resourcePool)); + registerVirtualEditor(VIRTUAL_TRIMMED_WINDOW_TRIMS, new VWindowTrimEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerVirtualEditor(VIRTUAL_ADDONS, new VApplicationAddons(modelProvider.getEditingDomain(), this, resourcePool)); + registerVirtualEditor(VIRTUAL_MENU_CONTRIBUTIONS, new VMenuContributionsEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerVirtualEditor(VIRTUAL_TOOLBAR_CONTRIBUTIONS, new VToolBarContributionsEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerVirtualEditor(VIRTUAL_TRIM_CONTRIBUTIONS, new VTrimContributionsEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerVirtualEditor(VIRTUAL_WINDOW_SHARED_ELEMENTS, new VWindowSharedElementsEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerVirtualEditor(VIRTUAL_MODEL_FRAGEMENTS, new VModelFragmentsEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerVirtualEditor(VIRTUAL_MODEL_IMPORTS, new VModelImportsEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerVirtualEditor(VIRTUAL_CATEGORIES, new VApplicationCategoriesEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerVirtualEditor(VIRTUAL_PARAMETERS, new VItemParametersEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerVirtualEditor(VIRTUAL_ROOT_CONTEXTS, new VRootBindingContexts(modelProvider.getEditingDomain(), this, resourcePool)); } private void registerVirtualEditor(String id, AbstractComponentEditor editor) { @@ -642,55 +646,55 @@ private void registerContributedEditors() { } private void registerDefaultEditors() { - registerEditor(ApplicationPackageImpl.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain(), this)); - registerEditor(ApplicationPackageImpl.Literals.ADDON, new AddonsEditor(modelProvider.getEditingDomain(), this, project)); - - registerEditor(CommandsPackageImpl.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(), this, modelProvider)); - registerEditor(CommandsPackageImpl.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain(), this, modelProvider, project)); - registerEditor(CommandsPackageImpl.Literals.COMMAND, new CommandEditor(modelProvider.getEditingDomain(), this)); - registerEditor(CommandsPackageImpl.Literals.COMMAND_PARAMETER, new CommandParameterEditor(modelProvider.getEditingDomain(), this)); - registerEditor(CommandsPackageImpl.Literals.PARAMETER, new ParameterEditor(modelProvider.getEditingDomain(), this)); - registerEditor(CommandsPackageImpl.Literals.BINDING_TABLE, new BindingTableEditor(modelProvider.getEditingDomain(), this)); - registerEditor(CommandsPackageImpl.Literals.BINDING_CONTEXT, new BindingContextEditor(modelProvider.getEditingDomain(), this)); - registerEditor(CommandsPackageImpl.Literals.CATEGORY, new CategoryEditor(modelProvider.getEditingDomain(), this)); - - registerEditor(MenuPackageImpl.Literals.TOOL_BAR, new ToolBarEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MenuPackageImpl.Literals.RENDERED_TOOL_BAR, new RenderedToolBarEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain(), this, project)); - registerEditor(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, new HandledToolItemEditor(modelProvider.getEditingDomain(), this, project, modelProvider)); - registerEditor(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, new ToolBarSeparatorEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MenuPackageImpl.Literals.TOOL_CONTROL, new ToolControlEditor(modelProvider.getEditingDomain(), this, project)); - - registerEditor(MenuPackageImpl.Literals.MENU, new MenuEditor(modelProvider.getEditingDomain(), project, this)); - registerEditor(MenuPackageImpl.Literals.RENDERED_MENU, new RenderedMenuEditor(modelProvider.getEditingDomain(), project, this)); - registerEditor(MenuPackageImpl.Literals.POPUP_MENU, new PopupMenuEditor(modelProvider.getEditingDomain(), project, this)); - registerEditor(MenuPackageImpl.Literals.MENU_SEPARATOR, new MenuSeparatorEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), this, project, modelProvider)); - registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this, project)); - registerEditor(MenuPackageImpl.Literals.RENDERED_MENU_ITEM, new RenderedMenuItem(modelProvider.getEditingDomain(), this, project)); - registerEditor(MenuPackageImpl.Literals.MENU_CONTRIBUTION, new MenuContributionEditor(modelProvider.getEditingDomain(), project, this)); - registerEditor(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION, new ToolBarContributionEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MenuPackageImpl.Literals.TRIM_CONTRIBUTION, new TrimContributionEditor(modelProvider.getEditingDomain(), this)); - - registerEditor(UiPackageImpl.Literals.CORE_EXPRESSION, new CoreExpressionEditor(modelProvider.getEditingDomain(), this)); - - registerEditor(BasicPackageImpl.Literals.PART, new PartEditor(modelProvider.getEditingDomain(), this, project)); - registerEditor(BasicPackageImpl.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain(), this, project)); - registerEditor(BasicPackageImpl.Literals.TRIMMED_WINDOW, new TrimmedWindowEditor(modelProvider.getEditingDomain(), this, project)); - registerEditor(BasicPackageImpl.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor(modelProvider.getEditingDomain(), this)); - registerEditor(AdvancedPackageImpl.Literals.AREA, new AreaEditor(modelProvider.getEditingDomain(), this, project)); - registerEditor(BasicPackageImpl.Literals.PART_STACK, new PartStackEditor(modelProvider.getEditingDomain(), this)); - registerEditor(BasicPackageImpl.Literals.INPUT_PART, new InputPartEditor(modelProvider.getEditingDomain(), this, project)); - registerEditor(BasicPackageImpl.Literals.TRIM_BAR, new TrimBarEditor(modelProvider.getEditingDomain(), this)); - - registerEditor(org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain(), this, project)); - - registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, new PerspectiveStackEditor(modelProvider.getEditingDomain(), this)); - registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE, new PerspectiveEditor(modelProvider.getEditingDomain(), project, this)); - registerEditor(AdvancedPackageImpl.Literals.PLACEHOLDER, new PlaceholderEditor(modelProvider.getEditingDomain(), this, modelProvider)); - - registerEditor(FragmentPackageImpl.Literals.MODEL_FRAGMENTS, new ModelFragmentsEditor(modelProvider.getEditingDomain(), this)); - registerEditor(FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT, new StringModelFragment(modelProvider.getEditingDomain(), this)); + registerEditor(ApplicationPackageImpl.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerEditor(ApplicationPackageImpl.Literals.ADDON, new AddonsEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); + + registerEditor(CommandsPackageImpl.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(), this, modelProvider, resourcePool)); + registerEditor(CommandsPackageImpl.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain(), this, modelProvider, project, resourcePool)); + registerEditor(CommandsPackageImpl.Literals.COMMAND, new CommandEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerEditor(CommandsPackageImpl.Literals.COMMAND_PARAMETER, new CommandParameterEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerEditor(CommandsPackageImpl.Literals.PARAMETER, new ParameterEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerEditor(CommandsPackageImpl.Literals.BINDING_TABLE, new BindingTableEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerEditor(CommandsPackageImpl.Literals.BINDING_CONTEXT, new BindingContextEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerEditor(CommandsPackageImpl.Literals.CATEGORY, new CategoryEditor(modelProvider.getEditingDomain(), this, resourcePool)); + + registerEditor(MenuPackageImpl.Literals.TOOL_BAR, new ToolBarEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerEditor(MenuPackageImpl.Literals.RENDERED_TOOL_BAR, new RenderedToolBarEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerEditor(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); + registerEditor(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, new HandledToolItemEditor(modelProvider.getEditingDomain(), this, project, modelProvider, resourcePool)); + registerEditor(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, new ToolBarSeparatorEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerEditor(MenuPackageImpl.Literals.TOOL_CONTROL, new ToolControlEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); + + registerEditor(MenuPackageImpl.Literals.MENU, new MenuEditor(modelProvider.getEditingDomain(), project, this, resourcePool)); + registerEditor(MenuPackageImpl.Literals.RENDERED_MENU, new RenderedMenuEditor(modelProvider.getEditingDomain(), project, this, resourcePool)); + registerEditor(MenuPackageImpl.Literals.POPUP_MENU, new PopupMenuEditor(modelProvider.getEditingDomain(), project, this, resourcePool)); + registerEditor(MenuPackageImpl.Literals.MENU_SEPARATOR, new MenuSeparatorEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), this, project, modelProvider, resourcePool)); + registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); + registerEditor(MenuPackageImpl.Literals.RENDERED_MENU_ITEM, new RenderedMenuItem(modelProvider.getEditingDomain(), this, project, resourcePool)); + registerEditor(MenuPackageImpl.Literals.MENU_CONTRIBUTION, new MenuContributionEditor(modelProvider.getEditingDomain(), project, this, resourcePool)); + registerEditor(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION, new ToolBarContributionEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerEditor(MenuPackageImpl.Literals.TRIM_CONTRIBUTION, new TrimContributionEditor(modelProvider.getEditingDomain(), this, resourcePool)); + + registerEditor(UiPackageImpl.Literals.CORE_EXPRESSION, new CoreExpressionEditor(modelProvider.getEditingDomain(), this, resourcePool)); + + registerEditor(BasicPackageImpl.Literals.PART, new PartEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); + registerEditor(BasicPackageImpl.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); + registerEditor(BasicPackageImpl.Literals.TRIMMED_WINDOW, new TrimmedWindowEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); + registerEditor(BasicPackageImpl.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerEditor(AdvancedPackageImpl.Literals.AREA, new AreaEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); + registerEditor(BasicPackageImpl.Literals.PART_STACK, new PartStackEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerEditor(BasicPackageImpl.Literals.INPUT_PART, new InputPartEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); + registerEditor(BasicPackageImpl.Literals.TRIM_BAR, new TrimBarEditor(modelProvider.getEditingDomain(), this, resourcePool)); + + registerEditor(org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); + + registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, new PerspectiveStackEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE, new PerspectiveEditor(modelProvider.getEditingDomain(), project, this, resourcePool)); + registerEditor(AdvancedPackageImpl.Literals.PLACEHOLDER, new PlaceholderEditor(modelProvider.getEditingDomain(), this, modelProvider, resourcePool)); + + registerEditor(FragmentPackageImpl.Literals.MODEL_FRAGMENTS, new ModelFragmentsEditor(modelProvider.getEditingDomain(), this, resourcePool)); + registerEditor(FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT, new StringModelFragment(modelProvider.getEditingDomain(), this, resourcePool)); } public void registerEditor(EClass eClass, AbstractComponentEditor editor) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index 67df8d015e..eda867614a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -23,8 +21,10 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; @@ -51,26 +51,16 @@ public class AddonsEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private IProject project; - private Image image; private EStackLayout stackLayout; - public AddonsEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor); + public AddonsEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); this.project = project; } @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Addons.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; + return createImage(ResourceProvider.IMG_Addons); } @Override @@ -179,7 +169,7 @@ public void widgetSelected(SelectionEvent e) { Util.addDecoration(t, binding); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 2e71b5d521..6ad610e85e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -10,15 +10,15 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -44,10 +44,7 @@ public class ApplicationEditor extends AbstractComponentEditor { private Composite composite; - private Image image; - private Image tbrImage; private EMFDataBindingContext context; - // private Button createRemoveRootContext; private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES); @@ -62,33 +59,17 @@ public class ApplicationEditor extends AbstractComponentEditor { private IListProperty BINDING_TABLE_CONTAINER__ROOT_CONTEXT = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT); - public ApplicationEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); + public ApplicationEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); } @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Application.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return image; + return createImage(ResourceProvider.IMG_Application); } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Application.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return tbrImage; + return createImage(ResourceProvider.IMG_Tbr_Application); } } return null; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java index c7c8b37874..955b3875ea 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -22,9 +20,11 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.AreaIconDialogEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -81,8 +81,8 @@ public class AreaEditor extends AbstractComponentEditor { private EStackLayout stackLayout; private IProject project; - public AreaEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor); + public AreaEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); this.project = project; } @@ -93,38 +93,18 @@ public Image getImage(Object element, Display display) { if (!horizontal) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area_vertical.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Area_vertical); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area_vertical.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_Area_vertical); } } if (horizontal) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Area); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_Area); } } return null; @@ -232,7 +212,7 @@ protected URI getImageURI() { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override @@ -307,7 +287,7 @@ public String getText(Object element) { Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -331,7 +311,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -367,7 +347,7 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -389,7 +369,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java index a792889f48..045adbec06 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -21,8 +19,10 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MBindingContext; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; @@ -58,7 +58,6 @@ public class BindingContextEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private EStackLayout stackLayout; @@ -66,33 +65,19 @@ public class BindingContextEditor extends AbstractComponentEditor { private List actions = new ArrayList(); - public BindingContextEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.BindingContextEditor_AddContext, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingContext.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddContext(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public BindingContextEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.BindingContextEditor_AddContext, createImageDescriptor(ResourceProvider.IMG_BindingContext)) { + @Override + public void run() { + handleAddContext(); + } + }); } @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingContext.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; + return createImage(ResourceProvider.IMG_BindingContext); } @Override @@ -197,7 +182,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -224,7 +209,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -251,7 +236,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -262,7 +247,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index 324098119c..ecb550e6ff 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -21,9 +19,11 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BindingContextSelectionDialog; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MBindingTable; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MKeyBinding; @@ -64,40 +64,25 @@ public class BindingTableEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private IListProperty BINDING_TABLE__BINDINGS = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS); private EStackLayout stackLayout; private List actions = new ArrayList(); - public BindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.BindingTableEditor_AddKeyBinding, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.png"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddKeyBinding(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public BindingTableEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.BindingTableEditor_AddKeyBinding, createImageDescriptor(ResourceProvider.IMG_KeyBinding)) { + @Override + public void run() { + handleAddKeyBinding(); + } + }); } @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingTable.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; + return createImage(ResourceProvider.IMG_BindingTable); } @Override @@ -183,7 +168,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override @@ -227,7 +212,7 @@ public void widgetSelected(SelectionEvent e) { Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -254,7 +239,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -281,7 +266,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -292,7 +277,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java index 723fada6ca..71904eb140 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java @@ -10,15 +10,15 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; @@ -37,26 +37,16 @@ public class CategoryEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private EStackLayout stackLayout; - public CategoryEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); + public CategoryEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); } @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Category.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; + return createImage(ResourceProvider.IMG_Category); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 77fcd742cd..c4d4ddf397 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -20,9 +18,11 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.CommandCategorySelectionDialog; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MCommand; import org.eclipse.e4.ui.model.application.commands.MCommandParameter; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; @@ -61,40 +61,25 @@ public class CommandEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private EStackLayout stackLayout; private List actions = new ArrayList(); private IEMFEditListProperty COMMAND__PARAMETERS = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__PARAMETERS); - public CommandEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.CommandEditor_AddCommandParameter, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CommandParameter.png"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddCommandParameter(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public CommandEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.CommandEditor_AddCommandParameter, createImageDescriptor(ResourceProvider.IMG_CommandParameter)) { + @Override + public void run() { + handleAddCommandParameter(); + } + }); } @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; + return createImage(ResourceProvider.IMG_Command); } @Override @@ -211,7 +196,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -251,7 +236,7 @@ public void widgetSelected(SelectionEvent e) { Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -278,7 +263,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -305,7 +290,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -316,7 +301,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java index 4ff5987e07..1a79f32a0f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java @@ -10,15 +10,15 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MCommandParameter; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -41,27 +41,17 @@ public class CommandParameterEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private EStackLayout stackLayout; - public CommandParameterEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); + public CommandParameterEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); } @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CommandParameter.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; + return createImage(ResourceProvider.IMG_CommandParameter); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 4ff3ef894e..b5c73a2836 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -22,6 +22,7 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.e4.ui.internal.workbench.E4XMIResource; import org.eclipse.e4.ui.model.application.MApplication; @@ -189,7 +190,7 @@ protected boolean canEdit(Object element) { Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); + b.setImage(editor.createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -243,7 +244,7 @@ protected void okPressed() { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_DELETE_IMAGE)); + b.setImage(editor.createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -286,7 +287,7 @@ public static void createFindImport(Composite parent, final AbstractComponentEdi final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(editor.getImage(t.getDisplay(), AbstractComponentEditor.SEARCH_IMAGE)); + b.setImage(editor.createImage(ResourceProvider.IMG_Obj16_zoom)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -384,7 +385,7 @@ public void keyPressed(KeyEvent e) { Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Add); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); + b.setImage(editor.createImage(ResourceProvider.IMG_Obj16_table_add)); gd = new GridData(GridData.FILL, GridData.CENTER, false, false); gd.verticalIndent = vIndent; b.setLayoutData(gd); @@ -418,7 +419,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_UP)); + b.setImage(editor.createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -445,7 +446,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_DOWN)); + b.setImage(editor.createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -472,7 +473,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_DELETE_IMAGE)); + b.setImage(editor.createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java index 99c47c8f55..dc0d852e29 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java @@ -10,14 +10,14 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ExpressionIdDialog; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.MCoreExpression; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; @@ -40,25 +40,15 @@ public class CoreExpressionEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; - public CoreExpressionEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); + public CoreExpressionEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); } @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CoreExpression.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; + return createImage(ResourceProvider.IMG_CoreExpression); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index ee46377fd1..d5933aa989 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -24,8 +22,10 @@ import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -54,8 +54,8 @@ public class DirectMenuItemEditor extends MenuItemEditor { private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); - public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor, project); + public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { + super(editingDomain, editor, project, resourcePool); } @Override @@ -63,19 +63,9 @@ public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_DirectMenuItem); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectMenuItem.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_DirectMenuItem); } } @@ -122,7 +112,7 @@ public void widgetSelected(SelectionEvent e) { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index da548c44ce..f5dc180f52 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -24,8 +22,10 @@ import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -54,8 +54,8 @@ public class DirectToolItemEditor extends ToolItemEditor { private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); - public DirectToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor, project); + public DirectToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { + super(editingDomain, editor, project, resourcePool); } @Override @@ -63,19 +63,9 @@ public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_DirectToolItem); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectToolItem.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_DirectToolItem); } } @@ -110,7 +100,7 @@ public void widgetSelected(SelectionEvent e) { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index a9034ec830..d320108383 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; @@ -22,9 +20,11 @@ import org.eclipse.e4.tools.emf.ui.common.CommandToStringConverter; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledMenuItemCommandSelectionDialog; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -56,8 +56,8 @@ public class HandledMenuItemEditor extends MenuItemEditor { private IEMFEditListProperty HANDLED_ITEM__PARAMETERS = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); - public HandledMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource) { - super(editingDomain, editor, project); + public HandledMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource, IResourcePool resourcePool) { + super(editingDomain, editor, project, resourcePool); this.resource = resource; } @@ -66,19 +66,9 @@ public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_HandledMenuItem); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/HandledMenuItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_HandledMenuItem); } } @@ -112,7 +102,7 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index 42bb48319d..61c4cdca91 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; @@ -22,9 +20,11 @@ import org.eclipse.e4.tools.emf.ui.common.CommandToStringConverter; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledToolItemCommandSelectionDialog; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -56,8 +56,8 @@ public class HandledToolItemEditor extends ToolItemEditor { private IEMFEditListProperty HANDLED_ITEM__PARAMETERS = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); - public HandledToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource) { - super(editingDomain, editor, project); + public HandledToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource, IResourcePool resourcePool) { + super(editingDomain, editor, project, resourcePool); this.resource = resource; } @@ -66,19 +66,9 @@ public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledToolItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_HandledToolItem); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/HandledToolItem.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_HandledToolItem); } } @@ -101,7 +91,7 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index a9995f307e..dc65799b46 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -25,9 +23,11 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandlerCommandSelectionDialog; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; @@ -55,29 +55,20 @@ public class HandlerEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private IModelResource resource; private IProject project; private EStackLayout stackLayout; - public HandlerEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource, IProject project) { - super(editingDomain, editor); + public HandlerEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource, IProject project, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); this.resource = resource; this.project = project; } @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return image; + return createImage(ResourceProvider.IMG_Handler); } @Override @@ -166,7 +157,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -202,7 +193,7 @@ public void widgetSelected(SelectionEvent e) { Util.addDecoration(t, binding); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setText(Messages.ModelTooling_Common_FindEllipsis); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java index 3ccdaf593e..6cc41e1778 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java @@ -14,6 +14,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; @@ -28,8 +29,8 @@ public class InputPartEditor extends PartEditor { - public InputPartEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor, project); + public InputPartEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { + super(editingDomain, editor, project, resourcePool); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index df1f3ba0ce..30f7dc44fc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.Binding; @@ -27,9 +25,11 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.KeyBindingCommandSelectionDialog; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MKeyBinding; import org.eclipse.e4.ui.model.application.commands.MKeySequence; @@ -70,7 +70,6 @@ public class KeyBindingEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private IModelResource resource; private EStackLayout stackLayout; @@ -78,34 +77,20 @@ public class KeyBindingEditor extends AbstractComponentEditor { private IEMFEditListProperty KEY_BINDING__PARAMETERS = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS); - public KeyBindingEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource) { - super(editingDomain, editor); + public KeyBindingEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); this.resource = resource; - try { - actions.add(new Action(Messages.KeyBindingEditor_AddParameter, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.png"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddParameter(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + actions.add(new Action(Messages.KeyBindingEditor_AddParameter, createImageDescriptor(ResourceProvider.IMG_Parameter)) { + @Override + public void run() { + handleAddParameter(); + } + }); } @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; + return createImage(ResourceProvider.IMG_KeyBinding); } @Override @@ -208,7 +193,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -245,7 +230,7 @@ public void widgetSelected(SelectionEvent e) { Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -272,7 +257,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -299,7 +284,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -324,7 +309,7 @@ public void widgetSelected(SelectionEvent e) { } }); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index b697f587c0..f244a12110 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -21,8 +19,10 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -65,8 +65,6 @@ public class MenuContributionEditor extends AbstractComponentEditor { private Composite composite; - private Image image; - private Image tbrImage; private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); @@ -84,33 +82,17 @@ public Struct(String label, EClass eClass, boolean separator) { } } - public MenuContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain, editor); + public MenuContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); } @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return image; + return createImage(ResourceProvider.IMG_MenuContribution); } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuContribution.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return tbrImage; + return createImage(ResourceProvider.IMG_Tbr_MenuContribution); } } @@ -252,7 +234,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -276,7 +258,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -314,7 +296,7 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -338,7 +320,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 441de33382..bb88a0df90 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.UpdateValueStrategy; @@ -30,11 +28,13 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor.EClass2EObject; import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor.EObject2EClass; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MExpression; @@ -106,39 +106,33 @@ public Struct(String label, EClass eClass, boolean separator) { } } - public MenuEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain, editor); + public MenuEditor(EditingDomain editingDomain, IProject project, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); this.project = project; - try { - actions.add(new Action(Messages.MenuEditor_AddHandledMenuItem, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false); - } - }); - actions.add(new Action(Messages.MenuEditor_AddMenu, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.MENU, false); - } - }); - actions.add(new Action(Messages.MenuEditor_AddDirectMenuItem, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false); - } - }); - actions.add(new Action(Messages.MenuEditor_AddSeparator, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuSeparator.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.MENU_SEPARATOR, true); - } - }); - - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + actions.add(new Action(Messages.MenuEditor_AddHandledMenuItem, createImageDescriptor(ResourceProvider.IMG_MenuItem)) { + @Override + public void run() { + handleAdd(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false); + } + }); + actions.add(new Action(Messages.MenuEditor_AddMenu, createImageDescriptor(ResourceProvider.IMG_Menu)) { + @Override + public void run() { + handleAdd(MenuPackageImpl.Literals.MENU, false); + } + }); + actions.add(new Action(Messages.MenuEditor_AddDirectMenuItem, createImageDescriptor(ResourceProvider.IMG_MenuItem)) { + @Override + public void run() { + handleAdd(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false); + } + }); + actions.add(new Action(Messages.MenuEditor_AddSeparator, createImageDescriptor(ResourceProvider.IMG_MenuSeparator)) { + @Override + public void run() { + handleAdd(MenuPackageImpl.Literals.MENU_SEPARATOR, true); + } + }); } @Override @@ -146,19 +140,9 @@ public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Menu); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Menu.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_Menu); } } @@ -289,7 +273,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -313,7 +297,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -351,7 +335,7 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -366,7 +350,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -420,7 +404,7 @@ protected URI getImageURI() { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 941e92dfda..b3f2a1000a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.UpdateValueStrategy; @@ -25,8 +23,10 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuItemIconDialogEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; @@ -64,14 +64,12 @@ public abstract class MenuItemEditor extends AbstractComponentEditor { private Composite composite; - private Image image; - private Image tbrImage; private EMFDataBindingContext context; protected IProject project; private EStackLayout stackLayout; - public MenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor); + public MenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); this.project = project; } @@ -79,25 +77,9 @@ public MenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return image; + return createImage(ResourceProvider.IMG_MenuItem); } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return tbrImage; + return createImage(ResourceProvider.IMG_Tbr_MenuItem); } } @@ -252,7 +234,7 @@ protected URI getImageURI() { }; final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index c290dd50f1..34356ca83e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -10,15 +10,15 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; @@ -38,27 +38,17 @@ import org.eclipse.swt.widgets.Text; public class MenuSeparatorEditor extends AbstractComponentEditor { - private Image separatorImage; private Composite composite; private EMFDataBindingContext context; private EStackLayout stackLayout; - public MenuSeparatorEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); + public MenuSeparatorEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); } @Override public Image getImage(Object element, Display display) { - if (separatorImage == null) { - try { - separatorImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuSeparator.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return separatorImage; + return createImage(ResourceProvider.IMG_MenuSeparator); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java index 62f129c019..7cb41fd053 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -20,9 +18,11 @@ import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.fragment.MFragmentFactory; import org.eclipse.e4.ui.model.fragment.MModelFragment; @@ -66,23 +66,14 @@ public class ModelFragmentsEditor extends AbstractComponentEditor { private IListProperty MODEL_FRAGMENTS__IMPORTS = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS); private Composite composite; - private Image image; - public ModelFragmentsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); + public ModelFragmentsEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); } @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ModelFragments.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return image; + return createImage(ResourceProvider.IMG_ModelFragments); } @Override @@ -140,7 +131,7 @@ private Composite createForm(Composite parent) { Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -167,7 +158,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -219,7 +210,7 @@ public int compare(Viewer viewer, Object e1, Object e2) { childrenDropDown.getCombo().select(0); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -238,7 +229,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -281,7 +272,7 @@ public void widgetSelected(SelectionEvent e) { Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -308,7 +299,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -335,7 +326,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -353,7 +344,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java index 0bd741eb47..f40fb4c319 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java @@ -10,15 +10,15 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -37,27 +37,17 @@ public class ParameterEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private EStackLayout stackLayout; - public ParameterEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); + public ParameterEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); } @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; + return createImage(ResourceProvider.IMG_Parameter); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 41d83b481d..217a36fdd3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IObservableValue; @@ -25,10 +23,12 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartDescriptorIconDialogEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; @@ -65,7 +65,6 @@ public class PartDescriptorEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private IProject project; @@ -75,23 +74,14 @@ public class PartDescriptorEditor extends AbstractComponentEditor { private Button createRemoveToolBar; private EStackLayout stackLayout; - public PartDescriptorEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor); + public PartDescriptorEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); this.project = project; } @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; + return createImage(ResourceProvider.IMG_PartDescriptor); } @Override @@ -222,7 +212,7 @@ protected URI getImageURI() { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override @@ -245,7 +235,7 @@ public void widgetSelected(SelectionEvent e) { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 1a92e757c8..e2306ba70c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -29,10 +27,12 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartIconDialogEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -71,7 +71,6 @@ public class PartEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private IProject project; @@ -80,10 +79,9 @@ public class PartEditor extends AbstractComponentEditor { private IValueProperty PART__TOOLBAR = EMFProperties.value(BasicPackageImpl.Literals.PART__TOOLBAR); private Button createRemoveToolBar; private EStackLayout stackLayout; - private Image tbrImage; - public PartEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor); + public PartEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); this.project = project; } @@ -91,25 +89,9 @@ public PartEditor(EditingDomain editingDomain, ModelEditor editor, IProject proj public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return image; + return createImage(ResourceProvider.IMG_Part); } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Part.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return tbrImage; + return createImage(ResourceProvider.IMG_Tbr_Part); } } @@ -211,7 +193,7 @@ protected URI getImageURI() { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override @@ -248,7 +230,7 @@ public void widgetSelected(SelectionEvent e) { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index d3ecac257f..370b4e0580 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -21,8 +19,10 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -76,50 +76,44 @@ public class PartSashContainerEditor extends AbstractComponentEditor { private EStackLayout stackLayout; private List actions = new ArrayList(); - public PartSashContainerEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.PartSashContainerEditor_AddPartSashContainer, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART_SASH_CONTAINER); - } - }); - actions.add(new Action(Messages.PartSashContainerEditor_AddPartStack, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART_STACK); - } - }); - actions.add(new Action(Messages.PartSashContainerEditor_AddPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART); - } - }); - actions.add(new Action(Messages.PartSashContainerEditor_AddInputPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.INPUT_PART); - } - }); - actions.add(new Action(Messages.PartSashContainerEditor_AddArea, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(AdvancedPackageImpl.Literals.AREA); - } - }); - actions.add(new Action(Messages.PartSashContainerEditor_AddPlaceholder, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Placeholder.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER); - } - }); - - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public PartSashContainerEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.PartSashContainerEditor_AddPartSashContainer, createImageDescriptor(ResourceProvider.IMG_PartSashContainer)) { + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.PART_SASH_CONTAINER); + } + }); + actions.add(new Action(Messages.PartSashContainerEditor_AddPartStack, createImageDescriptor(ResourceProvider.IMG_PartStack)) { + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.PART_STACK); + } + }); + actions.add(new Action(Messages.PartSashContainerEditor_AddPart, createImageDescriptor(ResourceProvider.IMG_Part)) { + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.PART); + } + }); + actions.add(new Action(Messages.PartSashContainerEditor_AddInputPart, createImageDescriptor(ResourceProvider.IMG_Part)) { + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.INPUT_PART); + } + }); + actions.add(new Action(Messages.PartSashContainerEditor_AddArea, createImageDescriptor(ResourceProvider.IMG_Area)) { + @Override + public void run() { + handleAddChild(AdvancedPackageImpl.Literals.AREA); + } + }); + actions.add(new Action(Messages.PartSashContainerEditor_AddPlaceholder, createImageDescriptor(ResourceProvider.IMG_Placeholder)) { + @Override + public void run() { + handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER); + } + }); } @Override @@ -129,38 +123,18 @@ public Image getImage(Object element, Display display) { if (!horizontal) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_PartSashContainer_vertical); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer_vertical.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_PartSashContainer_vertical); } } if (horizontal) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_PartSashContainer); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_PartSashContainer); } } return null; @@ -305,7 +279,7 @@ public String getText(Object element) { Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -329,7 +303,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -365,7 +339,7 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -379,7 +353,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 0061885ba1..06af6efb0c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -21,8 +19,10 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -68,64 +68,41 @@ public class PartStackEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private StackLayout stackLayout; - private Image tbrImage; private List actions = new ArrayList(); - public PartStackEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.PartStackEditor_AddPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART); - } - }); - actions.add(new Action(Messages.PartStackEditor_AddInputPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.INPUT_PART); - } - }); - actions.add(new Action(Messages.PartStackEditor_AddPlaceholder, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Placeholder.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public PartStackEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.PartStackEditor_AddPart, createImageDescriptor(ResourceProvider.IMG_Part)) { + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.PART); + } + }); + actions.add(new Action(Messages.PartStackEditor_AddInputPart, createImageDescriptor(ResourceProvider.IMG_Part)) { + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.INPUT_PART); + } + }); + actions.add(new Action(Messages.PartStackEditor_AddPlaceholder, createImageDescriptor(ResourceProvider.IMG_Placeholder)) { + @Override + public void run() { + handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER); + } + }); } @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { if (((MUIElement) element).isToBeRendered()) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return image; + return createImage(ResourceProvider.IMG_Part); } else { - if (tbrImage == null) { - try { - tbrImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartStack.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return tbrImage; + return createImage(ResourceProvider.IMG_Tbr_Part); } } @@ -249,7 +226,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -273,7 +250,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -309,7 +286,7 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -321,7 +298,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 2ee16ccea9..3bc04732ce 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -23,9 +21,11 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PerspectiveIconDialogEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -79,51 +79,45 @@ public class PerspectiveEditor extends AbstractComponentEditor { private EStackLayout stackLayout; private List actions = new ArrayList(); - public PerspectiveEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain, editor); + public PerspectiveEditor(EditingDomain editingDomain, IProject project, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); this.project = project; - try { - actions.add(new Action(Messages.PerspectiveEditor_AddPartSashContainer, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART_SASH_CONTAINER); - } - }); - actions.add(new Action(Messages.PerspectiveEditor_AddPartStack, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART_STACK); - } - }); - actions.add(new Action(Messages.PerspectiveEditor_AddPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART); - } - }); - actions.add(new Action(Messages.PerspectiveEditor_AddInputPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.INPUT_PART); - } - }); - actions.add(new Action(Messages.PerspectiveEditor_AddArea, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(AdvancedPackageImpl.Literals.AREA); - } - }); - actions.add(new Action(Messages.PerspectiveEditor_AddPlaceholder, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Placeholder.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER); - } - }); - - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + actions.add(new Action(Messages.PerspectiveEditor_AddPartSashContainer, createImageDescriptor(ResourceProvider.IMG_Perspective)) { + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.PART_SASH_CONTAINER); + } + }); + actions.add(new Action(Messages.PerspectiveEditor_AddPartStack, createImageDescriptor(ResourceProvider.IMG_PartStack)) { + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.PART_STACK); + } + }); + actions.add(new Action(Messages.PerspectiveEditor_AddPart, createImageDescriptor(ResourceProvider.IMG_Part)) { + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.PART); + } + }); + actions.add(new Action(Messages.PerspectiveEditor_AddInputPart, createImageDescriptor(ResourceProvider.IMG_Part)) { + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.INPUT_PART); + } + }); + actions.add(new Action(Messages.PerspectiveEditor_AddArea, createImageDescriptor(ResourceProvider.IMG_Area)) { + @Override + public void run() { + handleAddChild(AdvancedPackageImpl.Literals.AREA); + } + }); + actions.add(new Action(Messages.PerspectiveEditor_AddPlaceholder, createImageDescriptor(ResourceProvider.IMG_Placeholder)) { + @Override + public void run() { + handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER); + } + }); } @Override @@ -131,19 +125,9 @@ public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Perspective.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Perspective); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Perspective.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_Perspective); } } @@ -329,7 +313,7 @@ public void widgetSelected(SelectionEvent e) { Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -353,7 +337,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -389,7 +373,7 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -403,7 +387,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 792cd25fbb..711b3d32ad 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -21,8 +19,10 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -67,20 +67,14 @@ public class PerspectiveStackEditor extends AbstractComponentEditor { private EStackLayout stackLayout; private List actions = new ArrayList(); - public PerspectiveStackEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - - actions.add(new Action(Messages.PerspectiveStackEditor_AddPerspective, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Perspective.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddPerspective(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public PerspectiveStackEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.PerspectiveStackEditor_AddPerspective, createImageDescriptor(ResourceProvider.IMG_Perspective)) { + @Override + public void run() { + handleAddPerspective(); + } + }); } @Override @@ -88,19 +82,9 @@ public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_PerspectiveStack); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PerspectiveStack.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_PerspectiveStack); } } @@ -216,7 +200,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -240,7 +224,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -263,7 +247,7 @@ public void widgetSelected(SelectionEvent e) { }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @@ -275,7 +259,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index baf4f5e92f..89e18c96ec 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.conversion.Converter; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -21,8 +19,10 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.SharedElementsDialog; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; @@ -50,28 +50,18 @@ public class PlaceholderEditor extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private IModelResource resource; private EStackLayout stackLayout; - public PlaceholderEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource) { - super(editingDomain, editor); + public PlaceholderEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); this.resource = resource; } @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Placeholder.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; + return createImage(ResourceProvider.IMG_Placeholder); } @Override @@ -219,7 +209,7 @@ public Object convert(Object fromObject) { context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), AdvancedPackageImpl.Literals.PLACEHOLDER__REF).observeDetail(getMaster()), t2m, m2t); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java index 40607cac27..be51647acc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java @@ -14,6 +14,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.edit.domain.EditingDomain; @@ -21,8 +22,8 @@ public class PopupMenuEditor extends MenuEditor { - public PopupMenuEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain, project, editor); + public PopupMenuEditor(EditingDomain editingDomain, IProject project, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, project, editor, resourcePool); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java index edbf6030e4..5819befe8b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java @@ -13,12 +13,13 @@ import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.emf.edit.domain.EditingDomain; public class RenderedMenuEditor extends MenuEditor { - public RenderedMenuEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain, project, editor); + public RenderedMenuEditor(EditingDomain editingDomain, IProject project, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, project, editor, resourcePool); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java index d62c567092..c4c418f850 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java @@ -14,14 +14,15 @@ import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Composite; public class RenderedMenuItem extends MenuItemEditor { - public RenderedMenuItem(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor, project); + public RenderedMenuItem(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { + super(editingDomain, editor, project, resourcePool); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java index 9618f31d56..70c61e0445 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java @@ -12,12 +12,13 @@ import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.emf.edit.domain.EditingDomain; public class RenderedToolBarEditor extends ToolBarEditor { - public RenderedToolBarEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); + public RenderedToolBarEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index 1be39cdb77..f5fd803f6d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -20,10 +18,12 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FeatureSelectionDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindParentReferenceElementDialog; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.fragment.MModelFragment; import org.eclipse.e4.ui.model.fragment.MStringModelFragment; @@ -65,26 +65,17 @@ public class StringModelFragment extends AbstractComponentEditor { private Composite composite; - private Image image; private EMFDataBindingContext context; private IListProperty MODEL_FRAGMENT__ELEMENTS = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS); - public StringModelFragment(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); + public StringModelFragment(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); } @Override public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/StringModelFragment.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return image; + return createImage(ResourceProvider.IMG_StringModelFragment); } @Override @@ -226,7 +217,7 @@ public void widgetSelected(SelectionEvent e) { Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -253,7 +244,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -305,7 +296,7 @@ public int compare(Viewer viewer, Object e1, Object e2) { childrenDropDown.getCombo().select(0); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -324,7 +315,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -345,11 +336,6 @@ public void widgetSelected(SelectionEvent e) { } public void dispose() { - if (image != null) { - image.dispose(); - image = null; - } - if (composite != null) { composite.dispose(); composite = null; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index 115ca1b9ed..cf841a054f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -20,8 +18,10 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -81,8 +81,8 @@ public Struct(String label, EClass eClass, boolean separator) { } } - public ToolBarContributionEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); + public ToolBarContributionEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); } @Override @@ -90,19 +90,9 @@ public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_ToolBarContribution); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBarContribution.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_ToolBarContribution); } } @@ -244,7 +234,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -268,7 +258,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -306,7 +296,7 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -331,7 +321,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 07e16f5cd5..d4681ecb1b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -21,8 +19,10 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -85,37 +85,32 @@ public Struct(String label, EClass eClass, boolean separator) { } } - public ToolBarEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.ToolBarEditor_AddHandledToolItem, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledToolItem.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, false); - } - }); - actions.add(new Action(Messages.ToolBarEditor_AddDirectToolItem, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, false); - } - }); - actions.add(new Action(Messages.ToolBarEditor_AddToolControl, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.TOOL_CONTROL, false); - } - }); - actions.add(new Action(Messages.ToolBarEditor_AddToolBarSeparator, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, true); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public ToolBarEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.ToolBarEditor_AddHandledToolItem, createImageDescriptor(ResourceProvider.IMG_HandledToolItem)) { + @Override + public void run() { + handleAddChild(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, false); + } + }); + actions.add(new Action(Messages.ToolBarEditor_AddDirectToolItem, createImageDescriptor(ResourceProvider.IMG_DirectToolItem)) { + @Override + public void run() { + handleAddChild(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, false); + } + }); + actions.add(new Action(Messages.ToolBarEditor_AddToolControl, createImageDescriptor(ResourceProvider.IMG_ToolControl)) { + @Override + public void run() { + handleAddChild(MenuPackageImpl.Literals.TOOL_CONTROL, false); + } + }); + actions.add(new Action(Messages.ToolBarEditor_AddToolBarSeparator, createImageDescriptor(ResourceProvider.IMG_ToolBarSeparator)) { + @Override + public void run() { + handleAddChild(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, true); + } + }); } @Override @@ -123,19 +118,9 @@ public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBar.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_ToolBar); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBar.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_ToolBar); } } @@ -246,7 +231,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -270,7 +255,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -308,7 +293,7 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -323,7 +308,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index 9a81ba392c..c5b8969122 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -10,15 +10,15 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -44,8 +44,8 @@ public class ToolBarSeparatorEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private EStackLayout stackLayout; - public ToolBarSeparatorEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); + public ToolBarSeparatorEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); } @Override @@ -53,19 +53,9 @@ public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_ToolBarSeparator); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBarSeparator.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_ToolBarSeparator); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index 4383f6e165..6291b792ed 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; @@ -19,8 +17,10 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -51,8 +51,8 @@ public class ToolControlEditor extends AbstractComponentEditor { private IProject project; private EStackLayout stackLayout; - public ToolControlEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor); + public ToolControlEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); this.project = project; } @@ -71,19 +71,9 @@ public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_ToolControl); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolControl.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_ToolControl); } } @@ -173,7 +163,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setText(Messages.ModelTooling_Common_FindEllipsis); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index e7f2e09831..f587170bb2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -23,8 +23,10 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ToolItemIconDialogEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -62,8 +64,8 @@ public abstract class ToolItemEditor extends AbstractComponentEditor { protected IProject project; private EStackLayout stackLayout; - public ToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor); + public ToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); this.project = project; } @@ -198,7 +200,7 @@ protected URI getImageURI() { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index 5622e4cc83..18f6768aaa 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -22,8 +20,10 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MGenericTrimContainer; @@ -77,26 +77,21 @@ public class TrimBarEditor extends AbstractComponentEditor { private EStackLayout stackLayout; private List actions = new ArrayList(); - public TrimBarEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); + public TrimBarEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); this.editor = editor; - try { - actions.add(new Action(Messages.TrimBarEditor_AddToolBar, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Toolbar.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.TOOL_BAR); - } - }); - actions.add(new Action(Messages.TrimBarEditor_AddToolControl, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.TOOL_CONTROL); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + actions.add(new Action(Messages.TrimBarEditor_AddToolBar, createImageDescriptor(ResourceProvider.IMG_ToolBar)) { + @Override + public void run() { + handleAddChild(MenuPackageImpl.Literals.TOOL_BAR); + } + }); + actions.add(new Action(Messages.TrimBarEditor_AddToolControl, createImageDescriptor(ResourceProvider.IMG_ToolControl)) { + @Override + public void run() { + handleAddChild(MenuPackageImpl.Literals.TOOL_CONTROL); + } + }); } @Override @@ -104,19 +99,9 @@ public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_WindowTrim); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/WindowTrim.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_WindowTrim); } } @@ -241,7 +226,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -265,7 +250,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -299,7 +284,7 @@ public String getText(Object element) { typeViewer.setSelection(new StructuredSelection(MenuPackageImpl.Literals.TOOL_BAR)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -311,7 +296,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index 3452ce1a1d..c849e52bb0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -20,8 +18,10 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -68,8 +68,8 @@ public class TrimContributionEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; - public TrimContributionEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); + public TrimContributionEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); } @Override @@ -77,19 +77,9 @@ public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_TrimContribution); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/TrimContribution.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_TrimContribution); } } @@ -229,7 +219,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -253,7 +243,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -287,7 +277,7 @@ public String getText(Object element) { typeViewer.setSelection(new StructuredSelection(MenuPackageImpl.Literals.TOOL_BAR)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -306,7 +296,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java index b4fa9948df..4b95783eca 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java @@ -17,6 +17,7 @@ import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.ecore.EObject; @@ -25,8 +26,8 @@ public class TrimmedWindowEditor extends WindowEditor { private IListProperty TRIMMED_WINDOW__TRIM_BARS = EMFProperties.list(BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS); - public TrimmedWindowEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor, project); + public TrimmedWindowEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { + super(editingDomain, editor, project, resourcePool); } public IObservableList getChildList(Object element) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 37598cdf8a..0d9bc6da57 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -27,9 +25,11 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.WindowIconDialogEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -80,8 +80,8 @@ public class WindowEditor extends AbstractComponentEditor { private Button createRemoveMainMenu; private EStackLayout stackLayout; - public WindowEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor); + public WindowEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); this.project = project; addMainMenu = new Action(Messages.WindowEditor_AddMainMenu) { @Override @@ -96,19 +96,9 @@ public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { MUIElement uiElement = (MUIElement) element; if (uiElement.isToBeRendered() && uiElement.isVisible()) { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Window); } else { - try { - return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Window.gif"));//$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return createImage(ResourceProvider.IMG_Tbr_Window); } } @@ -298,7 +288,7 @@ protected URI getImageURI() { final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java index dca00e323c..d62c5ef2f3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java @@ -10,17 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MAddon; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationFactory; @@ -54,19 +54,14 @@ public class VApplicationAddons extends AbstractComponentEditor { private List actions = new ArrayList(); - public VApplicationAddons(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.VApplicationAddons_AddAddon, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Addons.png"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddAddon(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public VApplicationAddons(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.VApplicationAddons_AddAddon, createImageDescriptor(ResourceProvider.IMG_Addons)) { + @Override + public void run() { + handleAddAddon(); + } + }); } @Override @@ -131,7 +126,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -158,7 +153,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -185,7 +180,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -196,7 +191,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java index eb5ef69574..2d08172df9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java @@ -10,17 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.commands.MCategory; import org.eclipse.e4.ui.model.application.commands.impl.CommandsFactoryImpl; @@ -54,19 +54,14 @@ public class VApplicationCategoriesEditor extends AbstractComponentEditor { private List actions = new ArrayList(); - public VApplicationCategoriesEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.VApplicationCategoriesEditor_AddCategory, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Category.png"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public VApplicationCategoriesEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.VApplicationCategoriesEditor_AddCategory, createImageDescriptor(ResourceProvider.IMG_Category)) { + @Override + public void run() { + handleAdd(); + } + }); } @Override @@ -131,7 +126,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -158,7 +153,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -185,7 +180,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -196,7 +191,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index 857a361ee0..fca96e7f8c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -10,17 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MBindingTable; import org.eclipse.e4.ui.model.application.commands.MBindingTableContainer; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; @@ -53,19 +53,14 @@ public class VBindingTableEditor extends AbstractComponentEditor { private TableViewer bindingViewer; private List actions = new ArrayList(); - public VBindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.VBindingTableEditor_AddBindingTable, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingTable.png"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public VBindingTableEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.VBindingTableEditor_AddBindingTable, createImageDescriptor(ResourceProvider.IMG_BindingTable)) { + @Override + public void run() { + handleAdd(); + } + }); } @Override @@ -130,7 +125,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -157,7 +152,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -184,7 +179,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -195,7 +190,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index 81a39e6350..2c6ef7e779 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -10,17 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.commands.MCommand; import org.eclipse.e4.ui.model.application.commands.impl.CommandsFactoryImpl; @@ -55,20 +55,15 @@ public class VCommandEditor extends AbstractComponentEditor { private EStructuralFeature commandsFeature; private List actions = new ArrayList(); - public VCommandEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature commandsFeature) { - super(editingDomain, editor); + public VCommandEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature commandsFeature, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); this.commandsFeature = commandsFeature; - try { - actions.add(new Action(Messages.VCommandEditor_AddCommand, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.png"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + actions.add(new Action(Messages.VCommandEditor_AddCommand, createImageDescriptor(ResourceProvider.IMG_Command)) { + @Override + public void run() { + handleAdd(); + } + }); } @Override @@ -133,7 +128,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -160,7 +155,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -187,7 +182,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -198,7 +193,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index 9ccbd4d087..fa16189bdd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -10,17 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.commands.MHandlerContainer; @@ -53,19 +53,14 @@ public class VHandlerEditor extends AbstractComponentEditor { private TableViewer viewer; private List actions = new ArrayList(); - public VHandlerEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.VHandlerEditor_AddHandler, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.png"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public VHandlerEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.VHandlerEditor_AddHandler, createImageDescriptor(ResourceProvider.IMG_Handler)) { + @Override + public void run() { + handleAdd(); + } + }); } @Override @@ -130,7 +125,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -157,7 +152,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -184,7 +179,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -195,7 +190,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java index 08f398a673..807dacfcd9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java @@ -10,17 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; @@ -57,19 +57,14 @@ public class VItemParametersEditor extends AbstractComponentEditor { private IEMFListProperty HANDLED_ITEM__PARAMETERS = EMFProperties.list(MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); - public VItemParametersEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.VItemParametersEditor_AddParameter, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.png"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public VItemParametersEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.VItemParametersEditor_AddParameter, createImageDescriptor(ResourceProvider.IMG_Parameter)) { + @Override + public void run() { + handleAdd(); + } + }); } @Override @@ -134,7 +129,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -161,7 +156,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -188,7 +183,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -199,7 +194,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java index 346ad2a7d9..8fdd87fa87 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java @@ -10,17 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution; import org.eclipse.e4.ui.model.application.ui.menu.MMenuContributions; import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; @@ -54,19 +54,14 @@ public class VMenuContributionsEditor extends AbstractComponentEditor { private List actions = new ArrayList(); - public VMenuContributionsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.VMenuContributionsEditor_AddMenuContribution, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public VMenuContributionsEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.VMenuContributionsEditor_AddMenuContribution, createImageDescriptor(ResourceProvider.IMG_MenuContribution)) { + @Override + public void run() { + handleAdd(); + } + }); } @Override @@ -131,7 +126,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -158,7 +153,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -185,7 +180,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -196,7 +191,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java index 596bce56d1..cdedf9fba1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -10,17 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenu; @@ -56,20 +56,15 @@ public class VMenuEditor extends AbstractComponentEditor { private EStructuralFeature feature; private List actions = new ArrayList(); - public VMenuEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature feature) { - super(editingDomain, editor); + public VMenuEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature feature, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); this.feature = feature; - try { - actions.add(new Action(Messages.VMenuEditor_AddMenuContribution, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + actions.add(new Action(Messages.VMenuEditor_AddMenuContribution, createImageDescriptor(ResourceProvider.IMG_Menu)) { + @Override + public void run() { + handleAdd(); + } + }); } @Override @@ -133,7 +128,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -160,7 +155,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -188,7 +183,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -199,7 +194,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java index e67f9f8a4a..6e31542757 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java @@ -15,9 +15,11 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.fragment.MFragmentFactory; import org.eclipse.e4.ui.model.fragment.MModelFragments; import org.eclipse.e4.ui.model.fragment.MStringModelFragment; @@ -48,8 +50,8 @@ public class VModelFragmentsEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private TableViewer viewer; - public VModelFragmentsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); + public VModelFragmentsEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); } @Override @@ -115,7 +117,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -142,7 +144,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -169,7 +171,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -188,7 +190,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java index 582d95e2b2..fde83c1d30 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java @@ -17,9 +17,11 @@ import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.fragment.MModelFragments; import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; @@ -59,8 +61,8 @@ public class VModelImportsEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private TableViewer viewer; - public VModelImportsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); + public VModelImportsEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); } @Override @@ -124,7 +126,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -151,7 +153,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -203,7 +205,7 @@ public int compare(Viewer viewer, Object e1, Object e2) { childrenDropDown.getCombo().select(0); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -222,7 +224,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java index e0a5fdc69a..9c22f94b11 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java @@ -10,17 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory; import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptorContainer; @@ -53,19 +53,14 @@ public class VPartDescriptor extends AbstractComponentEditor { private TableViewer viewer; private List actions = new ArrayList(); - public VPartDescriptor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.VPartDescriptor_AddPartDescriptor, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public VPartDescriptor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.VPartDescriptor_AddPartDescriptor, createImageDescriptor(ResourceProvider.IMG_PartDescriptor)) { + @Override + public void run() { + handleAdd(); + } + }); } @Override @@ -130,7 +125,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -157,7 +152,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -184,7 +179,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -195,7 +190,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java index 8629943ab6..1b9c6a4d01 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java @@ -10,17 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.commands.MBindingContext; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; @@ -54,19 +54,14 @@ public class VRootBindingContexts extends AbstractComponentEditor { private List actions = new ArrayList(); - public VRootBindingContexts(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.VRootBindingContexts_AddContext, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingContext.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAddContext(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public VRootBindingContexts(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.VRootBindingContexts_AddContext, createImageDescriptor(ResourceProvider.IMG_BindingContext)) { + @Override + public void run() { + handleAddContext(); + } + }); } @Override @@ -131,7 +126,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -158,7 +153,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -185,7 +180,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -196,7 +191,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java index 34b558e9bb..ddceef6aa1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java @@ -10,17 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution; import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContributions; @@ -53,19 +53,14 @@ public class VToolBarContributionsEditor extends AbstractComponentEditor { private TableViewer viewer; private List actions = new ArrayList(); - public VToolBarContributionsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.VToolBarContributionsEditor_AddToolBarContribution, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public VToolBarContributionsEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.VToolBarContributionsEditor_AddToolBarContribution, createImageDescriptor(ResourceProvider.IMG_ToolBarContribution)) { + @Override + public void run() { + handleAdd(); + } + }); } @Override @@ -130,7 +125,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -157,7 +152,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -184,7 +179,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -195,7 +190,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index c0277478ab..7ad0b72283 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -19,9 +17,11 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; @@ -60,55 +60,49 @@ public class VWindowControlEditor extends AbstractComponentEditor { private TableViewer viewer; private List actions = new ArrayList(); - public VWindowControlEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.VWindowControlEditor_AddPerspectiveStack, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK); - } - }); - - actions.add(new Action(Messages.VWindowControlEditor_AddPartSashContainer, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART_SASH_CONTAINER); - } - }); - - actions.add(new Action(Messages.VWindowControlEditor_AddPartStack, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART_STACK); - } - }); - - actions.add(new Action(Messages.VWindowControlEditor_AddPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART); - } - }); - - actions.add(new Action(Messages.VWindowControlEditor_AddInputPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART); - } - }); - - actions.add(new Action(Messages.VWindowControlEditor_AddArea, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(AdvancedPackageImpl.Literals.AREA); - } - }); - - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public VWindowControlEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.VWindowControlEditor_AddPerspectiveStack, createImageDescriptor(ResourceProvider.IMG_PerspectiveStack)) { + @Override + public void run() { + handleAdd(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddPartSashContainer, createImageDescriptor(ResourceProvider.IMG_PartSashContainer_vertical)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART_SASH_CONTAINER); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddPartStack, createImageDescriptor(ResourceProvider.IMG_PartStack)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART_STACK); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddPart, createImageDescriptor(ResourceProvider.IMG_Part)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddInputPart, createImageDescriptor(ResourceProvider.IMG_Part)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddArea, createImageDescriptor(ResourceProvider.IMG_Area_vertical)) { + @Override + public void run() { + handleAdd(AdvancedPackageImpl.Literals.AREA); + } + }); } @Override @@ -173,7 +167,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -197,7 +191,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -232,7 +226,7 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -246,7 +240,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index 462628b329..3851e6e66c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -19,9 +17,11 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; @@ -59,25 +59,20 @@ public class VWindowEditor extends AbstractComponentEditor { private TableViewer viewer; private List actions = new ArrayList(); - public VWindowEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.VWindowEditor_AddTrimmedWindow, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.TRIMMED_WINDOW); - } - }); - actions.add(new Action(Messages.VWindowEditor_AddWindow, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.WINDOW); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public VWindowEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.VWindowEditor_AddTrimmedWindow, createImageDescriptor(ResourceProvider.IMG_Window)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.TRIMMED_WINDOW); + } + }); + actions.add(new Action(Messages.VWindowEditor_AddWindow, createImageDescriptor(ResourceProvider.IMG_Window)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.WINDOW); + } + }); } @Override @@ -142,7 +137,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -166,7 +161,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -201,7 +196,7 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.TRIMMED_WINDOW)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -213,7 +208,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java index 99be98eb6d..243fdb8488 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java @@ -10,17 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.emf.common.command.Command; @@ -59,34 +59,28 @@ public class VWindowSharedElementsEditor extends AbstractComponentEditor { private TableViewer viewer; private List actions = new ArrayList(); - public VWindowSharedElementsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - - try { - actions.add(new Action(Messages.VWindowSharedElementsEditor_AddPartSashContainer, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART_SASH_CONTAINER); - } - }); - - actions.add(new Action(Messages.VWindowSharedElementsEditor_AddPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART); - } - }); - - actions.add(new Action(Messages.VWindowSharedElementsEditor_AddInputPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.INPUT_PART); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public VWindowSharedElementsEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.VWindowSharedElementsEditor_AddPartSashContainer, createImageDescriptor(ResourceProvider.IMG_PartSashContainer)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART_SASH_CONTAINER); + } + }); + + actions.add(new Action(Messages.VWindowSharedElementsEditor_AddPart, createImageDescriptor(ResourceProvider.IMG_Part)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART); + } + }); + + actions.add(new Action(Messages.VWindowSharedElementsEditor_AddInputPart, createImageDescriptor(ResourceProvider.IMG_Part)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.INPUT_PART); + } + }); } @Override @@ -155,7 +149,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -182,7 +176,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -221,7 +215,7 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -235,7 +229,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java index f6ae8da45c..298e924503 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -10,17 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; @@ -50,19 +50,14 @@ public class VWindowTrimEditor extends AbstractComponentEditor { private TableViewer viewer; private List actions = new ArrayList(); - public VWindowTrimEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.VWindowTrimEditor_AddWindowTrim, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public VWindowTrimEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.VWindowTrimEditor_AddWindowTrim, createImageDescriptor(ResourceProvider.IMG_WindowTrim)) { + @Override + public void run() { + handleAdd(); + } + }); } @Override @@ -128,7 +123,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -139,7 +134,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -160,7 +155,6 @@ public void widgetSelected(SelectionEvent e) { @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } diff --git a/bundles/org.eclipse.e4.tools.services/.project b/bundles/org.eclipse.e4.tools.services/.project index 15c52ba19e..d8bd3a0180 100644 --- a/bundles/org.eclipse.e4.tools.services/.project +++ b/bundles/org.eclipse.e4.tools.services/.project @@ -20,6 +20,11 @@ + + org.eclipse.pde.ds.core.builder + + + org.eclipse.pde.PluginNature diff --git a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF index 08d062afb0..f14d25988c 100644 --- a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF @@ -6,3 +6,12 @@ Bundle-Version: 1.0.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 Export-Package: org.eclipse.e4.tools.services Bundle-Vendor: %Bundle-Vendor +Require-Bundle: org.eclipse.swt;bundle-version="3.7.0", + org.eclipse.equinox.common;bundle-version="3.6.0", + org.eclipse.e4.core.contexts;bundle-version="0.9.0", + javax.annotation;bundle-version="1.0.0", + org.eclipse.e4.core.di;bundle-version="0.9.0", + javax.inject;bundle-version="1.0.0", + org.eclipse.osgi;bundle-version="3.7.0" +Service-Component: OSGI-INF/resourcepoolfunction.xml, OSGI-INF/resourceservice.xml +Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.e4.tools.services/OSGI-INF/resourcepoolfunction.xml b/bundles/org.eclipse.e4.tools.services/OSGI-INF/resourcepoolfunction.xml new file mode 100644 index 0000000000..ee100ccaad --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/OSGI-INF/resourcepoolfunction.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.services/OSGI-INF/resourceservice.xml b/bundles/org.eclipse.e4.tools.services/OSGI-INF/resourceservice.xml new file mode 100644 index 0000000000..3291208df3 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/OSGI-INF/resourceservice.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.services/build.properties b/bundles/org.eclipse.e4.tools.services/build.properties index b8bb95d7f8..caddfdf972 100644 --- a/bundles/org.eclipse.e4.tools.services/build.properties +++ b/bundles/org.eclipse.e4.tools.services/build.properties @@ -1,6 +1,8 @@ -source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ about.html,\ - OSGI-INF/ + OSGI-INF/,\ + OSGI-INF/resourcepoolfunction.xml,\ + OSGI-INF/resourceservice.xml +source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/AbstractBundleResourceProvider.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/AbstractBundleResourceProvider.java new file mode 100644 index 0000000000..6fda1278b5 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/AbstractBundleResourceProvider.java @@ -0,0 +1,47 @@ +package org.eclipse.e4.tools.services; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.Map; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.Path; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.osgi.framework.BundleContext; + +public abstract class AbstractBundleResourceProvider implements IResourceProviderService { + private Map properties; + private BundleContext context; + + public void activate(BundleContext context, Map properties) { + this.properties = properties; + this.context = context; + } + + public Image getImage(Display display, String key) { + URL url = FileLocator.find(context.getBundle(),new Path(properties.get(key)),null); + + if( url != null ) { + InputStream stream = null; + try { + stream = url.openStream(); + return new Image(display, stream); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } finally { + if( stream != null ) { + try { + stream.close(); + } catch (IOException e) { + } + } + } + } + + // TODO Auto-generated method stub + return null; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourcePool.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourcePool.java new file mode 100644 index 0000000000..bd06e5ea53 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourcePool.java @@ -0,0 +1,17 @@ +package org.eclipse.e4.tools.services; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; + +public interface IResourcePool { + public Image getImage(String imageKey) throws CoreException; + public Image getImageUnchecked(String imageKey); + + public Color getColor(String imageKey) throws CoreException; + public Color getColorUnchecked(String imageKey); + + public Font getFont(String imageKey) throws CoreException; + public Font getFontUnchecked(String imageKey); +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceProviderService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceProviderService.java new file mode 100644 index 0000000000..5c047d05c5 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceProviderService.java @@ -0,0 +1,10 @@ +package org.eclipse.e4.tools.services; + +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; + +public interface IResourceProviderService { + public Image getImage(Display display, String key); + public Image getFont(Display display, String key); + public Image getColor(Display display, String key); +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceService.java new file mode 100644 index 0000000000..93324df8f7 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceService.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2011 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.services; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; + +public interface IResourceService { + public interface IPooledResource { + public T getResource(); + public void dispose(); + } + + public interface IDiposeableResourcePool extends IResourcePool { + public void dispose(); + } + + public IPooledResource getImage(Display display, String key); + public IPooledResource getColor(Display display, String key); + public IPooledResource getFont(Display display, String key); + + public IDiposeableResourcePool getResourcePool(Display display); + public IResourcePool getControlPool(Control control); +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourcePoolFactory.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourcePoolFactory.java new file mode 100644 index 0000000000..1808b9f401 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourcePoolFactory.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2011 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.services.impl; + +import org.eclipse.e4.core.contexts.ContextFunction; +import org.eclipse.e4.core.contexts.ContextInjectionFactory; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.tools.services.impl.ResourceService.ResourcePool; + +@SuppressWarnings("restriction") +public class ResourcePoolFactory extends ContextFunction { + + @Override + public Object compute(IEclipseContext context) { + return ContextInjectionFactory.make(ResourcePool.class, context); + } + +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java new file mode 100644 index 0000000000..f74b4af0fe --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java @@ -0,0 +1,389 @@ +/******************************************************************************* + * Copyright (c) 2011 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.services.impl; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PreDestroy; +import javax.inject.Inject; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.e4.tools.services.IResourcePool; +import org.eclipse.e4.tools.services.IResourceProviderService; +import org.eclipse.e4.tools.services.IResourceService; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Resource; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; + +public class ResourceService implements IResourceService { + private enum Type { + IMAGE, FONT, COLOR + } + + static class PooledResource implements + IPooledResource { + private Display display; + private int count; + private T resource; + private String imageKey; + private ResourceService resourceService; + + PooledResource(Display display, ResourceService resourceService, + String imageKey, T resource) { + this.display = display; + this.imageKey = imageKey; + this.count = 1; + this.resourceService = resourceService; + this.resource = resource; + } + + public T getResource() { + return resource; + } + + public void dispose() { + this.count--; + if (this.count == 0) { + resourceService.removePooledResource(this); + if (resource != null) { + resource.dispose(); + } + resource = null; + imageKey = null; + resourceService = null; + } + } + } + + static class ResourcePool implements IDiposeableResourcePool { + private ResourceService resourceService; + + private List> pooledImages = new ArrayList>(); + private List> pooledFonts = new ArrayList>(); + private List> pooledColors = new ArrayList>(); + private Display display; + + @Inject + public ResourcePool(ResourceService resourceService, Display display) { + this.display = display; + this.resourceService = resourceService; + } + + public Image getImage(String key) throws CoreException { + if (resourceService == null) { + throw new CoreException( + new Status(IStatus.ERROR, + "org.eclipse.e4.tools.services", + "The pool is disposed")); + } + PooledResource image = null; + + for (PooledResource img : pooledImages) { + if (img.imageKey.equals(key)) { + image = img; + } + } + if (image == null) { + image = resourceService.getImage(display, key); + pooledImages.add(image); + } + + return image.getResource(); + } + + public Font getFont(String key) throws CoreException { + if (resourceService == null) { + throw new CoreException( + new Status(IStatus.ERROR, + "org.eclipse.e4.tools.services", + "The pool is disposed")); + } + + PooledResource font = null; + for (PooledResource fon : pooledFonts) { + if (fon.imageKey.equals(key)) { + font = fon; + } + } + if( font == null ) { + font = resourceService.getFont(display, key); + pooledFonts.add(font); + } + return font.getResource(); + } + + public Color getColor(String key) throws CoreException { + if (resourceService == null) { + throw new CoreException( + new Status(IStatus.ERROR, + "org.eclipse.e4.tools.services", + "The pool is disposed")); + } + PooledResource color = null; + + for (PooledResource col : pooledColors) { + if (col.imageKey.equals(key)) { + color = col; + } + } + + if( color == null ) { + color = resourceService.getColor(display, + key); + pooledColors.add(color); + } + return color.getResource(); + } + + public Image getImageUnchecked(String key) { + try { + return getImage(key); + } catch (CoreException e) { + return null; + } + } + + public Font getFontUnchecked(String key) { + try { + return getFont(key); + } catch (CoreException e) { + return null; + } + } + + public Color getColorUnchecked(String key) { + try { + return getColor(key); + } catch (CoreException e) { + return null; + } + } + + @PreDestroy + public void dispose() { + for (IPooledResource img : pooledImages) { + img.dispose(); + } + for (IPooledResource font : pooledFonts) { + font.dispose(); + } + for (IPooledResource col : pooledColors) { + col.dispose(); + } + resourceService = null; + pooledImages = null; + pooledFonts = null; + pooledColors = null; + } + } + + static class DisplayPool { + private Map> imagePool; + private Map> colorPool; + private Map> fontPool; + + public Map> getColorPool() { + if (colorPool == null) { + colorPool = new HashMap>(); + } + return colorPool; + } + + public Map> getImagePool() { + if (imagePool == null) { + imagePool = new HashMap>(); + } + return imagePool; + } + + public Map> getFontPool() { + if (fontPool == null) { + fontPool = new HashMap>(); + } + return fontPool; + } + } + + private Map displayPool = new HashMap(); + // private Map imagekey2providers = new + // HashMap(); + // private Map fontkey2providers = new + // HashMap(); + // private Map colorkey2providers = new + // HashMap(); + private BundleContext context; + + public ResourceService() { + Bundle b = FrameworkUtil.getBundle(ResourceService.class); + context = b.getBundleContext(); + } + + protected void removePooledResource(PooledResource resource) { + if (resource.getResource() instanceof Image) { + displayPool.get(resource.display).getImagePool().remove(resource); + } else if (resource.getResource() instanceof Color) { + displayPool.get(resource.display).getColorPool().remove(resource); + } else if (resource.getResource() instanceof Font) { + displayPool.get(resource.display).getFontPool().remove(resource); + } + } + + @SuppressWarnings("unchecked") + private PooledResource loadResource( + Display display, String key, Type type) { + DisplayPool p = displayPool.get(display); + PooledResource resource = null; + + if (p != null) { + if (type == Type.IMAGE) { + resource = (PooledResource) p.getImagePool().get(key); + } else if (type == Type.COLOR) { + resource = (PooledResource) p.getColorPool().get(key); + } else { + resource = (PooledResource) p.getFontPool().get(key); + } + } + + if (resource != null) { + resource.count++; + } else { + resource = new PooledResource(display, this, key, + (R) lookupResource(display, key, type)); + + if (p == null) { + p = new DisplayPool(); + displayPool.put(display, p); + } + + if (type == Type.IMAGE) { + p.getImagePool().put(key, (PooledResource) resource); + } else if (type == Type.COLOR) { + p.getColorPool().put(key, (PooledResource) resource); + } else { + p.getFontPool().put(key, (PooledResource) resource); + } + + } + + return resource; + } + + @SuppressWarnings("unchecked") + private R lookupResource(Display display, String key, Type type) { + + if (type == Type.IMAGE) { + IResourceProviderService provider = lookupOSGI(key); + if (provider != null) { + return (R) provider.getImage(display, key); + } + } else if (type == Type.COLOR) { + IResourceProviderService provider = lookupOSGI(key); + if (provider != null) { + return (R) provider.getColor(display, key); + } + + } else { + IResourceProviderService provider = lookupOSGI(key); + if (provider != null) { + return (R) provider.getFont(display, key); + } + } + throw new IllegalArgumentException("No provider known for '" + key + + "'."); + } + + private IResourceProviderService lookupOSGI(String key) { + try { + Collection> refs = context + .getServiceReferences(IResourceProviderService.class, "(" + + key + "=*)"); + if (!refs.isEmpty()) { + ServiceReference ref = refs + .iterator().next(); + return context.getService(ref); + } + } catch (InvalidSyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } + + // public void addProvider(IResourceProviderService provider, + // Map map) { + // for (Entry e : map.entrySet()) { + // if( e.getKey().startsWith("IMAGE") ) { + // imagekey2providers.put(e.getKey(), provider); + // } else if( e.getKey().startsWith("FONT") ) { + // fontkey2providers.put(e.getKey(), provider); + // } else if( e.getKey().startsWith("COLOR") ) { + // colorkey2providers.put(e.getKey(), provider); + // } + // } + // } + // + // public void removeProvider(IResourceProviderService provider, + // Map map) { + // for (Entry e : map.entrySet()) { + // if( e.getKey().startsWith("IMAGE") ) { + // imagekey2providers.remove(e.getKey()); + // } else if( e.getKey().startsWith("FONT") ) { + // fontkey2providers.remove(e.getKey()); + // } else if( e.getKey().startsWith("COLOR") ) { + // colorkey2providers.remove(e.getKey()); + // } + // } + // } + + public PooledResource getImage(Display display, String key) { + return loadResource(display, key, Type.IMAGE); + } + + public PooledResource getColor(Display display, String key) { + return loadResource(display, key, Type.COLOR); + } + + public PooledResource getFont(Display display, String key) { + return loadResource(display, key, Type.FONT); + } + + public IDiposeableResourcePool getResourcePool(Display display) { + return new ResourcePool(this, display); + } + + public IResourcePool getControlPool(Control control) { + final ResourcePool pool = new ResourcePool(this, control.getDisplay()); + control.addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + pool.dispose(); + } + }); + return pool; + } + +} From b3be5bff75c7f1fb2b03dd4036a7523c91d8df0d Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 8 Jan 2011 13:13:21 +0000 Subject: [PATCH 0287/1286] Bug 321132 - [ModelTooling] AbstractComponentEditor needs to dispose its images on bundle shutdown --- .../emf/ui/internal/common/ModelEditor.java | 10 ++---- .../virtual/VTrimContributionsEditor.java | 33 ++++++++----------- .../internal/wbm/ApplicationModelEditor.java | 8 ++--- 3 files changed, 21 insertions(+), 30 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 7e44276b50..9b8ee232ec 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -51,6 +51,7 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.ShadowComposite; import org.eclipse.e4.tools.emf.ui.internal.common.component.AddonsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ApplicationEditor; @@ -168,7 +169,6 @@ import org.eclipse.swt.dnd.TransferData; import org.eclipse.swt.events.ControlAdapter; import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridData; @@ -215,8 +215,6 @@ public class ModelEditor { private boolean fragment; private Handler clipboardHandler; - private Image removeIcon; - @Inject @Optional private IClipboardService clipboardService; @@ -237,14 +235,13 @@ public class ModelEditor { private final IResourcePool resourcePool; - public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project, IResourcePool resourcePool) { + public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project, final IResourcePool resourcePool) { this.resourcePool = resourcePool; this.modelProvider = modelProvider; this.project = project; this.context = context; this.context.set(ModelEditor.class, this); this.obsManager = new ObservablesManager(); - this.removeIcon = new Image(composite.getDisplay(), ModelEditor.class.getResourceAsStream("/icons/full/obj16/cross.png")); registerDefaultEditors(); registerVirtualEditors(); @@ -386,7 +383,7 @@ public void menuAboutToShow(IMenuManager manager) { } if (o.eContainer() != null) { - actions.add(new Action(Messages.ModelEditor_Delete, ImageDescriptor.createFromImage(removeIcon)) { + actions.add(new Action(Messages.ModelEditor_Delete, ImageDescriptor.createFromImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_cross))) { public void run() { if (o.eContainingFeature().isMany()) { Command cmd = RemoveCommand.create(ModelEditor.this.modelProvider.getEditingDomain(), o.eContainer(), o.eContainingFeature(), o); @@ -763,7 +760,6 @@ public void setFocus() { @PreDestroy void dispose() { try { - removeIcon.dispose(); obsManager.dispose(); } catch (Exception e) { // TODO: handle exception diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java index 6aec00c547..4b47525409 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java @@ -10,17 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.e4.ui.model.application.ui.menu.MTrimContribution; import org.eclipse.e4.ui.model.application.ui.menu.MTrimContributions; @@ -53,19 +53,14 @@ public class VTrimContributionsEditor extends AbstractComponentEditor { private TableViewer viewer; private List actions = new ArrayList(); - public VTrimContributionsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - try { - actions.add(new Action(Messages.VTrimContributionsEditor_AddTrimContribution, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif"))) { //$NON-NLS-1$ - @Override - public void run() { - handleAdd(); - } - }); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public VTrimContributionsEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { + super(editingDomain, editor, resourcePool); + actions.add(new Action(Messages.VTrimContributionsEditor_AddTrimContribution, createImageDescriptor(ResourceProvider.IMG_TrimContribution)) { + @Override + public void run() { + handleAdd(); + } + }); } @Override @@ -130,7 +125,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -157,7 +152,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -184,7 +179,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override @@ -195,7 +190,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java index 60a2ae91af..162f84d57b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java @@ -17,12 +17,12 @@ import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.swt.widgets.Composite; public class ApplicationModelEditor extends ModelEditor { @Inject - public ApplicationModelEditor(Composite composite, IEclipseContext context, - IModelResource modelProvider, @Named("org.eclipse.e4.tools.emf.ui.editorproject") @Optional IProject project) { - super(composite, context, modelProvider, project); + public ApplicationModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, @Named("org.eclipse.e4.tools.emf.ui.editorproject") @Optional IProject project, IResourcePool resourcePool) { + super(composite, context, modelProvider, project, resourcePool); } -} +} From 8b59ee029fc80582bc154ce2ffb11cce84e7dd16 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 29 Jan 2011 00:23:41 +0000 Subject: [PATCH 0288/1286] Merging back changes --- .../tools/emf/editor3x/XMIModelResource.java | 118 -- .../META-INF/MANIFEST.MF | 3 +- .../OSGI-INF/images.properties | 3 + .../icons/full/obj16/application_form.png | Bin 0 -> 467 bytes .../icons/full/obj16/chart_organisation.png | Bin 0 -> 444 bytes .../icons/full/obj16/error_obj.gif | Bin 0 -> 339 bytes .../ui/common/CommandToStringConverter.java | 4 +- .../tools/emf/ui/common/IModelResource.java | 13 +- .../e4/tools/emf/ui/common/ImageTooltip.java | 5 +- .../tools/emf/ui/common/XMIModelResource.java | 24 +- .../component/AbstractComponentEditor.java | 19 +- .../e4/tools/emf/ui/internal/Messages.java | 1150 ++++++++--------- .../tools/emf/ui/internal/Messages.properties | 4 +- .../emf/ui/internal/ResourceProvider.java | 3 + .../common/ComponentLabelProvider.java | 5 +- .../emf/ui/internal/common/ModelEditor.java | 258 ++-- .../common/component/AddonsEditor.java | 24 +- .../common/component/ApplicationEditor.java | 13 +- .../internal/common/component/AreaEditor.java | 25 +- .../component/BindingContextEditor.java | 19 +- .../common/component/BindingTableEditor.java | 21 +- .../common/component/CategoryEditor.java | 14 +- .../common/component/CommandEditor.java | 23 +- .../component/CommandParameterEditor.java | 12 +- .../common/component/ControlFactory.java | 10 +- .../component/CoreExpressionEditor.java | 12 +- .../component/DirectMenuItemEditor.java | 13 +- .../component/DirectToolItemEditor.java | 13 +- .../component/HandledMenuItemEditor.java | 19 +- .../component/HandledToolItemEditor.java | 19 +- .../common/component/HandlerEditor.java | 32 +- .../common/component/InputPartEditor.java | 10 +- .../common/component/KeyBindingEditor.java | 30 +- .../component/MenuContributionEditor.java | 17 +- .../internal/common/component/MenuEditor.java | 34 +- .../common/component/MenuItemEditor.java | 35 +- .../common/component/MenuSeparatorEditor.java | 14 +- .../component/ModelFragmentsEditor.java | 13 +- .../common/component/ParameterEditor.java | 12 +- .../component/PartDescriptorEditor.java | 20 +- .../internal/common/component/PartEditor.java | 34 +- .../component/PartSashContainerEditor.java | 21 +- .../common/component/PartStackEditor.java | 21 +- .../common/component/PerspectiveEditor.java | 36 +- .../component/PerspectiveStackEditor.java | 21 +- .../common/component/PlaceholderEditor.java | 21 +- .../common/component/PopupMenuEditor.java | 15 +- .../common/component/RenderedMenuEditor.java | 10 +- .../common/component/RenderedMenuItem.java | 10 +- .../component/RenderedToolBarEditor.java | 9 +- .../common/component/StringModelFragment.java | 16 +- .../component/ToolBarContributionEditor.java | 16 +- .../common/component/ToolBarEditor.java | 19 +- .../component/ToolBarSeparatorEditor.java | 18 +- .../common/component/ToolControlEditor.java | 25 +- .../common/component/ToolItemEditor.java | 35 +- .../common/component/TrimBarEditor.java | 25 +- .../component/TrimContributionEditor.java | 16 +- .../common/component/TrimmedWindowEditor.java | 9 +- .../common/component/WindowEditor.java | 35 +- .../AbstractCommandSelectionDialog.java | 4 +- .../component/dialogs/AbstractIconDialog.java | 5 +- .../dialogs/AreaIconDialogEditor.java | 4 +- .../BindingContextSelectionDialog.java | 4 +- .../CommandCategorySelectionDialog.java | 4 +- .../dialogs/ContributionClassDialog.java | 4 +- .../component/dialogs/ExpressionIdDialog.java | 4 +- .../dialogs/FeatureSelectionDialog.java | 4 +- .../dialogs/FindImportElementDialog.java | 4 +- .../FindParentReferenceElementDialog.java | 4 +- ...HandledMenuItemCommandSelectionDialog.java | 4 +- ...HandledToolItemCommandSelectionDialog.java | 4 +- .../HandlerCommandSelectionDialog.java | 4 +- .../KeyBindingCommandSelectionDialog.java | 4 +- .../dialogs/MenuIconDialogEditor.java | 4 +- .../dialogs/MenuItemIconDialogEditor.java | 4 +- .../PartDescriptorIconDialogEditor.java | 4 +- .../dialogs/PartIconDialogEditor.java | 4 +- .../dialogs/PerspectiveIconDialogEditor.java | 4 +- .../dialogs/SharedElementsDialog.java | 4 +- .../dialogs/ToolItemIconDialogEditor.java | 4 +- .../dialogs/WindowIconDialogEditor.java | 4 +- .../component/virtual/VApplicationAddons.java | 17 +- .../virtual/VApplicationCategoriesEditor.java | 17 +- .../virtual/VBindingTableEditor.java | 17 +- .../component/virtual/VCommandEditor.java | 20 +- .../component/virtual/VHandlerEditor.java | 17 +- .../virtual/VItemParametersEditor.java | 17 +- .../virtual/VMenuContributionsEditor.java | 17 +- .../common/component/virtual/VMenuEditor.java | 15 +- .../virtual/VModelFragmentsEditor.java | 12 +- .../virtual/VModelImportsEditor.java | 12 +- .../component/virtual/VPartDescriptor.java | 17 +- .../virtual/VPartDescriptorMenuEditor.java | 11 + .../component/virtual/VPartMenuEditor.java | 12 + .../virtual/VRootBindingContexts.java | 17 +- .../virtual/VToolBarContributionsEditor.java | 17 +- .../virtual/VTrimContributionsEditor.java | 17 +- .../virtual/VWindowControlEditor.java | 17 +- .../component/virtual/VWindowEditor.java | 17 +- .../virtual/VWindowSharedElementsEditor.java | 17 +- .../component/virtual/VWindowTrimEditor.java | 17 +- .../internal/common/xml/AnnotationAccess.java | 61 + .../ui/internal/common/xml/ColorManager.java | 38 + .../xml/EMFDocumentResourceMediator.java | 94 ++ .../common/xml/IXMLColorConstants.java | 21 + .../xml/NonRuleBasedDamagerRepairer.java | 148 +++ .../emf/ui/internal/common/xml/TagRule.java | 41 + .../internal/common/xml/XMLConfiguration.java | 77 ++ .../common/xml/XMLDoubleClickStrategy.java | 125 ++ .../common/xml/XMLPartitionScanner.java | 35 + .../ui/internal/common/xml/XMLScanner.java | 34 + .../ui/internal/common/xml/XMLTagScanner.java | 37 + .../common/xml/XMLWhitespaceDetector.java | 20 + .../META-INF/MANIFEST.MF | 5 +- .../OSGI-INF/messagefactoryservice.xml | 7 + .../OSGI-INF/translationsupplier.xml | 8 + .../build.properties | 4 +- .../services/IMessageFactoryService.java | 6 + .../eclipse/e4/tools/services/Message.java | 9 + .../e4/tools/services/Translation.java | 16 + .../impl/MessageFactoryServiceImpl.java | 139 ++ .../PropertiesBundleTranslationProvider.java | 223 ++++ .../impl/TranslationObjectSupplier.java | 67 + 124 files changed, 2726 insertions(+), 1373 deletions(-) delete mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/application_form.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/chart_organisation.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/error_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptorMenuEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartMenuEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/AnnotationAccess.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/ColorManager.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/EMFDocumentResourceMediator.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/IXMLColorConstants.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/NonRuleBasedDamagerRepairer.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/TagRule.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLConfiguration.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLDoubleClickStrategy.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLPartitionScanner.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLScanner.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLTagScanner.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLWhitespaceDetector.java create mode 100644 bundles/org.eclipse.e4.tools.services/OSGI-INF/messagefactoryservice.xml create mode 100644 bundles/org.eclipse.e4.tools.services/OSGI-INF/translationsupplier.xml create mode 100644 bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IMessageFactoryService.java create mode 100644 bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/Message.java create mode 100644 bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/Translation.java create mode 100644 bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/MessageFactoryServiceImpl.java create mode 100644 bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/PropertiesBundleTranslationProvider.java create mode 100644 bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/TranslationObjectSupplier.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java deleted file mode 100644 index a19ed76ddb..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x; - -import java.util.ArrayList; -import java.util.EventObject; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.ui.internal.workbench.E4XMIResourceFactory; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.common.command.CommandStackListener; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; - -@SuppressWarnings("restriction") -public class XMIModelResource implements IModelResource { - private EditingDomain editingDomain; - private Resource resource; - private List listeners = new ArrayList(); - private boolean dirty; - - - public XMIModelResource(URI uri) { - ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - ResourceSet resourceSet = new ResourceSetImpl(); - BasicCommandStack commandStack = new BasicCommandStack(); - commandStack.addCommandStackListener(new CommandStackListener() { - - public void commandStackChanged(EventObject event) { - dirty = true; - fireDirtyChanged(); - fireCommandStackChanged(); - } - }); - editingDomain = new AdapterFactoryEditingDomain(adapterFactory, - commandStack, resourceSet); - resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap() - .put(Resource.Factory.Registry.DEFAULT_EXTENSION, - new E4XMIResourceFactory()); - resource = resourceSet.getResource(uri, true); - } - - public IObservableList getRoot() { - WritableList list = new WritableList(); - list.add(resource.getContents().get(0)); - return list; - } - - public EditingDomain getEditingDomain() { - return editingDomain; - } - - public boolean isSaveable() { - return true; - } - - public void addModelListener(ModelListener listener) { - listeners.add(listener); - } - - public void removeModelListener(ModelListener listener) { - listeners.remove(listener); - } - - public boolean isDirty() { - return dirty && getEditingDomain().getCommandStack().canUndo(); - } - - private void fireDirtyChanged() { - for( ModelListener listener : listeners ) { - listener.dirtyChanged(); - } - } - - private void fireCommandStackChanged() { - for( ModelListener listener : listeners ) { - listener.commandStackChanged(); - } - } - - public IStatus save() { - Map map = new HashMap(); - try { - resource.save(map); - editingDomain.getCommandStack().flush(); - dirty = false; - fireDirtyChanged(); - fireCommandStackChanged(); - } catch (Exception e) { - // TODO: handle exception - e.printStackTrace(); - } - - return Status.OK_STATUS; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 252f2ad402..8af951f288 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -28,7 +28,8 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.e4.ui.di;bundle-version="0.9.0", javax.annotation;bundle-version="1.0.0", org.eclipse.e4.tools.services;bundle-version="1.0.0", - org.eclipse.e4.core.di.extensions;bundle-version="0.9.0" + org.eclipse.e4.core.di.extensions;bundle-version="0.9.0", + org.eclipse.jface.text;bundle-version="3.7.0" Bundle-ActivationPolicy: lazy Import-Package: javax.inject;version="1.0.0", org.eclipse.core.runtime.jobs, diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/images.properties b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/images.properties index f38970e7fb..471396af6b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/images.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/images.properties @@ -81,6 +81,9 @@ IMG_org.eclipse.e4.tools.emf.ui.obj16.headermenu=/icons/full/obj16/headermenu.pn IMG_org.eclipse.e4.tools.emf.ui.obj16.table_add=/icons/full/obj16/table_add.png IMG_org.eclipse.e4.tools.emf.ui.obj16.table_delete=/icons/full/obj16/table_delete.png IMG_org.eclipse.e4.tools.emf.ui.obj16.zoom=/icons/full/obj16/zoom.png +IMG_org.eclipse.e4.tools.emf.ui.obj16.application_form=/icons/full/obj16/application_form.png +IMG_org.eclipse.e4.tools.emf.ui.obj16.chart_organisation=/icons/full/obj16/chart_organisation.png +IMG_org.eclipse.e4.tools.emf.ui.obj16.error_obj=/icons/full/obj16/error_obj.gif IMG_org.eclipse.e4.tools.emf.ui.wizban.fieldrefact_wiz=/icons/full/wizban/fieldrefact_wiz.png IMG_org.eclipse.e4.tools.emf.ui.wizban.import_wiz=/icons/full/wizban/import_wiz.png diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/application_form.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/application_form.png new file mode 100644 index 0000000000000000000000000000000000000000..807b862cfc087b70dcdd971af3ac92688484e998 GIT binary patch literal 467 zcmV;^0WAKBP)4nWfMy23V#h*$3p-!?D%AI~T5+JJ;5Qi)|`;Y?)XOj2U`VS70o zp1%L~Y4f1;U-b7MEOk38OU$EtImvzCpiEkKCg)@3^{;h@nc_6NuOBn7?ZF9Ev4w3+ zWiSxI_v2&k@_b{1R8kdeGLx;rFK&F@c}mqZ4YwJO$7q^VC6&nL^Y#-6g9F*zM-oa= z70W0^1X#=%!t{DQE-wCJ^Pd1r08&yFDUlL$EtoM3e+;?Hv-Nc(QI%=il9}v$`OS^N z)(TbAG~DLw><`m+N>!Xf5_@kR0j83~eKLh5sv-%=fC#``TU}jaG#UW`VS>Ph2!jLJ zROR&N$x3B;J002ov JPDHLkV1im=zqF_A89qTKGV%LqLqA&{k|D2>yV7qLmg~*x1@cbjz3zP!z2FhV16<-TNNz zuIz$fLNt0{xWmll%$dUkM1*+|PHJ2ZGvdmC35A3UoF6R(-~DS$BH+@Xy#VYsLyQ>z zxq>v8$ny|FSR~0W2u4ic`k5mcbEIiLksz4Y#KyE{9LLn}_oq&%6$}Oga?Zh83$3-^ zU4V1$eaMkz85m>bTh*c{3ch%tltQ=L4Q7$u>-Ff*JP6K)r(~Ul_41v6uR1rSij#*! zl14&E?hS3Iagod#Oo#p}d7WbijUO{Mqc5?@<$>unxw*22 z?bQuGkPsSMOgEm)qR1=cLLyZOm>T65_V?)|o0p=i_uUiST44Cz-W mqJp!8r`H!$*8T4x&4Leh&Epbde3h>N00004 z&?^&f5)>{J;LlXy?-r listeners = new ArrayList(); private boolean dirty; + private IObservableList list; public XMIModelResource(URI uri) { ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); @@ -54,11 +61,22 @@ public void commandStackChanged(EventObject event) { } public IObservableList getRoot() { - WritableList list = new WritableList(); - list.add(resource.getContents().get(0)); + if (list != null) { + return list; + } + + list = EMFEditProperties.resource(getEditingDomain()).observe(resource); + return list; } + public void replaceRoot(EObject eobject) { + Command cmdRemove = new RemoveCommand(getEditingDomain(), resource.getContents(), list.get(0)); + Command cmdAdd = new AddCommand(getEditingDomain(), resource.getContents(), eobject); + CompoundCommand cmd = new CompoundCommand(Arrays.asList(cmdRemove, cmdAdd)); + getEditingDomain().getCommandStack().execute(cmd); + } + public EditingDomain getEditingDomain() { return editingDomain; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index d1971b58cd..5786d640f7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -12,11 +12,14 @@ import java.util.Collections; import java.util.List; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.services.IResourcePool; +import org.eclipse.e4.tools.services.Translation; import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.ecore.EObject; @@ -28,8 +31,6 @@ import org.eclipse.swt.widgets.Display; public abstract class AbstractComponentEditor { - private EditingDomain editingDomain; - private WritableValue master = new WritableValue(); public static final int SEARCH_IMAGE = 0; @@ -40,14 +41,16 @@ public abstract class AbstractComponentEditor { protected static final int VERTICAL_LIST_WIDGET_INDENT = 10; + @Inject + private EditingDomain editingDomain; + @Inject private ModelEditor editor; - private final IResourcePool resourcePool; + @Inject + private IResourcePool resourcePool; - public AbstractComponentEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - this.editingDomain = editingDomain; - this.editor = editor; - this.resourcePool = resourcePool; - } + @Inject + @Translation + protected Messages Messages; public EditingDomain getEditingDomain() { return editingDomain; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index ee83fd605c..63be298c7b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -10,580 +10,576 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal; -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - - public static String ModelTooling_Common_Up; - public static String ModelTooling_Common_Down; - public static String ModelTooling_Common_AddEllipsis; - public static String ModelTooling_Common_Add; - public static String ModelTooling_Common_Remove; - public static String ModelTooling_Common_Id; - public static String ModelTooling_Common_RefId; - public static String ModelTooling_Common_FindEllipsis; - - public static String ModelTooling_UIElement_ToBeRendered; - public static String ModelTooling_UIElement_Visible; - public static String ModelTooling_UIElement_VisibleWhen; - public static String ModelTooling_UIElement_AccessibilityPhrase; - - public static String ModelTooling_Context_Variables; - public static String ModelTooling_Context_Properties; - - public static String ModelTooling_ApplicationElement_Tags; - public static String ModelTooling_Contribution_PersistedState; - - public static String AbstractCommandSelectionDialog_Label_CommandId; - - public static String ApplicationEditor_Label; - public static String ApplicationEditor_Description; - public static String ApplicationEditor_Handlers; - public static String ApplicationEditor_PartDescriptors; - public static String ApplicationEditor_BindingTables; - public static String ApplicationEditor_Commands; - public static String ApplicationEditor_Windows; - public static String ApplicationEditor_Addons; - public static String ApplicationEditor_MenuContributions; - public static String ApplicationEditor_ToolBarContributions; - public static String ApplicationEditor_TrimContributions; - public static String ApplicationEditor_RootContexts; - public static String ApplicationEditor_BindingContexts; - public static String ApplicationEditor_Categories; - - public static String BindingTableEditor_Label; - public static String BindingTableEditor_Description; - public static String BindingTableEditor_ContextId; - public static String BindingTableEditor_Keybindings; - public static String BindingTableEditor_KeySequence; - public static String BindingTableEditor_Command; - public static String BindingTableEditor_AddKeyBinding; - - public static String CommandEditor_Label; - public static String CommandEditor_Description; - public static String CommandEditor_Name; - public static String CommandEditor_LabelDescription; - public static String CommandEditor_Parameters; - public static String CommandEditor_ParameterName; - public static String CommandEditor_ParameterTypeId; - public static String CommandEditor_ParameterOptional; - public static String CommandEditor_ParameterOptional_No; - public static String CommandEditor_ParameterOptional_Yes; - public static String CommandEditor_ParameterId; - public static String CommandEditor_Category; - public static String CommandEditor_AddCommandParameter; - - public static String DirectMenuItemEditor_Label; - public static String DirectMenuItemEditor_Description; - public static String DirectMenuItemEditor_ClassURI; - - public static String ControlFactory_Key; - public static String ControlFactory_Value; - public static String ControlFactory_KeyValueShellTitle; - - public static String DirectToolItemEditor_ClassURI; - public static String DirectToolItemEditor_Label; - public static String DirectToolItemEditor_Description; - - public static String HandledMenuItemEditor_Label; - public static String HandledMenuItemEditor_Description; - public static String HandledMenuItemEditor_Command; - public static String HandledMenuItemEditor_Parameters; - public static String HandledMenuItemEditor_Tag; - public static String HandledMenuItemEditor_Value; - - public static String HandledToolItemEditor_Command; - public static String HandledToolItemEditor_Parameters; - public static String HandledToolItemEditor_ParametersName; - public static String HandledToolItemEditor_ParametersValue; - public static String HandledToolItemEditor_Label; - public static String HandledToolItemEditor_Description; - - public static String HandlerEditor_Label; - public static String HandlerEditor_Description; - public static String HandlerEditor_Command; - public static String HandlerEditor_ClassURI; - - public static String InputPartEditor_Label; - public static String InputPartEditor_InputURI; - - public static String KeyBindingEditor_Label; - public static String KeyBindingEditor_Description; - public static String KeyBindingEditor_Sequence; - public static String KeyBindingEditor_Command; - public static String KeyBindingEditor_Parameters; - public static String KeyBindingEditor_SequenceNotComplete; - public static String KeyBindingEditor_SequenceEmpty; - public static String KeyBindingEditor_AddParameter; - - public static String MenuEditor_Label; - public static String MenuEditor_Description; - public static String MenuEditor_MenuItems; - public static String MenuEditor_MenuItemType; - public static String MenuEditor_MenuItemItemType; - public static String MenuEditor_HandledMenuItem; - public static String MenuEditor_Separator; - public static String MenuEditor_Menu; - public static String MenuEditor_DirectMenuItem; - public static String MenuEditor_LabelLabel; - public static String MenuEditor_Tooltip; - public static String MenuEditor_IconURI; - public static String MenuEditor_Children; - public static String MenuEditor_Mnemonics; - public static String MenuEditor_AddHandledMenuItem; - public static String MenuEditor_AddMenu; - public static String MenuEditor_AddDirectMenuItem; - public static String MenuEditor_AddSeparator; - - public static String MenuItemEditor_Type; - public static String MenuItemEditor_Label; - public static String MenuItemEditor_Tooltip; - public static String MenuItemEditor_IconURI; - public static String MenuEditor_MainMenu; - public static String MenuItemEditor_Enabled; - public static String MenuItemEditor_Selected; - public static String MenuItemEditor_Mnemonics; - public static String MenuItemEditor_NoExpression; - - public static String MenuSeparatorEditor_Label; - - public static String PartDescriptorEditor_Label; - public static String PartDescriptorEditor_Descriptor; - public static String PartDescriptorEditor_LabelLabel; - public static String PartDescriptorEditor_Tooltip; - public static String PartDescriptorEditor_IconURI; - public static String PartDescriptorEditor_ClassURI; - public static String PartDescriptorEditor_Dirtyable; - public static String PartDescriptorEditor_Closeable; - public static String PartDescriptorEditor_Multiple; - public static String PartDescriptorEditor_Category; - public static String PartDescriptorEditor_Variables; - public static String PartDescriptorEditor_Properties; - public static String PartDescriptorEditor_PropertiesKey; - public static String PartDescriptorEditor_PropertiesValue; - public static String PartDescriptorEditor_Menus; - public static String PartDescriptorEditor_Handlers; - public static String PartDescriptorEditor_ContainerData; - - public static String PartEditor_Label; - public static String PartEditor_Description; - public static String PartEditor_LabelLabel; - public static String PartEditor_Tooltip; - public static String PartEditor_IconURI; - public static String PartEditor_ClassURI; - public static String PartEditor_Closeable; - public static String PartEditor_Menus; - public static String PartEditor_Handlers; - public static String PartEditor_ContainerData; - public static String PartEditor_ToolBar; - public static String PartEditor_BindingContexts; - - public static String PartSashContainerEditor_Label; - public static String PartSashContainerEditor_Description; - public static String PartSashContainerEditor_Orientation; - public static String PartSashContainerEditor_Vertical; - public static String PartSashContainerEditor_Horizontal; - public static String PartSashContainerEditor_SelectedElement; - public static String PartSashContainerEditor_Controls; - public static String PartSashContainerEditor_ContainerData; - public static String PartSashContainerEditor_AddPartSashContainer; - public static String PartSashContainerEditor_AddPartStack; - public static String PartSashContainerEditor_AddPart; - public static String PartSashContainerEditor_AddInputPart; - public static String PartSashContainerEditor_AddArea; - public static String PartSashContainerEditor_AddPlaceholder; - - public static String PartStackEditor_Label; - public static String PartStackEditor_Description; - public static String PartStackEditor_SelectedElement; - public static String PartStackEditor_Parts; - public static String PartStackEditor_ContainerData; - public static String PartStackEditor_AddPart; - public static String PartStackEditor_AddInputPart; - public static String PartStackEditor_AddPlaceholder; - - public static String PerspectiveEditor_Label; - public static String PerspectiveEditor_Description; - public static String PerspectiveEditor_LabelLabel; - public static String PerspectiveEditor_SelectedElement; - public static String PerspectiveEditor_Tooltip; - public static String PerspectiveEditor_IconURI; - public static String PerspectiveEditor_Controls; - public static String PerspectiveEditor_AddPartSashContainer; - public static String PerspectiveEditor_AddPartStack; - public static String PerspectiveEditor_AddPart; - public static String PerspectiveEditor_AddInputPart; - public static String PerspectiveEditor_AddArea; - public static String PerspectiveEditor_AddPlaceholder; - - public static String PerspectiveStackEditor_Perspectives; - public static String PerspectiveStackEditor_Label; - public static String PerspectiveStackEditor_Description; - public static String PerspectiveStackEditor_SelectedElement; - public static String PerspectiveStackEditor_AddPerspective; - - public static String PlaceholderEditor_Label; - public static String PlaceholderEditor_Descriptor; - public static String PlaceholderEditor_Reference; - - public static String ToolBarEditor_Label; - public static String ToolBarEditor_Description; - public static String ToolBarEditor_ToolbarItems; - public static String ToolBarEditor_ToolbarItemsType; - public static String ToolBarEditor_ToolbarItemsItemType; - public static String ToolBarEditor_HandledToolItem; - public static String ToolBarEditor_DirectToolItem; - public static String ToolBarEditor_ToolControl; - public static String ToolBarEditor_Separator; - public static String ToolBarEditor_AddHandledToolItem; - public static String ToolBarEditor_AddDirectToolItem; - public static String ToolBarEditor_AddToolControl; - public static String ToolBarEditor_AddToolBarSeparator; - - public static String ToolBarSeparatorEditor_Label; - - public static String ToolControlEditor_Label; - public static String ToolControlEditor_Description; - public static String ToolControlEditor_ClassURI; - - public static String VBindingTableEditor_Label; - public static String VBindingTableEditor_Description; - public static String VBindingTableEditor_Contexts; - public static String VBindingTableEditor_Name; - public static String VBindingTableEditor_LabelDescription; - public static String VBindingTableEditor_BindingTables; - public static String VBindingTableEditor_AddBindingTable; - - public static String AddonsEditor_ClassURI; - public static String AddonsEditor_TreeLabel; - public static String AddonsEditor_TreeLabelDescription; - public static String AddonsEditor_Tags; - - public static String ContributionClassDialog_DialogMessage; - public static String ContributionClassDialog_DialogTitle; - public static String ContributionClassDialog_Label_Classname; - public static String ContributionClassDialog_ShellTitle; - - public static String MenuContributionEditor_MenuItems; - public static String MenuContributionEditor_MenuItemType; - public static String MenuContributionEditor_MenuItemItemType; - public static String MenuContributionEditor_HandledMenuItem; - public static String MenuContributionEditor_Separator; - public static String MenuContributionEditor_Menu; - public static String MenuContributionEditor_DirectMenuItem; - public static String MenuContributionEditor_ParentId; - public static String MenuContributionEditor_Position; - public static String MenuContributionEditor_TreeLabel; - public static String MenuContributionEditor_TreeLabelDescription; - - public static String ModelFragmentsEditor_ModelFragments; - public static String ModelFragmentsEditor_Label; - public static String ModelFragmentsEditor_Description; - public static String ModelFragmentsEditor_Imports; - - public static String StringModelFragment_Label; - public static String StringModelFragment_Description; - public static String StringModelFragment_Featurename; - public static String StringModelFragment_ParentId; - public static String StringModelFragment_PositionInList; - public static String StringModelFragment_Elements; - - public static String FeatureSelectionDialog_Filter; - public static String FeatureSelectionDialog_ShellTitle; - public static String FeatureSelectionDialog_DialogTitle; - public static String FeatureSelectionDialog_DialogMessage; - - public static String CategoryEditor_TreeLabel; - public static String CategoryEditor_TreeLabelDescriptor; - public static String CategoryEditor_Name; - public static String CategoryEditor_Description; - public static String CategoryEditor_Tags; - - public static String CommandCategorySelectionDialog_LabelCategoryId; - - public static String BindingContextSelectionDialog_LabelContextId; - - public static String ComponentLabelProvider_invisible; - public static String ComponentLabelProvider_notrendered; - - public static String BindingContextEditor_TreeLabel; - public static String BindingContextEditor_TreeLabelDescription; - public static String BindingContextEditor_Name; - public static String BindingContextEditor_Description; - public static String BindingContextEditor_Subcontexts; - public static String BindingContextEditor_AddContext; - - public static String CommandParameterEditor_TreeLabel; - public static String CommandParameterEditor_TreeLabelDescritpion; - public static String CommandParameterEditor_Name; - public static String CommandParameterEditor_TypeId; - public static String CommandParameterEditor_Optional; - - public static String ParameterEditor_TreeLabel; - public static String ParameterEditor_TreeLabelDescription; - public static String ParameterEditor_Name; - public static String ParameterEditor_Value; - - public static String PopupMenuEditor_TreeLabel; - public static String PopupMenuEditor_TreeLabelDescription; - - public static String RenderedMenuEditor_TreeLabel; - - public static String RenderedMenuItem_TreeLabel; - public static String RenderedMenuItem_TreeLabelDescription; - - public static String RenderedToolBarEditor_TreeLabel; - - public static String ToolBarContributionEditor_TreeLabel; - public static String ToolBarContributionEditor_TreeLabelDescription; - - public static String ToolItemEditor_Type; - public static String ToolItemEditor_Label; - public static String ToolItemEditor_ToolTip; - public static String ToolItemEditor_IconURI; - public static String ToolItemEditor_Enabled; - public static String ToolItemEditor_Selected; - public static String ToolItemEditor_NoExpression; - - public static String TrimBarEditor_TreeLabel; - public static String TrimBarEditor_TreeLabelDescription; - public static String TrimBarEditor_Side; - public static String TrimBarEditor_Controls; - public static String TrimBarEditor_AddToolBar; - public static String TrimBarEditor_AddToolControl; - - public static String TrimContributionEditor_TreeLabel; - public static String TrimContributionEditor_TreeLabelDescription; - public static String TrimContributionEditor_ParentId; - public static String TrimContributionEditor_Position; - public static String TrimContributionEditor_Controls; - - public static String TrimmedWindowEditor_TrimBars; - public static String TrimmedWindowEditor_TreeLabel; - - public static String WindowEditor_AddMainMenu; - public static String WindowEditor_TreeLabel; - public static String WindowEditor_TreeLabelDescription; - public static String WindowEditor_X; - public static String WindowEditor_Y; - public static String WindowEditor_Width; - public static String WindowEditor_Height; - public static String WindowEditor_Label; - public static String WindowEditor_Tooltip; - public static String WindowEditor_IconURI; - public static String WindowEditor_MainMenu; - public static String WindowEditor_SelectedElement; - public static String WindowEditor_BindingContexts; - public static String WindowEditor_Handlers; - public static String WindowEditor_Windows; - public static String WindowEditor_Controls; - public static String WindowEditor_SharedElements; - - public static String VApplicationAddons_AddAddon; - public static String VApplicationAddons_TreeLabel; - public static String VApplicationAddons_TreeLabelDescription; - public static String VApplicationAddons_Commands; - - public static String VApplicationCategoriesEditor_TreeLabel; - public static String VApplicationCategoriesEditor_TreeLabelDescription; - public static String VApplicationCategoriesEditor_Categories; - public static String VApplicationCategoriesEditor_AddCategory; - - public static String VCommandEditor_TreeLabel; - public static String VCommandEditor_TreeLabelDescription; - public static String VCommandEditor_Commands; - public static String VCommandEditor_AddCommand; - - public static String VHandlerEditor_TreeLabel; - public static String VHandlerEditor_TreeLabelDescription; - public static String VHandlerEditor_Handlers; - public static String VHandlerEditor_AddHandler; - - public static String VMenuContributionsEditor_TreeLabel; - public static String VMenuContributionsEditor_TreeLabelDescription; - public static String VMenuContributionsEditor_MenuContributions; - public static String VMenuContributionsEditor_AddMenuContribution; - - public static String VMenuEditor_TreeLabel; - public static String VMenuEditor_TreeLabelDescription; - public static String VMenuEditor_Menus; - public static String VMenuEditor_AddMenuContribution; - - public static String VModelFragmentsEditor_TreeLabel; - public static String VModelFragmentsEditor_TreeLabelDescription; - public static String VModelFragmentsEditor_Fragments; - - public static String VModelImportsEditor_TreeLabel; - public static String VModelImportsEditor_TreeLabelDescription; - public static String VModelImportsEditor_Imports; - - public static String VPartDescriptor_TreeLabel; - public static String VPartDescriptor_TreeLabelDescription; - public static String VPartDescriptor_Descriptors; - public static String VPartDescriptor_AddPartDescriptor; - - public static String VToolBarContributionsEditor_Contributions; - public static String VToolBarContributionsEditor_TreeLabelDescription; - public static String VToolBarContributionsEditor_TreeLabel; - public static String VToolBarContributionsEditor_AddToolBarContribution; - - public static String VTrimContributionsEditor_TreeLabel; - public static String VTrimContributionsEditor_TreeLabelDescription; - public static String VTrimContributionsEditor_Contributions; - public static String VTrimContributionsEditor_AddTrimContribution; - - public static String VWindowControlEditor_TreeLabel; - public static String VWindowControlEditor_TreeLabelDescription; - public static String VWindowControlEditor_Controls; - public static String VWindowControlEditor_AddPerspectiveStack; - public static String VWindowControlEditor_AddPartSashContainer; - public static String VWindowControlEditor_AddPartStack; - public static String VWindowControlEditor_AddPart; - public static String VWindowControlEditor_AddInputPart; - public static String VWindowControlEditor_AddArea; - - public static String VWindowEditor_TreeLabel; - public static String VWindowEditor_TreeLabelDescription; - public static String VWindowEditor_Windows; - public static String VWindowEditor_AddTrimmedWindow; - public static String VWindowEditor_AddWindow; - - public static String VWindowSharedElementsEditor_TreeLabel; - public static String VWindowSharedElementsEditor_TreeLabelDescription; - public static String VWindowSharedElementsEditor_Controls; - public static String VWindowSharedElementsEditor_AddPartSashContainer; - public static String VWindowSharedElementsEditor_AddPart; - public static String VWindowSharedElementsEditor_AddInputPart; - - public static String VWindowTrimEditor_TreeLabel; - public static String VWindowTrimEditor_TreeLabelDescription; - public static String VWindowTrimEditor_Controls; - public static String VWindowTrimEditor_AddWindowTrim; - - public static String AbstractIconDialog_IconName; - - public static String BindingContextSelectionDialog_ShellTitle; - public static String BindingContextSelectionDialog_Title; - public static String BindingContextSelectionDialog_Message; - public static String BindingContextSelectionDialog_NoIdReference; - - public static String CommandCategorySelectionDialog_ShellTitle; - public static String CommandCategorySelectionDialog_Title; - public static String CommandCategorySelectionDialog_Message; - - public static String FindImportElementDialog_ShellTitle; - public static String FindImportElementDialog_Title; - public static String FindImportElementDialog_Message; - public static String FindImportElementDialog_Search; - public static String FindImportElementDialog_ClearCache; - public static String FindImportElementDialog_NoIdReference; - public static String FindImportElementDialog_noId; - - public static String FindParentReferenceElementDialog_ShellTitle; - public static String FindParentReferenceElementDialog_Title; - public static String FindParentReferenceElementDialog_Message; - public static String FindParentReferenceElementDialog_ContainerType; - public static String FindParentReferenceElementDialog_Search; - public static String FindParentReferenceElementDialog_NoId; - public static String FindParentReferenceElementDialog_ClearCache; - public static String FindParentReferenceElementDialog_NoReferenceId; - - public static String HandledMenuItemCommandSelectionDialog_ShellTitle; - public static String HandledMenuItemCommandSelectionDialog_DialogTitle; - public static String HandledMenuItemCommandSelectionDialog_DialogMessage; - - public static String HandledToolItemCommandSelectionDialog_ShellTitle; - public static String HandledToolItemCommandSelectionDialog_DialogTitle; - public static String HandledToolItemCommandSelectionDialog_DialogMessage; - - public static String HandlerCommandSelectionDialog_ShellTitle; - public static String HandlerCommandSelectionDialog_DialogTitle; - public static String HandlerCommandSelectionDialog_DialogMessage; - - public static String KeyBindingCommandSelectionDialog_ShellTitle; - public static String KeyBindingCommandSelectionDialog_DialogTitle; - public static String KeyBindingCommandSelectionDialog_DialogMessage; - - public static String MenuIconDialogEditor_ShellTitle; - public static String MenuIconDialogEditor_DialogTitle; - public static String MenuIconDialogEditor_DialogMessage; - - public static String MenuItemIconDialogEditor_ShellTitle; - public static String MenuItemIconDialogEditor_DialogTitle; - public static String MenuItemIconDialogEditor_DialogMessage; - - public static String PartDescriptorIconDialogEditor_ShellTitle; - public static String PartDescriptorIconDialogEditor_DialogTitle; - public static String PartDescriptorIconDialogEditor_DialogMessage; - - public static String PartIconDialogEditor_ShellTitle; - public static String PartIconDialogEditor_DialogTitle; - public static String PartIconDialogEditor_DialogMessage; - - public static String PerspectiveIconDialogEditor_ShellTitle; - public static String PerspectiveIconDialogEditor_DialogTitle; - public static String PerspectiveIconDialogEditor_DialogMessage; - - public static String SharedElementsDialog_ShellTitle; - public static String SharedElementsDialog_Title; - public static String SharedElementsDialog_Message; - public static String SharedElementsDialog_Name; - - public static String ToolItemIconDialogEditor_ShellTitle; - public static String ToolItemIconDialogEditor_DialogTitle; - public static String ToolItemIconDialogEditor_DialogMessage; - - public static String WindowIconDialogEditor_ShellTitle; - public static String WindowIconDialogEditor_DialogTitle; - public static String WindowIconDialogEditor_DialogMessage; - - public static String ImageTooltip_UnknownError; - public static String ImageTooltip_FileNotFound; - public static String ImageTooltip_Icon; - public static String ImageTooltip_Name; - public static String ImageTooltip_Dimension; - public static String ImageTooltip_FileSize; - - public static String VItemParametersEditor_TreeLabel; - public static String VItemParametersEditor_TreeLabelDescription; - public static String VItemParametersEditor_Parameters; - public static String VItemParametersEditor_AddParameter; - - public static String CoreExpressionEditor_TreeLabel; - public static String CoreExpressionEditor_TreeLabelDescription; - public static String CoreExpressionEditor_ExpressionId; - - public static String ExpressionIdDialog_ShellTitle; - public static String ExpressionIdDialog_DialogTitle; - public static String ExpressionIdDialog_DialogMessage; - public static String ExpressionIdDialog_Id; - - public static String CommandToStringConverter_None; - - public static String VRootBindingContexts_AddContext; - public static String VRootBindingContexts_TreeLabel; - public static String VRootBindingContexts_TreeLabelDescription; - public static String VRootBindingContexts_Contexts; - - public static String AreaEditor_Label; - public static String AreaEditor_Description; - public static String AreaEditor_Orientation; - public static String AreaEditor_Horizontal; - public static String AreaEditor_SelectedElement; - public static String AreaEditor_ContainerData; - public static String AreaEditor_Controls; - public static String AreaEditor_Vertical; - public static String AreaEditor_LabelLabel; - public static String AreaEditor_Tooltip; - public static String AreaEditor_IconURI; - - public static String AreaIconDialogEditor_ShellTitle; - public static String AreaIconDialogEditor_DialogTitle; - public static String AreaIconDialogEditor_DialogMessage; - - public static String ModelEditor_Delete; - - static { - NLS.initializeMessages(Messages.class.getName(), Messages.class); - } -} +public class Messages { + + public String ModelTooling_Common_Up; + public String ModelTooling_Common_Down; + public String ModelTooling_Common_AddEllipsis; + public String ModelTooling_Common_Add; + public String ModelTooling_Common_Remove; + public String ModelTooling_Common_Id; + public String ModelTooling_Common_RefId; + public String ModelTooling_Common_FindEllipsis; + + public String ModelTooling_UIElement_ToBeRendered; + public String ModelTooling_UIElement_Visible; + public String ModelTooling_UIElement_VisibleWhen; + public String ModelTooling_UIElement_AccessibilityPhrase; + + public String ModelTooling_Context_Variables; + public String ModelTooling_Context_Properties; + + public String ModelTooling_ApplicationElement_Tags; + public String ModelTooling_Contribution_PersistedState; + + public String AbstractCommandSelectionDialog_Label_CommandId; + + public String ApplicationEditor_Label; + public String ApplicationEditor_Description; + public String ApplicationEditor_Handlers; + public String ApplicationEditor_PartDescriptors; + public String ApplicationEditor_BindingTables; + public String ApplicationEditor_Commands; + public String ApplicationEditor_Windows; + public String ApplicationEditor_Addons; + public String ApplicationEditor_MenuContributions; + public String ApplicationEditor_ToolBarContributions; + public String ApplicationEditor_TrimContributions; + public String ApplicationEditor_RootContexts; + public String ApplicationEditor_BindingContexts; + public String ApplicationEditor_Categories; + + public String BindingTableEditor_Label; + public String BindingTableEditor_Description; + public String BindingTableEditor_ContextId; + public String BindingTableEditor_Keybindings; + public String BindingTableEditor_KeySequence; + public String BindingTableEditor_Command; + public String BindingTableEditor_AddKeyBinding; + + public String CommandEditor_Label; + public String CommandEditor_Description; + public String CommandEditor_Name; + public String CommandEditor_LabelDescription; + public String CommandEditor_Parameters; + public String CommandEditor_ParameterName; + public String CommandEditor_ParameterTypeId; + public String CommandEditor_ParameterOptional; + public String CommandEditor_ParameterOptional_No; + public String CommandEditor_ParameterOptional_Yes; + public String CommandEditor_ParameterId; + public String CommandEditor_Category; + public String CommandEditor_AddCommandParameter; + + public String DirectMenuItemEditor_Label; + public String DirectMenuItemEditor_Description; + public String DirectMenuItemEditor_ClassURI; + + public String ControlFactory_Key; + public String ControlFactory_Value; + public String ControlFactory_KeyValueShellTitle; + + public String DirectToolItemEditor_ClassURI; + public String DirectToolItemEditor_Label; + public String DirectToolItemEditor_Description; + + public String HandledMenuItemEditor_Label; + public String HandledMenuItemEditor_Description; + public String HandledMenuItemEditor_Command; + public String HandledMenuItemEditor_Parameters; + public String HandledMenuItemEditor_Tag; + public String HandledMenuItemEditor_Value; + + public String HandledToolItemEditor_Command; + public String HandledToolItemEditor_Parameters; + public String HandledToolItemEditor_ParametersName; + public String HandledToolItemEditor_ParametersValue; + public String HandledToolItemEditor_Label; + public String HandledToolItemEditor_Description; + + public String HandlerEditor_Label; + public String HandlerEditor_Description; + public String HandlerEditor_Command; + public String HandlerEditor_ClassURI; + + public String InputPartEditor_Label; + public String InputPartEditor_InputURI; + + public String KeyBindingEditor_Label; + public String KeyBindingEditor_Description; + public String KeyBindingEditor_Sequence; + public String KeyBindingEditor_Command; + public String KeyBindingEditor_Parameters; + public String KeyBindingEditor_SequenceNotComplete; + public String KeyBindingEditor_SequenceEmpty; + public String KeyBindingEditor_AddParameter; + + public String MenuEditor_Label; + public String MenuEditor_Description; + public String MenuEditor_MenuItems; + public String MenuEditor_MenuItemType; + public String MenuEditor_MenuItemItemType; + public String MenuEditor_HandledMenuItem; + public String MenuEditor_Separator; + public String MenuEditor_Menu; + public String MenuEditor_DirectMenuItem; + public String MenuEditor_LabelLabel; + public String MenuEditor_Tooltip; + public String MenuEditor_IconURI; + public String MenuEditor_Children; + public String MenuEditor_Mnemonics; + public String MenuEditor_AddHandledMenuItem; + public String MenuEditor_AddMenu; + public String MenuEditor_AddDirectMenuItem; + public String MenuEditor_AddSeparator; + + public String MenuItemEditor_Type; + public String MenuItemEditor_Label; + public String MenuItemEditor_Tooltip; + public String MenuItemEditor_IconURI; + public String MenuEditor_MainMenu; + public String MenuItemEditor_Enabled; + public String MenuItemEditor_Selected; + public String MenuItemEditor_Mnemonics; + public String MenuItemEditor_NoExpression; + + public String MenuSeparatorEditor_Label; + + public String PartDescriptorEditor_Label; + public String PartDescriptorEditor_Descriptor; + public String PartDescriptorEditor_LabelLabel; + public String PartDescriptorEditor_Tooltip; + public String PartDescriptorEditor_IconURI; + public String PartDescriptorEditor_ClassURI; + public String PartDescriptorEditor_Dirtyable; + public String PartDescriptorEditor_Closeable; + public String PartDescriptorEditor_Multiple; + public String PartDescriptorEditor_Category; + public String PartDescriptorEditor_Variables; + public String PartDescriptorEditor_Properties; + public String PartDescriptorEditor_PropertiesKey; + public String PartDescriptorEditor_PropertiesValue; + public String PartDescriptorEditor_Menus; + public String PartDescriptorEditor_Handlers; + public String PartDescriptorEditor_ContainerData; + + public String PartEditor_Label; + public String PartEditor_Description; + public String PartEditor_LabelLabel; + public String PartEditor_Tooltip; + public String PartEditor_IconURI; + public String PartEditor_ClassURI; + public String PartEditor_Closeable; + public String PartEditor_Menus; + public String PartEditor_Handlers; + public String PartEditor_ContainerData; + public String PartEditor_ToolBar; + public String PartEditor_BindingContexts; + + public String PartSashContainerEditor_Label; + public String PartSashContainerEditor_Description; + public String PartSashContainerEditor_Orientation; + public String PartSashContainerEditor_Vertical; + public String PartSashContainerEditor_Horizontal; + public String PartSashContainerEditor_SelectedElement; + public String PartSashContainerEditor_Controls; + public String PartSashContainerEditor_ContainerData; + public String PartSashContainerEditor_AddPartSashContainer; + public String PartSashContainerEditor_AddPartStack; + public String PartSashContainerEditor_AddPart; + public String PartSashContainerEditor_AddInputPart; + public String PartSashContainerEditor_AddArea; + public String PartSashContainerEditor_AddPlaceholder; + + public String PartStackEditor_Label; + public String PartStackEditor_Description; + public String PartStackEditor_SelectedElement; + public String PartStackEditor_Parts; + public String PartStackEditor_ContainerData; + public String PartStackEditor_AddPart; + public String PartStackEditor_AddInputPart; + public String PartStackEditor_AddPlaceholder; + + public String PerspectiveEditor_Label; + public String PerspectiveEditor_Description; + public String PerspectiveEditor_LabelLabel; + public String PerspectiveEditor_SelectedElement; + public String PerspectiveEditor_Tooltip; + public String PerspectiveEditor_IconURI; + public String PerspectiveEditor_Controls; + public String PerspectiveEditor_AddPartSashContainer; + public String PerspectiveEditor_AddPartStack; + public String PerspectiveEditor_AddPart; + public String PerspectiveEditor_AddInputPart; + public String PerspectiveEditor_AddArea; + public String PerspectiveEditor_AddPlaceholder; + + public String PerspectiveStackEditor_Perspectives; + public String PerspectiveStackEditor_Label; + public String PerspectiveStackEditor_Description; + public String PerspectiveStackEditor_SelectedElement; + public String PerspectiveStackEditor_AddPerspective; + + public String PlaceholderEditor_Label; + public String PlaceholderEditor_Descriptor; + public String PlaceholderEditor_Reference; + + public String ToolBarEditor_Label; + public String ToolBarEditor_Description; + public String ToolBarEditor_ToolbarItems; + public String ToolBarEditor_ToolbarItemsType; + public String ToolBarEditor_ToolbarItemsItemType; + public String ToolBarEditor_HandledToolItem; + public String ToolBarEditor_DirectToolItem; + public String ToolBarEditor_ToolControl; + public String ToolBarEditor_Separator; + public String ToolBarEditor_AddHandledToolItem; + public String ToolBarEditor_AddDirectToolItem; + public String ToolBarEditor_AddToolControl; + public String ToolBarEditor_AddToolBarSeparator; + + public String ToolBarSeparatorEditor_Label; + + public String ToolControlEditor_Label; + public String ToolControlEditor_Description; + public String ToolControlEditor_ClassURI; + + public String VBindingTableEditor_Label; + public String VBindingTableEditor_Description; + public String VBindingTableEditor_Contexts; + public String VBindingTableEditor_Name; + public String VBindingTableEditor_LabelDescription; + public String VBindingTableEditor_BindingTables; + public String VBindingTableEditor_AddBindingTable; + + public String AddonsEditor_ClassURI; + public String AddonsEditor_TreeLabel; + public String AddonsEditor_TreeLabelDescription; + public String AddonsEditor_Tags; + + public String ContributionClassDialog_DialogMessage; + public String ContributionClassDialog_DialogTitle; + public String ContributionClassDialog_Label_Classname; + public String ContributionClassDialog_ShellTitle; + + public String MenuContributionEditor_MenuItems; + public String MenuContributionEditor_MenuItemType; + public String MenuContributionEditor_MenuItemItemType; + public String MenuContributionEditor_HandledMenuItem; + public String MenuContributionEditor_Separator; + public String MenuContributionEditor_Menu; + public String MenuContributionEditor_DirectMenuItem; + public String MenuContributionEditor_ParentId; + public String MenuContributionEditor_Position; + public String MenuContributionEditor_TreeLabel; + public String MenuContributionEditor_TreeLabelDescription; + + public String ModelFragmentsEditor_ModelFragments; + public String ModelFragmentsEditor_Label; + public String ModelFragmentsEditor_Description; + public String ModelFragmentsEditor_Imports; + + public String StringModelFragment_Label; + public String StringModelFragment_Description; + public String StringModelFragment_Featurename; + public String StringModelFragment_ParentId; + public String StringModelFragment_PositionInList; + public String StringModelFragment_Elements; + + public String FeatureSelectionDialog_Filter; + public String FeatureSelectionDialog_ShellTitle; + public String FeatureSelectionDialog_DialogTitle; + public String FeatureSelectionDialog_DialogMessage; + + public String CategoryEditor_TreeLabel; + public String CategoryEditor_TreeLabelDescriptor; + public String CategoryEditor_Name; + public String CategoryEditor_Description; + public String CategoryEditor_Tags; + + public String CommandCategorySelectionDialog_LabelCategoryId; + + public String BindingContextSelectionDialog_LabelContextId; + + public String ComponentLabelProvider_invisible; + public String ComponentLabelProvider_notrendered; + + public String BindingContextEditor_TreeLabel; + public String BindingContextEditor_TreeLabelDescription; + public String BindingContextEditor_Name; + public String BindingContextEditor_Description; + public String BindingContextEditor_Subcontexts; + public String BindingContextEditor_AddContext; + + public String CommandParameterEditor_TreeLabel; + public String CommandParameterEditor_TreeLabelDescritpion; + public String CommandParameterEditor_Name; + public String CommandParameterEditor_TypeId; + public String CommandParameterEditor_Optional; + + public String ParameterEditor_TreeLabel; + public String ParameterEditor_TreeLabelDescription; + public String ParameterEditor_Name; + public String ParameterEditor_Value; + + public String PopupMenuEditor_TreeLabel; + public String PopupMenuEditor_TreeLabelDescription; + + public String RenderedMenuEditor_TreeLabel; + + public String RenderedMenuItem_TreeLabel; + public String RenderedMenuItem_TreeLabelDescription; + + public String RenderedToolBarEditor_TreeLabel; + + public String ToolBarContributionEditor_TreeLabel; + public String ToolBarContributionEditor_TreeLabelDescription; + + public String ToolItemEditor_Type; + public String ToolItemEditor_Label; + public String ToolItemEditor_ToolTip; + public String ToolItemEditor_IconURI; + public String ToolItemEditor_Enabled; + public String ToolItemEditor_Selected; + public String ToolItemEditor_NoExpression; + + public String TrimBarEditor_TreeLabel; + public String TrimBarEditor_TreeLabelDescription; + public String TrimBarEditor_Side; + public String TrimBarEditor_Controls; + public String TrimBarEditor_AddToolBar; + public String TrimBarEditor_AddToolControl; + + public String TrimContributionEditor_TreeLabel; + public String TrimContributionEditor_TreeLabelDescription; + public String TrimContributionEditor_ParentId; + public String TrimContributionEditor_Position; + public String TrimContributionEditor_Controls; + + public String TrimmedWindowEditor_TrimBars; + public String TrimmedWindowEditor_TreeLabel; + + public String WindowEditor_AddMainMenu; + public String WindowEditor_TreeLabel; + public String WindowEditor_TreeLabelDescription; + public String WindowEditor_X; + public String WindowEditor_Y; + public String WindowEditor_Width; + public String WindowEditor_Height; + public String WindowEditor_Label; + public String WindowEditor_Tooltip; + public String WindowEditor_IconURI; + public String WindowEditor_MainMenu; + public String WindowEditor_SelectedElement; + public String WindowEditor_BindingContexts; + public String WindowEditor_Handlers; + public String WindowEditor_Windows; + public String WindowEditor_Controls; + public String WindowEditor_SharedElements; + + public String VApplicationAddons_AddAddon; + public String VApplicationAddons_TreeLabel; + public String VApplicationAddons_TreeLabelDescription; + public String VApplicationAddons_Commands; + + public String VApplicationCategoriesEditor_TreeLabel; + public String VApplicationCategoriesEditor_TreeLabelDescription; + public String VApplicationCategoriesEditor_Categories; + public String VApplicationCategoriesEditor_AddCategory; + + public String VCommandEditor_TreeLabel; + public String VCommandEditor_TreeLabelDescription; + public String VCommandEditor_Commands; + public String VCommandEditor_AddCommand; + + public String VHandlerEditor_TreeLabel; + public String VHandlerEditor_TreeLabelDescription; + public String VHandlerEditor_Handlers; + public String VHandlerEditor_AddHandler; + + public String VMenuContributionsEditor_TreeLabel; + public String VMenuContributionsEditor_TreeLabelDescription; + public String VMenuContributionsEditor_MenuContributions; + public String VMenuContributionsEditor_AddMenuContribution; + + public String VMenuEditor_TreeLabel; + public String VMenuEditor_TreeLabelDescription; + public String VMenuEditor_Menus; + public String VMenuEditor_AddMenuContribution; + + public String VModelFragmentsEditor_TreeLabel; + public String VModelFragmentsEditor_TreeLabelDescription; + public String VModelFragmentsEditor_Fragments; + + public String VModelImportsEditor_TreeLabel; + public String VModelImportsEditor_TreeLabelDescription; + public String VModelImportsEditor_Imports; + + public String VPartDescriptor_TreeLabel; + public String VPartDescriptor_TreeLabelDescription; + public String VPartDescriptor_Descriptors; + public String VPartDescriptor_AddPartDescriptor; + + public String VToolBarContributionsEditor_Contributions; + public String VToolBarContributionsEditor_TreeLabelDescription; + public String VToolBarContributionsEditor_TreeLabel; + public String VToolBarContributionsEditor_AddToolBarContribution; + + public String VTrimContributionsEditor_TreeLabel; + public String VTrimContributionsEditor_TreeLabelDescription; + public String VTrimContributionsEditor_Contributions; + public String VTrimContributionsEditor_AddTrimContribution; + + public String VWindowControlEditor_TreeLabel; + public String VWindowControlEditor_TreeLabelDescription; + public String VWindowControlEditor_Controls; + public String VWindowControlEditor_AddPerspectiveStack; + public String VWindowControlEditor_AddPartSashContainer; + public String VWindowControlEditor_AddPartStack; + public String VWindowControlEditor_AddPart; + public String VWindowControlEditor_AddInputPart; + public String VWindowControlEditor_AddArea; + + public String VWindowEditor_TreeLabel; + public String VWindowEditor_TreeLabelDescription; + public String VWindowEditor_Windows; + public String VWindowEditor_AddTrimmedWindow; + public String VWindowEditor_AddWindow; + + public String VWindowSharedElementsEditor_TreeLabel; + public String VWindowSharedElementsEditor_TreeLabelDescription; + public String VWindowSharedElementsEditor_Controls; + public String VWindowSharedElementsEditor_AddPartSashContainer; + public String VWindowSharedElementsEditor_AddPart; + public String VWindowSharedElementsEditor_AddInputPart; + + public String VWindowTrimEditor_TreeLabel; + public String VWindowTrimEditor_TreeLabelDescription; + public String VWindowTrimEditor_Controls; + public String VWindowTrimEditor_AddWindowTrim; + + public String AbstractIconDialog_IconName; + + public String BindingContextSelectionDialog_ShellTitle; + public String BindingContextSelectionDialog_Title; + public String BindingContextSelectionDialog_Message; + public String BindingContextSelectionDialog_NoIdReference; + + public String CommandCategorySelectionDialog_ShellTitle; + public String CommandCategorySelectionDialog_Title; + public String CommandCategorySelectionDialog_Message; + + public String FindImportElementDialog_ShellTitle; + public String FindImportElementDialog_Title; + public String FindImportElementDialog_Message; + public String FindImportElementDialog_Search; + public String FindImportElementDialog_ClearCache; + public String FindImportElementDialog_NoIdReference; + public String FindImportElementDialog_noId; + + public String FindParentReferenceElementDialog_ShellTitle; + public String FindParentReferenceElementDialog_Title; + public String FindParentReferenceElementDialog_Message; + public String FindParentReferenceElementDialog_ContainerType; + public String FindParentReferenceElementDialog_Search; + public String FindParentReferenceElementDialog_NoId; + public String FindParentReferenceElementDialog_ClearCache; + public String FindParentReferenceElementDialog_NoReferenceId; + + public String HandledMenuItemCommandSelectionDialog_ShellTitle; + public String HandledMenuItemCommandSelectionDialog_DialogTitle; + public String HandledMenuItemCommandSelectionDialog_DialogMessage; + + public String HandledToolItemCommandSelectionDialog_ShellTitle; + public String HandledToolItemCommandSelectionDialog_DialogTitle; + public String HandledToolItemCommandSelectionDialog_DialogMessage; + + public String HandlerCommandSelectionDialog_ShellTitle; + public String HandlerCommandSelectionDialog_DialogTitle; + public String HandlerCommandSelectionDialog_DialogMessage; + + public String KeyBindingCommandSelectionDialog_ShellTitle; + public String KeyBindingCommandSelectionDialog_DialogTitle; + public String KeyBindingCommandSelectionDialog_DialogMessage; + + public String MenuIconDialogEditor_ShellTitle; + public String MenuIconDialogEditor_DialogTitle; + public String MenuIconDialogEditor_DialogMessage; + + public String MenuItemIconDialogEditor_ShellTitle; + public String MenuItemIconDialogEditor_DialogTitle; + public String MenuItemIconDialogEditor_DialogMessage; + + public String PartDescriptorIconDialogEditor_ShellTitle; + public String PartDescriptorIconDialogEditor_DialogTitle; + public String PartDescriptorIconDialogEditor_DialogMessage; + + public String PartIconDialogEditor_ShellTitle; + public String PartIconDialogEditor_DialogTitle; + public String PartIconDialogEditor_DialogMessage; + + public String PerspectiveIconDialogEditor_ShellTitle; + public String PerspectiveIconDialogEditor_DialogTitle; + public String PerspectiveIconDialogEditor_DialogMessage; + + public String SharedElementsDialog_ShellTitle; + public String SharedElementsDialog_Title; + public String SharedElementsDialog_Message; + public String SharedElementsDialog_Name; + + public String ToolItemIconDialogEditor_ShellTitle; + public String ToolItemIconDialogEditor_DialogTitle; + public String ToolItemIconDialogEditor_DialogMessage; + + public String WindowIconDialogEditor_ShellTitle; + public String WindowIconDialogEditor_DialogTitle; + public String WindowIconDialogEditor_DialogMessage; + + public String ImageTooltip_UnknownError; + public String ImageTooltip_FileNotFound; + public String ImageTooltip_Icon; + public String ImageTooltip_Name; + public String ImageTooltip_Dimension; + public String ImageTooltip_FileSize; + + public String VItemParametersEditor_TreeLabel; + public String VItemParametersEditor_TreeLabelDescription; + public String VItemParametersEditor_Parameters; + public String VItemParametersEditor_AddParameter; + + public String CoreExpressionEditor_TreeLabel; + public String CoreExpressionEditor_TreeLabelDescription; + public String CoreExpressionEditor_ExpressionId; + + public String ExpressionIdDialog_ShellTitle; + public String ExpressionIdDialog_DialogTitle; + public String ExpressionIdDialog_DialogMessage; + public String ExpressionIdDialog_Id; + + public String CommandToStringConverter_None; + + public String VRootBindingContexts_AddContext; + public String VRootBindingContexts_TreeLabel; + public String VRootBindingContexts_TreeLabelDescription; + public String VRootBindingContexts_Contexts; + + public String AreaEditor_Label; + public String AreaEditor_Description; + public String AreaEditor_Orientation; + public String AreaEditor_Horizontal; + public String AreaEditor_SelectedElement; + public String AreaEditor_ContainerData; + public String AreaEditor_Controls; + public String AreaEditor_Vertical; + public String AreaEditor_LabelLabel; + public String AreaEditor_Tooltip; + public String AreaEditor_IconURI; + + public String AreaIconDialogEditor_ShellTitle; + public String AreaIconDialogEditor_DialogTitle; + public String AreaIconDialogEditor_DialogMessage; + + public String ModelEditor_Delete; + public String ModelEditor_Form; + public String ModelEditor_XMI; +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 163b7d2c33..59e04fdbba 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -578,4 +578,6 @@ AreaIconDialogEditor_ShellTitle=Area Icon Search AreaIconDialogEditor_DialogTitle=Area Icon Search AreaIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project -ModelEditor_Delete=Remove \ No newline at end of file +ModelEditor_Delete=Remove +ModelEditor_Form=Form +ModelEditor_XMI=XMI \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java index e1ca66fdc5..41c8eeead4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java @@ -88,6 +88,9 @@ public class ResourceProvider extends AbstractBundleResourceProvider { public static final String IMG_Obj16_table_add = "IMG_org.eclipse.e4.tools.emf.ui.obj16.table_add"; //$NON-NLS-1$ public static final String IMG_Obj16_table_delete = "IMG_org.eclipse.e4.tools.emf.ui.obj16.table_delete"; //$NON-NLS-1$ public static final String IMG_Obj16_zoom = "IMG_org.eclipse.e4.tools.emf.ui.obj16.zoom"; //$NON-NLS-1$ + public static final String IMG_Obj16_application_form = "IMG_org.eclipse.e4.tools.emf.ui.obj16.application_form"; //$NON-NLS-1$ + public static final String IMG_Obj16_chart_organisation = "IMG_org.eclipse.e4.tools.emf.ui.obj16.chart_organisation"; //$NON-NLS-1$ + public static final String IMG_Obj16_error_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.error_obj"; //$NON-NLS-1$ public static final String IMG_Wizban16_fieldrefact_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.fieldrefact_wiz"; //$NON-NLS-1$ public static final String IMG_Wizban16_import_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.import_wiz"; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java index 22653dd83e..f7e54e99f7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java @@ -33,6 +33,8 @@ public class ComponentLabelProvider extends StyledCellLabelProvider { private Font font; + private Messages Messages; + private static Styler NOT_RENDERED_STYLER = new Styler() { { JFaceResources.getColorRegistry().put(NOT_RENDERED_KEY, new RGB(200, 200, 200)); @@ -44,8 +46,9 @@ public void applyStyles(TextStyle textStyle) { } }; - public ComponentLabelProvider(ModelEditor editor) { + public ComponentLabelProvider(ModelEditor editor, Messages Messages) { this.editor = editor; + this.Messages = Messages; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 9b8ee232ec..78a07d74e9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -35,6 +35,7 @@ import org.eclipse.core.runtime.IExtensionRegistry; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.RegistryFactory; +import org.eclipse.e4.core.contexts.ContextInjectionFactory; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.core.di.extensions.Preference; @@ -101,10 +102,11 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VItemParametersEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuContributionsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelFragmentsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelImportsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptorMenuEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartMenuEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VRootBindingContexts; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VToolBarContributionsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VTrimContributionsEditor; @@ -112,9 +114,15 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowSharedElementsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.xml.AnnotationAccess; +import org.eclipse.e4.tools.emf.ui.internal.common.xml.ColorManager; +import org.eclipse.e4.tools.emf.ui.internal.common.xml.EMFDocumentResourceMediator; +import org.eclipse.e4.tools.emf.ui.internal.common.xml.XMLConfiguration; +import org.eclipse.e4.tools.emf.ui.internal.common.xml.XMLPartitionScanner; import org.eclipse.e4.tools.services.IClipboardService; import org.eclipse.e4.tools.services.IClipboardService.Handler; import org.eclipse.e4.tools.services.IResourcePool; +import org.eclipse.e4.tools.services.Translation; import org.eclipse.e4.ui.di.Focus; import org.eclipse.e4.ui.di.Persist; import org.eclipse.e4.ui.model.application.MApplicationElement; @@ -137,6 +145,7 @@ import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.resource.Resource.Diagnostic; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.CommandParameter; @@ -151,6 +160,15 @@ import org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider; import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.IDocumentPartitioner; +import org.eclipse.jface.text.Position; +import org.eclipse.jface.text.rules.FastPartitioner; +import org.eclipse.jface.text.source.Annotation; +import org.eclipse.jface.text.source.AnnotationModel; +import org.eclipse.jface.text.source.SourceViewer; +import org.eclipse.jface.text.source.VerticalRuler; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; @@ -159,6 +177,8 @@ import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerDropAdapter; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.custom.SashForm; import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.dnd.Clipboard; @@ -169,11 +189,14 @@ import org.eclipse.swt.dnd.TransferData; import org.eclipse.swt.events.ControlAdapter; import org.eclipse.swt.events.ControlEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.TreeItem; @@ -201,6 +224,8 @@ public class ModelEditor { public static final String VIRTUAL_MENUELEMENTS = ModelEditor.class.getName() + ".VIRTUAL_MENUELEMENTS"; //$NON-NLS-1$ public static final String VIRTUAL_ROOT_CONTEXTS = ModelEditor.class.getName() + ".VIRTUAL_ROOT_CONTEXTS"; //$NON-NLS-1$ + private static final int VERTICAL_RULER_WIDTH = 20; + private Map editorMap = new HashMap(); private Map virtualEditors = new HashMap(); private List labelFeaturePaths = new ArrayList(); @@ -231,10 +256,16 @@ public class ModelEditor { @Optional private IExtensionLookup extensionLookup; + @Inject + @Translation + private Messages messages; + private ObservablesManager obsManager; private final IResourcePool resourcePool; + private EMFDocumentResourceMediator emfDocumentProvider; + public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project, final IResourcePool resourcePool) { this.resourcePool = resourcePool; this.modelProvider = modelProvider; @@ -242,6 +273,18 @@ public ModelEditor(Composite composite, IEclipseContext context, IModelResource this.context = context; this.context.set(ModelEditor.class, this); this.obsManager = new ObservablesManager(); + } + + @PostConstruct + void postCreate(Composite composite) { + context.set(ModelEditor.class, this); + context.set(IResourcePool.class, resourcePool); + context.set(EditingDomain.class, modelProvider.getEditingDomain()); + context.set(IModelResource.class, modelProvider); + + if (project != null) { + context.set(IProject.class, project); + } registerDefaultEditors(); registerVirtualEditors(); @@ -253,6 +296,71 @@ public ModelEditor(Composite composite, IEclipseContext context, IModelResource fragment = modelProvider.getRoot().get(0) instanceof MModelFragments; + final CTabFolder folder = new CTabFolder(composite, SWT.BOTTOM); + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(messages.ModelEditor_Form); + item.setControl(createFormTab(folder)); + item.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_application_form)); + + emfDocumentProvider = new EMFDocumentResourceMediator(modelProvider); + + item = new CTabItem(folder, SWT.NONE); + item.setText(messages.ModelEditor_XMI); + item.setControl(createXMITab(folder)); + item.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_chart_organisation)); + folder.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (folder.getSelectionIndex() == 1) { + emfDocumentProvider.updateFromEMF(); + } + } + }); + + folder.setSelection(0); + } + + private Control createXMITab(Composite composite) { + + final AnnotationModel model = new AnnotationModel(); + VerticalRuler verticalRuler = new VerticalRuler(VERTICAL_RULER_WIDTH, new AnnotationAccess(resourcePool)); + ColorManager colorManager = new ColorManager(); + int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION; + SourceViewer viewer = new SourceViewer(composite, verticalRuler, styles); + viewer.configure(new XMLConfiguration(colorManager)); + viewer.setEditable(project != null); + + final IDocument document = emfDocumentProvider.getDocument(); + IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT }); + partitioner.connect(document); + document.setDocumentPartitioner(partitioner); + viewer.setDocument(document); + verticalRuler.setModel(model); + + emfDocumentProvider.setValidationChangedCallback(new Runnable() { + + public void run() { + model.removeAllAnnotations(); + + for (Diagnostic d : emfDocumentProvider.getErrorList()) { + Annotation a = new Annotation("e4xmi.error", false, d.getMessage()); //$NON-NLS-1$ + int l; + try { + l = document.getLineOffset(d.getLine() - 1); + model.addAnnotation(a, new Position(l)); + } catch (BadLocationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } + }); + + return viewer.getControl(); + } + + private Composite createFormTab(Composite composite) { SashForm form = new SashForm(composite, SWT.HORIZONTAL); form.setBackground(form.getDisplay().getSystemColor(SWT.COLOR_WHITE)); @@ -383,7 +491,7 @@ public void menuAboutToShow(IMenuManager manager) { } if (o.eContainer() != null) { - actions.add(new Action(Messages.ModelEditor_Delete, ImageDescriptor.createFromImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_cross))) { + actions.add(new Action(messages.ModelEditor_Delete, ImageDescriptor.createFromImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_cross))) { public void run() { if (o.eContainingFeature().isMany()) { Command cmd = RemoveCommand.create(ModelEditor.this.modelProvider.getEditingDomain(), o.eContainer(), o.eContainingFeature(), o); @@ -409,11 +517,9 @@ public void run() { } }); viewer.getControl().setMenu(mgr.createContextMenu(viewer.getControl())); - } - - @PostConstruct - void postCreate() { viewer.setSelection(new StructuredSelection(modelProvider.getRoot())); + + return form; } public IExtensionLookup getExtensionLookup() { @@ -516,7 +622,7 @@ private TreeViewer createTreeViewerArea(Composite parent) { ShadowComposite editingArea = new ShadowComposite(parent, SWT.NONE); editingArea.setLayout(new FillLayout()); final TreeViewer viewer = new TreeViewer(editingArea, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); - viewer.setLabelProvider(new ComponentLabelProvider(this)); + viewer.setLabelProvider(new ComponentLabelProvider(this, messages)); ObservableListTreeContentProvider contentProvider = new ObservableListTreeContentProvider(new ObservableFactoryImpl(), new TreeStructureAdvisorImpl()); viewer.setContentProvider(contentProvider); @@ -591,25 +697,25 @@ private void registerContributedVirtualEditors() { } private void registerVirtualEditors() { - registerVirtualEditor(VIRTUAL_PART_MENU, new VMenuEditor(modelProvider.getEditingDomain(), this, BasicPackageImpl.Literals.PART__MENUS, resourcePool)); - registerVirtualEditor(VIRTUAL_HANDLER, new VHandlerEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerVirtualEditor(VIRTUAL_BINDING_TABLE, new VBindingTableEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerVirtualEditor(VIRTUAL_COMMAND, new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.APPLICATION__COMMANDS, resourcePool)); - registerVirtualEditor(VIRTUAL_WINDOWS, new VWindowEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerVirtualEditor(VIRTUAL_WINDOW_CONTROLS, new VWindowControlEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerVirtualEditor(VIRTUAL_PART_DESCRIPTORS, new VPartDescriptor(modelProvider.getEditingDomain(), this, resourcePool)); - registerVirtualEditor(VIRTUAL_PARTDESCRIPTOR_MENU, new VMenuEditor(modelProvider.getEditingDomain(), this, org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS, resourcePool)); - registerVirtualEditor(VIRTUAL_TRIMMED_WINDOW_TRIMS, new VWindowTrimEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerVirtualEditor(VIRTUAL_ADDONS, new VApplicationAddons(modelProvider.getEditingDomain(), this, resourcePool)); - registerVirtualEditor(VIRTUAL_MENU_CONTRIBUTIONS, new VMenuContributionsEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerVirtualEditor(VIRTUAL_TOOLBAR_CONTRIBUTIONS, new VToolBarContributionsEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerVirtualEditor(VIRTUAL_TRIM_CONTRIBUTIONS, new VTrimContributionsEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerVirtualEditor(VIRTUAL_WINDOW_SHARED_ELEMENTS, new VWindowSharedElementsEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerVirtualEditor(VIRTUAL_MODEL_FRAGEMENTS, new VModelFragmentsEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerVirtualEditor(VIRTUAL_MODEL_IMPORTS, new VModelImportsEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerVirtualEditor(VIRTUAL_CATEGORIES, new VApplicationCategoriesEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerVirtualEditor(VIRTUAL_PARAMETERS, new VItemParametersEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerVirtualEditor(VIRTUAL_ROOT_CONTEXTS, new VRootBindingContexts(modelProvider.getEditingDomain(), this, resourcePool)); + registerVirtualEditor(VIRTUAL_PART_MENU, ContextInjectionFactory.make(VPartMenuEditor.class, context)); + registerVirtualEditor(VIRTUAL_HANDLER, ContextInjectionFactory.make(VHandlerEditor.class, context)); + registerVirtualEditor(VIRTUAL_BINDING_TABLE, ContextInjectionFactory.make(VBindingTableEditor.class, context)); + registerVirtualEditor(VIRTUAL_COMMAND, ContextInjectionFactory.make(VCommandEditor.class, context)); + registerVirtualEditor(VIRTUAL_WINDOWS, ContextInjectionFactory.make(VWindowEditor.class, context)); + registerVirtualEditor(VIRTUAL_WINDOW_CONTROLS, ContextInjectionFactory.make(VWindowControlEditor.class, context)); + registerVirtualEditor(VIRTUAL_PART_DESCRIPTORS, ContextInjectionFactory.make(VPartDescriptor.class, context)); + registerVirtualEditor(VIRTUAL_PARTDESCRIPTOR_MENU, ContextInjectionFactory.make(VPartDescriptorMenuEditor.class, context)); + registerVirtualEditor(VIRTUAL_TRIMMED_WINDOW_TRIMS, ContextInjectionFactory.make(VWindowTrimEditor.class, context)); + registerVirtualEditor(VIRTUAL_ADDONS, ContextInjectionFactory.make(VApplicationAddons.class, context)); + registerVirtualEditor(VIRTUAL_MENU_CONTRIBUTIONS, ContextInjectionFactory.make(VMenuContributionsEditor.class, context)); + registerVirtualEditor(VIRTUAL_TOOLBAR_CONTRIBUTIONS, ContextInjectionFactory.make(VToolBarContributionsEditor.class, context)); + registerVirtualEditor(VIRTUAL_TRIM_CONTRIBUTIONS, ContextInjectionFactory.make(VTrimContributionsEditor.class, context)); + registerVirtualEditor(VIRTUAL_WINDOW_SHARED_ELEMENTS, ContextInjectionFactory.make(VWindowSharedElementsEditor.class, context)); + registerVirtualEditor(VIRTUAL_MODEL_FRAGEMENTS, ContextInjectionFactory.make(VModelFragmentsEditor.class, context)); + registerVirtualEditor(VIRTUAL_MODEL_IMPORTS, ContextInjectionFactory.make(VModelImportsEditor.class, context)); + registerVirtualEditor(VIRTUAL_CATEGORIES, ContextInjectionFactory.make(VApplicationCategoriesEditor.class, context)); + registerVirtualEditor(VIRTUAL_PARAMETERS, ContextInjectionFactory.make(VItemParametersEditor.class, context)); + registerVirtualEditor(VIRTUAL_ROOT_CONTEXTS, ContextInjectionFactory.make(VRootBindingContexts.class, context)); } private void registerVirtualEditor(String id, AbstractComponentEditor editor) { @@ -643,55 +749,57 @@ private void registerContributedEditors() { } private void registerDefaultEditors() { - registerEditor(ApplicationPackageImpl.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerEditor(ApplicationPackageImpl.Literals.ADDON, new AddonsEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); - - registerEditor(CommandsPackageImpl.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(), this, modelProvider, resourcePool)); - registerEditor(CommandsPackageImpl.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain(), this, modelProvider, project, resourcePool)); - registerEditor(CommandsPackageImpl.Literals.COMMAND, new CommandEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerEditor(CommandsPackageImpl.Literals.COMMAND_PARAMETER, new CommandParameterEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerEditor(CommandsPackageImpl.Literals.PARAMETER, new ParameterEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerEditor(CommandsPackageImpl.Literals.BINDING_TABLE, new BindingTableEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerEditor(CommandsPackageImpl.Literals.BINDING_CONTEXT, new BindingContextEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerEditor(CommandsPackageImpl.Literals.CATEGORY, new CategoryEditor(modelProvider.getEditingDomain(), this, resourcePool)); - - registerEditor(MenuPackageImpl.Literals.TOOL_BAR, new ToolBarEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerEditor(MenuPackageImpl.Literals.RENDERED_TOOL_BAR, new RenderedToolBarEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerEditor(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); - registerEditor(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, new HandledToolItemEditor(modelProvider.getEditingDomain(), this, project, modelProvider, resourcePool)); - registerEditor(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, new ToolBarSeparatorEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerEditor(MenuPackageImpl.Literals.TOOL_CONTROL, new ToolControlEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); - - registerEditor(MenuPackageImpl.Literals.MENU, new MenuEditor(modelProvider.getEditingDomain(), project, this, resourcePool)); - registerEditor(MenuPackageImpl.Literals.RENDERED_MENU, new RenderedMenuEditor(modelProvider.getEditingDomain(), project, this, resourcePool)); - registerEditor(MenuPackageImpl.Literals.POPUP_MENU, new PopupMenuEditor(modelProvider.getEditingDomain(), project, this, resourcePool)); - registerEditor(MenuPackageImpl.Literals.MENU_SEPARATOR, new MenuSeparatorEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), this, project, modelProvider, resourcePool)); - registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); - registerEditor(MenuPackageImpl.Literals.RENDERED_MENU_ITEM, new RenderedMenuItem(modelProvider.getEditingDomain(), this, project, resourcePool)); - registerEditor(MenuPackageImpl.Literals.MENU_CONTRIBUTION, new MenuContributionEditor(modelProvider.getEditingDomain(), project, this, resourcePool)); - registerEditor(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION, new ToolBarContributionEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerEditor(MenuPackageImpl.Literals.TRIM_CONTRIBUTION, new TrimContributionEditor(modelProvider.getEditingDomain(), this, resourcePool)); - - registerEditor(UiPackageImpl.Literals.CORE_EXPRESSION, new CoreExpressionEditor(modelProvider.getEditingDomain(), this, resourcePool)); - - registerEditor(BasicPackageImpl.Literals.PART, new PartEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); - registerEditor(BasicPackageImpl.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); - registerEditor(BasicPackageImpl.Literals.TRIMMED_WINDOW, new TrimmedWindowEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); - registerEditor(BasicPackageImpl.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerEditor(AdvancedPackageImpl.Literals.AREA, new AreaEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); - registerEditor(BasicPackageImpl.Literals.PART_STACK, new PartStackEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerEditor(BasicPackageImpl.Literals.INPUT_PART, new InputPartEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); - registerEditor(BasicPackageImpl.Literals.TRIM_BAR, new TrimBarEditor(modelProvider.getEditingDomain(), this, resourcePool)); - - registerEditor(org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain(), this, project, resourcePool)); - - registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, new PerspectiveStackEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE, new PerspectiveEditor(modelProvider.getEditingDomain(), project, this, resourcePool)); - registerEditor(AdvancedPackageImpl.Literals.PLACEHOLDER, new PlaceholderEditor(modelProvider.getEditingDomain(), this, modelProvider, resourcePool)); - - registerEditor(FragmentPackageImpl.Literals.MODEL_FRAGMENTS, new ModelFragmentsEditor(modelProvider.getEditingDomain(), this, resourcePool)); - registerEditor(FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT, new StringModelFragment(modelProvider.getEditingDomain(), this, resourcePool)); + System.err.println(resourcePool); + + registerEditor(ApplicationPackageImpl.Literals.APPLICATION, ContextInjectionFactory.make(ApplicationEditor.class, context)); + registerEditor(ApplicationPackageImpl.Literals.ADDON, ContextInjectionFactory.make(AddonsEditor.class, context)); + + registerEditor(CommandsPackageImpl.Literals.KEY_BINDING, ContextInjectionFactory.make(KeyBindingEditor.class, context)); + registerEditor(CommandsPackageImpl.Literals.HANDLER, ContextInjectionFactory.make(HandlerEditor.class, context)); + registerEditor(CommandsPackageImpl.Literals.COMMAND, ContextInjectionFactory.make(CommandEditor.class, context)); + registerEditor(CommandsPackageImpl.Literals.COMMAND_PARAMETER, ContextInjectionFactory.make(CommandParameterEditor.class, context)); + registerEditor(CommandsPackageImpl.Literals.PARAMETER, ContextInjectionFactory.make(ParameterEditor.class, context)); + registerEditor(CommandsPackageImpl.Literals.BINDING_TABLE, ContextInjectionFactory.make(BindingTableEditor.class, context)); + registerEditor(CommandsPackageImpl.Literals.BINDING_CONTEXT, ContextInjectionFactory.make(BindingContextEditor.class, context)); + registerEditor(CommandsPackageImpl.Literals.CATEGORY, ContextInjectionFactory.make(CategoryEditor.class, context)); + + registerEditor(MenuPackageImpl.Literals.TOOL_BAR, ContextInjectionFactory.make(ToolBarEditor.class, context)); + registerEditor(MenuPackageImpl.Literals.RENDERED_TOOL_BAR, ContextInjectionFactory.make(RenderedToolBarEditor.class, context)); + registerEditor(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, ContextInjectionFactory.make(DirectToolItemEditor.class, context)); + registerEditor(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, ContextInjectionFactory.make(HandledToolItemEditor.class, context)); + registerEditor(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, ContextInjectionFactory.make(ToolBarSeparatorEditor.class, context)); + registerEditor(MenuPackageImpl.Literals.TOOL_CONTROL, ContextInjectionFactory.make(ToolControlEditor.class, context)); + + registerEditor(MenuPackageImpl.Literals.MENU, ContextInjectionFactory.make(MenuEditor.class, context)); + registerEditor(MenuPackageImpl.Literals.RENDERED_MENU, ContextInjectionFactory.make(RenderedMenuEditor.class, context)); + registerEditor(MenuPackageImpl.Literals.POPUP_MENU, ContextInjectionFactory.make(PopupMenuEditor.class, context)); + registerEditor(MenuPackageImpl.Literals.MENU_SEPARATOR, ContextInjectionFactory.make(MenuSeparatorEditor.class, context)); + registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, ContextInjectionFactory.make(HandledMenuItemEditor.class, context)); + registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, ContextInjectionFactory.make(DirectMenuItemEditor.class, context)); + registerEditor(MenuPackageImpl.Literals.RENDERED_MENU_ITEM, ContextInjectionFactory.make(RenderedMenuItem.class, context)); + registerEditor(MenuPackageImpl.Literals.MENU_CONTRIBUTION, ContextInjectionFactory.make(MenuContributionEditor.class, context)); + registerEditor(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION, ContextInjectionFactory.make(ToolBarContributionEditor.class, context)); + registerEditor(MenuPackageImpl.Literals.TRIM_CONTRIBUTION, ContextInjectionFactory.make(TrimContributionEditor.class, context)); + + registerEditor(UiPackageImpl.Literals.CORE_EXPRESSION, ContextInjectionFactory.make(CoreExpressionEditor.class, context)); + + registerEditor(BasicPackageImpl.Literals.PART, ContextInjectionFactory.make(PartEditor.class, context)); + registerEditor(BasicPackageImpl.Literals.WINDOW, ContextInjectionFactory.make(WindowEditor.class, context)); + registerEditor(BasicPackageImpl.Literals.TRIMMED_WINDOW, ContextInjectionFactory.make(TrimmedWindowEditor.class, context)); + registerEditor(BasicPackageImpl.Literals.PART_SASH_CONTAINER, ContextInjectionFactory.make(PartSashContainerEditor.class, context)); + registerEditor(AdvancedPackageImpl.Literals.AREA, ContextInjectionFactory.make(AreaEditor.class, context)); + registerEditor(BasicPackageImpl.Literals.PART_STACK, ContextInjectionFactory.make(PartStackEditor.class, context)); + registerEditor(BasicPackageImpl.Literals.INPUT_PART, ContextInjectionFactory.make(InputPartEditor.class, context)); + registerEditor(BasicPackageImpl.Literals.TRIM_BAR, ContextInjectionFactory.make(TrimBarEditor.class, context)); + + registerEditor(org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR, ContextInjectionFactory.make(PartDescriptorEditor.class, context)); + + registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, ContextInjectionFactory.make(PerspectiveStackEditor.class, context)); + registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE, ContextInjectionFactory.make(PerspectiveEditor.class, context)); + registerEditor(AdvancedPackageImpl.Literals.PLACEHOLDER, ContextInjectionFactory.make(PlaceholderEditor.class, context)); + + registerEditor(FragmentPackageImpl.Literals.MODEL_FRAGMENTS, ContextInjectionFactory.make(ModelFragmentsEditor.class, context)); + registerEditor(FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT, ContextInjectionFactory.make(StringModelFragment.class, context)); } public void registerEditor(EClass eClass, AbstractComponentEditor editor) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index eda867614a..6a88ffcdac 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -10,27 +10,25 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.ContributionURIValidator; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -50,12 +48,16 @@ public class AddonsEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; + + @Inject + @Optional private IProject project; + private EStackLayout stackLayout; - public AddonsEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); - this.project = project; + @Inject + public AddonsEditor() { + super(); } @Override @@ -128,7 +130,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, } if (getEditor().isModelFragment() && isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -174,14 +176,14 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages); dialog.open(); } }); } - ControlFactory.createMapProperties(parent, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, Messages.AddonsEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.AddonsEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 6ad610e85e..7f73e005fc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -10,15 +10,14 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -29,7 +28,6 @@ import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -59,8 +57,9 @@ public class ApplicationEditor extends AbstractComponentEditor { private IListProperty BINDING_TABLE_CONTAINER__ROOT_CONTEXT = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT); - public ApplicationEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public ApplicationEditor() { + super(); } @Override @@ -125,8 +124,8 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, Messages.ApplicationEditor_BindingContexts, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ApplicationEditor_BindingContexts, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java index 955b3875ea..2f3af7ca9d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java @@ -11,20 +11,19 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component; import java.util.List; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.AreaIconDialogEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -47,7 +46,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; @@ -79,11 +77,14 @@ public class AreaEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; + + @Inject + @Optional private IProject project; - public AreaEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); - this.project = project; + @Inject + public AreaEditor() { + super(); } @Override @@ -166,7 +167,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -197,7 +198,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - new ImageTooltip(t) { + new ImageTooltip(t, Messages) { @Override protected URI getImageURI() { @@ -217,7 +218,7 @@ protected URI getImageURI() { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - AreaIconDialogEditor dialog = new AreaIconDialogEditor(b.getShell(), project, getEditingDomain(), (MPart) getMaster().getValue()); + AreaIconDialogEditor dialog = new AreaIconDialogEditor(b.getShell(), project, getEditingDomain(), (MPart) getMaster().getValue(), Messages); dialog.open(); } }); @@ -271,7 +272,7 @@ public String getText(Object element) { viewer.getControl().setLayoutData(gd); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(getMaster())); @@ -389,7 +390,7 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java index 045adbec06..86b346b413 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java @@ -12,17 +12,16 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MBindingContext; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; @@ -36,7 +35,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -65,8 +63,13 @@ public class BindingContextEditor extends AbstractComponentEditor { private List actions = new ArrayList(); - public BindingContextEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public BindingContextEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.BindingContextEditor_AddContext, createImageDescriptor(ResourceProvider.IMG_BindingContext)) { @Override public void run() { @@ -147,7 +150,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -166,7 +169,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN); viewer.setInput(prop.observeDetail(master)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index ecb550e6ff..c389c96153 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -12,18 +12,17 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BindingContextSelectionDialog; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MBindingTable; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MKeyBinding; @@ -40,7 +39,6 @@ import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -70,8 +68,13 @@ public class BindingTableEditor extends AbstractComponentEditor { private EStackLayout stackLayout; private List actions = new ArrayList(); - public BindingTableEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public BindingTableEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.BindingTableEditor_AddKeyBinding, createImageDescriptor(ResourceProvider.IMG_KeyBinding)) { @Override public void run() { @@ -141,7 +144,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO } if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -173,7 +176,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - BindingContextSelectionDialog dialog = new BindingContextSelectionDialog(b.getShell(), getEditor().getModelProvider()); + BindingContextSelectionDialog dialog = new BindingContextSelectionDialog(b.getShell(), getEditor().getModelProvider(), Messages); if (dialog.open() == BindingContextSelectionDialog.OK) { Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID, dialog.getSelectedId()); if (cmd.canExecute()) { @@ -196,7 +199,7 @@ public void widgetSelected(SelectionEvent e) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); IEMFListProperty prop = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS); viewer.setInput(prop.observeDetail(getMaster())); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java index 71904eb140..b6e35c248e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java @@ -10,21 +10,18 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -40,8 +37,9 @@ public class CategoryEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private EStackLayout stackLayout; - public CategoryEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public CategoryEditor() { + super(); } @Override @@ -110,7 +108,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO } if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -118,7 +116,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.CategoryEditor_Name, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.CATEGORY__NAME)); ControlFactory.createTextField(parent, Messages.CategoryEditor_Description, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.CATEGORY__DESCRIPTION)); - ControlFactory.createStringListWidget(parent, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index c4d4ddf397..a49e84e3bf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -12,17 +12,16 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.CommandCategorySelectionDialog; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MCommand; import org.eclipse.e4.ui.model.application.commands.MCommandParameter; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; @@ -37,7 +36,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -67,8 +65,13 @@ public class CommandEditor extends AbstractComponentEditor { private IEMFEditListProperty COMMAND__PARAMETERS = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__PARAMETERS); - public CommandEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public CommandEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.CommandEditor_AddCommandParameter, createImageDescriptor(ResourceProvider.IMG_CommandParameter)) { @Override public void run() { @@ -138,7 +141,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO } if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -201,7 +204,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - CommandCategorySelectionDialog dialog = new CommandCategorySelectionDialog(b.getShell(), getEditor().getModelProvider(), (MCommand) getMaster().getValue()); + CommandCategorySelectionDialog dialog = new CommandCategorySelectionDialog(b.getShell(), getEditor().getModelProvider(), (MCommand) getMaster().getValue(), Messages); dialog.open(); } }); @@ -216,7 +219,7 @@ public void widgetSelected(SelectionEvent e) { final TableViewer viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 120; @@ -317,7 +320,7 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java index 1a79f32a0f..351ed51b7d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java @@ -10,15 +10,13 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MCommandParameter; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -26,7 +24,6 @@ import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -45,8 +42,9 @@ public class CommandParameterEditor extends AbstractComponentEditor { private EStackLayout stackLayout; - public CommandParameterEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public CommandParameterEditor() { + super(); } @Override @@ -121,7 +119,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index b5c73a2836..c14d9ce8ac 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -80,7 +80,7 @@ public class ControlFactory { public static void createXMIId(Composite parent, AbstractComponentEditor editor) { Label l = new Label(parent, SWT.NONE); - l.setText("XMI:ID"); + l.setText("XMI:ID"); //$NON-NLS-1$ l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); final Text t = new Text(parent, SWT.BORDER); @@ -106,7 +106,7 @@ public void handleValueChange(ValueChangeEvent event) { }); } - public static void createMapProperties(Composite parent, final AbstractComponentEditor editor, String label, final EStructuralFeature feature, int vIndent) { + public static void createMapProperties(Composite parent, final Messages Messages, final AbstractComponentEditor editor, String label, final EStructuralFeature feature, int vIndent) { Label l = new Label(parent, SWT.NONE); l.setText(label); GridData gd = new GridData(GridData.END, GridData.BEGINNING, false, false); @@ -273,7 +273,7 @@ public static void createTextField(Composite parent, String label, IObservableVa } - public static void createFindImport(Composite parent, final AbstractComponentEditor editor, EMFDataBindingContext context) { + public static void createFindImport(Composite parent, final Messages Messages, final AbstractComponentEditor editor, EMFDataBindingContext context) { IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); Label l = new Label(parent, SWT.NONE); @@ -291,7 +291,7 @@ public static void createFindImport(Composite parent, final AbstractComponentEdi b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - FindImportElementDialog dialog = new FindImportElementDialog(b.getShell(), editor, (EObject) editor.getMaster().getValue()); + FindImportElementDialog dialog = new FindImportElementDialog(b.getShell(), editor, (EObject) editor.getMaster().getValue(), Messages); dialog.open(); } }); @@ -363,7 +363,7 @@ public void handleValueChange(ValueChangeEvent event) { }); } - public static void createStringListWidget(Composite parent, final AbstractComponentEditor editor, String label, final EStructuralFeature feature, int vIndent) { + public static void createStringListWidget(Composite parent, Messages Messages, final AbstractComponentEditor editor, String label, final EStructuralFeature feature, int vIndent) { Label l = new Label(parent, SWT.NONE); l.setText(label); GridData gd = new GridData(GridData.END, GridData.BEGINNING, false, false); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java index dc0d852e29..7834e8d631 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java @@ -10,19 +10,16 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ExpressionIdDialog; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.MCoreExpression; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -42,8 +39,9 @@ public class CoreExpressionEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - public CoreExpressionEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public CoreExpressionEditor() { + super(); } @Override @@ -111,7 +109,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ExpressionIdDialog dialog = new ExpressionIdDialog(t.getShell(), getEditor().getExtensionLookup(), (MCoreExpression) getMaster().getValue(), getEditingDomain(), getEditor().isLiveModel()); + ExpressionIdDialog dialog = new ExpressionIdDialog(t.getShell(), getEditor().getExtensionLookup(), (MCoreExpression) getMaster().getValue(), getEditingDomain(), getEditor().isLiveModel(), Messages); dialog.open(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index d5933aa989..411a15775d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -10,6 +10,7 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -17,15 +18,11 @@ import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.ContributionURIValidator; import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -36,7 +33,6 @@ import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -54,8 +50,9 @@ public class DirectMenuItemEditor extends MenuItemEditor { private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); - public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { - super(editingDomain, editor, project, resourcePool); + @Inject + public DirectMenuItemEditor() { + super(); } @Override @@ -117,7 +114,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages); dialog.open(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index f5dc180f52..f435c895f6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -10,6 +10,7 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -17,15 +18,11 @@ import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.ContributionURIValidator; import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -36,7 +33,6 @@ import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -54,8 +50,9 @@ public class DirectToolItemEditor extends ToolItemEditor { private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); - public DirectToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { - super(editingDomain, editor, project, resourcePool); + @Inject + public DirectToolItemEditor() { + super(); } @Override @@ -105,7 +102,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages); dialog.open(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index d320108383..f7e952a3bf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -10,21 +10,19 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.CommandToStringConverter; import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledMenuItemCommandSelectionDialog; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -36,7 +34,6 @@ import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -51,14 +48,16 @@ import org.eclipse.swt.widgets.Text; public class HandledMenuItemEditor extends MenuItemEditor { - private IModelResource resource; private IEMFEditListProperty HANDLED_ITEM__PARAMETERS = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); - public HandledMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource, IResourcePool resourcePool) { - super(editingDomain, editor, project, resourcePool); - this.resource = resource; + @Inject + private IModelResource resource; + + @Inject + public HandledMenuItemEditor() { + super(); } @Override @@ -98,7 +97,7 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEditable(false); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND).observeDetail(master), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND).observeDetail(master), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter(Messages))); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); @@ -107,7 +106,7 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - HandledMenuItemCommandSelectionDialog dialog = new HandledMenuItemCommandSelectionDialog(b.getShell(), (MHandledItem) getMaster().getValue(), resource); + HandledMenuItemCommandSelectionDialog dialog = new HandledMenuItemCommandSelectionDialog(b.getShell(), (MHandledItem) getMaster().getValue(), resource, Messages); dialog.open(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index 61c4cdca91..2044e0708a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -10,21 +10,19 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.CommandToStringConverter; import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledToolItemCommandSelectionDialog; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -36,7 +34,6 @@ import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -51,14 +48,16 @@ import org.eclipse.swt.widgets.Text; public class HandledToolItemEditor extends ToolItemEditor { - private IModelResource resource; private IEMFEditListProperty HANDLED_ITEM__PARAMETERS = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); - public HandledToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource, IResourcePool resourcePool) { - super(editingDomain, editor, project, resourcePool); - this.resource = resource; + @Inject + private IModelResource resource; + + @Inject + public HandledToolItemEditor() { + super(); } @Override @@ -87,7 +86,7 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEditable(false); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND).observeDetail(master), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND).observeDetail(master), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter(Messages))); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); @@ -96,7 +95,7 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - HandledToolItemCommandSelectionDialog dialog = new HandledToolItemCommandSelectionDialog(b.getShell(), (MHandledItem) getMaster().getValue(), resource); + HandledToolItemCommandSelectionDialog dialog = new HandledToolItemCommandSelectionDialog(b.getShell(), (MHandledItem) getMaster().getValue(), resource, Messages); dialog.open(); } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index dc65799b46..6130636cce 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -10,11 +10,13 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.CommandToStringConverter; import org.eclipse.e4.tools.emf.ui.common.ContributionURIValidator; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; @@ -22,12 +24,9 @@ import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandlerCommandSelectionDialog; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; @@ -36,7 +35,6 @@ import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -56,14 +54,18 @@ public class HandlerEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; + private EStackLayout stackLayout; + + @Inject private IModelResource resource; + + @Inject + @Optional private IProject project; - private EStackLayout stackLayout; - public HandlerEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource, IProject project, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); - this.resource = resource; - this.project = project; + @Inject + public HandlerEditor() { + super(); } @Override @@ -127,7 +129,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO } if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -153,7 +155,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEditable(false); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.HANDLER__COMMAND).observeDetail(getMaster()), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.HANDLER__COMMAND).observeDetail(getMaster()), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter(Messages))); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); @@ -162,7 +164,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - HandlerCommandSelectionDialog dialog = new HandlerCommandSelectionDialog(b.getShell(), (MHandler) getMaster().getValue(), resource); + HandlerCommandSelectionDialog dialog = new HandlerCommandSelectionDialog(b.getShell(), (MHandler) getMaster().getValue(), resource, Messages); dialog.open(); } }); @@ -199,13 +201,13 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages); dialog.open(); } }); } - ControlFactory.createMapProperties(parent, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java index 6cc41e1778..0ae5765a7b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java @@ -10,15 +10,12 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -29,8 +26,9 @@ public class InputPartEditor extends PartEditor { - public InputPartEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { - super(editingDomain, editor, project, resourcePool); + @Inject + public InputPartEditor() { + super(); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 30f7dc44fc..1b31435d51 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -12,6 +12,8 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -24,12 +26,9 @@ import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.KeyBindingCommandSelectionDialog; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MKeyBinding; import org.eclipse.e4.ui.model.application.commands.MKeySequence; @@ -45,7 +44,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.bindings.keys.KeySequence; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; @@ -71,15 +69,21 @@ public class KeyBindingEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private IModelResource resource; private EStackLayout stackLayout; private List actions = new ArrayList(); private IEMFEditListProperty KEY_BINDING__PARAMETERS = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS); - public KeyBindingEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); - this.resource = resource; + @Inject + private IModelResource resource; + + @Inject + public KeyBindingEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.KeyBindingEditor_AddParameter, createImageDescriptor(ResourceProvider.IMG_Parameter)) { @Override public void run() { @@ -149,7 +153,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -189,7 +193,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEditable(false); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_BINDING__COMMAND).observeDetail(getMaster()), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter())); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_BINDING__COMMAND).observeDetail(getMaster()), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter(Messages))); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_FindEllipsis); @@ -198,7 +202,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - KeyBindingCommandSelectionDialog dialog = new KeyBindingCommandSelectionDialog(b.getShell(), (MKeyBinding) getMaster().getValue(), resource); + KeyBindingCommandSelectionDialog dialog = new KeyBindingCommandSelectionDialog(b.getShell(), (MKeyBinding) getMaster().getValue(), resource, Messages); dialog.open(); } }); @@ -211,7 +215,7 @@ public void widgetSelected(SelectionEvent e) { final TableViewer viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 120; @@ -312,7 +316,7 @@ public void widgetSelected(SelectionEvent e) { b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index f244a12110..b0eea46bde 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -11,18 +11,15 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component; import java.util.List; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -40,7 +37,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -82,8 +78,9 @@ public Struct(String label, EClass eClass, boolean separator) { } } - public MenuContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public MenuContributionEditor() { + super(); } @Override @@ -160,7 +157,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -214,7 +211,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr final TableViewer viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; @@ -339,7 +336,7 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index bb88a0df90..90e6eda011 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -12,6 +12,8 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IListChangeListener; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -23,18 +25,16 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor.EClass2EObject; import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor.EObject2EClass; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MExpression; @@ -58,7 +58,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -87,13 +86,16 @@ public class MenuEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); private EStackLayout stackLayout; private List actions = new ArrayList(); + @Inject + @Optional + private IProject project; + private static class Struct { private final String label; private final EClass eClass; @@ -106,9 +108,13 @@ public Struct(String label, EClass eClass, boolean separator) { } } - public MenuEditor(EditingDomain editingDomain, IProject project, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); - this.project = project; + @Inject + public MenuEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.MenuEditor_AddHandledMenuItem, createImageDescriptor(ResourceProvider.IMG_MenuItem)) { @Override public void run() { @@ -200,7 +206,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -257,7 +263,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(master)); @@ -389,7 +395,7 @@ public void widgetSelected(SelectionEvent e) { t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - new ImageTooltip(t) { + new ImageTooltip(t, Messages) { @Override protected URI getImageURI() { @@ -409,7 +415,7 @@ protected URI getImageURI() { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MenuIconDialogEditor dialog = new MenuIconDialogEditor(b.getShell(), project, getEditingDomain(), (MMenu) getMaster().getValue()); + MenuIconDialogEditor dialog = new MenuIconDialogEditor(b.getShell(), project, getEditingDomain(), (MMenu) getMaster().getValue(), Messages); dialog.open(); } }); @@ -439,13 +445,13 @@ public String getText(Object element) { list.add(UiPackageImpl.Literals.CORE_EXPRESSION); list.addAll(getEditor().getFeatureClasses(UiPackageImpl.Literals.EXPRESSION, UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN)); combo.setInput(list); - context.bindValue(ViewerProperties.singleSelection().observe(combo), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN).observeDetail(getMaster()), new UpdateValueStrategy().setConverter(new EClass2EObject()), new UpdateValueStrategy().setConverter(new EObject2EClass())); + context.bindValue(ViewerProperties.singleSelection().observe(combo), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN).observeDetail(getMaster()), new UpdateValueStrategy().setConverter(new EClass2EObject(Messages)), new UpdateValueStrategy().setConverter(new EObject2EClass(Messages))); } ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index b3f2a1000a..251fda8fef 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -12,21 +12,21 @@ import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.conversion.Converter; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuItemIconDialogEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; @@ -41,7 +41,6 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerProperties; @@ -65,12 +64,15 @@ public abstract class MenuItemEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - protected IProject project; + private EStackLayout stackLayout; - public MenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); - this.project = project; + @Inject + @Optional + protected IProject project; + + public MenuItemEditor() { + super(); } @Override @@ -134,7 +136,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -220,7 +222,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - new ImageTooltip(t) { + new ImageTooltip(t, Messages) { @Override protected URI getImageURI() { @@ -240,7 +242,7 @@ protected URI getImageURI() { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - MenuItemIconDialogEditor dialog = new MenuItemIconDialogEditor(b.getShell(), project, getEditingDomain(), (MMenuItem) getMaster().getValue()); + MenuItemIconDialogEditor dialog = new MenuItemIconDialogEditor(b.getShell(), project, getEditingDomain(), (MMenuItem) getMaster().getValue(), Messages); dialog.open(); } }); @@ -308,7 +310,7 @@ public String getText(Object element) { list.add(UiPackageImpl.Literals.CORE_EXPRESSION); list.addAll(getEditor().getFeatureClasses(UiPackageImpl.Literals.EXPRESSION, UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN)); combo.setInput(list); - context.bindValue(ViewerProperties.singleSelection().observe(combo), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN).observeDetail(getMaster()), new UpdateValueStrategy().setConverter(new EClass2EObject()), new UpdateValueStrategy().setConverter(new EObject2EClass())); + context.bindValue(ViewerProperties.singleSelection().observe(combo), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN).observeDetail(getMaster()), new UpdateValueStrategy().setConverter(new EClass2EObject(Messages)), new UpdateValueStrategy().setConverter(new EObject2EClass(Messages))); } createFormSubTypeForm(parent, context, master); @@ -316,7 +318,7 @@ public String getText(Object element) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } @@ -343,8 +345,11 @@ public FeaturePath[] getLabelProperties() { } static class EObject2EClass extends Converter { - public EObject2EClass() { + Messages Messages; + + public EObject2EClass(Messages Messages) { super(EObject.class, EClass.class); + this.Messages = Messages; } public Object convert(Object fromObject) { @@ -356,9 +361,11 @@ public Object convert(Object fromObject) { } static class EClass2EObject extends Converter { + Messages Messages; - public EClass2EObject() { + public EClass2EObject(Messages Messages) { super(EClass.class, EObject.class); + this.Messages = Messages; } public Object convert(Object fromObject) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index 34356ca83e..0ac8e5e11c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -10,21 +10,18 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -42,8 +39,9 @@ public class MenuSeparatorEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private EStackLayout stackLayout; - public MenuSeparatorEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public MenuSeparatorEditor() { + super(); } @Override @@ -112,7 +110,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -134,7 +132,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java index 7cb41fd053..2ee762c4ec 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java @@ -12,17 +12,16 @@ import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.fragment.MFragmentFactory; import org.eclipse.e4.ui.model.fragment.MModelFragment; @@ -39,7 +38,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; @@ -67,8 +65,9 @@ public class ModelFragmentsEditor extends AbstractComponentEditor { private Composite composite; - public ModelFragmentsEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public ModelFragmentsEditor() { + super(); } @Override @@ -112,7 +111,7 @@ private Composite createForm(Composite parent) { final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 200; viewer.getControl().setLayoutData(gd); @@ -253,7 +252,7 @@ public void widgetSelected(SelectionEvent e) { final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 200; viewer.getControl().setLayoutData(gd); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java index f40fb4c319..22e06e5183 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java @@ -10,22 +10,19 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -41,8 +38,9 @@ public class ParameterEditor extends AbstractComponentEditor { private EStackLayout stackLayout; - public ParameterEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public ParameterEditor() { + super(); } @Override @@ -117,7 +115,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 217a36fdd3..d78611042d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -10,6 +10,7 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IObservableValue; @@ -22,13 +23,11 @@ import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartDescriptorIconDialogEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; @@ -46,7 +45,6 @@ import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -74,9 +72,9 @@ public class PartDescriptorEditor extends AbstractComponentEditor { private Button createRemoveToolBar; private EStackLayout stackLayout; - public PartDescriptorEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); - this.project = project; + @Inject + public PartDescriptorEditor() { + super(); } @Override @@ -144,7 +142,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -197,7 +195,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - new ImageTooltip(t) { + new ImageTooltip(t, Messages) { @Override protected URI getImageURI() { @@ -217,7 +215,7 @@ protected URI getImageURI() { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - PartDescriptorIconDialogEditor dialog = new PartDescriptorIconDialogEditor(b.getShell(), project, getEditingDomain(), (MPartDescriptor) getMaster().getValue()); + PartDescriptorIconDialogEditor dialog = new PartDescriptorIconDialogEditor(b.getShell(), project, getEditingDomain(), (MPartDescriptor) getMaster().getValue(), Messages); dialog.open(); } }); @@ -240,7 +238,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MPartDescriptor) getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CONTRIBUTION_URI); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MPartDescriptor) getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CONTRIBUTION_URI, Messages); dialog.open(); } }); @@ -336,7 +334,7 @@ public void widgetSelected(SelectionEvent e) { context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CATEGORY).observeDetail(master)); } - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index e2306ba70c..af1321b106 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -10,6 +10,7 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -20,19 +21,18 @@ import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.ContributionURIValidator; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartIconDialogEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -51,7 +51,6 @@ import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -72,7 +71,6 @@ public class PartEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private IProject project; private IListProperty PART__MENUS = EMFProperties.list(BasicPackageImpl.Literals.PART__MENUS); private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); @@ -80,9 +78,13 @@ public class PartEditor extends AbstractComponentEditor { private Button createRemoveToolBar; private EStackLayout stackLayout; - public PartEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); - this.project = project; + @Inject + @Optional + private IProject project; + + @Inject + public PartEditor() { + super(); } @Override @@ -159,7 +161,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -178,7 +180,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - new ImageTooltip(t) { + new ImageTooltip(t, Messages) { @Override protected URI getImageURI() { @@ -198,7 +200,7 @@ protected URI getImageURI() { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - PartIconDialogEditor dialog = new PartIconDialogEditor(b.getShell(), project, getEditingDomain(), (MPart) getMaster().getValue()); + PartIconDialogEditor dialog = new PartIconDialogEditor(b.getShell(), project, getEditingDomain(), (MPart) getMaster().getValue(), Messages); dialog.open(); } }); @@ -235,7 +237,7 @@ public void widgetSelected(SelectionEvent e) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages); dialog.open(); } }); @@ -272,11 +274,11 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, Messages.PartEditor_BindingContexts, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.PartEditor_BindingContexts, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 370b4e0580..29912ff150 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -12,17 +12,16 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -41,7 +40,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -76,8 +74,13 @@ public class PartSashContainerEditor extends AbstractComponentEditor { private EStackLayout stackLayout; private List actions = new ArrayList(); - public PartSashContainerEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public PartSashContainerEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.PartSashContainerEditor_AddPartSashContainer, createImageDescriptor(ResourceProvider.IMG_PartSashContainer)) { @Override public void run() { @@ -196,7 +199,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -263,7 +266,7 @@ public String getText(Object element) { viewer.getControl().setLayoutData(gd); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(getMaster())); @@ -373,7 +376,7 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 06af6efb0c..9830102cea 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -12,17 +12,16 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -40,7 +39,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -74,8 +72,13 @@ public class PartStackEditor extends AbstractComponentEditor { private StackLayout stackLayout; private List actions = new ArrayList(); - public PartStackEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public PartStackEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.PartStackEditor_AddPart, createImageDescriptor(ResourceProvider.IMG_Part)) { @Override public void run() { @@ -165,7 +168,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -207,7 +210,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); @@ -318,7 +321,7 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 3bc04732ce..fe375de2a1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -12,20 +12,20 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PerspectiveIconDialogEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -46,7 +46,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -73,15 +72,22 @@ public class PerspectiveEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private IProject project; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; private List actions = new ArrayList(); - public PerspectiveEditor(EditingDomain editingDomain, IProject project, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); - this.project = project; + @Inject + @Optional + private IProject project; + + @Inject + public PerspectiveEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.PerspectiveEditor_AddPartSashContainer, createImageDescriptor(ResourceProvider.IMG_Perspective)) { @Override public void run() { @@ -205,7 +211,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -262,7 +268,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - new ImageTooltip(t) { + new ImageTooltip(t, Messages) { @Override protected URI getImageURI() { @@ -280,7 +286,7 @@ protected URI getImageURI() { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - PerspectiveIconDialogEditor dialog = new PerspectiveIconDialogEditor(b.getShell(), project, getEditingDomain(), (MPerspective) getMaster().getValue()); + PerspectiveIconDialogEditor dialog = new PerspectiveIconDialogEditor(b.getShell(), project, getEditingDomain(), (MPerspective) getMaster().getValue(), Messages); dialog.open(); } }); @@ -297,7 +303,7 @@ public void widgetSelected(SelectionEvent e) { viewer.getControl().setLayoutData(gd); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(getMaster())); @@ -407,9 +413,9 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createMapProperties(parent, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 711b3d32ad..164d4c93d8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -12,17 +12,16 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -38,7 +37,6 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -67,8 +65,13 @@ public class PerspectiveStackEditor extends AbstractComponentEditor { private EStackLayout stackLayout; private List actions = new ArrayList(); - public PerspectiveStackEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public PerspectiveStackEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.PerspectiveStackEditor_AddPerspective, createImageDescriptor(ResourceProvider.IMG_Perspective)) { @Override public void run() { @@ -152,7 +155,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -181,7 +184,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); @@ -279,7 +282,7 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 89e18c96ec..ab49f99d0b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -10,6 +10,7 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.conversion.Converter; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -18,11 +19,8 @@ import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.SharedElementsDialog; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; @@ -32,7 +30,6 @@ import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -51,12 +48,14 @@ public class PlaceholderEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private IModelResource resource; private EStackLayout stackLayout; - public PlaceholderEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); - this.resource = resource; + @Inject + private IModelResource resource; + + @Inject + public PlaceholderEditor() { + super(); } @Override @@ -150,7 +149,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -214,14 +213,14 @@ public Object convert(Object fromObject) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - SharedElementsDialog dialog = new SharedElementsDialog(b.getShell(), getEditor(), (MPlaceholder) getMaster().getValue(), resource); + SharedElementsDialog dialog = new SharedElementsDialog(b.getShell(), getEditor(), (MPlaceholder) getMaster().getValue(), resource, Messages); dialog.open(); } }); } ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java index be51647acc..799ea94c98 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java @@ -10,28 +10,25 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Composite; public class PopupMenuEditor extends MenuEditor { - public PopupMenuEditor(EditingDomain editingDomain, IProject project, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, project, editor, resourcePool); + @Inject + public PopupMenuEditor() { + super(); } @Override protected Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean rootMenu, boolean isImport) { Composite comp = super.createForm(parent, context, master, rootMenu, isImport); if (!isImport) { - ControlFactory.createMapProperties(parent, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(comp, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(comp, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); } return comp; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java index 5819befe8b..baf767ff30 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java @@ -10,16 +10,14 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; -import org.eclipse.core.resources.IProject; +import javax.inject.Inject; import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.emf.edit.domain.EditingDomain; public class RenderedMenuEditor extends MenuEditor { - public RenderedMenuEditor(EditingDomain editingDomain, IProject project, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, project, editor, resourcePool); + @Inject + public RenderedMenuEditor() { + super(); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java index c4c418f850..fdbed724f0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java @@ -10,19 +10,17 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Composite; public class RenderedMenuItem extends MenuItemEditor { - public RenderedMenuItem(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { - super(editingDomain, editor, project, resourcePool); + @Inject + public RenderedMenuItem() { + super(); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java index 70c61e0445..85d96c2378 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java @@ -10,15 +10,14 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.emf.edit.domain.EditingDomain; public class RenderedToolBarEditor extends ToolBarEditor { - public RenderedToolBarEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public RenderedToolBarEditor() { + super(); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index f5fd803f6d..f4d76d53cc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -12,18 +12,16 @@ import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FeatureSelectionDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindParentReferenceElementDialog; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.fragment.MModelFragment; import org.eclipse.e4.ui.model.fragment.MStringModelFragment; @@ -39,7 +37,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -69,8 +66,9 @@ public class StringModelFragment extends AbstractComponentEditor { private IListProperty MODEL_FRAGMENT__ELEMENTS = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS); - public StringModelFragment(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public StringModelFragment() { + super(); } @Override @@ -140,7 +138,7 @@ private Composite createForm(Composite parent) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - FindParentReferenceElementDialog dialog = new FindParentReferenceElementDialog(b.getShell(), StringModelFragment.this, (MStringModelFragment) getMaster().getValue()); + FindParentReferenceElementDialog dialog = new FindParentReferenceElementDialog(b.getShell(), StringModelFragment.this, (MStringModelFragment) getMaster().getValue(), Messages); dialog.open(); } }); @@ -171,7 +169,7 @@ public void widgetSelected(SelectionEvent e) { button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - FeatureSelectionDialog dialog = new FeatureSelectionDialog(button.getShell(), getEditingDomain(), (MStringModelFragment) getMaster().getValue()); + FeatureSelectionDialog dialog = new FeatureSelectionDialog(button.getShell(), getEditingDomain(), (MStringModelFragment) getMaster().getValue(), Messages); dialog.open(); } }); @@ -198,7 +196,7 @@ public void widgetSelected(SelectionEvent e) { final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index cf841a054f..cd929bf9d1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -11,17 +11,15 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component; import java.util.List; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -39,7 +37,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -81,8 +78,9 @@ public Struct(String label, EClass eClass, boolean separator) { } } - public ToolBarContributionEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public ToolBarContributionEditor() { + super(); } @Override @@ -160,7 +158,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -218,7 +216,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 120; viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(master)); @@ -340,7 +338,7 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index d4681ecb1b..da90978bef 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -12,17 +12,16 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -40,7 +39,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -85,8 +83,13 @@ public Struct(String label, EClass eClass, boolean separator) { } } - public ToolBarEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public ToolBarEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.ToolBarEditor_AddHandledToolItem, createImageDescriptor(ResourceProvider.IMG_HandledToolItem)) { @Override public void run() { @@ -183,7 +186,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -215,7 +218,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 120; viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(master)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index c5b8969122..cc8876bc20 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -10,15 +10,13 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -26,7 +24,6 @@ import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -44,8 +41,9 @@ public class ToolBarSeparatorEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private EStackLayout stackLayout; - public ToolBarSeparatorEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public ToolBarSeparatorEditor() { + super(); } @Override @@ -123,7 +121,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -140,9 +138,9 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index 6291b792ed..993a36a269 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -10,17 +10,16 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -29,7 +28,6 @@ import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; @@ -48,12 +46,15 @@ public class ToolControlEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private Composite composite; - private IProject project; private EStackLayout stackLayout; - public ToolControlEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); - this.project = project; + @Inject + @Optional + private IProject project; + + @Inject + public ToolControlEditor() { + super(); } @Override @@ -132,7 +133,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -168,7 +169,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); + ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages); dialog.open(); } }); @@ -177,8 +178,8 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createMapProperties(parent, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index f587170bb2..43e56a95e4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -12,21 +12,21 @@ import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.conversion.Converter; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ToolItemIconDialogEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -40,7 +40,6 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerProperties; @@ -61,12 +60,15 @@ public abstract class ToolItemEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - protected IProject project; + private EStackLayout stackLayout; - public ToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); - this.project = project; + @Inject + @Optional + protected IProject project; + + public ToolItemEditor() { + super(); } @Override @@ -115,7 +117,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -185,7 +187,7 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - new ImageTooltip(t) { + new ImageTooltip(t, Messages) { @Override protected URI getImageURI() { @@ -205,7 +207,7 @@ protected URI getImageURI() { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - ToolItemIconDialogEditor dialog = new ToolItemIconDialogEditor(b.getShell(), project, getEditingDomain(), (MToolItem) getMaster().getValue()); + ToolItemIconDialogEditor dialog = new ToolItemIconDialogEditor(b.getShell(), project, getEditingDomain(), (MToolItem) getMaster().getValue(), Messages); dialog.open(); } }); @@ -273,7 +275,7 @@ public String getText(Object element) { list.add(UiPackageImpl.Literals.CORE_EXPRESSION); list.addAll(getEditor().getFeatureClasses(UiPackageImpl.Literals.EXPRESSION, UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN)); combo.setInput(list); - context.bindValue(ViewerProperties.singleSelection().observe(combo), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN).observeDetail(getMaster()), new UpdateValueStrategy().setConverter(new EClass2EObject()), new UpdateValueStrategy().setConverter(new EObject2EClass())); + context.bindValue(ViewerProperties.singleSelection().observe(combo), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN).observeDetail(getMaster()), new UpdateValueStrategy().setConverter(new EClass2EObject(Messages)), new UpdateValueStrategy().setConverter(new EObject2EClass(Messages))); } // ------------------------------------------------------------ @@ -282,7 +284,7 @@ public String getText(Object element) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); } protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, WritableValue master) { @@ -311,8 +313,11 @@ public FeaturePath[] getLabelProperties() { } static class EObject2EClass extends Converter { - public EObject2EClass() { + private Messages Messages; + + public EObject2EClass(Messages Messages) { super(EObject.class, EClass.class); + this.Messages = Messages; } public Object convert(Object fromObject) { @@ -324,9 +329,11 @@ public Object convert(Object fromObject) { } static class EClass2EObject extends Converter { + private Messages Messages; - public EClass2EObject() { + public EClass2EObject(Messages Messages) { super(EClass.class, EObject.class); + this.Messages = Messages; } public Object convert(Object fromObject) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index 18f6768aaa..2fc3431d87 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -12,6 +12,8 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -19,11 +21,9 @@ import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MGenericTrimContainer; @@ -42,7 +42,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -71,15 +70,21 @@ public class TrimBarEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private ModelEditor editor; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; private List actions = new ArrayList(); - public TrimBarEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); - this.editor = editor; + @Inject + private ModelEditor editor; + + @Inject + public TrimBarEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.TrimBarEditor_AddToolBar, createImageDescriptor(ResourceProvider.IMG_ToolBar)) { @Override public void run() { @@ -164,7 +169,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -206,7 +211,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer viewer = new TableViewer(parent); - viewer.setLabelProvider(new ComponentLabelProvider(editor)); + viewer.setLabelProvider(new ComponentLabelProvider(editor, Messages)); viewer.setContentProvider(new ObservableListContentProvider()); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; @@ -316,7 +321,7 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index c849e52bb0..42fa30f6a2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -11,17 +11,15 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component; import java.util.List; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -38,7 +36,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; @@ -68,8 +65,9 @@ public class TrimContributionEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; - public TrimContributionEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public TrimContributionEditor() { + super(); } @Override @@ -147,7 +145,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -199,7 +197,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer viewer = new TableViewer(parent); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); viewer.setContentProvider(new ObservableListContentProvider()); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; @@ -316,7 +314,7 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java index 4b95783eca..497685d47d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java @@ -10,24 +10,23 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; public class TrimmedWindowEditor extends WindowEditor { private IListProperty TRIMMED_WINDOW__TRIM_BARS = EMFProperties.list(BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS); - public TrimmedWindowEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { - super(editingDomain, editor, project, resourcePool); + @Inject + public TrimmedWindowEditor() { + super(); } public IObservableList getChildList(Object element) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 0d9bc6da57..31ee67b856 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -12,6 +12,8 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IValueChangeListener; @@ -20,16 +22,15 @@ import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.WindowIconDialogEditor; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -47,7 +48,6 @@ import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -68,7 +68,6 @@ public class WindowEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; - private IProject project; private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); private IListProperty WINDOW__WINDOWS = EMFProperties.list(BasicPackageImpl.Literals.WINDOW__WINDOWS); @@ -80,9 +79,17 @@ public class WindowEditor extends AbstractComponentEditor { private Button createRemoveMainMenu; private EStackLayout stackLayout; - public WindowEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); - this.project = project; + @Inject + @Optional + private IProject project; + + @Inject + public WindowEditor() { + super(); + } + + @PostConstruct + void init() { addMainMenu = new Action(Messages.WindowEditor_AddMainMenu) { @Override public void run() { @@ -166,7 +173,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { - ControlFactory.createFindImport(parent, this, context); + ControlFactory.createFindImport(parent, Messages, this, context); return parent; } @@ -273,7 +280,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - new ImageTooltip(t) { + new ImageTooltip(t, Messages) { @Override protected URI getImageURI() { @@ -293,7 +300,7 @@ protected URI getImageURI() { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - WindowIconDialogEditor dialog = new WindowIconDialogEditor(b.getShell(), project, getEditingDomain(), (MWindow) getMaster().getValue()); + WindowIconDialogEditor dialog = new WindowIconDialogEditor(b.getShell(), project, getEditingDomain(), (MWindow) getMaster().getValue(), Messages); dialog.open(); } }); @@ -323,10 +330,10 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ ControlFactory.createSelectedElement(parent, this, context, Messages.WindowEditor_SelectedElement); - ControlFactory.createStringListWidget(parent, this, Messages.WindowEditor_BindingContexts, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.WindowEditor_BindingContexts, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java index 9968650d51..b0034d2080 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java @@ -51,10 +51,12 @@ public abstract class AbstractCommandSelectionDialog extends TitleAreaDialog { private IModelResource resource; private TableViewer viewer; + protected Messages Messages; - public AbstractCommandSelectionDialog(Shell parentShell, IModelResource resource) { + public AbstractCommandSelectionDialog(Shell parentShell, IModelResource resource, Messages Messages) { super(parentShell); this.resource = resource; + this.Messages = Messages; } protected abstract String getShellTitle(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java index 3dbefb247f..dfd06994c2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java @@ -64,12 +64,15 @@ public abstract class AbstractIconDialog extends TitleAreaDialog { private EditingDomain editingDomain; private Map icons = Collections.synchronizedMap(new HashMap()); - public AbstractIconDialog(Shell parentShell, IProject project, EditingDomain editingDomain, MApplicationElement element, EStructuralFeature feature) { + protected Messages Messages; + + public AbstractIconDialog(Shell parentShell, IProject project, EditingDomain editingDomain, MApplicationElement element, EStructuralFeature feature, Messages Messages) { super(parentShell); this.editingDomain = editingDomain; this.element = element; this.feature = feature; this.project = project; + this.Messages = Messages; } protected abstract String getShellTitle(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java index e918099acb..218d564cba 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java @@ -19,8 +19,8 @@ public class AreaIconDialogEditor extends AbstractIconDialog { - public AreaIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MPart element) { - super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); + public AreaIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MPart element, Messages Messages) { + super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI, Messages); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java index 559841a18b..05a63e2378 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java @@ -50,10 +50,12 @@ public class BindingContextSelectionDialog extends TitleAreaDialog { private IModelResource resource; private TableViewer viewer; private String selectedId; + private Messages Messages; - public BindingContextSelectionDialog(Shell parentShell, IModelResource resource) { + public BindingContextSelectionDialog(Shell parentShell, IModelResource resource, Messages Messages) { super(parentShell); this.resource = resource; + this.Messages = Messages; } public String getSelectedId() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java index 4c6d63ed1c..2df3390307 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java @@ -53,11 +53,13 @@ public class CommandCategorySelectionDialog extends TitleAreaDialog { private IModelResource resource; private TableViewer viewer; private MCommand command; + private Messages Messages; - public CommandCategorySelectionDialog(Shell parentShell, IModelResource resource, MCommand command) { + public CommandCategorySelectionDialog(Shell parentShell, IModelResource resource, MCommand command, Messages Messages) { super(parentShell); this.resource = resource; this.command = command; + this.Messages = Messages; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java index dc9338fdbd..d7664cf431 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -57,13 +57,15 @@ public class ContributionClassDialog extends TitleAreaDialog { private EditingDomain editingDomain; private TableViewer viewer; private EStructuralFeature feature; + private Messages Messages; - public ContributionClassDialog(Shell parentShell, IProject project, EditingDomain editingDomain, MApplicationElement contribution, EStructuralFeature feature) { + public ContributionClassDialog(Shell parentShell, IProject project, EditingDomain editingDomain, MApplicationElement contribution, EStructuralFeature feature, Messages Messages) { super(parentShell); this.project = project; this.contribution = contribution; this.editingDomain = editingDomain; this.feature = feature; + this.Messages = Messages; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java index abdeb0b8cf..12eaf29494 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java @@ -52,13 +52,15 @@ public class ExpressionIdDialog extends TitleAreaDialog { private EditingDomain domain; private MCoreExpression expression; private boolean liveModel; + private Messages Messages; - public ExpressionIdDialog(Shell parentShell, IExtensionLookup lookup, MCoreExpression expression, EditingDomain domain, boolean liveModel) { + public ExpressionIdDialog(Shell parentShell, IExtensionLookup lookup, MCoreExpression expression, EditingDomain domain, boolean liveModel, Messages Messages) { super(parentShell); this.lookup = lookup; this.expression = expression; this.domain = domain; this.liveModel = liveModel; + this.Messages = Messages; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java index 2b8028996a..d0cfce3825 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java @@ -58,11 +58,13 @@ public class FeatureSelectionDialog extends TitleAreaDialog { private TreeViewer viewer; private MStringModelFragment fragment; private EditingDomain editingDomain; + private Messages Messages; - public FeatureSelectionDialog(Shell parentShell, EditingDomain editingDomain, MStringModelFragment fragment) { + public FeatureSelectionDialog(Shell parentShell, EditingDomain editingDomain, MStringModelFragment fragment, Messages Messages) { super(parentShell); this.fragment = fragment; this.editingDomain = editingDomain; + this.Messages = Messages; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java index f5673911af..1a492b65a5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java @@ -57,11 +57,13 @@ public class FindImportElementDialog extends TitleAreaDialog { private EObject element; private AbstractComponentEditor editor; private TableViewer viewer; + private Messages Messages; - public FindImportElementDialog(Shell parentShell, AbstractComponentEditor editor, EObject element) { + public FindImportElementDialog(Shell parentShell, AbstractComponentEditor editor, EObject element, Messages Messages) { super(parentShell); this.element = element; this.editor = editor; + this.Messages = Messages; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java index b6823e6aba..9c0df83089 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java @@ -68,11 +68,13 @@ public class FindParentReferenceElementDialog extends TitleAreaDialog { private MStringModelFragment fragment; private AbstractComponentEditor editor; private TableViewer viewer; + private Messages Messages; - public FindParentReferenceElementDialog(Shell parentShell, AbstractComponentEditor editor, MStringModelFragment fragment) { + public FindParentReferenceElementDialog(Shell parentShell, AbstractComponentEditor editor, MStringModelFragment fragment, Messages Messages) { super(parentShell); this.fragment = fragment; this.editor = editor; + this.Messages = Messages; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java index 778fb9b94d..a2ae60fe08 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java @@ -23,8 +23,8 @@ public class HandledMenuItemCommandSelectionDialog extends AbstractCommandSelectionDialog { private MHandledItem handler; - public HandledMenuItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource) { - super(parentShell, resource); + public HandledMenuItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource, Messages Messages) { + super(parentShell, resource, Messages); this.handler = handler; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java index 67b3ebc5ed..48c62637a8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java @@ -23,8 +23,8 @@ public class HandledToolItemCommandSelectionDialog extends AbstractCommandSelectionDialog { private MHandledItem handler; - public HandledToolItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource) { - super(parentShell, resource); + public HandledToolItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource, Messages Messages) { + super(parentShell, resource, Messages); this.handler = handler; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java index de38caa972..afa6facb4c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java @@ -23,8 +23,8 @@ public class HandlerCommandSelectionDialog extends AbstractCommandSelectionDialog { private MHandler handler; - public HandlerCommandSelectionDialog(Shell parentShell, MHandler handler, IModelResource resource) { - super(parentShell, resource); + public HandlerCommandSelectionDialog(Shell parentShell, MHandler handler, IModelResource resource, Messages Messages) { + super(parentShell, resource, Messages); this.handler = handler; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java index a2c1405fc3..18259a9e12 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java @@ -23,8 +23,8 @@ public class KeyBindingCommandSelectionDialog extends AbstractCommandSelectionDialog { private MKeyBinding binding; - public KeyBindingCommandSelectionDialog(Shell parentShell, MKeyBinding binding, IModelResource resource) { - super(parentShell, resource); + public KeyBindingCommandSelectionDialog(Shell parentShell, MKeyBinding binding, IModelResource resource, Messages Messages) { + super(parentShell, resource, Messages); this.binding = binding; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java index e27843d1af..3358369558 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java @@ -19,8 +19,8 @@ public class MenuIconDialogEditor extends AbstractIconDialog { - public MenuIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MMenu element) { - super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); + public MenuIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MMenu element, Messages Messages) { + super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI, Messages); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java index 9e1812800e..2d5ad184e4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java @@ -19,8 +19,8 @@ public class MenuItemIconDialogEditor extends AbstractIconDialog { - public MenuItemIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MMenuItem element) { - super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); + public MenuItemIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MMenuItem element, Messages Messages) { + super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI, Messages); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java index 6abf5c6d3a..92814cd1cd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java @@ -19,8 +19,8 @@ public class PartDescriptorIconDialogEditor extends AbstractIconDialog { - public PartDescriptorIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MPartDescriptor element) { - super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); + public PartDescriptorIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MPartDescriptor element, Messages Messages) { + super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI, Messages); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java index 7b7b48a632..8f283343ed 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java @@ -19,8 +19,8 @@ public class PartIconDialogEditor extends AbstractIconDialog { - public PartIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MPart element) { - super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); + public PartIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MPart element, Messages Messages) { + super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI, Messages); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java index 3e380367c2..189632c316 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java @@ -19,8 +19,8 @@ public class PerspectiveIconDialogEditor extends AbstractIconDialog { - public PerspectiveIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MPerspective element) { - super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); + public PerspectiveIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MPerspective element, Messages Messages) { + super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI, Messages); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java index 4ffc8cb35c..ce28f7fc02 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java @@ -61,12 +61,14 @@ public class SharedElementsDialog extends TitleAreaDialog { private MPlaceholder placeholder; private IModelResource resource; private ModelEditor editor; + private Messages Messages; - public SharedElementsDialog(Shell parentShell, ModelEditor editor, MPlaceholder placeholder, IModelResource resource) { + public SharedElementsDialog(Shell parentShell, ModelEditor editor, MPlaceholder placeholder, IModelResource resource, Messages Messages) { super(parentShell); this.editor = editor; this.placeholder = placeholder; this.resource = resource; + this.Messages = Messages; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java index 0966feb280..242fba0f00 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java @@ -19,8 +19,8 @@ public class ToolItemIconDialogEditor extends AbstractIconDialog { - public ToolItemIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MToolItem element) { - super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); + public ToolItemIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MToolItem element, Messages Messages) { + super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI, Messages); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java index a112f7a30b..1a0fbaffd1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java @@ -19,8 +19,8 @@ public class WindowIconDialogEditor extends AbstractIconDialog { - public WindowIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MWindow element) { - super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); + public WindowIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MWindow element, Messages Messages) { + super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI, Messages); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java index d62c5ef2f3..a384584a6f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java @@ -12,15 +12,14 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MAddon; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationFactory; @@ -30,7 +29,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; @@ -54,8 +52,13 @@ public class VApplicationAddons extends AbstractComponentEditor { private List actions = new ArrayList(); - public VApplicationAddons(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public VApplicationAddons() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.VApplicationAddons_AddAddon, createImageDescriptor(ResourceProvider.IMG_Addons)) { @Override public void run() { @@ -113,7 +116,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java index 2d08172df9..205c652dcb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java @@ -12,15 +12,14 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.commands.MCategory; import org.eclipse.e4.ui.model.application.commands.impl.CommandsFactoryImpl; @@ -30,7 +29,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; @@ -54,8 +52,13 @@ public class VApplicationCategoriesEditor extends AbstractComponentEditor { private List actions = new ArrayList(); - public VApplicationCategoriesEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public VApplicationCategoriesEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.VApplicationCategoriesEditor_AddCategory, createImageDescriptor(ResourceProvider.IMG_Category)) { @Override public void run() { @@ -113,7 +116,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index fca96e7f8c..a289242700 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -12,15 +12,14 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MBindingTable; import org.eclipse.e4.ui.model.application.commands.MBindingTableContainer; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; @@ -30,7 +29,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; @@ -53,8 +51,13 @@ public class VBindingTableEditor extends AbstractComponentEditor { private TableViewer bindingViewer; private List actions = new ArrayList(); - public VBindingTableEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public VBindingTableEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.VBindingTableEditor_AddBindingTable, createImageDescriptor(ResourceProvider.IMG_BindingTable)) { @Override public void run() { @@ -112,7 +115,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; bindingViewer.getControl().setLayoutData(gd); - bindingViewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + bindingViewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index 2c6ef7e779..31bf81e474 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -12,25 +12,24 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.commands.MCommand; import org.eclipse.e4.ui.model.application.commands.impl.CommandsFactoryImpl; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; @@ -55,9 +54,14 @@ public class VCommandEditor extends AbstractComponentEditor { private EStructuralFeature commandsFeature; private List actions = new ArrayList(); - public VCommandEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature commandsFeature, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); - this.commandsFeature = commandsFeature; + @Inject + public VCommandEditor() { + super(); + this.commandsFeature = ApplicationPackageImpl.Literals.APPLICATION__COMMANDS; + } + + @PostConstruct + void init() { actions.add(new Action(Messages.VCommandEditor_AddCommand, createImageDescriptor(ResourceProvider.IMG_Command)) { @Override public void run() { @@ -115,7 +119,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index fa16189bdd..883bc1a075 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -12,15 +12,14 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.commands.MHandlerContainer; @@ -30,7 +29,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; @@ -53,8 +51,13 @@ public class VHandlerEditor extends AbstractComponentEditor { private TableViewer viewer; private List actions = new ArrayList(); - public VHandlerEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public VHandlerEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.VHandlerEditor_AddHandler, createImageDescriptor(ResourceProvider.IMG_Handler)) { @Override public void run() { @@ -112,7 +115,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java index 807dacfcd9..67b2b39f51 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java @@ -12,15 +12,14 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; @@ -32,7 +31,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; @@ -57,8 +55,13 @@ public class VItemParametersEditor extends AbstractComponentEditor { private IEMFListProperty HANDLED_ITEM__PARAMETERS = EMFProperties.list(MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); - public VItemParametersEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public VItemParametersEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.VItemParametersEditor_AddParameter, createImageDescriptor(ResourceProvider.IMG_Parameter)) { @Override public void run() { @@ -116,7 +119,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java index 8fdd87fa87..3c39157ab4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java @@ -12,15 +12,14 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution; import org.eclipse.e4.ui.model.application.ui.menu.MMenuContributions; import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; @@ -30,7 +29,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; @@ -54,8 +52,13 @@ public class VMenuContributionsEditor extends AbstractComponentEditor { private List actions = new ArrayList(); - public VMenuContributionsEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public VMenuContributionsEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.VMenuContributionsEditor_AddMenuContribution, createImageDescriptor(ResourceProvider.IMG_MenuContribution)) { @Override public void run() { @@ -113,7 +116,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java index cdedf9fba1..4ee60e3a1f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -12,15 +12,13 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenu; @@ -32,7 +30,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; @@ -56,9 +53,13 @@ public class VMenuEditor extends AbstractComponentEditor { private EStructuralFeature feature; private List actions = new ArrayList(); - public VMenuEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature feature, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + protected VMenuEditor(EStructuralFeature feature) { + super(); this.feature = feature; + } + + @PostConstruct + void init() { actions.add(new Action(Messages.VMenuEditor_AddMenuContribution, createImageDescriptor(ResourceProvider.IMG_Menu)) { @Override public void run() { @@ -115,7 +116,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java index 6e31542757..59be50e2ad 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java @@ -11,15 +11,13 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; import java.util.List; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.fragment.MFragmentFactory; import org.eclipse.e4.ui.model.fragment.MModelFragments; import org.eclipse.e4.ui.model.fragment.MStringModelFragment; @@ -29,7 +27,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; @@ -50,8 +47,9 @@ public class VModelFragmentsEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private TableViewer viewer; - public VModelFragmentsEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public VModelFragmentsEditor() { + super(); } @Override @@ -100,7 +98,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java index fde83c1d30..3e9a08a157 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java @@ -12,16 +12,14 @@ import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.fragment.MModelFragments; import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; @@ -35,7 +33,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; @@ -61,8 +58,9 @@ public class VModelImportsEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private TableViewer viewer; - public VModelImportsEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public VModelImportsEditor() { + super(); } @Override @@ -110,7 +108,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java index 9c22f94b11..69a754b810 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java @@ -12,15 +12,14 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory; import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptorContainer; @@ -30,7 +29,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; @@ -53,8 +51,13 @@ public class VPartDescriptor extends AbstractComponentEditor { private TableViewer viewer; private List actions = new ArrayList(); - public VPartDescriptor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public VPartDescriptor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.VPartDescriptor_AddPartDescriptor, createImageDescriptor(ResourceProvider.IMG_PartDescriptor)) { @Override public void run() { @@ -112,7 +115,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptorMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptorMenuEditor.java new file mode 100644 index 0000000000..b14dc15b85 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptorMenuEditor.java @@ -0,0 +1,11 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import javax.inject.Inject; + +public class VPartDescriptorMenuEditor extends VMenuEditor { + @Inject + public VPartDescriptorMenuEditor() { + super(org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS); + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartMenuEditor.java new file mode 100644 index 0000000000..3c5191fd25 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartMenuEditor.java @@ -0,0 +1,12 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import javax.inject.Inject; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; + +public class VPartMenuEditor extends VMenuEditor { + @Inject + public VPartMenuEditor() { + super(BasicPackageImpl.Literals.PART__MENUS); + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java index 1b9c6a4d01..7fdb2bf488 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java @@ -12,15 +12,14 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.commands.MBindingContext; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; @@ -30,7 +29,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; @@ -54,8 +52,13 @@ public class VRootBindingContexts extends AbstractComponentEditor { private List actions = new ArrayList(); - public VRootBindingContexts(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public VRootBindingContexts() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.VRootBindingContexts_AddContext, createImageDescriptor(ResourceProvider.IMG_BindingContext)) { @Override public void run() { @@ -113,7 +116,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java index ddceef6aa1..206999f4d0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java @@ -12,15 +12,14 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution; import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContributions; @@ -30,7 +29,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; @@ -53,8 +51,13 @@ public class VToolBarContributionsEditor extends AbstractComponentEditor { private TableViewer viewer; private List actions = new ArrayList(); - public VToolBarContributionsEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public VToolBarContributionsEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.VToolBarContributionsEditor_AddToolBarContribution, createImageDescriptor(ResourceProvider.IMG_ToolBarContribution)) { @Override public void run() { @@ -112,7 +115,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java index 4b47525409..9978ad2b65 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java @@ -12,15 +12,14 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.e4.ui.model.application.ui.menu.MTrimContribution; import org.eclipse.e4.ui.model.application.ui.menu.MTrimContributions; @@ -30,7 +29,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; @@ -53,8 +51,13 @@ public class VTrimContributionsEditor extends AbstractComponentEditor { private TableViewer viewer; private List actions = new ArrayList(); - public VTrimContributionsEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public VTrimContributionsEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.VTrimContributionsEditor_AddTrimContribution, createImageDescriptor(ResourceProvider.IMG_TrimContribution)) { @Override public void run() { @@ -112,7 +115,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index 7ad0b72283..4b749c5099 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -12,16 +12,15 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; @@ -34,7 +33,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ArrayContentProvider; @@ -60,8 +58,13 @@ public class VWindowControlEditor extends AbstractComponentEditor { private TableViewer viewer; private List actions = new ArrayList(); - public VWindowControlEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public VWindowControlEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.VWindowControlEditor_AddPerspectiveStack, createImageDescriptor(ResourceProvider.IMG_PerspectiveStack)) { @Override public void run() { @@ -151,7 +154,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index 3851e6e66c..464e066521 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -12,16 +12,15 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; @@ -33,7 +32,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ArrayContentProvider; @@ -59,8 +57,13 @@ public class VWindowEditor extends AbstractComponentEditor { private TableViewer viewer; private List actions = new ArrayList(); - public VWindowEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public VWindowEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.VWindowEditor_AddTrimmedWindow, createImageDescriptor(ResourceProvider.IMG_Window)) { @Override public void run() { @@ -120,7 +123,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; viewer.getControl().setLayoutData(gd); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java index 243fdb8488..18649ac4fa 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java @@ -12,15 +12,14 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.emf.common.command.Command; @@ -33,7 +32,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.ArrayContentProvider; @@ -59,8 +57,13 @@ public class VWindowSharedElementsEditor extends AbstractComponentEditor { private TableViewer viewer; private List actions = new ArrayList(); - public VWindowSharedElementsEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public VWindowSharedElementsEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.VWindowSharedElementsEditor_AddPartSashContainer, createImageDescriptor(ResourceProvider.IMG_PartSashContainer)) { @Override public void run() { @@ -129,7 +132,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java index 298e924503..9bc4b8bb57 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -12,15 +12,14 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; @@ -28,7 +27,6 @@ import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; @@ -50,8 +48,13 @@ public class VWindowTrimEditor extends AbstractComponentEditor { private TableViewer viewer; private List actions = new ArrayList(); - public VWindowTrimEditor(EditingDomain editingDomain, ModelEditor editor, IResourcePool resourcePool) { - super(editingDomain, editor, resourcePool); + @Inject + public VWindowTrimEditor() { + super(); + } + + @PostConstruct + void init() { actions.add(new Action(Messages.VWindowTrimEditor_AddWindowTrim, createImageDescriptor(ResourceProvider.IMG_WindowTrim)) { @Override public void run() { @@ -106,7 +109,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 300; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/AnnotationAccess.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/AnnotationAccess.java new file mode 100644 index 0000000000..0f4ccbd86b --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/AnnotationAccess.java @@ -0,0 +1,61 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.xml; + +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.services.IResourcePool; +import org.eclipse.jface.text.source.Annotation; +import org.eclipse.jface.text.source.IAnnotationAccess; +import org.eclipse.jface.text.source.IAnnotationAccessExtension; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Canvas; + +public class AnnotationAccess implements IAnnotationAccess, IAnnotationAccessExtension { + private IResourcePool pool; + + public AnnotationAccess(IResourcePool pool) { + this.pool = pool; + } + + public String getTypeLabel(Annotation annotation) { + return annotation.getText(); + } + + public int getLayer(Annotation annotation) { + return IAnnotationAccessExtension.DEFAULT_LAYER; + } + + public void paint(Annotation annotation, GC gc, Canvas canvas, Rectangle bounds) { + gc.drawImage(pool.getImageUnchecked(ResourceProvider.IMG_Obj16_error_obj), bounds.x, bounds.y); + } + + public boolean isPaintable(Annotation annotation) { + // TODO Auto-generated method stub + return false; + } + + public boolean isSubtype(Object annotationType, Object potentialSupertype) { + // TODO Auto-generated method stub + return false; + } + + public Object[] getSupertypes(Object annotationType) { + // TODO Auto-generated method stub + return null; + } + + public Object getType(Annotation annotation) { + // TODO Auto-generated method stub + return null; + } + + public boolean isMultiLine(Annotation annotation) { + // TODO Auto-generated method stub + return false; + } + + public boolean isTemporary(Annotation annotation) { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/ColorManager.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/ColorManager.java new file mode 100644 index 0000000000..4a3a225d66 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/ColorManager.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.xml; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.widgets.Display; + +public class ColorManager { + + protected Map fColorTable = new HashMap(10); + + public void dispose() { + Iterator e = fColorTable.values().iterator(); + while (e.hasNext()) + ((Color) e.next()).dispose(); + } + + public Color getColor(RGB rgb) { + Color color = (Color) fColorTable.get(rgb); + if (color == null) { + color = new Color(Display.getCurrent(), rgb); + fColorTable.put(rgb, color); + } + return color; + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/EMFDocumentResourceMediator.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/EMFDocumentResourceMediator.java new file mode 100644 index 0000000000..1907ecfe4e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/EMFDocumentResourceMediator.java @@ -0,0 +1,94 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.xml; + +import java.io.IOException; +import java.io.StringReader; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource.Diagnostic; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; +import org.eclipse.jface.text.Document; +import org.eclipse.jface.text.DocumentEvent; +import org.eclipse.jface.text.IDocumentListener; +import org.xml.sax.InputSource; + +public class EMFDocumentResourceMediator { + private IModelResource modelResource; + private Document document; + private boolean updateFromEMF; + private List errorList = new ArrayList(); + private Runnable documentValidationChanged; + + public EMFDocumentResourceMediator(final IModelResource modelResource) { + this.modelResource = modelResource; + this.document = new Document(); + this.document.addDocumentListener(new IDocumentListener() { + + public void documentChanged(DocumentEvent event) { + if (updateFromEMF) { + return; + } + + String doc = document.get(); + XMIResourceImpl res = new XMIResourceImpl(); + try { + res.load(new InputSource(new StringReader(doc)), null); + modelResource.replaceRoot(res.getContents().get(0)); + errorList.clear(); + if (documentValidationChanged != null) { + documentValidationChanged.run(); + } + } catch (IOException e) { + errorList = res.getErrors(); + if (documentValidationChanged != null) { + documentValidationChanged.run(); + } + + } + } + + public void documentAboutToBeChanged(DocumentEvent event) { + + } + }); + updateFromEMF(); + } + + public void setValidationChangedCallback(Runnable runnable) { + documentValidationChanged = runnable; + } + + public List getErrorList() { + return Collections.unmodifiableList(errorList); + } + + public void updateFromEMF() { + try { + updateFromEMF = true; + this.document.set(toXMI((EObject) modelResource.getRoot().get(0))); + } finally { + updateFromEMF = false; + } + } + + public Document getDocument() { + return document; + } + + private String toXMI(EObject root) { + XMIResourceImpl resource = new XMIResourceImpl(); + resource.getContents().add(EcoreUtil.copy(root)); + StringWriter writer = new StringWriter(); + try { + resource.save(writer, null); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return writer.toString(); + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/IXMLColorConstants.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/IXMLColorConstants.java new file mode 100644 index 0000000000..0c7a2a580b --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/IXMLColorConstants.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.xml; + +import org.eclipse.swt.graphics.RGB; + +public interface IXMLColorConstants { + RGB XML_COMMENT = new RGB(128, 0, 0); + RGB PROC_INSTR = new RGB(128, 128, 128); + RGB STRING = new RGB(0, 128, 0); + RGB DEFAULT = new RGB(0, 0, 0); + RGB TAG = new RGB(0, 0, 128); +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/NonRuleBasedDamagerRepairer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/NonRuleBasedDamagerRepairer.java new file mode 100644 index 0000000000..627ce6af1f --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/NonRuleBasedDamagerRepairer.java @@ -0,0 +1,148 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.xml; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.DocumentEvent; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.IRegion; +import org.eclipse.jface.text.ITypedRegion; +import org.eclipse.jface.text.Region; +import org.eclipse.jface.text.TextAttribute; +import org.eclipse.jface.text.TextPresentation; +import org.eclipse.jface.text.presentation.IPresentationDamager; +import org.eclipse.jface.text.presentation.IPresentationRepairer; +import org.eclipse.swt.custom.StyleRange; + +public class NonRuleBasedDamagerRepairer + implements IPresentationDamager, IPresentationRepairer { + + /** The document this object works on */ + protected IDocument fDocument; + /** The default text attribute if non is returned as data by the current token */ + protected TextAttribute fDefaultTextAttribute; + + /** + * Constructor for NonRuleBasedDamagerRepairer. + */ + public NonRuleBasedDamagerRepairer(TextAttribute defaultTextAttribute) { + Assert.isNotNull(defaultTextAttribute); + + fDefaultTextAttribute = defaultTextAttribute; + } + + /** + * @see IPresentationRepairer#setDocument(IDocument) + */ + public void setDocument(IDocument document) { + fDocument = document; + } + + /** + * Returns the end offset of the line that contains the specified offset or + * if the offset is inside a line delimiter, the end offset of the next line. + * + * @param offset the offset whose line end offset must be computed + * @return the line end offset for the given offset + * @exception BadLocationException if offset is invalid in the current document + */ + protected int endOfLineOf(int offset) throws BadLocationException { + + IRegion info = fDocument.getLineInformationOfOffset(offset); + if (offset <= info.getOffset() + info.getLength()) + return info.getOffset() + info.getLength(); + + int line = fDocument.getLineOfOffset(offset); + try { + info = fDocument.getLineInformation(line + 1); + return info.getOffset() + info.getLength(); + } catch (BadLocationException x) { + return fDocument.getLength(); + } + } + + /** + * @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent, boolean) + */ + public IRegion getDamageRegion( + ITypedRegion partition, + DocumentEvent event, + boolean documentPartitioningChanged) { + if (!documentPartitioningChanged) { + try { + + IRegion info = + fDocument.getLineInformationOfOffset(event.getOffset()); + int start = Math.max(partition.getOffset(), info.getOffset()); + + int end = + event.getOffset() + + (event.getText() == null + ? event.getLength() + : event.getText().length()); + + if (info.getOffset() <= end + && end <= info.getOffset() + info.getLength()) { + // optimize the case of the same line + end = info.getOffset() + info.getLength(); + } else + end = endOfLineOf(end); + + end = + Math.min( + partition.getOffset() + partition.getLength(), + end); + return new Region(start, end - start); + + } catch (BadLocationException x) { + } + } + + return partition; + } + + /** + * @see IPresentationRepairer#createPresentation(TextPresentation, ITypedRegion) + */ + public void createPresentation( + TextPresentation presentation, + ITypedRegion region) { + addRange( + presentation, + region.getOffset(), + region.getLength(), + fDefaultTextAttribute); + } + + /** + * Adds style information to the given text presentation. + * + * @param presentation the text presentation to be extended + * @param offset the offset of the range to be styled + * @param length the length of the range to be styled + * @param attr the attribute describing the style of the range to be styled + */ + protected void addRange( + TextPresentation presentation, + int offset, + int length, + TextAttribute attr) { + if (attr != null) + presentation.addStyleRange( + new StyleRange( + offset, + length, + attr.getForeground(), + attr.getBackground(), + attr.getStyle())); + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/TagRule.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/TagRule.java new file mode 100644 index 0000000000..85719e9150 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/TagRule.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.xml; + +import org.eclipse.jface.text.rules.ICharacterScanner; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.MultiLineRule; + +public class TagRule extends MultiLineRule { + + public TagRule(IToken token) { + super("<", ">", token); //$NON-NLS-1$//$NON-NLS-2$ + } + + protected boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean eofAllowed) { + int c = scanner.read(); + if (sequence[0] == '<') { + if (c == '?') { + // processing instruction - abort + scanner.unread(); + return false; + } + if (c == '!') { + scanner.unread(); + // comment - abort + return false; + } + } else if (sequence[0] == '>') { + scanner.unread(); + } + return super.sequenceDetected(scanner, sequence, eofAllowed); + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLConfiguration.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLConfiguration.java new file mode 100644 index 0000000000..42080119a1 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLConfiguration.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.xml; + +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.ITextDoubleClickStrategy; +import org.eclipse.jface.text.TextAttribute; +import org.eclipse.jface.text.presentation.IPresentationReconciler; +import org.eclipse.jface.text.presentation.PresentationReconciler; +import org.eclipse.jface.text.rules.DefaultDamagerRepairer; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.jface.text.source.ISourceViewer; +import org.eclipse.jface.text.source.SourceViewerConfiguration; + +public class XMLConfiguration extends SourceViewerConfiguration { + private XMLDoubleClickStrategy doubleClickStrategy; + private XMLTagScanner tagScanner; + private XMLScanner scanner; + private ColorManager colorManager; + + public XMLConfiguration(ColorManager colorManager) { + this.colorManager = colorManager; + } + + public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { + return new String[] { IDocument.DEFAULT_CONTENT_TYPE, XMLPartitionScanner.XML_COMMENT, XMLPartitionScanner.XML_TAG }; + } + + public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, String contentType) { + if (doubleClickStrategy == null) + doubleClickStrategy = new XMLDoubleClickStrategy(); + return doubleClickStrategy; + } + + protected XMLScanner getXMLScanner() { + if (scanner == null) { + scanner = new XMLScanner(colorManager); + scanner.setDefaultReturnToken(new Token(new TextAttribute(colorManager.getColor(IXMLColorConstants.DEFAULT)))); + } + return scanner; + } + + protected XMLTagScanner getXMLTagScanner() { + if (tagScanner == null) { + tagScanner = new XMLTagScanner(colorManager); + tagScanner.setDefaultReturnToken(new Token(new TextAttribute(colorManager.getColor(IXMLColorConstants.TAG)))); + } + return tagScanner; + } + + public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { + PresentationReconciler reconciler = new PresentationReconciler(); + + DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getXMLTagScanner()); + reconciler.setDamager(dr, XMLPartitionScanner.XML_TAG); + reconciler.setRepairer(dr, XMLPartitionScanner.XML_TAG); + + dr = new DefaultDamagerRepairer(getXMLScanner()); + reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE); + reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); + + NonRuleBasedDamagerRepairer ndr = new NonRuleBasedDamagerRepairer(new TextAttribute(colorManager.getColor(IXMLColorConstants.XML_COMMENT))); + reconciler.setDamager(ndr, XMLPartitionScanner.XML_COMMENT); + reconciler.setRepairer(ndr, XMLPartitionScanner.XML_COMMENT); + + return reconciler; + } + +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLDoubleClickStrategy.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLDoubleClickStrategy.java new file mode 100644 index 0000000000..492d51bbc1 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLDoubleClickStrategy.java @@ -0,0 +1,125 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.xml; + +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.ITextDoubleClickStrategy; +import org.eclipse.jface.text.ITextViewer; + +public class XMLDoubleClickStrategy implements ITextDoubleClickStrategy { + protected ITextViewer fText; + + public void doubleClicked(ITextViewer part) { + int pos = part.getSelectedRange().x; + + if (pos < 0) + return; + + fText = part; + + if (!selectComment(pos)) { + selectWord(pos); + } + } + protected boolean selectComment(int caretPos) { + IDocument doc = fText.getDocument(); + int startPos, endPos; + + try { + int pos = caretPos; + char c = ' '; + + while (pos >= 0) { + c = doc.getChar(pos); + if (c == '\\') { + pos -= 2; + continue; + } + if (c == Character.LINE_SEPARATOR || c == '\"') + break; + --pos; + } + + if (c != '\"') + return false; + + startPos = pos; + + pos = caretPos; + int length = doc.getLength(); + c = ' '; + + while (pos < length) { + c = doc.getChar(pos); + if (c == Character.LINE_SEPARATOR || c == '\"') + break; + ++pos; + } + if (c != '\"') + return false; + + endPos = pos; + + int offset = startPos + 1; + int len = endPos - offset; + fText.setSelectedRange(offset, len); + return true; + } catch (BadLocationException x) { + } + + return false; + } + protected boolean selectWord(int caretPos) { + + IDocument doc = fText.getDocument(); + int startPos, endPos; + + try { + + int pos = caretPos; + char c; + + while (pos >= 0) { + c = doc.getChar(pos); + if (!Character.isJavaIdentifierPart(c)) + break; + --pos; + } + + startPos = pos; + + pos = caretPos; + int length = doc.getLength(); + + while (pos < length) { + c = doc.getChar(pos); + if (!Character.isJavaIdentifierPart(c)) + break; + ++pos; + } + + endPos = pos; + selectRange(startPos, endPos); + return true; + + } catch (BadLocationException x) { + } + + return false; + } + + private void selectRange(int startPos, int stopPos) { + int offset = startPos + 1; + int length = stopPos - offset; + fText.setSelectedRange(offset, length); + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLPartitionScanner.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLPartitionScanner.java new file mode 100644 index 0000000000..04ea48a9cc --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLPartitionScanner.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.xml; + +import org.eclipse.jface.text.rules.IPredicateRule; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.MultiLineRule; +import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; +import org.eclipse.jface.text.rules.Token; + +public class XMLPartitionScanner extends RuleBasedPartitionScanner { + public final static String XML_COMMENT = "__xml_comment"; //$NON-NLS-1$ + public final static String XML_TAG = "__xml_tag"; //$NON-NLS-1$ + + public XMLPartitionScanner() { + + IToken xmlComment = new Token(XML_COMMENT); + IToken tag = new Token(XML_TAG); + + IPredicateRule[] rules = new IPredicateRule[2]; + + rules[0] = new MultiLineRule("", xmlComment); //$NON-NLS-1$//$NON-NLS-2$ + rules[1] = new TagRule(tag); + + setPredicateRules(rules); + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLScanner.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLScanner.java new file mode 100644 index 0000000000..7eaafe0632 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLScanner.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.xml; + +import org.eclipse.jface.text.TextAttribute; +import org.eclipse.jface.text.rules.IRule; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.RuleBasedScanner; +import org.eclipse.jface.text.rules.SingleLineRule; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.jface.text.rules.WhitespaceRule; + +public class XMLScanner extends RuleBasedScanner { + + public XMLScanner(ColorManager manager) { + IToken procInstr = new Token(new TextAttribute(manager.getColor(IXMLColorConstants.PROC_INSTR))); + + IRule[] rules = new IRule[2]; + // Add rule for processing instructions + rules[0] = new SingleLineRule("", procInstr); //$NON-NLS-1$//$NON-NLS-2$ + // Add generic whitespace rule. + rules[1] = new WhitespaceRule(new XMLWhitespaceDetector()); + + setRules(rules); + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLTagScanner.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLTagScanner.java new file mode 100644 index 0000000000..47ccf71b98 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLTagScanner.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.xml; + +import org.eclipse.jface.text.TextAttribute; +import org.eclipse.jface.text.rules.IRule; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.RuleBasedScanner; +import org.eclipse.jface.text.rules.SingleLineRule; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.jface.text.rules.WhitespaceRule; + +public class XMLTagScanner extends RuleBasedScanner { + + public XMLTagScanner(ColorManager manager) { + IToken string = new Token(new TextAttribute(manager.getColor(IXMLColorConstants.STRING))); + + IRule[] rules = new IRule[3]; + + // Add rule for double quotes + rules[0] = new SingleLineRule("\"", "\"", string, '\\'); //$NON-NLS-1$//$NON-NLS-2$ + // Add a rule for single quotes + rules[1] = new SingleLineRule("'", "'", string, '\\'); //$NON-NLS-1$ //$NON-NLS-2$ + // Add generic whitespace rule. + rules[2] = new WhitespaceRule(new XMLWhitespaceDetector()); + + setRules(rules); + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLWhitespaceDetector.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLWhitespaceDetector.java new file mode 100644 index 0000000000..3ded701a8c --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLWhitespaceDetector.java @@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.xml; + +import org.eclipse.jface.text.rules.IWhitespaceDetector; + +public class XMLWhitespaceDetector implements IWhitespaceDetector { + + public boolean isWhitespace(char c) { + return (c == ' ' || c == '\t' || c == '\n' || c == '\r'); + } +} diff --git a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF index f14d25988c..445bfb48c2 100644 --- a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF @@ -12,6 +12,7 @@ Require-Bundle: org.eclipse.swt;bundle-version="3.7.0", javax.annotation;bundle-version="1.0.0", org.eclipse.e4.core.di;bundle-version="0.9.0", javax.inject;bundle-version="1.0.0", - org.eclipse.osgi;bundle-version="3.7.0" -Service-Component: OSGI-INF/resourcepoolfunction.xml, OSGI-INF/resourceservice.xml + org.eclipse.osgi;bundle-version="3.7.0", + org.eclipse.e4.core.services;bundle-version="0.9.1" +Service-Component: OSGI-INF/resourcepoolfunction.xml, OSGI-INF/resourceservice.xml, OSGI-INF/messagefactoryservice.xml, OSGI-INF/translationsupplier.xml Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.e4.tools.services/OSGI-INF/messagefactoryservice.xml b/bundles/org.eclipse.e4.tools.services/OSGI-INF/messagefactoryservice.xml new file mode 100644 index 0000000000..6331e45327 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/OSGI-INF/messagefactoryservice.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.services/OSGI-INF/translationsupplier.xml b/bundles/org.eclipse.e4.tools.services/OSGI-INF/translationsupplier.xml new file mode 100644 index 0000000000..a25fcdfb93 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/OSGI-INF/translationsupplier.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.services/build.properties b/bundles/org.eclipse.e4.tools.services/build.properties index caddfdf972..e611dd6a4e 100644 --- a/bundles/org.eclipse.e4.tools.services/build.properties +++ b/bundles/org.eclipse.e4.tools.services/build.properties @@ -4,5 +4,7 @@ bin.includes = META-INF/,\ about.html,\ OSGI-INF/,\ OSGI-INF/resourcepoolfunction.xml,\ - OSGI-INF/resourceservice.xml + OSGI-INF/resourceservice.xml,\ + OSGI-INF/messagefactoryservice.xml,\ + OSGI-INF/translationsupplier.xml source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IMessageFactoryService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IMessageFactoryService.java new file mode 100644 index 0000000000..fc22333050 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IMessageFactoryService.java @@ -0,0 +1,6 @@ +package org.eclipse.e4.tools.services; + +public interface IMessageFactoryService { + public M createInstance(final String locale, final Class messages) + throws InstantiationException, IllegalAccessException; +} diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/Message.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/Message.java new file mode 100644 index 0000000000..d2948f9753 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/Message.java @@ -0,0 +1,9 @@ +package org.eclipse.e4.tools.services; + +public @interface Message { + public enum ReferenceType { + NONE, SOFT, WEAK + } + + ReferenceType referenceType() default ReferenceType.SOFT; +} diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/Translation.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/Translation.java new file mode 100644 index 0000000000..ca92d445ee --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/Translation.java @@ -0,0 +1,16 @@ +package org.eclipse.e4.tools.services; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.inject.Qualifier; + +@Qualifier +@Documented +@Target({ElementType.FIELD, ElementType.PARAMETER}) +@Retention(RetentionPolicy.RUNTIME) +public @interface Translation { + +} diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/MessageFactoryServiceImpl.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/MessageFactoryServiceImpl.java new file mode 100644 index 0000000000..2d8d3496b4 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/MessageFactoryServiceImpl.java @@ -0,0 +1,139 @@ +/******************************************************************************* + * Copyright (c) 2011 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.services.impl; + +import java.lang.ref.Reference; +import java.lang.ref.SoftReference; +import java.lang.ref.WeakReference; +import java.lang.reflect.Field; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; + +import org.eclipse.e4.tools.services.IMessageFactoryService; +import org.eclipse.e4.tools.services.Message; +import org.eclipse.e4.tools.services.Message.ReferenceType; + +public class MessageFactoryServiceImpl implements IMessageFactoryService { + + // Cache so when multiple instance use the same message class + private Map> SOFT_CACHE = Collections + .synchronizedMap(new HashMap>()); + + private Map> WEAK_CACHE = Collections + .synchronizedMap(new HashMap>()); + + private int CLEANUPCOUNT = 0; + + public M createInstance(final String locale, final Class messages) + throws InstantiationException, IllegalAccessException { + String key = messages.getName() + "_" + locale; + + final Message annotation = messages.getAnnotation(Message.class); + Map> cache = null; + ReferenceType type = ReferenceType.NONE; + + if (++CLEANUPCOUNT > 1000) { + Iterator>> it = WEAK_CACHE + .entrySet().iterator(); + while (it.hasNext()) { + if (it.next().getValue().get() == null) { + it.remove(); + } + } + + it = SOFT_CACHE.entrySet().iterator(); + while (it.hasNext()) { + if (it.next().getValue().get() == null) { + it.remove(); + } + } + CLEANUPCOUNT = 0; + } + + if (annotation == null + || annotation.referenceType() == ReferenceType.SOFT) { + cache = SOFT_CACHE; + type = ReferenceType.SOFT; + } else if (annotation.referenceType() == ReferenceType.WEAK) { + cache = WEAK_CACHE; + type = ReferenceType.WEAK; + } + + if (cache != null && cache.containsKey(key)) { + @SuppressWarnings("unchecked") + Reference ref = (Reference) cache.get(key); + M o = ref.get(); + if (o != null) { + return o; + } + cache.remove(key); + } + + M instance; + + if (System.getSecurityManager() == null) { + instance = doCreateInstance(locale, messages, annotation); + } else { + instance = AccessController.doPrivileged(new PrivilegedAction() { + + public M run() { + try { + return doCreateInstance(locale, messages, annotation); + } catch (InstantiationException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return null; + } + + }); + } + + if (cache != null) { + if (type == ReferenceType.SOFT) { + cache.put(key, new SoftReference(instance)); + } else if (type == ReferenceType.WEAK) { + cache.put(key, new WeakReference(instance)); + } + } + + return instance; + } + + private static M doCreateInstance(String locale, Class messages, + Message annotation) throws InstantiationException, + IllegalAccessException { + + String basename = messages.getName().replace('.', '/'); + PropertiesBundleTranslationProvider provider = new PropertiesBundleTranslationProvider( + messages.getClassLoader(), basename); + + M instance = messages.newInstance(); + Field[] fields = messages.getDeclaredFields(); + + for (int i = 0; i < fields.length; i++) { + if (!fields[i].isAccessible()) { + fields[i].setAccessible(true); + } + + fields[i].set(instance, + provider.translate(locale, fields[i].getName())); + } + + return instance; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/PropertiesBundleTranslationProvider.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/PropertiesBundleTranslationProvider.java new file mode 100644 index 0000000000..c7ed9fb242 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/PropertiesBundleTranslationProvider.java @@ -0,0 +1,223 @@ +/******************************************************************************* + * Copyright (c) 2011 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.services.impl; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.List; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.PropertyResourceBundle; +import java.util.ResourceBundle; +import org.eclipse.osgi.service.localization.BundleLocalization; + +/** + * The lookup of the translation the same than the one in {@link BundleLocalization} which is based + * upon the value found in equinox.root.locale which defaults to "en": + *
      + *
    • If set to empty string then the search order for: + *
        + *
      • bn + Ls + "_" + Cs + "_" + Vs
      • + *
      • bn + Ls + "_" + Cs
      • + *
      • bn + Ls
      • + *
      • bn + Ld + "_" + Cd + "_" + Vd
      • + *
      • bn + Ld + "_" + Cd
      • + *
      • bn + Ld
      • + *
      + *
    • + *
    • If Ls equals the value of equinox.root.locale then the following search order is used: + *
        + *
      • bn + Ls + "_" + Cs + "_" + Vs
      • + *
      • bn + Ls + "_" + Cs
      • + *
      • bn + Ls
      • + *
      • bn + Ld + "_" + Cd + "_" + Vd
      • + *
      • bn + Ld + "_" + Cd
      • + *
      • bn + Ld
      • + *
      + *
    • + *
    + * Where bn is this bundle's localization basename, Ls, Cs and Vs are the specified locale + * (language, country, variant) and Ld, Cd and Vd are the default locale (language, country, + * variant). + */ +public class PropertiesBundleTranslationProvider { + final static String DEFAULT_ROOT = getEquinoxRootLocale(); + + private ClassLoader loader; + private String baseName; + + private final Hashtable cache = new Hashtable( + 5); + + public PropertiesBundleTranslationProvider(ClassLoader loader, String baseName) { + this.loader = loader; + this.baseName = baseName; + } + + private static String getEquinoxRootLocale() { + // Logic from FrameworkProperties.getProperty("equinox.root.locale", "en") + String root = System.getProperties().getProperty("equinox.root.locale"); + if (root == null) { + root = "en"; + } + return root; + } + + public String translate(String locale, String key) { + String defaultLocale = Locale.getDefault().toString(); + String localeString = locale; + ResourceBundle bundle = getResourceBundle(locale.toString(), + defaultLocale.equals(localeString)); + try { + return bundle.getString(key); + } catch (Exception e) { + e.printStackTrace(); + return key; + } + + } + + private ResourceBundle getResourceBundle(String localeString, boolean isDefaultLocale) { + BundleResourceBundle resourceBundle = lookupResourceBundle(localeString); + if (isDefaultLocale) + return (ResourceBundle) resourceBundle; + // need to determine if this is resource bundle is an empty stem + // if it is then the default locale should be used + if (resourceBundle == null || resourceBundle.isStemEmpty()) + return (ResourceBundle) lookupResourceBundle(Locale.getDefault().toString()); + return (ResourceBundle) resourceBundle; + } + + private interface BundleResourceBundle { + void setParent(ResourceBundle parent); + + boolean isEmpty(); + + boolean isStemEmpty(); + } + + private BundleResourceBundle lookupResourceBundle(String localeString) { + // get the localization header as late as possible to avoid accessing the raw headers + // getting the first value from the raw headers forces the manifest to be parsed (bug + // 332039) + String localizationHeader = baseName; + synchronized (cache) { + BundleResourceBundle result = cache.get(localeString); + if (result != null) + return result.isEmpty() ? null : result; + String[] nlVarients = buildNLVariants(localeString); + BundleResourceBundle parent = null; + + for (int i = nlVarients.length - 1; i >= 0; i--) { + BundleResourceBundle varientBundle = null; + InputStream resourceStream = loader.getResourceAsStream(localizationHeader + + (nlVarients[i].equals("") ? nlVarients[i] : '_' + nlVarients[i]) + + ".properties"); + + if (resourceStream == null) { + varientBundle = cache.get(nlVarients[i]); + } else { + try { + varientBundle = new LocalizationResourceBundle(resourceStream); + } catch (IOException e) { + // ignore and continue + } finally { + if (resourceStream != null) { + try { + resourceStream.close(); + } catch (IOException e3) { + // Ignore exception + } + } + } + } + + if (varientBundle == null) { + varientBundle = new EmptyResouceBundle(nlVarients[i]); + } + if (parent != null) + varientBundle.setParent((ResourceBundle) parent); + cache.put(nlVarients[i], varientBundle); + parent = varientBundle; + } + result = cache.get(localeString); + return result.isEmpty() ? null : result; + } + } + + private String[] buildNLVariants(String nl) { + List result = new ArrayList(); + while (nl.length() > 0) { + result.add(nl); + int i = nl.lastIndexOf('_'); + nl = (i < 0) ? "" : nl.substring(0, i); //$NON-NLS-1$ + } + result.add(""); //$NON-NLS-1$ + return result.toArray(new String[result.size()]); + } + + private class LocalizationResourceBundle extends PropertyResourceBundle implements + BundleResourceBundle { + public LocalizationResourceBundle(InputStream in) throws IOException { + super(in); + } + + public void setParent(ResourceBundle parent) { + super.setParent(parent); + } + + public boolean isEmpty() { + return false; + } + + public boolean isStemEmpty() { + return parent == null; + } + } + + class EmptyResouceBundle extends ResourceBundle implements BundleResourceBundle { + private final String localeString; + + public EmptyResouceBundle(String locale) { + super(); + this.localeString = locale; + } + + public Enumeration getKeys() { + return null; + } + + protected Object handleGetObject(String arg0) throws MissingResourceException { + return null; + } + + public void setParent(ResourceBundle parent) { + super.setParent(parent); + } + + public boolean isEmpty() { + if (parent == null) + return true; + return ((BundleResourceBundle) parent).isEmpty(); + } + + public boolean isStemEmpty() { + if (DEFAULT_ROOT.equals(localeString)) + return false; + if (parent == null) + return true; + return ((BundleResourceBundle) parent).isStemEmpty(); + } + } +} diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/TranslationObjectSupplier.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/TranslationObjectSupplier.java new file mode 100644 index 0000000000..a7ee2584f4 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/TranslationObjectSupplier.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2011 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.services.impl; + +import java.lang.reflect.ParameterizedType; + +import java.lang.reflect.Type; +import java.util.Locale; + +import org.eclipse.e4.core.internal.contexts.ContextObjectSupplier; + +import org.eclipse.e4.core.internal.di.Requestor; +import org.eclipse.e4.core.services.translation.TranslationService; + +import org.eclipse.e4.core.di.suppliers.IObjectDescriptor; +import org.eclipse.e4.core.di.suppliers.IRequestor; + +import org.eclipse.e4.core.di.suppliers.ExtendedObjectSupplier; +import org.eclipse.e4.tools.services.IMessageFactoryService; + +public class TranslationObjectSupplier extends ExtendedObjectSupplier { + + @Override + public Object get(IObjectDescriptor descriptor, IRequestor requestor, + boolean track, boolean group) { + Class descriptorsClass = getDesiredClass(descriptor.getDesiredType()); + + Requestor req = (Requestor) requestor; + ContextObjectSupplier sub = (ContextObjectSupplier) req + .getPrimarySupplier(); + + String locale = (String) sub.getContext().get(TranslationService.LOCALE); + locale = locale == null ? Locale.getDefault().toString() : locale; + IMessageFactoryService factoryService = sub.getContext().get(IMessageFactoryService.class); + + try { + return factoryService.createInstance(locale,descriptorsClass); + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } + + private Class getDesiredClass(Type desiredType) { + if (desiredType instanceof Class) + return (Class) desiredType; + if (desiredType instanceof ParameterizedType) { + Type rawType = ((ParameterizedType) desiredType).getRawType(); + if (rawType instanceof Class) + return (Class) rawType; + } + return null; + } + +} \ No newline at end of file From 71f87f118fd20d47227b18b03d86025e6ed672e8 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 29 Jan 2011 01:16:48 +0000 Subject: [PATCH 0289/1286] Bug 316371 - [ModelTooling] ModelEditor should be multipart editors which allows to edit xml or via UI --- .../OSGI-INF/resourceprovider.xml | 2 +- ...images.properties => resources.properties} | 8 +++- .../emf/ui/internal/ResourceProvider.java | 19 ++++------ .../emf/ui/internal/common/ModelEditor.java | 4 +- .../ui/internal/common/xml/ColorManager.java | 38 ------------------- .../internal/common/xml/XMLConfiguration.java | 18 +++++---- .../ui/internal/common/xml/XMLScanner.java | 6 ++- .../ui/internal/common/xml/XMLTagScanner.java | 6 ++- ...ovider.java => BasicResourceProvider.java} | 26 +++++++++++-- .../services/IResourceProviderService.java | 6 ++- 10 files changed, 61 insertions(+), 72 deletions(-) rename bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/{images.properties => resources.properties} (96%) delete mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/ColorManager.java rename bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/{AbstractBundleResourceProvider.java => BasicResourceProvider.java} (57%) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resourceprovider.xml b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resourceprovider.xml index fc93362838..4f18498cdc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resourceprovider.xml +++ b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resourceprovider.xml @@ -4,5 +4,5 @@ - + diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/images.properties b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties similarity index 96% rename from bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/images.properties rename to bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties index 471396af6b..598a3c1fc8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/images.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties @@ -89,4 +89,10 @@ IMG_org.eclipse.e4.tools.emf.ui.wizban.fieldrefact_wiz=/icons/full/wizban/fieldr IMG_org.eclipse.e4.tools.emf.ui.wizban.import_wiz=/icons/full/wizban/import_wiz.png IMG_org.eclipse.e4.tools.emf.ui.wizban.newclass_wiz=/icons/full/wizban/newclass_wiz.png IMG_org.eclipse.e4.tools.emf.ui.wizban.newexp_wiz=/icons/full/wizban/newexp_wiz.png -IMG_org.eclipse.e4.tools.emf.ui.wizban.typerefact_wiz=/icons/full/wizban/typerefact_wiz.png \ No newline at end of file +IMG_org.eclipse.e4.tools.emf.ui.wizban.typerefact_wiz=/icons/full/wizban/typerefact_wiz.png + +COLOR_org.eclipse.e4.tools.emf.ui.XML_COMMENT=rgb(128, 0, 0) +COLOR_org.eclipse.e4.tools.emf.ui.PROC_INSTR=rgb(128, 128, 128) +COLOR_org.eclipse.e4.tools.emf.ui.STRING=rgb(0, 128, 0) +COLOR_org.eclipse.e4.tools.emf.ui.DEFAULT=rgb(0, 0, 0) +COLOR_org.eclipse.e4.tools.emf.ui.TAG=rgb(0, 0, 128) \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java index 41c8eeead4..13f4fba9ba 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java @@ -1,10 +1,8 @@ package org.eclipse.e4.tools.emf.ui.internal; -import org.eclipse.e4.tools.services.AbstractBundleResourceProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; +import org.eclipse.e4.tools.services.BasicResourceProvider; -public class ResourceProvider extends AbstractBundleResourceProvider { +public class ResourceProvider extends BasicResourceProvider { public static final String IMG_Addons = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Addons"; //$NON-NLS-1$ public static final String IMG_Application = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Application"; //$NON-NLS-1$ public static final String IMG_Area_vertical = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Area_vertical"; //$NON-NLS-1$ @@ -98,12 +96,9 @@ public class ResourceProvider extends AbstractBundleResourceProvider { public static final String IMG_Wizban16_newexp_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.newexp_wiz"; //$NON-NLS-1$ public static final String IMG_Wizban16_typerefact_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.typerefact_wiz"; //$NON-NLS-1$ - public Image getFont(Display display, String key) { - return null; - } - - public Image getColor(Display display, String key) { - return null; - } - + public static final String COLOR_XML_COMMENT = "COLOR_org.eclipse.e4.tools.emf.ui.XML_COMMENT"; //$NON-NLS-1$ + public static final String COLOR_PROC_INSTR = "COLOR_org.eclipse.e4.tools.emf.ui.PROC_INSTR"; //$NON-NLS-1$ + public static final String COLOR_STRING = "COLOR_org.eclipse.e4.tools.emf.ui.STRING"; //$NON-NLS-1$ + public static final String COLOR_DEFAULT = "COLOR_org.eclipse.e4.tools.emf.ui.DEFAULT"; //$NON-NLS-1$ + public static final String COLOR_TAG = "COLOR_org.eclipse.e4.tools.emf.ui.TAG"; //$NON-NLS-1$ } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 78a07d74e9..e6a382381e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -115,7 +115,6 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowSharedElementsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor; import org.eclipse.e4.tools.emf.ui.internal.common.xml.AnnotationAccess; -import org.eclipse.e4.tools.emf.ui.internal.common.xml.ColorManager; import org.eclipse.e4.tools.emf.ui.internal.common.xml.EMFDocumentResourceMediator; import org.eclipse.e4.tools.emf.ui.internal.common.xml.XMLConfiguration; import org.eclipse.e4.tools.emf.ui.internal.common.xml.XMLPartitionScanner; @@ -324,10 +323,9 @@ private Control createXMITab(Composite composite) { final AnnotationModel model = new AnnotationModel(); VerticalRuler verticalRuler = new VerticalRuler(VERTICAL_RULER_WIDTH, new AnnotationAccess(resourcePool)); - ColorManager colorManager = new ColorManager(); int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION; SourceViewer viewer = new SourceViewer(composite, verticalRuler, styles); - viewer.configure(new XMLConfiguration(colorManager)); + viewer.configure(new XMLConfiguration(resourcePool)); viewer.setEditable(project != null); final IDocument document = emfDocumentProvider.getDocument(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/ColorManager.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/ColorManager.java deleted file mode 100644 index 4a3a225d66..0000000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/ColorManager.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.xml; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.widgets.Display; - -public class ColorManager { - - protected Map fColorTable = new HashMap(10); - - public void dispose() { - Iterator e = fColorTable.values().iterator(); - while (e.hasNext()) - ((Color) e.next()).dispose(); - } - - public Color getColor(RGB rgb) { - Color color = (Color) fColorTable.get(rgb); - if (color == null) { - color = new Color(Display.getCurrent(), rgb); - fColorTable.put(rgb, color); - } - return color; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLConfiguration.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLConfiguration.java index 42080119a1..ea8ed3b260 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLConfiguration.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLConfiguration.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.xml; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextDoubleClickStrategy; import org.eclipse.jface.text.TextAttribute; @@ -24,10 +26,10 @@ public class XMLConfiguration extends SourceViewerConfiguration { private XMLDoubleClickStrategy doubleClickStrategy; private XMLTagScanner tagScanner; private XMLScanner scanner; - private ColorManager colorManager; + private IResourcePool pool; - public XMLConfiguration(ColorManager colorManager) { - this.colorManager = colorManager; + public XMLConfiguration(IResourcePool pool) { + this.pool = pool; } public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { @@ -42,16 +44,16 @@ public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewe protected XMLScanner getXMLScanner() { if (scanner == null) { - scanner = new XMLScanner(colorManager); - scanner.setDefaultReturnToken(new Token(new TextAttribute(colorManager.getColor(IXMLColorConstants.DEFAULT)))); + scanner = new XMLScanner(pool); + scanner.setDefaultReturnToken(new Token(new TextAttribute(pool.getColorUnchecked(ResourceProvider.COLOR_DEFAULT)))); } return scanner; } protected XMLTagScanner getXMLTagScanner() { if (tagScanner == null) { - tagScanner = new XMLTagScanner(colorManager); - tagScanner.setDefaultReturnToken(new Token(new TextAttribute(colorManager.getColor(IXMLColorConstants.TAG)))); + tagScanner = new XMLTagScanner(pool); + tagScanner.setDefaultReturnToken(new Token(new TextAttribute(pool.getColorUnchecked(ResourceProvider.COLOR_TAG)))); } return tagScanner; } @@ -67,7 +69,7 @@ public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceVie reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE); reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); - NonRuleBasedDamagerRepairer ndr = new NonRuleBasedDamagerRepairer(new TextAttribute(colorManager.getColor(IXMLColorConstants.XML_COMMENT))); + NonRuleBasedDamagerRepairer ndr = new NonRuleBasedDamagerRepairer(new TextAttribute(pool.getColorUnchecked(ResourceProvider.COLOR_XML_COMMENT))); reconciler.setDamager(ndr, XMLPartitionScanner.XML_COMMENT); reconciler.setRepairer(ndr, XMLPartitionScanner.XML_COMMENT); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLScanner.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLScanner.java index 7eaafe0632..1e4329581f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLScanner.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLScanner.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.xml; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.jface.text.TextAttribute; import org.eclipse.jface.text.rules.IRule; import org.eclipse.jface.text.rules.IToken; @@ -20,8 +22,8 @@ public class XMLScanner extends RuleBasedScanner { - public XMLScanner(ColorManager manager) { - IToken procInstr = new Token(new TextAttribute(manager.getColor(IXMLColorConstants.PROC_INSTR))); + public XMLScanner(IResourcePool pool) { + IToken procInstr = new Token(new TextAttribute(pool.getColorUnchecked(ResourceProvider.COLOR_PROC_INSTR))); IRule[] rules = new IRule[2]; // Add rule for processing instructions diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLTagScanner.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLTagScanner.java index 47ccf71b98..3a12036884 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLTagScanner.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLTagScanner.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.xml; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.jface.text.TextAttribute; import org.eclipse.jface.text.rules.IRule; import org.eclipse.jface.text.rules.IToken; @@ -20,8 +22,8 @@ public class XMLTagScanner extends RuleBasedScanner { - public XMLTagScanner(ColorManager manager) { - IToken string = new Token(new TextAttribute(manager.getColor(IXMLColorConstants.STRING))); + public XMLTagScanner(IResourcePool pool) { + IToken string = new Token(new TextAttribute(pool.getColorUnchecked(ResourceProvider.COLOR_STRING))); IRule[] rules = new IRule[3]; diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/AbstractBundleResourceProvider.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/BasicResourceProvider.java similarity index 57% rename from bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/AbstractBundleResourceProvider.java rename to bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/BasicResourceProvider.java index 6fda1278b5..30944d79fe 100644 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/AbstractBundleResourceProvider.java +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/BasicResourceProvider.java @@ -7,13 +7,16 @@ import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.Path; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; import org.osgi.framework.BundleContext; -public abstract class AbstractBundleResourceProvider implements IResourceProviderService { - private Map properties; - private BundleContext context; +public abstract class BasicResourceProvider implements IResourceProviderService { + protected Map properties; + protected BundleContext context; public void activate(BundleContext context, Map properties) { this.properties = properties; @@ -44,4 +47,21 @@ public Image getImage(Display display, String key) { // TODO Auto-generated method stub return null; } + + public Font getFont(Display display, String key) { + return null; + } + + public Color getColor(Display display, String key) { + String color = properties.get(key); + if (color.startsWith("rgb")) { + String rgb = color.substring(color.indexOf('(')+1, color.indexOf(')')); + String[] cols = rgb.split(","); + int r = Integer.parseInt(cols[0].trim()); + int g = Integer.parseInt(cols[1].trim()); + int b = Integer.parseInt(cols[2].trim()); + return new Color(display, new RGB(r,g,b)); + } + return null; + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceProviderService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceProviderService.java index 5c047d05c5..70413f2bf0 100644 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceProviderService.java +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceProviderService.java @@ -1,10 +1,12 @@ package org.eclipse.e4.tools.services; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Display; public interface IResourceProviderService { public Image getImage(Display display, String key); - public Image getFont(Display display, String key); - public Image getColor(Display display, String key); + public Font getFont(Display display, String key); + public Color getColor(Display display, String key); } \ No newline at end of file From cf23674051375fbde3a914db9319be2946c398ca Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 29 Jan 2011 14:05:12 +0000 Subject: [PATCH 0290/1286] Bug 316371 - [ModelTooling] ModelEditor should be multipart editors which allows to edit xml or via UI --- .../tools/emf/ui/common/XMIModelResource.java | 25 +++++++++++++++++-- .../xml/EMFDocumentResourceMediator.java | 9 +++---- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java index c9f53fb4b9..ab131ba7b0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java @@ -16,20 +16,24 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.e4.ui.internal.workbench.E4XMIResource; import org.eclipse.e4.ui.internal.workbench.E4XMIResourceFactory; import org.eclipse.emf.common.command.BasicCommandStack; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.command.CommandStackListener; import org.eclipse.emf.common.command.CompoundCommand; +import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; @@ -70,11 +74,28 @@ public IObservableList getRoot() { return list; } - public void replaceRoot(EObject eobject) { + public void replaceRoot(EObject eObject) { + E4XMIResource resource = (E4XMIResource) eObject.eResource(); + Map idMap = new HashMap(); + idMap.put(eObject, resource.getID(eObject)); + + TreeIterator it = EcoreUtil.getAllContents(eObject, true); + while (it.hasNext()) { + EObject o = it.next(); + resource = (E4XMIResource) o.eResource(); + idMap.put(o, resource.getID(o)); + } + + resource = (E4XMIResource) ((EObject) list.get(0)).eResource(); + Command cmdRemove = new RemoveCommand(getEditingDomain(), resource.getContents(), list.get(0)); - Command cmdAdd = new AddCommand(getEditingDomain(), resource.getContents(), eobject); + Command cmdAdd = new AddCommand(getEditingDomain(), resource.getContents(), eObject); CompoundCommand cmd = new CompoundCommand(Arrays.asList(cmdRemove, cmdAdd)); getEditingDomain().getCommandStack().execute(cmd); + + for (Entry e : idMap.entrySet()) { + resource.setID(e.getKey(), e.getValue()); + } } public EditingDomain getEditingDomain() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/EMFDocumentResourceMediator.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/EMFDocumentResourceMediator.java index 1907ecfe4e..5dd518af4a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/EMFDocumentResourceMediator.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/EMFDocumentResourceMediator.java @@ -7,10 +7,9 @@ import java.util.Collections; import java.util.List; import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.ui.internal.workbench.E4XMIResource; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource.Diagnostic; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.DocumentEvent; import org.eclipse.jface.text.IDocumentListener; @@ -34,7 +33,7 @@ public void documentChanged(DocumentEvent event) { } String doc = document.get(); - XMIResourceImpl res = new XMIResourceImpl(); + E4XMIResource res = new E4XMIResource(); try { res.load(new InputSource(new StringReader(doc)), null); modelResource.replaceRoot(res.getContents().get(0)); @@ -80,8 +79,8 @@ public Document getDocument() { } private String toXMI(EObject root) { - XMIResourceImpl resource = new XMIResourceImpl(); - resource.getContents().add(EcoreUtil.copy(root)); + E4XMIResource resource = (E4XMIResource) root.eResource(); + // resource.getContents().add(EcoreUtil.copy(root)); StringWriter writer = new StringWriter(); try { resource.save(writer, null); From 25a6bc60d40f4ba5c19fec12dbc5c51c4beae137 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 29 Jan 2011 15:12:17 +0000 Subject: [PATCH 0291/1286] Bug 335587 - [ModelTooling] NPE thrown when using 'New Addon Class' wizard --- .../internal/tools/wizards/classes/AbstractNewClassPage.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java index 91584d662d..a304714fa2 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java @@ -347,6 +347,9 @@ public PackageFragmentRootToStringConverter() { public Object convert(Object fromObject) { IPackageFragmentRoot f = (IPackageFragmentRoot) fromObject; + if( f == null ) { + return ""; + } return f.getPath().makeRelative().toString(); } } From af8b71ad7c093faad6100b1b1903796a3dd15536 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 2 Feb 2011 23:08:20 +0000 Subject: [PATCH 0292/1286] Bug 335767 - [ModelTooling] Add support for NLS --- .../META-INF/MANIFEST.MF | 3 +- .../impl/AbstractTranslationProvider.java | 225 ++++++++++++++++++ .../PropertiesBundleTranslationProvider.java | 186 ++------------- 3 files changed, 241 insertions(+), 173 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/AbstractTranslationProvider.java diff --git a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF index 445bfb48c2..25140262a7 100644 --- a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF @@ -4,7 +4,8 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.e4.tools.services Bundle-Version: 1.0.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Export-Package: org.eclipse.e4.tools.services +Export-Package: org.eclipse.e4.tools.services, + org.eclipse.e4.tools.services.impl;x-friends:="org.eclipse.e4.tools.emf.ui" Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.swt;bundle-version="3.7.0", org.eclipse.equinox.common;bundle-version="3.6.0", diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/AbstractTranslationProvider.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/AbstractTranslationProvider.java new file mode 100644 index 0000000000..c255ee13cb --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/AbstractTranslationProvider.java @@ -0,0 +1,225 @@ +/******************************************************************************* + * Copyright (c) 2011 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.services.impl; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.List; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.PropertyResourceBundle; +import java.util.ResourceBundle; +import org.eclipse.osgi.service.localization.BundleLocalization; + +/** + * The lookup of the translation the same than the one in {@link BundleLocalization} which is based + * upon the value found in equinox.root.locale which defaults to "en": + *
      + *
    • If set to empty string then the search order for: + *
        + *
      • bn + Ls + "_" + Cs + "_" + Vs
      • + *
      • bn + Ls + "_" + Cs
      • + *
      • bn + Ls
      • + *
      • bn + Ld + "_" + Cd + "_" + Vd
      • + *
      • bn + Ld + "_" + Cd
      • + *
      • bn + Ld
      • + *
      + *
    • + *
    • If Ls equals the value of equinox.root.locale then the following search order is used: + *
        + *
      • bn + Ls + "_" + Cs + "_" + Vs
      • + *
      • bn + Ls + "_" + Cs
      • + *
      • bn + Ls
      • + *
      • bn + Ld + "_" + Cd + "_" + Vd
      • + *
      • bn + Ld + "_" + Cd
      • + *
      • bn + Ld
      • + *
      + *
    • + *
    + * Where bn is this bundle's localization basename, Ls, Cs and Vs are the specified locale + * (language, country, variant) and Ld, Cd and Vd are the default locale (language, country, + * variant). + */ +public abstract class AbstractTranslationProvider { + final static String DEFAULT_ROOT = getEquinoxRootLocale(); + + private final Hashtable cache = new Hashtable( + 5); + + private static String getEquinoxRootLocale() { + // Logic from FrameworkProperties.getProperty("equinox.root.locale", "en") + String root = System.getProperties().getProperty("equinox.root.locale"); + if (root == null) { + root = "en"; + } + return root; + } + + protected abstract InputStream getResourceAsStream(String name); + protected abstract String getBasename(); + + public String translate(String locale, String key) { + String defaultLocale = Locale.getDefault().toString(); + String localeString = locale; + ResourceBundle bundle = getResourceBundle(locale.toString(), + defaultLocale.equals(localeString)); + try { + if( bundle == null ) { + return key; + } + return bundle.getString(key); + } catch (Exception e) { + e.printStackTrace(); + return key; + } + + } + + private ResourceBundle getResourceBundle(String localeString, boolean isDefaultLocale) { + BundleResourceBundle resourceBundle = lookupResourceBundle(localeString); + if (isDefaultLocale) + return (ResourceBundle) resourceBundle; + // need to determine if this is resource bundle is an empty stem + // if it is then the default locale should be used + if (resourceBundle == null || resourceBundle.isStemEmpty()) + return (ResourceBundle) lookupResourceBundle(Locale.getDefault().toString()); + return (ResourceBundle) resourceBundle; + } + + private interface BundleResourceBundle { + void setParent(ResourceBundle parent); + + boolean isEmpty(); + + boolean isStemEmpty(); + } + + private BundleResourceBundle lookupResourceBundle(String localeString) { + // get the localization header as late as possible to avoid accessing the raw headers + // getting the first value from the raw headers forces the manifest to be parsed (bug + // 332039) + String localizationHeader = getBasename(); + synchronized (cache) { + BundleResourceBundle result = cache.get(localeString); + if (result != null) + return result.isEmpty() ? null : result; + String[] nlVarients = buildNLVariants(localeString); + BundleResourceBundle parent = null; + + for (int i = nlVarients.length - 1; i >= 0; i--) { + BundleResourceBundle varientBundle = null; + InputStream resourceStream = getResourceAsStream(localizationHeader + + (nlVarients[i].equals("") ? nlVarients[i] : '_' + nlVarients[i]) + + ".properties"); + + if (resourceStream == null) { + varientBundle = cache.get(nlVarients[i]); + } else { + try { + varientBundle = new LocalizationResourceBundle(resourceStream); + } catch (IOException e) { + // ignore and continue + } finally { + if (resourceStream != null) { + try { + resourceStream.close(); + } catch (IOException e3) { + // Ignore exception + } + } + } + } + + if (varientBundle == null) { + varientBundle = new EmptyResouceBundle(nlVarients[i]); + } + if (parent != null) + varientBundle.setParent((ResourceBundle) parent); + cache.put(nlVarients[i], varientBundle); + parent = varientBundle; + } + result = cache.get(localeString); + return result.isEmpty() ? null : result; + } + } + + private String[] buildNLVariants(String nl) { + List result = new ArrayList(); + while (nl.length() > 0) { + result.add(nl); + int i = nl.lastIndexOf('_'); + nl = (i < 0) ? "" : nl.substring(0, i); //$NON-NLS-1$ + } + result.add(""); //$NON-NLS-1$ + return result.toArray(new String[result.size()]); + } + + private class LocalizationResourceBundle extends PropertyResourceBundle implements + BundleResourceBundle { + public LocalizationResourceBundle(InputStream in) throws IOException { + super(in); + } + + public void setParent(ResourceBundle parent) { + super.setParent(parent); + } + + public boolean isEmpty() { + return false; + } + + public boolean isStemEmpty() { + return parent == null; + } + } + + class EmptyResouceBundle extends ResourceBundle implements BundleResourceBundle { + private final String localeString; + + public EmptyResouceBundle(String locale) { + super(); + this.localeString = locale; + } + + public Enumeration getKeys() { + return null; + } + + protected Object handleGetObject(String arg0) throws MissingResourceException { + return null; + } + + public void setParent(ResourceBundle parent) { + super.setParent(parent); + } + + public boolean isEmpty() { + if (parent == null) + return true; + return ((BundleResourceBundle) parent).isEmpty(); + } + + public boolean isStemEmpty() { + if (DEFAULT_ROOT.equals(localeString)) + return false; + if (parent == null) + return true; + return ((BundleResourceBundle) parent).isStemEmpty(); + } + } + + protected void clearCache() { + cache.clear(); + } +} diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/PropertiesBundleTranslationProvider.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/PropertiesBundleTranslationProvider.java index c7ed9fb242..55242b699b 100644 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/PropertiesBundleTranslationProvider.java +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/PropertiesBundleTranslationProvider.java @@ -10,16 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.services.impl; -import java.io.IOException; import java.io.InputStream; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.List; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.PropertyResourceBundle; -import java.util.ResourceBundle; + import org.eclipse.osgi.service.localization.BundleLocalization; /** @@ -51,173 +43,23 @@ * (language, country, variant) and Ld, Cd and Vd are the default locale (language, country, * variant). */ -public class PropertiesBundleTranslationProvider { - final static String DEFAULT_ROOT = getEquinoxRootLocale(); - +public class PropertiesBundleTranslationProvider extends AbstractTranslationProvider { private ClassLoader loader; - private String baseName; - - private final Hashtable cache = new Hashtable( - 5); - + private String basename; + public PropertiesBundleTranslationProvider(ClassLoader loader, String baseName) { + super(); + this.basename = baseName; this.loader = loader; - this.baseName = baseName; - } - - private static String getEquinoxRootLocale() { - // Logic from FrameworkProperties.getProperty("equinox.root.locale", "en") - String root = System.getProperties().getProperty("equinox.root.locale"); - if (root == null) { - root = "en"; - } - return root; - } - - public String translate(String locale, String key) { - String defaultLocale = Locale.getDefault().toString(); - String localeString = locale; - ResourceBundle bundle = getResourceBundle(locale.toString(), - defaultLocale.equals(localeString)); - try { - return bundle.getString(key); - } catch (Exception e) { - e.printStackTrace(); - return key; - } - - } - - private ResourceBundle getResourceBundle(String localeString, boolean isDefaultLocale) { - BundleResourceBundle resourceBundle = lookupResourceBundle(localeString); - if (isDefaultLocale) - return (ResourceBundle) resourceBundle; - // need to determine if this is resource bundle is an empty stem - // if it is then the default locale should be used - if (resourceBundle == null || resourceBundle.isStemEmpty()) - return (ResourceBundle) lookupResourceBundle(Locale.getDefault().toString()); - return (ResourceBundle) resourceBundle; - } - - private interface BundleResourceBundle { - void setParent(ResourceBundle parent); - - boolean isEmpty(); - - boolean isStemEmpty(); - } - - private BundleResourceBundle lookupResourceBundle(String localeString) { - // get the localization header as late as possible to avoid accessing the raw headers - // getting the first value from the raw headers forces the manifest to be parsed (bug - // 332039) - String localizationHeader = baseName; - synchronized (cache) { - BundleResourceBundle result = cache.get(localeString); - if (result != null) - return result.isEmpty() ? null : result; - String[] nlVarients = buildNLVariants(localeString); - BundleResourceBundle parent = null; - - for (int i = nlVarients.length - 1; i >= 0; i--) { - BundleResourceBundle varientBundle = null; - InputStream resourceStream = loader.getResourceAsStream(localizationHeader - + (nlVarients[i].equals("") ? nlVarients[i] : '_' + nlVarients[i]) - + ".properties"); - - if (resourceStream == null) { - varientBundle = cache.get(nlVarients[i]); - } else { - try { - varientBundle = new LocalizationResourceBundle(resourceStream); - } catch (IOException e) { - // ignore and continue - } finally { - if (resourceStream != null) { - try { - resourceStream.close(); - } catch (IOException e3) { - // Ignore exception - } - } - } - } - - if (varientBundle == null) { - varientBundle = new EmptyResouceBundle(nlVarients[i]); - } - if (parent != null) - varientBundle.setParent((ResourceBundle) parent); - cache.put(nlVarients[i], varientBundle); - parent = varientBundle; - } - result = cache.get(localeString); - return result.isEmpty() ? null : result; - } } - private String[] buildNLVariants(String nl) { - List result = new ArrayList(); - while (nl.length() > 0) { - result.add(nl); - int i = nl.lastIndexOf('_'); - nl = (i < 0) ? "" : nl.substring(0, i); //$NON-NLS-1$ - } - result.add(""); //$NON-NLS-1$ - return result.toArray(new String[result.size()]); - } - - private class LocalizationResourceBundle extends PropertyResourceBundle implements - BundleResourceBundle { - public LocalizationResourceBundle(InputStream in) throws IOException { - super(in); - } - - public void setParent(ResourceBundle parent) { - super.setParent(parent); - } - - public boolean isEmpty() { - return false; - } - - public boolean isStemEmpty() { - return parent == null; - } + @Override + protected InputStream getResourceAsStream(String name) { + return loader.getResourceAsStream(name); } - - class EmptyResouceBundle extends ResourceBundle implements BundleResourceBundle { - private final String localeString; - - public EmptyResouceBundle(String locale) { - super(); - this.localeString = locale; - } - - public Enumeration getKeys() { - return null; - } - - protected Object handleGetObject(String arg0) throws MissingResourceException { - return null; - } - - public void setParent(ResourceBundle parent) { - super.setParent(parent); - } - - public boolean isEmpty() { - if (parent == null) - return true; - return ((BundleResourceBundle) parent).isEmpty(); - } - - public boolean isStemEmpty() { - if (DEFAULT_ROOT.equals(localeString)) - return false; - if (parent == null) - return true; - return ((BundleResourceBundle) parent).isStemEmpty(); - } + + @Override + protected String getBasename() { + return basename; } -} +} \ No newline at end of file From 253f58ee31d331bbb7d0f0763e3ed6832a8fcb72 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 2 Feb 2011 23:44:13 +0000 Subject: [PATCH 0293/1286] Bug 335767 - [ModelTooling] Add support for NLS --- .../OSGI-INF/resources.properties | 1 + .../icons/full/obj16/world_edit.png | Bin 0 -> 945 bytes .../component/AbstractComponentEditor.java | 20 ++- .../e4/tools/emf/ui/internal/Messages.java | 6 +- .../tools/emf/ui/internal/Messages.properties | 5 +- .../emf/ui/internal/ResourceProvider.java | 1 + .../emf/ui/internal/common/ModelEditor.java | 16 ++ .../internal/common/component/AreaEditor.java | 4 +- .../common/component/ControlFactory.java | 45 +++++ .../internal/common/component/MenuEditor.java | 7 +- .../common/component/MenuItemEditor.java | 6 +- .../component/PartDescriptorEditor.java | 3 +- .../internal/common/component/PartEditor.java | 3 +- .../common/component/PerspectiveEditor.java | 7 +- .../common/component/PlaceholderEditor.java | 11 +- .../common/component/ToolItemEditor.java | 6 +- .../common/component/WindowEditor.java | 101 +++-------- .../ProjectOSGiTranslationProvider.java | 160 ++++++++++++++++++ .../properties/ResourceBundleEditor.java | 15 ++ .../properties/ResourceBundleEntry.java | 19 +++ 20 files changed, 317 insertions(+), 119 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/world_edit.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ResourceBundleEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ResourceBundleEntry.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties index 598a3c1fc8..bf7fc81021 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties @@ -84,6 +84,7 @@ IMG_org.eclipse.e4.tools.emf.ui.obj16.zoom=/icons/full/obj16/zoom.png IMG_org.eclipse.e4.tools.emf.ui.obj16.application_form=/icons/full/obj16/application_form.png IMG_org.eclipse.e4.tools.emf.ui.obj16.chart_organisation=/icons/full/obj16/chart_organisation.png IMG_org.eclipse.e4.tools.emf.ui.obj16.error_obj=/icons/full/obj16/error_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.obj16.world_edit=/icons/full/obj16/world_edit.png IMG_org.eclipse.e4.tools.emf.ui.wizban.fieldrefact_wiz=/icons/full/wizban/fieldrefact_wiz.png IMG_org.eclipse.e4.tools.emf.ui.wizban.import_wiz=/icons/full/wizban/import_wiz.png diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/world_edit.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/world_edit.png new file mode 100644 index 0000000000000000000000000000000000000000..00794d4088a00c6baf0c26268ce127cc2c0277a8 GIT binary patch literal 945 zcmV;i15W&jP)wbexvw|;D@Bpf2#?5tPj)lD7w%noq+*50?iyU*w6AgL1SN!I(xtJI>ioRNhm3 z8y=*@c8$zNJK5S0C$-Jo_k6|Ll7+?aK9-_;S@0|HYf>1rjrX%u;FB{MepKXNWhx3c)tdmO*|ZNArkPMxVZ889e0pvz1Z#dze2>G{HV zh$91qls28kbG1mEJG7MiMzhUrQU&Dok7h|F~{5T*SG)I#1Af~Z4$+Bm-QZ|{agwxOcT_6 zh)MA>qt$8jm2IcNd=z7-0Y$4cDTf3vJ@HICtF~=Qxv<4hB7Kb&OBE~D3aq8uXgl}{ z-NV&r%qNoKYI3vS#s7WdzhrEE;bGanS0DGEO{4DI*0mjq%?Tm=CKwQ8KRy394wBI; Te6@B!00000NkvXXu0mjfI-kC4 literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index 5786d640f7..1432201fd1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -13,14 +13,20 @@ import java.util.Collections; import java.util.List; import javax.inject.Inject; +import javax.inject.Named; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.core.di.annotations.Optional; +import org.eclipse.e4.core.services.translation.TranslationService; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory; +import org.eclipse.e4.tools.emf.ui.internal.common.properties.ProjectOSGiTranslationProvider; import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.tools.services.Translation; import org.eclipse.e4.ui.model.application.MApplicationElement; +import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; @@ -46,12 +52,20 @@ public abstract class AbstractComponentEditor { @Inject private ModelEditor editor; @Inject - private IResourcePool resourcePool; + protected IResourcePool resourcePool; @Inject @Translation protected Messages Messages; + @Inject + @Optional + private ProjectOSGiTranslationProvider translationProvider; + + @Inject + @Named(TranslationService.LOCALE) + private String locale; + public EditingDomain getEditingDomain() { return editingDomain; } @@ -100,4 +114,8 @@ public FeaturePath[] getLabelProperties() { public List getActions(Object element) { return Collections.emptyList(); } + + protected String getLocalizedLabel(MUILabel element) { + return ControlFactory.getLocalizedLabel(translationProvider, element, locale); + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 63be298c7b..95ccf714c3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -362,10 +362,8 @@ public class Messages { public String WindowEditor_AddMainMenu; public String WindowEditor_TreeLabel; public String WindowEditor_TreeLabelDescription; - public String WindowEditor_X; - public String WindowEditor_Y; - public String WindowEditor_Width; - public String WindowEditor_Height; + + public String WindowEditor_Bounds; public String WindowEditor_Label; public String WindowEditor_Tooltip; public String WindowEditor_IconURI; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 59e04fdbba..244f4bd0e5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -362,10 +362,7 @@ TrimmedWindowEditor_TreeLabel=Trimmed Window WindowEditor_AddMainMenu=Add Main Menu WindowEditor_TreeLabel=Window WindowEditor_TreeLabelDescription=Window bla bla bla -WindowEditor_X=X -WindowEditor_Y=Y -WindowEditor_Width=Width -WindowEditor_Height=Height +WindowEditor_Bounds=Bounds(x,y,w,h) WindowEditor_Label=Label WindowEditor_Tooltip=Tooltip WindowEditor_IconURI=Icon URI diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java index 13f4fba9ba..f7b91e96a1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java @@ -89,6 +89,7 @@ public class ResourceProvider extends BasicResourceProvider { public static final String IMG_Obj16_application_form = "IMG_org.eclipse.e4.tools.emf.ui.obj16.application_form"; //$NON-NLS-1$ public static final String IMG_Obj16_chart_organisation = "IMG_org.eclipse.e4.tools.emf.ui.obj16.chart_organisation"; //$NON-NLS-1$ public static final String IMG_Obj16_error_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.error_obj"; //$NON-NLS-1$ + public static final String IMG_Obj16_world_edit = "IMG_org.eclipse.e4.tools.emf.ui.obj16.world_edit"; //$NON-NLS-1$ public static final String IMG_Wizban16_fieldrefact_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.fieldrefact_wiz"; //$NON-NLS-1$ public static final String IMG_Wizban16_import_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.import_wiz"; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index e6a382381e..ff86656d7f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -114,6 +114,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowSharedElementsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.properties.ProjectOSGiTranslationProvider; import org.eclipse.e4.tools.emf.ui.internal.common.xml.AnnotationAccess; import org.eclipse.e4.tools.emf.ui.internal.common.xml.EMFDocumentResourceMediator; import org.eclipse.e4.tools.emf.ui.internal.common.xml.XMLConfiguration; @@ -272,6 +273,21 @@ public ModelEditor(Composite composite, IEclipseContext context, IModelResource this.context = context; this.context.set(ModelEditor.class, this); this.obsManager = new ObservablesManager(); + if (project != null) { + ProjectOSGiTranslationProvider translationProvider = new ProjectOSGiTranslationProvider(project) { + @Override + protected void clearCache() { + super.clearCache(); + viewer.getControl().getDisplay().asyncExec(new Runnable() { + + public void run() { + viewer.refresh(); + } + }); + } + }; + context.set(ProjectOSGiTranslationProvider.class, translationProvider); + } } @PostConstruct diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java index 2f3af7ca9d..43dde29643 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java @@ -28,7 +28,6 @@ import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.advanced.MArea; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer; @@ -402,8 +401,7 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { - MArea o = (MArea) element; - return o.getLabel(); + return getLocalizedLabel((MUILabel) element); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index c14d9ce8ac..fc15824a33 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -19,11 +19,14 @@ import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; +import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; +import org.eclipse.e4.tools.emf.ui.internal.common.properties.ProjectOSGiTranslationProvider; +import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.internal.workbench.E4XMIResource; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationElement; @@ -270,7 +273,26 @@ public static void createTextField(Composite parent, String label, IObservableVa gd.horizontalSpan = 2; t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), modelProp.observeDetail(master)); + } + + public static void createTranslatedTextField(Composite parent, String label, IObservableValue master, EMFDataBindingContext context, IWidgetValueProperty textProp, IEMFEditValueProperty modelProp, IResourcePool resourcePool, IProject project) { + Label l = new Label(parent, SWT.NONE); + l.setText(label); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + Text t = new Text(parent, SWT.BORDER); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + if (project == null) { + gd.horizontalSpan = 2; + } + + t.setLayoutData(gd); + context.bindValue(textProp.observeDelayed(200, t), modelProp.observeDetail(master)); + if (project != null) { + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_world_edit)); + } } public static void createFindImport(Composite parent, final Messages Messages, final AbstractComponentEditor editor, EMFDataBindingContext context) { @@ -519,4 +541,27 @@ public static void createCheckBox(Composite parent, String label, IObservableVal context.bindValue(selectionProp.observe(t), modelProp.observeDetail(master)); } + + public static String getLocalizedLabel(ProjectOSGiTranslationProvider translationProvider, MUILabel element, String locale) { + if (translationProvider == null) { + if (element.getLocalizedLabel() != null && element.getLocalizedLabel().trim().length() > 0) { + return element.getLocalizedLabel(); + } + } + + if (element.getLabel() != null && element.getLabel().trim().length() > 0) { + String label = element.getLabel(); + return tr(translationProvider, locale, label); + } + return null; + } + + public static String tr(ProjectOSGiTranslationProvider translationProvider, String locale, String label) { + if (label.startsWith("%") && translationProvider != null) { //$NON-NLS-1$ + String key = label.substring(1); + String translation = translationProvider.translate(locale, key); + return translation == key ? label : translation; + } + return label; + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 90e6eda011..98182644a7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -523,12 +523,7 @@ public String getLabel(Object element) { @Override public String getDetailLabel(Object element) { - MMenu menu = (MMenu) element; - - if (menu.getLabel() != null && menu.getLabel().trim().length() > 0) { - return menu.getLabel(); - } - return null; + return getLocalizedLabel((MUILabel) element); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 251fda8fef..d1698a348c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -332,11 +332,7 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { - MUILabel label = (MUILabel) element; - if (label.getLabel() != null && label.getLabel().trim().length() > 0) { - return label.getLabel(); - } - return null; + return getLocalizedLabel((MUILabel) element); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index d78611042d..ac6200f940 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -412,8 +412,7 @@ public void handleValueChange(ValueChangeEvent event) { @Override public String getDetailLabel(Object element) { - MPartDescriptor o = (MPartDescriptor) element; - return o.getLabel(); + return getLocalizedLabel((MUILabel) element); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index af1321b106..c730592713 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -360,8 +360,7 @@ public void handleValueChange(ValueChangeEvent event) { @Override public String getDetailLabel(Object element) { - MPart o = (MPart) element; - return o.getLabel(); + return getLocalizedLabel((MUILabel) element); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index fe375de2a1..ef4351da87 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -147,12 +147,7 @@ public String getLabel(Object element) { @Override public String getDetailLabel(Object element) { - MPerspective perspective = (MPerspective) element; - if (perspective.getLabel() != null && perspective.getLabel().trim().length() > 0) { - return perspective.getLabel(); - } - - return null; + return getLocalizedLabel((MUILabel) element); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index ab49f99d0b..e1051d681b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -77,8 +77,10 @@ public String getDetailLabel(Object element) { b.append(((EObject) pl.getRef()).eClass().getName()); if (pl.getRef() instanceof MUILabel) { MUILabel label = (MUILabel) pl.getRef(); - if (label.getLabel() != null && label.getLabel().trim().length() > 0) { - b.append(" (" + label.getLabel() + ")"); //$NON-NLS-1$//$NON-NLS-2$ + String l = getLocalizedLabel(label); + + if (l != null && l.trim().length() > 0) { + b.append(" (" + l + ")"); //$NON-NLS-1$//$NON-NLS-2$ } else if (label.getTooltip() != null && label.getTooltip().trim().length() > 0) { b.append(" (" + label.getTooltip() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ } else { @@ -194,8 +196,9 @@ public Object convert(Object fromObject) { EObject o = (EObject) fromObject; if (o instanceof MUILabel) { MUILabel label = (MUILabel) o; - if (!Util.isNullOrEmpty(label.getLabel())) { - return o.eClass().getName() + " - " + label.getLabel(); //$NON-NLS-1$ + String l = getLocalizedLabel(label); + if (!Util.isNullOrEmpty(l)) { + return o.eClass().getName() + " - " + l; //$NON-NLS-1$ } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 43e56a95e4..e80b357a93 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -299,8 +299,10 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { MToolItem item = (MToolItem) element; - if (item.getLabel() != null && item.getLabel().trim().length() > 0) { - return item.getLabel(); + String l = getLocalizedLabel(item); + + if (l != null && l.trim().length() > 0) { + return l; } else if (item.getTooltip() != null && item.getTooltip().trim().length() > 0) { return item.getTooltip(); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 31ee67b856..17dbc2f497 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -177,98 +177,43 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); - l.setText(Messages.WindowEditor_X); + l.setText(Messages.WindowEditor_Bounds); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - Text t = new Text(parent, SWT.BORDER); + Composite comp = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(4, true); + layout.marginWidth = 0; + layout.marginHeight = 0; + comp.setLayout(layout); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__X).observeDetail(getMaster())); - } + comp.setLayoutData(gd); - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.WindowEditor_Y); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + Text t = new Text(comp, SWT.BORDER | SWT.TRAIL); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__X).observeDetail(getMaster())); - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); + t = new Text(comp, SWT.BORDER | SWT.TRAIL); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__Y).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.WindowEditor_Width); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); + t = new Text(comp, SWT.BORDER | SWT.TRAIL); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__WIDTH).observeDetail(getMaster())); - } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.WindowEditor_Height); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); + t = new Text(comp, SWT.BORDER | SWT.TRAIL); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__HEIGHT).observeDetail(getMaster())); } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.WindowEditor_Label); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.WindowEditor_Tooltip); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); - } + ControlFactory.createTranslatedTextField(parent, Messages.WindowEditor_Label, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project); + ControlFactory.createTranslatedTextField(parent, Messages.WindowEditor_Tooltip, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool, project); + ControlFactory.createTranslatedTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE), resourcePool, project); // ------------------------------------------------------------ { @@ -424,11 +369,7 @@ public void handleValueChange(ValueChangeEvent event) { @Override public String getDetailLabel(Object element) { - MWindow window = (MWindow) element; - if (window.getLabel() != null && window.getLabel().trim().length() > 0) { - return window.getLabel(); - } - return null; + return getLocalizedLabel((MUILabel) element); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java new file mode 100644 index 0000000000..112b60e1a3 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java @@ -0,0 +1,160 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.properties; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResourceChangeEvent; +import org.eclipse.core.resources.IResourceChangeListener; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.resources.IResourceDeltaVisitor; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.e4.tools.services.impl.AbstractTranslationProvider; + +public abstract class ProjectOSGiTranslationProvider extends AbstractTranslationProvider { + private IProject project; + private List observedFiles = new ArrayList(); + private IResourceChangeListener listener; + private String basename; + + public ProjectOSGiTranslationProvider(IProject project) { + super(); + this.project = project; + this.listener = new IResourceChangeListener() { + + public void resourceChanged(IResourceChangeEvent event) { + if (event.getType() == IResourceChangeEvent.POST_CHANGE) { + try { + event.getDelta().accept(new IResourceDeltaVisitor() { + + public boolean visit(IResourceDelta delta) throws CoreException { + return ProjectOSGiTranslationProvider.this.visit(delta); + } + }); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + }; + this.project.getWorkspace().addResourceChangeListener(listener); + IFile f = this.project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$ + if (f.exists()) { + handleManifestChange(f); + } else { + basename = "OSGI-INF/l10n/bundle"; //$NON-NLS-1$ + } + } + + boolean visit(IResourceDelta delta) throws CoreException { + if (delta.getResource() instanceof IWorkspaceRoot) { + return true; + } else if (delta.getResource().equals(project)) { + return true; + } else if (delta.getResource().getProjectRelativePath().toString().equals("META-INF")) { //$NON-NLS-1$ + return true; + } else if (delta.getResource().getProjectRelativePath().toString().equals("META-INF/MANIFEST.MF")) { //$NON-NLS-1$ + handleManifestChange((IFile) delta.getResource()); + return false; + } + + for (String o : observedFiles) { + if (delta.getResource().getProjectRelativePath().toString().equals(o)) { + clearCache(); + return false; + } + + String[] p = o.split("/"); //$NON-NLS-1$ + int i = 0; + String path = ""; //$NON-NLS-1$ + do { + path += p[i]; + if (delta.getResource().getProjectRelativePath().toString().equals(path)) { + return true; + } + path += "/"; //$NON-NLS-1$ + } while (++i < p.length); + } + + return false; + } + + private void handleManifestChange(IFile file) { + try { + InputStream in = file.getContents(); + BufferedReader r = new BufferedReader(new InputStreamReader(in)); + String line; + String newValue = "OSGI-INF/l10n/bundle"; //$NON-NLS-1$ + while ((line = r.readLine()) != null) { + if (line.startsWith("Bundle-Localization:")) { //$NON-NLS-1$ + newValue = line.substring("Bundle-Localization:".length()).trim(); //$NON-NLS-1$ + break; + } + } + + r.close(); + + if (!newValue.equals(basename)) { + if (basename != null) { + basename = newValue; + clearCache(); + } else { + basename = newValue; + } + } + + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + protected InputStream getResourceAsStream(String name) { + IFile f = project.getFile(name); + observedFiles.add(name); + try { + if (f.exists()) { + return f.getContents(); + } else { + return null; + } + } catch (CoreException e) { + return null; + } + } + + @Override + protected void clearCache() { + super.clearCache(); + observedFiles.clear(); + } + + @Override + protected String getBasename() { + return basename; + } + + public void dispose() { + + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ResourceBundleEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ResourceBundleEditor.java new file mode 100644 index 0000000000..4c8495ab5b --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ResourceBundleEditor.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.properties; + +public class ResourceBundleEditor { + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ResourceBundleEntry.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ResourceBundleEntry.java new file mode 100644 index 0000000000..63b9f4151f --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ResourceBundleEntry.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.properties; + +import java.util.SortedMap; +import java.util.TreeMap; + +public class ResourceBundleEntry { + public String key; + public SortedMap translations = new TreeMap(); +} From a9d46c3a0de8b0711f23759b095bcf0ccb760acd Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 8 Feb 2011 23:02:06 +0000 Subject: [PATCH 0294/1286] Bug 335767 - [ModelTooling] Add support for NLS --- .../OSGI-INF/resources.properties | 1 + .../icons/full/wizban/extstr_wiz.png | Bin 0 -> 6405 bytes .../e4/tools/emf/ui/internal/Messages.java | 10 + .../tools/emf/ui/internal/Messages.properties | 11 +- .../emf/ui/internal/ResourceProvider.java | 1 + .../emf/ui/internal/common/ModelEditor.java | 12 + .../properties/ExternalizeStringHandler.java | 237 ++++++++++++++++++ .../ProjectOSGiTranslationProvider.java | 29 ++- 8 files changed, 288 insertions(+), 13 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/extstr_wiz.png create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties index bf7fc81021..300c6bab2b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties @@ -91,6 +91,7 @@ IMG_org.eclipse.e4.tools.emf.ui.wizban.import_wiz=/icons/full/wizban/import_wiz. IMG_org.eclipse.e4.tools.emf.ui.wizban.newclass_wiz=/icons/full/wizban/newclass_wiz.png IMG_org.eclipse.e4.tools.emf.ui.wizban.newexp_wiz=/icons/full/wizban/newexp_wiz.png IMG_org.eclipse.e4.tools.emf.ui.wizban.typerefact_wiz=/icons/full/wizban/typerefact_wiz.png +IMG_org.eclipse.e4.tools.emf.ui.wizban.extstr_wiz=/icons/full/wizban/extstr_wiz.png COLOR_org.eclipse.e4.tools.emf.ui.XML_COMMENT=rgb(128, 0, 0) COLOR_org.eclipse.e4.tools.emf.ui.PROC_INSTR=rgb(128, 128, 128) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/extstr_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/extstr_wiz.png new file mode 100644 index 0000000000000000000000000000000000000000..74ff2458416eab9b8c998b51586397e1b99abd0b GIT binary patch literal 6405 zcmV+g8T#glP)002S=1^@s6A3-Z300009a7bBm000XU z000XU0RWnu7ytkYO=&|zP*7-ZbZ>KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-ePrx>>xFPTiH1=E+A$W$=bG8>s^ zm=Bn5Rah$aDtr}@$`X}2l~$F0mFKEdRdZE8)p@E5RI61Ft6o-prbbn>P~)iy)E2AN zsU20jsWz_8Qg>31P|s0cqrPALg8E|(vWA65poU1JRAaZs8I2(p#xiB`SVGovRs-uS zYnV-9TeA7=Om+qP8+I>yOjAR1s%ETak!GFdam@h^# z)@rS0t$wXH+Irf)+G6c;?H29p+V6F6oj{!|o%K3xI`?%6x;DB|x`n#ibhIR?(H}Q3Gzd138Ei2)WAMz7W9Vy`X}HnwgyEn!VS)>mv$8&{hQn>w4zwy3R}t;BYlZQm5)6pty=DfLrs+A-|>>;~;Q z_F?uV_HFjh9n2gO9o9Q^JA86v({H5aB!kjoO6 zc9$1ZZKsN-Zl8L~mE{`ly3)1N^`o1+o7}D0ZPeY&J;i;i`%NyJ8_8Y6J?}yE@b_5a zam?eLr<8@mESk|3$_SkmS{wQ>%qC18))9_|&j{ZT zes8AvOzF(F2#DZEY>2oYX&IRp`F#{ADl)1r>QS^)ba8a|EY_^#S^HO&t^Rgqwv=MZThqqEWH8 zxJo>d=ABlR_Bh=;eM9Tw|Ih34~oTE|= zX_mAr*D$vzw@+p(E0Yc6dFE}(8oqt`+R{gE3x4zjX+Sb3_cYE^= zgB=w+-tUy`ytONMS8KgRef4hA?t0j zufM;t32jm~jUGrkaOInTZ`zyfns>EuS}G30LFK_G-==(f<51|K&cocp&EJ`SxAh3? zNO>#LI=^+SEu(FqJ)ynt=!~PC9bO$rzPJB=?=j6w@a-(u02P7 zaQ)#(uUl{HW%tYNS3ItC^iAtK(eKlL`f9+{bJzISE?u8_z3;~C8@FyI-5j_jy7l;W z_U#vU3hqqYU3!mrul&B+{ptt$59)uk{;_4iZQ%G|z+lhASr6|H35TBkl>gI*;nGLU zN7W-nBaM%pA0HbH8olyl&XeJ%vZoWz%6?Y=dFykl=imL}`%BMQ{Mhgd`HRoLu6e2R za__6DuR6yg#~-}Tc|Gx_{H@O0eebyMy5GmWADJlpK>kqk(fVV@r_fLLKIeS?{4e)} z^ZO;zpECde00d`2O+f$vv5tKEQIh}w03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(` z>RI+y?e7jKeZ#YO-C4kAfJK~#9!?3;UVT-ANYKfiPD-KVsA*~Val2_zWvC?YXT zoIrzdA4!3f&NNLrZ2(V7|42J64V~#fOkFojr_-d9%w&dUGLwXM3T-ASB$*D=7J{Kb z-4JLgp~l!eELoPVm$lMrrQLh)Ilum~5ACjGkgSzlMD8Ejd-gu|oR5CL-}(K%=U(Aw z+oIcF{o@Hwm6WP>snQ9g{hwiJ0u%sgRdUX0R+V()@%KEeuY7OVQzh$^lyjO^r&*^Y z7CZMn3+ro-o=iJOMpY9E9;%(FCg1Lw_Y|zJ|L~M?N>WujRq;eXl?asmli;yujSf0*WN^}W{_IP>pM-ggvk8Rn$Mpfu^W9AQy#@ncYGDt z|9r4_+9^G%XP){6d}E~7wJAoe3M{9}T-UXAC{iUN4Pd0YBT_|FJGV+pWFE92&~*i+ zC+5A5D1&;HIa?}ig+f*^utjP$A^=;~OtX~#_>tM$Q(NClKsL5Ls??dJV6 zw@o5LYR9bvI!k%@&^2AVf%tzbo6Z^ zw`DtS^l&a$dgWWa(V^S|_wb}wL{>fiwg;ATi-Kr&J85w{X>vPhaLZa-Q@yy_hEQuy0@ z0X!oaW16MkcZD0a#qC;yK7#dg*ooKC;wV8nO(r^xnH#-#%+u5)&$k)KU`0^1h+}y)e+b>%3{qFnn zL;U{UPomC2c?K^o<1|J+k03~pjLW2F26lG%|F(0w>la@*J2n+KvDLsi4Xnd=s;Dj~ z#G7Gl*s$fU4SicV{MwKEckSD@`%J)g?c3H5bT@o;?BM=^W1)46z~v zvE+etb!HGCj3PRw-ykqP&UiS_r=VTT${Zcx7!#%Ax6#FtVX5L-M_{cctR>;x+rwED zRw|L<<9qJJi1Z&i{GSIJf$iG2tsA%pxU;8c)k@+)?AU;A^r=*{H_j3p3@heJde9Y1yP z^DjNmA3Xfae17-+TzAQy=9J;AVF?{N!_4k4;k*>txjD8>nVw2Ao6b<2Ize!T z>#ZYE0pya-wWpk}z(PnHpYfR~ZrQUJh5r9NeDJ?}`?g$s!=5|X(9?$vXE`!(jJdgK zJaPEqNCbxSdV2Vk-JhU;#}MCm{5}RIUgJ~Oe|~;;6L{sd!DV%7sxXTP*bO@n5j-H< zk;U^2#t6RWkw^rLP1q(_3KCmQ$4*nuVO*Qb9v{FHp~Lfd>a8Pe-E=;m*t3^RN8iOC zxa#L|#_;;FHyIfj!V`xPhi4p~D4saR^QU>^xNzx~t^Dq%@8ZEn9%55&3%hsRjsVwP za~UuE&rycQe!8GomWG{18@&0W*DR9Q8Zwy-s){;?XAHyD%0a=4tY)m$q*GX}+R(2} z+<_QUp5f&;4xzw@ue+6z!W6F@eVNi+0UL!Bi<6W~GeC@I9KLa+lL1{FS)w@P{JuVZ z`&U2B*B|~O7k0m&%PzQ@>-x8IegF1F3g(4{_JYEC!7(9|Nn>peP%I)*tXbm4s(Vdme}1I?UG69B&K{Fjo#K%*-%3c?!=sjGe*7MH0S8*+tkWNf^#CRhXn4 z&H~D(oS1pb0_qRC=fAU0c5GgLwFeV=S5gL4+E;wxtiTdM_2v8p7D zA?16-&M|yy5Tgzkm6#J)t1rERl9}Z3 zm%qm?JAbpmLgq8|#d5O6>cz#5B@ziT>2$q-UsG5BmWpMie2>UVW#A~6TzC;T-}nnW z{q)1Uc_hpO*B;zIaIEnr`@i_P1NoeP(~Bpb#M+odkl=$?_Vbh1pJdOKzeXmLs$0nL z$OI=&jW?wit$J5eyZYxNAH2K{(Re~KnPiPw&AXvfB`}q^Wg5QAPoAdKo#)1zK8wM1 zzkcK=kG3YRU7b1Z`uLynogY8IV~78aY&wHl$C0r^luKo@*>oMuqyO?Bj7>~((FGfq z+{u6V;lFe6(J$4319+Z?({p550CVL6#n~xJv85C{=3+}Jwmkjfb6mFLYHqygHweV_ zzxvvXO^It{m1Hu(9Ur@gqvJ0zUO3L?-c8I#GvIWAwS4Bb8<&;QKlj3`^=s=2fHA~t zY+0uECtoDL%CGV_dPlzaKbI&F%?n z5)Hy9uf2n*e4cU?HU;YXjMm1^NA4V0*6Han9)I?`6p95R>j<3^Sx01**g0Zb$!(4u z8D{Y43vAo65zhG3e^8*AtdQ^3zjn$Zl@XshSrv+Ofsw0@md8#NNs2 ziHn!CI03x%#t1P#l|Zdq7@q@J2lo#= zxS~$mW?A`bpM8|$LxWt{bt!(}H67b}ejk7NH;=R~VV$Az&N|vT3-BwJm8;gXxoa!E z=}p8@OeULdN-BT-mK*rgEjKi)6D|4Iaa!D3jBQ-_ZqFhs;y2ZHE!z8HqTm9N@N9lp z2|81@53R&ftx7S@RYq88D>aEmomS7Qh<=T5Tmz&y78_ZO$`Mgvj#ArT4UCj>`@iys za;7D))>3CBZnr?QLV{G_dbGtNv_T$L8unX{yXLl2Y-EWd(MS<3M;f)w4UdnO(@r%T z#=6k8s{3F4<_~z{*_Y_*%q;o7ue>(Ep&vc41j`aX5Z9|xgHiRFI+SYV+W?AIfE5dL zRtY0Z=u|X>a4yvHOo?(^U=59x166WOt2>J+1p@c~@oz0FW550GzgU`OIeZV>qt$CB&4S%1p_6C-bxB z#MqRK73Q?Ol*(yYutp}sgeo12XYh;9gi>8JU2cG1nq^6#&UH5}S=1~`#fgYj2vsO4 zrsy!IL+cOEgl1@D$_!5xb=JD2EA~rqnB4r9tH-e{=)&|K^dj?b8(iD~k&t;G4&%HZn(z2X1pJJqhpsPQwxZ#ZU`PdCW&-1%uqGG`oj*7en!)jcIaw@A*{x90c}G~Mr=vij zqsg8qG4!rXSAUss*3NKj1kE= zb=aCD($G;`mrJUHsDCz|2hO>=l+rlB)^pcX&nnEuMwPBwL{O#oY_oj<@r|U{ST0|^ z)tvx zs#%q+6RTRxvbq7U9iT)Ie;rv>6Rc8b(?GJ~dMkgmW4&2b9ab1QBS?2UENZ=4)x2d1 zJqmqDdscgVPm-(shSoWO6u@u```Y entries = new ArrayList(); + TreeIterator it = EcoreUtil.getAllContents(list); + + List ids = new ArrayList(); + + while (it.hasNext()) { + EObject o = it.next(); + if (o instanceof MUILabel) { + MUILabel l = (MUILabel) o; + if (l.getLabel() != null && l.getLabel().startsWith("%")) { //$NON-NLS-1$ + ids.add(l.getLabel()); + } + + if (l.getTooltip() != null && l.getTooltip().startsWith("%")) { //$NON-NLS-1$ + ids.add(l.getTooltip()); + } + } + } + + try { + IFile file = project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$ + String base = ProjectOSGiTranslationProvider.extractBasenameFromManifest(file); + IFile f = project.getFile(base + ".properties"); //$NON-NLS-1$ + if (f.exists()) { + Properties prop = new Properties(); + InputStream in = f.getContents(); + prop.load(in); + in.close(); + + for (Object o : prop.keySet()) { + ids.add(o.toString()); + } + } + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + it = EcoreUtil.getAllContents(list); + while (it.hasNext()) { + EObject o = it.next(); + if (o instanceof MUILabel) { + MUILabel l = (MUILabel) o; + if (l.getLabel() != null && l.getLabel().trim().length() != 0 && !l.getLabel().startsWith("%")) { //$NON-NLS-1$ + String id = findId(ids, o.eClass().getName().toLowerCase() + ".label"); //$NON-NLS-1$ + entries.add(new Entry(o, UiPackageImpl.Literals.UI_LABEL__LABEL, id, l.getLabel())); + ids.add(id); + } + + if (l.getTooltip() != null && l.getTooltip().trim().length() != 0 && !l.getTooltip().startsWith("%")) { //$NON-NLS-1$ + String id = findId(ids, o.eClass().getName().toLowerCase() + ".tooltip"); //$NON-NLS-1$ + entries.add(new Entry(o, UiPackageImpl.Literals.UI_LABEL__TOOLTIP, id, l.getTooltip())); + ids.add(id); + } + } + } + viewer.setContentProvider(new ArrayContentProvider()); + viewer.setInput(entries); + viewer.setAllChecked(true); + + for (int i = 1; i < viewer.getTable().getColumnCount(); i++) { + TableColumn c = viewer.getTable().getColumn(i); + c.pack(); + if (c.getWidth() < 120) { + c.setWidth(120); + } + } + + return container; + } + + @Override + protected void okPressed() { + super.okPressed(); + } + } + + private static String findId(List ids, String prefix) { + int count = 1; + String id = prefix + "." + count; //$NON-NLS-1$ + while (ids.contains(prefix)) { + id = prefix + "." + ++count; //$NON-NLS-1$ + } + return id; + } + + static class Entry { + private EObject object; + private EStructuralFeature feature; + private String key; + private String value; + + public Entry(EObject object, EStructuralFeature feature, String key, String value) { + this.object = object; + this.feature = feature; + this.key = key; + this.value = value; + } + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java index 112b60e1a3..436711cd26 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java @@ -97,18 +97,7 @@ boolean visit(IResourceDelta delta) throws CoreException { private void handleManifestChange(IFile file) { try { - InputStream in = file.getContents(); - BufferedReader r = new BufferedReader(new InputStreamReader(in)); - String line; - String newValue = "OSGI-INF/l10n/bundle"; //$NON-NLS-1$ - while ((line = r.readLine()) != null) { - if (line.startsWith("Bundle-Localization:")) { //$NON-NLS-1$ - newValue = line.substring("Bundle-Localization:".length()).trim(); //$NON-NLS-1$ - break; - } - } - - r.close(); + String newValue = extractBasenameFromManifest(file); if (!newValue.equals(basename)) { if (basename != null) { @@ -128,6 +117,22 @@ private void handleManifestChange(IFile file) { } } + public static String extractBasenameFromManifest(IFile file) throws CoreException, IOException { + InputStream in = file.getContents(); + BufferedReader r = new BufferedReader(new InputStreamReader(in)); + String line; + String newValue = "OSGI-INF/l10n/bundle"; //$NON-NLS-1$ + while ((line = r.readLine()) != null) { + if (line.startsWith("Bundle-Localization:")) { //$NON-NLS-1$ + newValue = line.substring("Bundle-Localization:".length()).trim(); //$NON-NLS-1$ + break; + } + } + + r.close(); + return newValue; + } + @Override protected InputStream getResourceAsStream(String name) { IFile f = project.getFile(name); From 6fea43f5abfe126d8168f64954119353d4e5ccd2 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 9 Feb 2011 21:45:25 +0000 Subject: [PATCH 0295/1286] Bug 335767 - [ModelTooling] Add support for NLS --- .../properties/ExternalizeStringHandler.java | 102 +++++++++++++----- 1 file changed, 77 insertions(+), 25 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java index 8a217492d6..e7a699538c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java @@ -1,5 +1,6 @@ package org.eclipse.e4.tools.emf.ui.internal.common.properties; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; @@ -10,6 +11,7 @@ import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.Messages; @@ -19,10 +21,12 @@ import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.services.IServiceConstants; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.jface.dialogs.TitleAreaDialog; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.CheckboxTableViewer; @@ -40,7 +44,7 @@ public class ExternalizeStringHandler { @Execute public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, @Translation Messages messages, IModelResource resource, IResourcePool pool, IProject project) { - TitleAreaDialog dialog = new ExtractionDialog(shell, messages, resource.getRoot(), pool, project); + TitleAreaDialog dialog = new ExtractionDialog(shell, messages, resource, resource.getRoot(), pool, project); dialog.open(); } @@ -49,13 +53,16 @@ static class ExtractionDialog extends TitleAreaDialog { private IObservableList list; private IResourcePool pool; private IProject project; + private CheckboxTableViewer viewer; + private IModelResource resource; - public ExtractionDialog(Shell parentShell, Messages messages, IObservableList list, IResourcePool pool, IProject project) { + public ExtractionDialog(Shell parentShell, Messages messages, IModelResource resource, IObservableList list, IResourcePool pool, IProject project) { super(parentShell); this.messages = messages; this.list = list; this.pool = pool; this.project = project; + this.resource = resource; } @Override @@ -71,7 +78,8 @@ protected Control createDialogArea(Composite parent) { t.setHeaderVisible(true); t.setLinesVisible(true); - CheckboxTableViewer viewer = new CheckboxTableViewer(t); + viewer = new CheckboxTableViewer(t); + { TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.setLabelProvider(new ColumnLabelProvider() { @@ -151,26 +159,9 @@ public String getText(Object element) { } } - try { - IFile file = project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$ - String base = ProjectOSGiTranslationProvider.extractBasenameFromManifest(file); - IFile f = project.getFile(base + ".properties"); //$NON-NLS-1$ - if (f.exists()) { - Properties prop = new Properties(); - InputStream in = f.getContents(); - prop.load(in); - in.close(); - - for (Object o : prop.keySet()) { - ids.add(o.toString()); - } - } - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + Properties properties = getBaseProperties(); + for (Object o : properties.keySet()) { + ids.add(o.toString()); } it = EcoreUtil.getAllContents(list); @@ -208,14 +199,75 @@ public String getText(Object element) { @Override protected void okPressed() { - super.okPressed(); + Object[] els = viewer.getCheckedElements(); + if (els.length > 0) { + try { + IFile f = getBasePropertyFile(); + if (f.exists()) { + StringBuilder b = new StringBuilder(System.getProperty("line.separator")); + for (Object o : els) { + Entry e = (Entry) o; + b.append(e.key + " = " + e.value + System.getProperty("line.separator")); //$NON-NLS-1$//$NON-NLS-2$ + } + + System.err.println("Appending: " + b); + + ByteArrayInputStream stream = new ByteArrayInputStream(b.toString().getBytes()); + f.appendContents(stream, IFile.KEEP_HISTORY, new NullProgressMonitor()); + + for (Object o : els) { + Entry e = (Entry) o; + Command cmd = SetCommand.create(resource.getEditingDomain(), e.object, e.feature, "%" + e.key); + + if (cmd.canExecute()) { + resource.getEditingDomain().getCommandStack().execute(cmd); + } + } + } + super.okPressed(); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + } + + private IFile getBasePropertyFile() throws CoreException, IOException { + IFile file = project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$ + String base = ProjectOSGiTranslationProvider.extractBasenameFromManifest(file); + return project.getFile(base + ".properties"); //$NON-NLS-1$ + } + + private Properties getBaseProperties() { + Properties prop = new Properties(); + try { + IFile f = getBasePropertyFile(); + if (f.exists()) { + + InputStream in = f.getContents(); + prop.load(in); + in.close(); + } + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return prop; } } private static String findId(List ids, String prefix) { int count = 1; String id = prefix + "." + count; //$NON-NLS-1$ - while (ids.contains(prefix)) { + while (ids.contains(id)) { id = prefix + "." + ++count; //$NON-NLS-1$ } return id; From 4ba96cd1a70be319f0134c19ed0ce27bcc4186f8 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 14 Feb 2011 19:59:19 +0000 Subject: [PATCH 0296/1286] Bug 321019 - [ModelTooling] Copy&Paste does not work in DetailArea * some refactoring to make focus control accessible --- .../component/AbstractComponentEditor.java | 14 +++++++- .../emf/ui/internal/common/ModelEditor.java | 34 +++++++++++++++++-- .../common/component/AddonsEditor.java | 2 +- .../common/component/ApplicationEditor.java | 2 +- .../internal/common/component/AreaEditor.java | 2 +- .../component/BindingContextEditor.java | 2 +- .../common/component/BindingTableEditor.java | 2 +- .../common/component/CategoryEditor.java | 2 +- .../common/component/CommandEditor.java | 2 +- .../component/CommandParameterEditor.java | 2 +- .../common/component/ControlFactory.java | 10 +++++- .../component/CoreExpressionEditor.java | 2 +- .../common/component/HandlerEditor.java | 2 +- .../common/component/KeyBindingEditor.java | 2 +- .../component/MenuContributionEditor.java | 2 +- .../internal/common/component/MenuEditor.java | 2 +- .../common/component/MenuItemEditor.java | 2 +- .../common/component/MenuSeparatorEditor.java | 2 +- .../component/ModelFragmentsEditor.java | 2 +- .../common/component/ParameterEditor.java | 2 +- .../component/PartDescriptorEditor.java | 2 +- .../internal/common/component/PartEditor.java | 2 +- .../component/PartSashContainerEditor.java | 2 +- .../common/component/PartStackEditor.java | 2 +- .../common/component/PerspectiveEditor.java | 2 +- .../component/PerspectiveStackEditor.java | 2 +- .../common/component/PlaceholderEditor.java | 2 +- .../common/component/StringModelFragment.java | 2 +- .../component/ToolBarContributionEditor.java | 2 +- .../common/component/ToolBarEditor.java | 2 +- .../component/ToolBarSeparatorEditor.java | 2 +- .../common/component/ToolControlEditor.java | 2 +- .../common/component/ToolItemEditor.java | 2 +- .../common/component/TrimBarEditor.java | 2 +- .../component/TrimContributionEditor.java | 2 +- .../common/component/WindowEditor.java | 2 +- .../component/virtual/VApplicationAddons.java | 2 +- .../virtual/VApplicationCategoriesEditor.java | 2 +- .../virtual/VBindingTableEditor.java | 2 +- .../component/virtual/VCommandEditor.java | 2 +- .../component/virtual/VHandlerEditor.java | 2 +- .../virtual/VItemParametersEditor.java | 2 +- .../virtual/VMenuContributionsEditor.java | 2 +- .../common/component/virtual/VMenuEditor.java | 2 +- .../virtual/VModelFragmentsEditor.java | 2 +- .../virtual/VModelImportsEditor.java | 2 +- .../component/virtual/VPartDescriptor.java | 2 +- .../virtual/VRootBindingContexts.java | 2 +- .../virtual/VToolBarContributionsEditor.java | 2 +- .../virtual/VTrimContributionsEditor.java | 2 +- .../virtual/VWindowControlEditor.java | 2 +- .../component/virtual/VWindowEditor.java | 2 +- .../virtual/VWindowSharedElementsEditor.java | 2 +- .../component/virtual/VWindowTrimEditor.java | 2 +- 54 files changed, 104 insertions(+), 56 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index 1432201fd1..41e6a3995e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -103,7 +103,7 @@ public ImageDescriptor createImageDescriptor(String key) { public abstract String getDescription(Object element); - public abstract Composite getEditor(Composite parent, Object object); + public abstract Composite doGetEditor(Composite parent, Object object); public abstract IObservableList getChildList(Object element); @@ -118,4 +118,16 @@ public List getActions(Object element) { protected String getLocalizedLabel(MUILabel element) { return ControlFactory.getLocalizedLabel(translationProvider, element, locale); } + + public void handleCopy() { + + } + + public void handlePaste() { + + } + + public void handleCut() { + + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index d5212285f3..e88e0546ca 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -268,6 +268,8 @@ public class ModelEditor { private EMFDocumentResourceMediator emfDocumentProvider; + private AbstractComponentEditor currentEditor; + public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project, final IResourcePool resourcePool) { this.resourcePool = resourcePool; this.modelProvider = modelProvider; @@ -441,12 +443,13 @@ public void selectionChanged(SelectionChangedEvent event) { EObject obj = (EObject) s.getFirstElement(); final AbstractComponentEditor editor = getEditor(obj.eClass()); if (editor != null) { + currentEditor = editor; textLabel.setText(editor.getLabel(obj)); iconLabel.setImage(editor.getImage(obj, iconLabel.getDisplay())); obsManager.runAndCollect(new Runnable() { public void run() { - Composite comp = editor.getEditor(contentContainer, s.getFirstElement()); + Composite comp = editor.doGetEditor(contentContainer, s.getFirstElement()); comp.setBackgroundMode(SWT.INHERIT_DEFAULT); layout.topControl = comp; contentContainer.layout(true); @@ -457,12 +460,13 @@ public void run() { VirtualEntry entry = (VirtualEntry) s.getFirstElement(); final AbstractComponentEditor editor = virtualEditors.get(entry.getId()); if (editor != null) { + currentEditor = editor; textLabel.setText(editor.getLabel(entry)); iconLabel.setImage(editor.getImage(entry, iconLabel.getDisplay())); obsManager.runAndCollect(new Runnable() { public void run() { - Composite comp = editor.getEditor(contentContainer, s.getFirstElement()); + Composite comp = editor.doGetEditor(contentContainer, s.getFirstElement()); comp.setBackgroundMode(SWT.INHERIT_DEFAULT); layout.topControl = comp; contentContainer.layout(true); @@ -907,8 +911,16 @@ public IModelResource getModelProvider() { class ClipboardHandler implements Handler { - @SuppressWarnings("unchecked") public void paste() { + if (viewer.getControl().getDisplay().getFocusControl() == viewer.getControl()) { + handleStructurePaste(); + } else if (currentEditor != null) { + currentEditor.handlePaste(); + } + } + + @SuppressWarnings("unchecked") + private void handleStructurePaste() { Clipboard clip = new Clipboard(viewer.getControl().getDisplay()); Object o = clip.getContents(MemoryTransfer.getInstance()); clip.dispose(); @@ -965,6 +977,14 @@ public void paste() { } public void copy() { + if (viewer.getControl().getDisplay().getFocusControl() == viewer.getControl()) { + handleStructureCopy(); + } else if (currentEditor != null) { + currentEditor.handleCopy(); + } + } + + private void handleStructureCopy() { Object o = ((IStructuredSelection) viewer.getSelection()).getFirstElement(); if (o != null && o instanceof EObject) { Clipboard clip = new Clipboard(viewer.getControl().getDisplay()); @@ -974,6 +994,14 @@ public void copy() { } public void cut() { + if (viewer.getControl().getDisplay().getFocusControl() == viewer.getControl()) { + handleStructureCut(); + } else if (currentEditor != null) { + currentEditor.handleCut(); + } + } + + private void handleStructureCut() { Object o = ((IStructuredSelection) viewer.getSelection()).getFirstElement(); if (o != null && o instanceof EObject) { Clipboard clip = new Clipboard(viewer.getControl().getDisplay()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index 6a88ffcdac..21ff5edbdd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -85,7 +85,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 7f73e005fc..fca8f63e9b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -85,7 +85,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java index 43dde29643..60054fcbbf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java @@ -121,7 +121,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java index 86b346b413..cf1434ab99 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java @@ -105,7 +105,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index c389c96153..45cf8492b8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -99,7 +99,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java index b6e35c248e..c561544156 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java @@ -63,7 +63,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index a49e84e3bf..4a7022565f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -96,7 +96,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java index 351ed51b7d..7bf53d2c84 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java @@ -74,7 +74,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index fc15824a33..cc23a52bb8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -19,6 +19,7 @@ import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; +import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -81,6 +82,8 @@ import org.eclipse.swt.widgets.Text; public class ControlFactory { + public static final String COPY_WRITABLE = ControlFactory.class.getName() + ".COPY_WRITABLE"; //$NON-NLS-1$ + public static void createXMIId(Composite parent, AbstractComponentEditor editor) { Label l = new Label(parent, SWT.NONE); l.setText("XMI:ID"); //$NON-NLS-1$ @@ -272,7 +275,12 @@ public static void createTextField(Composite parent, String label, IObservableVa GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), modelProp.observeDetail(master)); + + IObservableValue modelObs = modelProp.observeDetail(master); + WritableValue copyWritable = new WritableValue("", String.class);//$NON-NLS-1$ + context.bindValue(copyWritable, modelObs); + t.setData(COPY_WRITABLE, copyWritable); + context.bindValue(textProp.observeDelayed(200, t), modelObs); } public static void createTranslatedTextField(Composite parent, String label, IObservableValue master, EMFDataBindingContext context, IWidgetValueProperty textProp, IEMFEditValueProperty modelProp, IResourcePool resourcePool, IProject project) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java index 7834e8d631..5791ac9101 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java @@ -68,7 +68,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = new Composite(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 6130636cce..6983528939 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -84,7 +84,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 1b31435d51..ad83a92b81 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -108,7 +108,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index b0eea46bde..5eb7d82715 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -112,7 +112,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 98182644a7..88d0a53d73 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -161,7 +161,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = new Composite(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index d1698a348c..e445857947 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -89,7 +89,7 @@ public Image getImage(Object element, Display display) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index 0ac8e5e11c..1b8a9a0d9c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -65,7 +65,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java index 2ee762c4ec..4d243152fb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java @@ -86,7 +86,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { composite = createForm(parent); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java index 22e06e5183..7595fe5c59 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java @@ -70,7 +70,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index ac6200f940..8335a6ecf8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -93,7 +93,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index c730592713..bfa1a088cd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -111,7 +111,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 29912ff150..ddbd2d9921 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -154,7 +154,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 9830102cea..ceee54eb4d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -123,7 +123,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index ef4351da87..025561f5be 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -161,7 +161,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 164d4c93d8..0f69f83f41 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -110,7 +110,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index e1051d681b..d2e024d67e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -106,7 +106,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index f4d76d53cc..e7701f0f78 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -92,7 +92,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index cd929bf9d1..bdc7d9432f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -113,7 +113,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index da90978bef..41f3ea009b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -141,7 +141,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index cc8876bc20..d0876f29e7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -76,7 +76,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index 993a36a269..f34edd8092 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -88,7 +88,7 @@ public String getDetailLabel(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index e80b357a93..12c097df92 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -72,7 +72,7 @@ public ToolItemEditor() { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index 2fc3431d87..b765b894da 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -124,7 +124,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index 42fa30f6a2..2bde1c7a67 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -100,7 +100,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 17dbc2f497..afd72eb246 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -123,7 +123,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); if (getEditor().isModelFragment()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java index a384584a6f..ee3ba01ebc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java @@ -88,7 +88,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java index 205c652dcb..0b8524dade 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java @@ -88,7 +88,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index a289242700..6e48adf6ca 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -87,7 +87,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index 31bf81e474..77a7003a47 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -91,7 +91,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index 883bc1a075..5a5d7deff5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -87,7 +87,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java index 67b2b39f51..d412d3df28 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java @@ -91,7 +91,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java index 3c39157ab4..ef39aec75e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java @@ -88,7 +88,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java index 4ee60e3a1f..b1d755a4be 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -89,7 +89,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java index 59be50e2ad..b81404add4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java @@ -73,7 +73,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java index 3e9a08a157..f7d052f0a2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java @@ -84,7 +84,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java index 69a754b810..c79019d817 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java @@ -87,7 +87,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java index 7fdb2bf488..459644ec10 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java @@ -88,7 +88,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java index 206999f4d0..4f7dcaf82c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java @@ -87,7 +87,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java index 9978ad2b65..8565227248 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java @@ -87,7 +87,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index 4b749c5099..981869255c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -129,7 +129,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index 464e066521..5e9b5d8750 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -99,7 +99,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java index 18649ac4fa..52969346d4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java @@ -107,7 +107,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java index 9bc4b8bb57..491c87e837 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -84,7 +84,7 @@ public String getDescription(Object element) { } @Override - public Composite getEditor(Composite parent, Object object) { + public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); From bba998e0641e0600ec8aa2f52ba13199dd316feb Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 14 Feb 2011 21:20:54 +0000 Subject: [PATCH 0297/1286] Bug 321019 - [ModelTooling] Copy&Paste does not work in DetailArea * handling pastes --- .../component/AbstractComponentEditor.java | 36 ++++++++- .../emf/ui/internal/common/ModelEditor.java | 4 +- .../common/component/AddonsEditor.java | 14 +--- .../common/component/ApplicationEditor.java | 16 +--- .../internal/common/component/AreaEditor.java | 30 +------ .../common/component/BindingTableEditor.java | 2 + .../common/component/CommandEditor.java | 29 ++----- .../common/component/ControlFactory.java | 79 +++++++++++++++---- .../component/CoreExpressionEditor.java | 2 + .../component/DirectMenuItemEditor.java | 2 + .../component/DirectToolItemEditor.java | 2 + .../component/HandledMenuItemEditor.java | 2 + .../component/HandledToolItemEditor.java | 2 + .../common/component/HandlerEditor.java | 16 +--- .../common/component/InputPartEditor.java | 17 +--- .../common/component/KeyBindingEditor.java | 16 +--- .../component/MenuContributionEditor.java | 43 +--------- .../internal/common/component/MenuEditor.java | 49 ++---------- .../common/component/MenuItemEditor.java | 58 ++------------ .../common/component/MenuSeparatorEditor.java | 22 +----- .../component/PartDescriptorEditor.java | 43 ++-------- .../internal/common/component/PartEditor.java | 3 + .../component/PartSashContainerEditor.java | 29 +------ .../common/component/PartStackEditor.java | 30 +------ .../common/component/PerspectiveEditor.java | 45 ++--------- .../component/PerspectiveStackEditor.java | 16 +--- .../common/component/PlaceholderEditor.java | 16 +--- .../common/component/RenderedMenuEditor.java | 1 - .../common/component/RenderedMenuItem.java | 1 - .../component/RenderedToolBarEditor.java | 1 - .../common/component/StringModelFragment.java | 15 +--- .../component/ToolBarContributionEditor.java | 43 +--------- .../common/component/ToolBarEditor.java | 15 +--- .../component/ToolBarSeparatorEditor.java | 20 +---- .../common/component/ToolControlEditor.java | 16 +--- .../common/component/ToolItemEditor.java | 30 +------ .../common/component/TrimBarEditor.java | 15 +--- .../component/TrimContributionEditor.java | 43 +--------- .../common/component/TrimmedWindowEditor.java | 1 - 39 files changed, 198 insertions(+), 626 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index 41e6a3995e..3234f2753d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -23,6 +23,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory; import org.eclipse.e4.tools.emf.ui.internal.common.properties.ProjectOSGiTranslationProvider; +import org.eclipse.e4.tools.services.IClipboardService.Handler; import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.tools.services.Translation; import org.eclipse.e4.ui.model.application.MApplicationElement; @@ -34,6 +35,7 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; public abstract class AbstractComponentEditor { @@ -66,6 +68,8 @@ public abstract class AbstractComponentEditor { @Named(TranslationService.LOCALE) private String locale; + private Composite editorControl; + public EditingDomain getEditingDomain() { return editingDomain; } @@ -103,7 +107,11 @@ public ImageDescriptor createImageDescriptor(String key) { public abstract String getDescription(Object element); - public abstract Composite doGetEditor(Composite parent, Object object); + public Composite getEditor(Composite parent, Object object) { + return editorControl = doGetEditor(parent, object); + } + + protected abstract Composite doGetEditor(Composite parent, Object object); public abstract IObservableList getChildList(Object element); @@ -119,15 +127,41 @@ protected String getLocalizedLabel(MUILabel element) { return ControlFactory.getLocalizedLabel(translationProvider, element, locale); } + private boolean isFocusChild(Control control) { + Control c = control; + while (c != null && c != editorControl) { + c = c.getParent(); + } + return c != null; + } + public void handleCopy() { + if (editorControl != null) { + Control focusControl = editorControl.getDisplay().getFocusControl(); + if (isFocusChild(focusControl) && focusControl.getData(ControlFactory.COPY_HANDLER) != null) { + ((Handler) focusControl.getData(ControlFactory.COPY_HANDLER)).copy(); + } + } } public void handlePaste() { + if (editorControl != null) { + Control focusControl = editorControl.getDisplay().getFocusControl(); + if (isFocusChild(focusControl) && focusControl.getData(ControlFactory.COPY_HANDLER) != null) { + ((Handler) focusControl.getData(ControlFactory.COPY_HANDLER)).paste(); + } + } } public void handleCut() { + if (editorControl != null) { + Control focusControl = editorControl.getDisplay().getFocusControl(); + if (isFocusChild(focusControl) && focusControl.getData(ControlFactory.COPY_HANDLER) != null) { + ((Handler) focusControl.getData(ControlFactory.COPY_HANDLER)).cut(); + } + } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index e88e0546ca..4b9b691638 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -449,7 +449,7 @@ public void selectionChanged(SelectionChangedEvent event) { obsManager.runAndCollect(new Runnable() { public void run() { - Composite comp = editor.doGetEditor(contentContainer, s.getFirstElement()); + Composite comp = editor.getEditor(contentContainer, s.getFirstElement()); comp.setBackgroundMode(SWT.INHERIT_DEFAULT); layout.topControl = comp; contentContainer.layout(true); @@ -466,7 +466,7 @@ public void run() { obsManager.runAndCollect(new Runnable() { public void run() { - Composite comp = editor.doGetEditor(contentContainer, s.getFirstElement()); + Composite comp = editor.getEditor(contentContainer, s.getFirstElement()); comp.setBackgroundMode(SWT.INHERIT_DEFAULT); layout.topControl = comp; contentContainer.layout(true); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index 21ff5edbdd..a85b73d9a2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -23,6 +23,7 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -134,17 +135,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, return parent; } - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); // ------------------------------------------------------------ { @@ -166,6 +157,7 @@ public void widgetSelected(SelectionEvent e) { } Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster()), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy()); Util.addDecoration(t, binding); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index fca8f63e9b..47c41be24d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -32,12 +32,9 @@ import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; public class ApplicationEditor extends AbstractComponentEditor { @@ -107,18 +104,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) ControlFactory.createXMIId(parent, this); } - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java index 60054fcbbf..0adaf8b07a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java @@ -23,6 +23,7 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.AreaIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; @@ -170,19 +171,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.AreaEditor_LabelLabel, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL)); ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); ControlFactory.createTextField(parent, Messages.AreaEditor_Tooltip, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP)); @@ -194,6 +183,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); final Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); @@ -246,19 +236,7 @@ public String getText(Object element) { } ControlFactory.createSelectedElement(parent, this, context, Messages.AreaEditor_SelectedElement); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.AreaEditor_ContainerData); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); - } + ControlFactory.createTextField(parent, Messages.AreaEditor_ContainerData, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA)); { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index 45cf8492b8..862cba0a4a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -22,6 +22,7 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BindingContextSelectionDialog; import org.eclipse.e4.ui.model.application.commands.MBindingTable; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; @@ -166,6 +167,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID).observeDetail(getMaster())); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 4a7022565f..d86773c3f9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -21,6 +21,7 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.CommandCategorySelectionDialog; import org.eclipse.e4.ui.model.application.commands.MCommand; import org.eclipse.e4.ui.model.application.commands.MCommandParameter; @@ -146,30 +147,8 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO return parent; } - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.CommandEditor_Name); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME).observeDetail(getMaster())); - } + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); + ControlFactory.createTextField(parent, Messages.CommandEditor_Name, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME)); // ------------------------------------------------------------ { @@ -178,6 +157,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); Text t = new Text(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); + TextPasteHandler.createFor(t); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; gd.heightHint = 100; @@ -192,6 +172,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); GridData gd = new GridData(GridData.FILL_HORIZONTAL); t.setLayoutData(gd); t.setEditable(false); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index cc23a52bb8..b73d1b9e5a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -19,7 +19,6 @@ import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.resources.IProject; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; @@ -27,6 +26,7 @@ import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.e4.tools.emf.ui.internal.common.properties.ProjectOSGiTranslationProvider; +import org.eclipse.e4.tools.services.IClipboardService.Handler; import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.internal.workbench.E4XMIResource; import org.eclipse.e4.ui.model.application.MApplication; @@ -69,6 +69,9 @@ import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.swt.SWT; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.SelectionAdapter; @@ -82,7 +85,49 @@ import org.eclipse.swt.widgets.Text; public class ControlFactory { - public static final String COPY_WRITABLE = ControlFactory.class.getName() + ".COPY_WRITABLE"; //$NON-NLS-1$ + public static final String COPY_HANDLER = ControlFactory.class.getName() + ".COPY_HANDLER"; //$NON-NLS-1$ + + public static class TextPasteHandler implements Handler { + private final Text t; + + public TextPasteHandler(Text t) { + this.t = t; + } + + public static void createFor(Text t) { + t.setData(COPY_HANDLER, new TextPasteHandler(t)); + } + + public void paste() { + Clipboard cp = new Clipboard(t.getDisplay()); + Object o = cp.getContents(TextTransfer.getInstance()); + cp.dispose(); + if (o == null) { + return; + } + + if (validate(o.toString())) { + t.insert(o.toString()); + } + } + + public void cut() { + Clipboard cp = new Clipboard(t.getDisplay()); + cp.setContents(new Object[] { t.getSelectionText() }, new Transfer[] { TextTransfer.getInstance() }); + cp.dispose(); + t.insert(""); //$NON-NLS-1$ + } + + public void copy() { + Clipboard cp = new Clipboard(t.getDisplay()); + cp.setContents(new Object[] { t.getSelectionText() }, new Transfer[] { TextTransfer.getInstance() }); + cp.dispose(); + } + + public boolean validate(String text) { + return true; + } + } public static void createXMIId(Composite parent, AbstractComponentEditor editor) { Label l = new Label(parent, SWT.NONE); @@ -95,6 +140,8 @@ public static void createXMIId(Composite parent, AbstractComponentEditor editor) gd.horizontalSpan = 2; t.setLayoutData(gd); + TextPasteHandler.createFor(t); + editor.getMaster().addValueChangeListener(new IValueChangeListener() { public void handleValueChange(ValueChangeEvent event) { @@ -271,16 +318,13 @@ public static void createTextField(Composite parent, String label, IObservableVa l.setText(label); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - Text t = new Text(parent, SWT.BORDER); + final Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - IObservableValue modelObs = modelProp.observeDetail(master); - WritableValue copyWritable = new WritableValue("", String.class);//$NON-NLS-1$ - context.bindValue(copyWritable, modelObs); - t.setData(COPY_WRITABLE, copyWritable); - context.bindValue(textProp.observeDelayed(200, t), modelObs); + TextPasteHandler.createFor(t); + context.bindValue(textProp.observeDelayed(200, t), modelProp.observeDetail(master)); } public static void createTranslatedTextField(Composite parent, String label, IObservableValue master, EMFDataBindingContext context, IWidgetValueProperty textProp, IEMFEditValueProperty modelProp, IResourcePool resourcePool, IProject project) { @@ -288,19 +332,21 @@ public static void createTranslatedTextField(Composite parent, String label, IOb l.setText(label); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - Text t = new Text(parent, SWT.BORDER); + final Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); if (project == null) { gd.horizontalSpan = 2; } t.setLayoutData(gd); + + TextPasteHandler.createFor(t); context.bindValue(textProp.observeDelayed(200, t), modelProp.observeDetail(master)); - if (project != null) { - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_world_edit)); - } + // if (project != null) { + // Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + // b.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_world_edit)); + // } } public static void createFindImport(Composite parent, final Messages Messages, final AbstractComponentEditor editor, EMFDataBindingContext context) { @@ -310,9 +356,12 @@ public static void createFindImport(Composite parent, final Messages Messages, f l.setText(Messages.ModelTooling_Common_RefId); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - Text t = new Text(parent, SWT.BORDER); + final Text t = new Text(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); t.setLayoutData(gd); + + TextPasteHandler.createFor(t); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(editor.getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(editor.getMaster())); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); @@ -413,6 +462,8 @@ public void keyPressed(KeyEvent e) { } }); + TextPasteHandler.createFor(t); + Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Add); b.setImage(editor.createImage(ResourceProvider.IMG_Obj16_table_add)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java index 5791ac9101..d67a3153e8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java @@ -15,6 +15,7 @@ import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ExpressionIdDialog; import org.eclipse.e4.ui.model.application.ui.MCoreExpression; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -97,6 +98,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); final Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); GridData gd = new GridData(GridData.FILL_HORIZONTAL); t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.CORE_EXPRESSION__CORE_EXPRESSION_ID).observeDetail(getMaster())); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index 411a15775d..886fa2eaba 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -22,6 +22,7 @@ import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -103,6 +104,7 @@ public void widgetSelected(SelectionEvent e) { } Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy()); Util.addDecoration(t, binding); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index f435c895f6..d1cd523839 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -22,6 +22,7 @@ import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -91,6 +92,7 @@ public void widgetSelected(SelectionEvent e) { } Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy()); Util.addDecoration(t, binding); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java index f7e952a3bf..b07c8c69f0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java @@ -22,6 +22,7 @@ import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledMenuItemCommandSelectionDialog; import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -95,6 +96,7 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEditable(false); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND).observeDetail(master), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter(Messages))); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index 2044e0708a..e4895037f3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -22,6 +22,7 @@ import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledToolItemCommandSelectionDialog; import org.eclipse.e4.ui.model.application.commands.MParameter; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -84,6 +85,7 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEditable(false); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND).observeDetail(master), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter(Messages))); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 6983528939..9ec6853c4a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -25,6 +25,7 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandlerCommandSelectionDialog; import org.eclipse.e4.ui.model.application.MContribution; @@ -133,18 +134,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); // ------------------------------------------------------------ { @@ -153,6 +143,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEditable(false); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.HANDLER__COMMAND).observeDetail(getMaster()), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter(Messages))); @@ -190,6 +181,7 @@ public void widgetSelected(SelectionEvent e) { } Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster()), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy()); Util.addDecoration(t, binding); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java index 0ae5765a7b..3810c7bbc8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java @@ -12,17 +12,13 @@ import javax.inject.Inject; import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; public class InputPartEditor extends PartEditor { @@ -40,17 +36,6 @@ public String getLabel(Object element) { protected void createSubformElements(Composite parent, EMFDataBindingContext context, IObservableValue master) { IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.InputPartEditor_InputURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.INPUT__INPUT_URI).observeDetail(master)); - } + ControlFactory.createTextField(parent, Messages.InputPartEditor_InputURI, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.INPUT__INPUT_URI)); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index ad83a92b81..490fda82a6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -28,6 +28,7 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.KeyBindingCommandSelectionDialog; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MKeyBinding; @@ -157,18 +158,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); // ------------------------------------------------------------ { @@ -177,6 +167,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); final Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); @@ -191,6 +182,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); t.setEditable(false); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_BINDING__COMMAND).observeDetail(getMaster()), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter(Messages))); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index 5eb7d82715..11a523c505 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -57,7 +57,6 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; public class MenuContributionEditor extends AbstractComponentEditor { private Composite composite; @@ -161,46 +160,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_ParentId); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__PARENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_Position); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__POSITION_IN_PARENT).observeDetail(getMaster())); - } + ControlFactory.createTextField(parent, Messages.MenuContributionEditor_ParentId, master, context, textProp, EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__PARENT_ID)); + ControlFactory.createTextField(parent, Messages.MenuContributionEditor_Position, master, context, textProp, EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__POSITION_IN_PARENT)); // ------------------------------------------------------------ { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 88d0a53d73..b844c4c7b5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -32,6 +32,7 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor.EClass2EObject; import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor.EObject2EClass; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; @@ -210,46 +211,15 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); // ------------------------------------------------------------ if (!rootMenu) { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuEditor_LabelLabel); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); + ControlFactory.createTranslatedTextField(parent, Messages.MenuEditor_LabelLabel, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project); } ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuEditor_Mnemonics); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_ELEMENT__MNEMONICS).observeDetail(master)); - } + ControlFactory.createTextField(parent, Messages.MenuEditor_Mnemonics, master, context, textProp, EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_ELEMENT__MNEMONICS)); { Label l = new Label(parent, SWT.NONE); @@ -374,15 +344,7 @@ public void widgetSelected(SelectionEvent e) { // ------------------------------------------------------------ if (!rootMenu) { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuEditor_Tooltip); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); + ControlFactory.createTranslatedTextField(parent, Messages.MenuEditor_Tooltip, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool, project); } // ------------------------------------------------------------ @@ -392,6 +354,7 @@ public void widgetSelected(SelectionEvent e) { l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index e445857947..71bd5672d2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -26,6 +26,7 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuItemIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -140,18 +141,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); if (this.getClass() != MenuItemEditor.class) { // ------------------------------------------------------------ @@ -171,46 +161,11 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuItemEditor_Label); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); - } - + ControlFactory.createTranslatedTextField(parent, Messages.MenuItemEditor_Label, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project); ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuItemEditor_Mnemonics); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_ELEMENT__MNEMONICS).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuItemEditor_Tooltip); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); - } + ControlFactory.createTranslatedTextField(parent, Messages.MenuItemEditor_Label, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project); + ControlFactory.createTextField(parent, Messages.MenuItemEditor_Mnemonics, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_ELEMENT__MNEMONICS)); + ControlFactory.createTranslatedTextField(parent, Messages.MenuItemEditor_Tooltip, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool, project); // ------------------------------------------------------------ { @@ -219,6 +174,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index 1b8a9a0d9c..66a86641f3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -26,13 +26,10 @@ import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; public class MenuSeparatorEditor extends AbstractComponentEditor { private Composite composite; @@ -114,23 +111,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - - ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 8335a6ecf8..4161f1bb0d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -26,6 +26,7 @@ import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartDescriptorIconDialogEditor; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; @@ -146,44 +147,9 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_LabelLabel); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_Tooltip); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); - } + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); + ControlFactory.createTranslatedTextField(parent, Messages.PartDescriptorEditor_LabelLabel, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project); + ControlFactory.createTranslatedTextField(parent, Messages.PartDescriptorEditor_Tooltip, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool, project); // ------------------------------------------------------------ { @@ -192,6 +158,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index bfa1a088cd..f2fd78d3f7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -31,6 +31,7 @@ import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartIconDialogEditor; import org.eclipse.e4.ui.model.application.MContribution; @@ -177,6 +178,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); final Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); @@ -226,6 +228,7 @@ public void widgetSelected(SelectionEvent e) { } Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy()); Util.addDecoration(t, binding); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index ddbd2d9921..b22e2e9bb8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -63,7 +63,6 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; public class PartSashContainerEditor extends AbstractComponentEditor { @@ -203,19 +202,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); // ------------------------------------------------------------ @@ -241,19 +228,7 @@ public String getText(Object element) { } ControlFactory.createSelectedElement(parent, this, context, Messages.PartSashContainerEditor_SelectedElement); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartSashContainerEditor_ContainerData); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); - } + ControlFactory.createTextField(parent, Messages.PartSashContainerEditor_ContainerData, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA)); { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index ceee54eb4d..014342c2d9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -61,7 +61,6 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; public class PartStackEditor extends AbstractComponentEditor { @@ -172,35 +171,10 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - ControlFactory.createSelectedElement(parent, this, context, Messages.PartStackEditor_SelectedElement); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartStackEditor_ContainerData); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); - } + ControlFactory.createTextField(parent, Messages.PartStackEditor_ContainerData, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA)); // ------------------------------------------------------------ { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 025561f5be..852c38996b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -25,6 +25,7 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PerspectiveIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; @@ -210,48 +211,11 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - ControlFactory.createSelectedElement(parent, this, context, Messages.PerspectiveEditor_SelectedElement); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PerspectiveEditor_LabelLabel); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PerspectiveEditor_Tooltip); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); - } + ControlFactory.createTranslatedTextField(parent, Messages.PerspectiveEditor_LabelLabel, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project); + ControlFactory.createTranslatedTextField(parent, Messages.PerspectiveEditor_Tooltip, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool, project); // ------------------------------------------------------------ { @@ -260,6 +224,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 0f69f83f41..050891670d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -55,7 +55,6 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; public class PerspectiveStackEditor extends AbstractComponentEditor { private Composite composite; @@ -159,21 +158,8 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - ControlFactory.createSelectedElement(parent, this, context, Messages.PerspectiveStackEditor_SelectedElement); // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index d2e024d67e..57bade472c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -20,6 +20,7 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.SharedElementsDialog; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -155,19 +156,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); // ------------------------------------------------------------ @@ -177,6 +166,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setEditable(false); GridData gd = new GridData(GridData.FILL_HORIZONTAL); t.setLayoutData(gd); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java index baf767ff30..8f9f2ae530 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuEditor.java @@ -11,7 +11,6 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component; import javax.inject.Inject; -import org.eclipse.e4.tools.emf.ui.internal.Messages; public class RenderedMenuEditor extends MenuEditor { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java index fdbed724f0..b0da74aaa7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedMenuItem.java @@ -12,7 +12,6 @@ import javax.inject.Inject; import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.swt.widgets.Composite; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java index 85d96c2378..04aa50ad6b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/RenderedToolBarEditor.java @@ -11,7 +11,6 @@ package org.eclipse.e4.tools.emf.ui.internal.common.component; import javax.inject.Inject; -import org.eclipse.e4.tools.emf.ui.internal.Messages; public class RenderedToolBarEditor extends ToolBarEditor { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index e7701f0f78..247f65ff93 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -20,6 +20,7 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FeatureSelectionDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindParentReferenceElementDialog; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -128,6 +129,7 @@ private Composite createForm(Composite parent) { comp.setLayout(gl); Text t = new Text(comp, SWT.BORDER); + TextPasteHandler.createFor(t); t.setEditable(false); gd = new GridData(GridData.FILL_HORIZONTAL); t.setLayoutData(gd); @@ -160,6 +162,7 @@ public void widgetSelected(SelectionEvent e) { comp.setLayout(gl); Text t = new Text(comp, SWT.BORDER); + TextPasteHandler.createFor(t); gd = new GridData(GridData.FILL_HORIZONTAL); t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__FEATURENAME).observeDetail(getMaster())); @@ -176,17 +179,7 @@ public void widgetSelected(SelectionEvent e) { } - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.StringModelFragment_PositionInList); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__POSITION_IN_LIST).observeDetail(getMaster())); - } + ControlFactory.createTextField(parent, Messages.StringModelFragment_PositionInList, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__POSITION_IN_LIST)); // ------------------------------------------------------------ { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index bdc7d9432f..488cd656b5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -57,7 +57,6 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; public class ToolBarContributionEditor extends AbstractComponentEditor { private Composite composite; @@ -162,46 +161,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_ParentId); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__PARENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_Position); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__POSITION_IN_PARENT).observeDetail(getMaster())); - } + ControlFactory.createTextField(parent, Messages.MenuContributionEditor_ParentId, master, context, textProp, EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__PARENT_ID)); + ControlFactory.createTextField(parent, Messages.MenuContributionEditor_Position, master, context, textProp, EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__POSITION_IN_PARENT)); // ------------------------------------------------------------ { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 41f3ea009b..6ea78a7bf2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -60,7 +60,6 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; public class ToolBarEditor extends AbstractComponentEditor { @@ -190,19 +189,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index d0876f29e7..8f6b6dfc6b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -28,13 +28,10 @@ import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; public class ToolBarSeparatorEditor extends AbstractComponentEditor { private Composite composite; @@ -125,21 +122,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index f34edd8092..ff437a247f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -19,6 +19,7 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -137,19 +138,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); - } - + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); // ------------------------------------------------------------ @@ -159,6 +148,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 12c097df92..7e7266edde 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -26,6 +26,7 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ToolItemIconDialogEditor; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUILabel; @@ -149,33 +150,9 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con context.bindValue(ViewerProperties.singleSelection().observe(viewer), itemTypeObs); } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ToolItemEditor_Label); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); - } - + ControlFactory.createTextField(parent, Messages.ToolItemEditor_Label, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL)); ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ToolItemEditor_ToolTip); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); - } + ControlFactory.createTextField(parent, Messages.ToolItemEditor_ToolTip, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP)); // ------------------------------------------------------------ { @@ -184,6 +161,7 @@ protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext con l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Text t = new Text(parent, SWT.BORDER); + TextPasteHandler.createFor(t); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index b765b894da..2109295acf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -64,7 +64,6 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; public class TrimBarEditor extends AbstractComponentEditor { @@ -173,19 +172,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); // ------------------------------------------------------------ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index 2bde1c7a67..4e796d85fd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -56,7 +56,6 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; public class TrimContributionEditor extends AbstractComponentEditor { private Composite composite; @@ -149,46 +148,10 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr return parent; } - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.TrimContributionEditor_ParentId); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__PARENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.TrimContributionEditor_Position); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__POSITION_IN_PARENT).observeDetail(getMaster())); - } + ControlFactory.createTextField(parent, Messages.TrimContributionEditor_ParentId, master, context, textProp, EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__PARENT_ID)); + ControlFactory.createTextField(parent, Messages.TrimContributionEditor_Position, master, context, textProp, EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__POSITION_IN_PARENT)); // ------------------------------------------------------------ { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java index 497685d47d..74ca26b6c2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java @@ -14,7 +14,6 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; From f7ed82299f490ae7f672d0cce07c7d6b62c19c43 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 14 Feb 2011 23:21:50 +0000 Subject: [PATCH 0298/1286] Bug 325388 - [ModelTooling] Using "Find Class..." to create class results in incorrect URL --- .../extension/AddonContributionEditor.java | 20 +++++++++++++++-- .../extension/HandlerContributionEditor.java | 13 ++++++++++- .../extension/PartContributionEditor.java | 13 ++++++++++- .../e4/tools/emf/editor3x/extension/Util.java | 22 +++++++++++++++++++ 4 files changed, 64 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java index 19f4ec5122..6f615c007c 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java @@ -13,6 +13,7 @@ import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; import org.eclipse.e4.internal.tools.wizards.classes.NewAddonClassWizard; import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; import org.eclipse.e4.ui.model.application.MContribution; @@ -31,8 +32,13 @@ import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.pde.core.project.IBundleProjectDescription; +import org.eclipse.pde.core.project.IBundleProjectService; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PartInitException; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; public class AddonContributionEditor implements IContributionClassCreator { @@ -57,7 +63,7 @@ private void createOpen(MContribution contribution, EditingDomain domain, try { String packageName = el.getPackageDeclarations()[0].getElementName(); String className = wizard.getDomainClass().getName(); - Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "platform:/plugin/" + f.getProject().getName() + "/" + packageName+"."+className); + Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "platform:/plugin/" + Util.getBundleSymbolicName(f.getProject()) + "/" + packageName+"."+className); if( cmd.canExecute() ) { domain.getCommandStack().execute(cmd); } @@ -71,6 +77,17 @@ private void createOpen(MContribution contribution, EditingDomain domain, if (uri.segmentCount() == 3) { IProject p = ResourcesPlugin.getWorkspace().getRoot() .getProject(uri.segment(1)); + + if( ! p.exists() ) { + for( IProject check : ResourcesPlugin.getWorkspace().getRoot().getProjects() ) { + String name = Util.getBundleSymbolicName(check); + if( uri.segment(1).equals(name) ) { + p = check; + break; + } + } + } + // TODO If this is not a WS-Resource we need to open differently if (p != null) { IJavaProject jp = JavaCore.create(p); @@ -99,5 +116,4 @@ private void createOpen(MContribution contribution, EditingDomain domain, } } } - } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java index 56c9933235..4a49f21f79 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java @@ -53,7 +53,7 @@ private void createOpen(MContribution contribution, EditingDomain domain, IProje try { String packageName = el.getPackageDeclarations()[0].getElementName(); String className = wizard.getDomainClass().getName(); - Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "platform:/plugin/" + f.getProject().getName() + "/" + packageName+"."+className); + Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "platform:/plugin/" + Util.getBundleSymbolicName(f.getProject()) + "/" + packageName+"."+className); if( cmd.canExecute() ) { domain.getCommandStack().execute(cmd); } @@ -67,6 +67,17 @@ private void createOpen(MContribution contribution, EditingDomain domain, IProje if (uri.segmentCount() == 3) { IProject p = ResourcesPlugin.getWorkspace().getRoot() .getProject(uri.segment(1)); + + if( ! p.exists() ) { + for( IProject check : ResourcesPlugin.getWorkspace().getRoot().getProjects() ) { + String name = Util.getBundleSymbolicName(check); + if( uri.segment(1).equals(name) ) { + p = check; + break; + } + } + } + // TODO If this is not a WS-Resource we need to open differently if (p != null) { IJavaProject jp = JavaCore.create(p); diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java index 8fea74032d..0f343de897 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java @@ -61,7 +61,7 @@ private void createOpen(MContribution contribution, EditingDomain domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "platform:/plugin/" - + f.getProject().getName() + "/" + + Util.getBundleSymbolicName(f.getProject()) + "/" + packageName + "." + className); if (cmd.canExecute()) { domain.getCommandStack().execute(cmd); @@ -76,6 +76,17 @@ private void createOpen(MContribution contribution, EditingDomain domain, if (uri.segmentCount() == 3) { IProject p = ResourcesPlugin.getWorkspace().getRoot() .getProject(uri.segment(1)); + + if( ! p.exists() ) { + for( IProject check : ResourcesPlugin.getWorkspace().getRoot().getProjects() ) { + String name = Util.getBundleSymbolicName(check); + if( uri.segment(1).equals(name) ) { + p = check; + break; + } + } + } + // TODO If this is not a WS-Resource we need to open differently if (p != null) { IJavaProject jp = JavaCore.create(p); diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/Util.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/Util.java index f49d3b784c..23d5bb0bf6 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/Util.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/Util.java @@ -10,10 +10,32 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x.extension; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; import org.eclipse.emf.ecore.EClass; +import org.eclipse.pde.core.project.IBundleProjectDescription; +import org.eclipse.pde.core.project.IBundleProjectService; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; public class Util { public static boolean isTypeOrSuper(EClass eClass, EClass element) { return eClass.equals(element) || element.getEAllSuperTypes().contains(eClass); } + + public static String getBundleSymbolicName(IProject project) { + BundleContext context = FrameworkUtil.getBundle(AddonContributionEditor.class).getBundleContext(); + ServiceReference ref = context.getServiceReference(IBundleProjectService.class); + IBundleProjectService service = context.getService(ref); + try { + IBundleProjectDescription description = service.getDescription(project); + return description.getSymbolicName(); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return null; + } } From cc72156a72cf866c3db2e8c55d40e923010d7d1e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 14 Feb 2011 23:37:32 +0000 Subject: [PATCH 0299/1286] Bug 337174 - [ModelTooling] Creating class is default package fails --- .../extension/AddonContributionEditor.java | 17 +++- .../extension/HandlerContributionEditor.java | 17 +++- .../extension/PartContributionEditor.java | 26 +++--- .../classes/templates/AddonTemplate.java | 16 ++-- .../classes/templates/HandlerTemplate.java | 38 ++++---- .../classes/templates/PartTemplate.java | 86 ++++++++++--------- .../templates/addon.txtjet | 2 + .../templates/handler.txtjet | 2 + .../templates/part.txtjet | 2 + 9 files changed, 128 insertions(+), 78 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java index 6f615c007c..a1da6fd58e 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java @@ -61,9 +61,20 @@ private void createOpen(MContribution contribution, EditingDomain domain, IFile f = wizard.getFile(); ICompilationUnit el = JavaCore.createCompilationUnitFrom(f); try { - String packageName = el.getPackageDeclarations()[0].getElementName(); - String className = wizard.getDomainClass().getName(); - Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "platform:/plugin/" + Util.getBundleSymbolicName(f.getProject()) + "/" + packageName+"."+className); + String fullyQualified; + if( el.getPackageDeclarations() != null && el.getPackageDeclarations().length > 0 ) { + String packageName = el.getPackageDeclarations()[0].getElementName(); + String className = wizard.getDomainClass().getName(); + if( packageName.trim().length() > 0 ) { + fullyQualified = packageName + "." + className; + } else { + fullyQualified = className; + } + } else { + fullyQualified = wizard.getDomainClass().getName(); + } + + Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "platform:/plugin/" + Util.getBundleSymbolicName(f.getProject()) + "/" + fullyQualified); if( cmd.canExecute() ) { domain.getCommandStack().execute(cmd); } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java index 4a49f21f79..e8e1ca2a58 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java @@ -51,9 +51,20 @@ private void createOpen(MContribution contribution, EditingDomain domain, IProje IFile f = wizard.getFile(); ICompilationUnit el = JavaCore.createCompilationUnitFrom(f); try { - String packageName = el.getPackageDeclarations()[0].getElementName(); - String className = wizard.getDomainClass().getName(); - Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "platform:/plugin/" + Util.getBundleSymbolicName(f.getProject()) + "/" + packageName+"."+className); + String fullyQualified; + if( el.getPackageDeclarations() != null && el.getPackageDeclarations().length > 0 ) { + String packageName = el.getPackageDeclarations()[0].getElementName(); + String className = wizard.getDomainClass().getName(); + if( packageName.trim().length() > 0 ) { + fullyQualified = packageName + "." + className; + } else { + fullyQualified = className; + } + } else { + fullyQualified = wizard.getDomainClass().getName(); + } + + Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "platform:/plugin/" + Util.getBundleSymbolicName(f.getProject()) + "/" + fullyQualified); if( cmd.canExecute() ) { domain.getCommandStack().execute(cmd); } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java index 0f343de897..22561f88c2 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java @@ -53,17 +53,21 @@ private void createOpen(MContribution contribution, EditingDomain domain, IFile f = wizard.getFile(); ICompilationUnit el = JavaCore.createCompilationUnitFrom(f); try { - String packageName = el.getPackageDeclarations()[0] - .getElementName(); - String className = wizard.getDomainClass().getName(); - Command cmd = SetCommand - .create(domain, - contribution, - ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, - "platform:/plugin/" - + Util.getBundleSymbolicName(f.getProject()) + "/" - + packageName + "." + className); - if (cmd.canExecute()) { + String fullyQualified; + if( el.getPackageDeclarations() != null && el.getPackageDeclarations().length > 0 ) { + String packageName = el.getPackageDeclarations()[0].getElementName(); + String className = wizard.getDomainClass().getName(); + if( packageName.trim().length() > 0 ) { + fullyQualified = packageName + "." + className; + } else { + fullyQualified = className; + } + } else { + fullyQualified = wizard.getDomainClass().getName(); + } + + Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "platform:/plugin/" + Util.getBundleSymbolicName(f.getProject()) + "/" + fullyQualified); + if( cmd.canExecute() ) { domain.getCommandStack().execute(cmd); } } catch (JavaModelException e) { diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/AddonTemplate.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/AddonTemplate.java index 52be770c3d..316a8ddee6 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/AddonTemplate.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/AddonTemplate.java @@ -14,19 +14,25 @@ public static synchronized AddonTemplate create(String lineSeparator) } public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = " " + NL + "package "; - protected final String TEXT_2 = ";" + NL + "" + NL + "import javax.inject.Inject;" + NL + "import javax.annotation.PostConstruct;" + NL + "import javax.annotation.PreDestroy;" + NL + "" + NL + "import org.eclipse.e4.core.services.events.IEventBroker;" + NL + "" + NL + "public class "; - protected final String TEXT_3 = " {" + NL + "\t@Inject" + NL + "\tIEventBroker eventBroker;" + NL + "\t" + NL + "\t@PostConstruct" + NL + "\tvoid hookListeners() {" + NL + "\t\t// Hook event listeners" + NL + "\t}" + NL + "\t" + NL + "\t@PreDestroy" + NL + "\tvoid unhookListeners() {" + NL + "\t\t// Unhook event listeners" + NL + "\t}" + NL + "}"; + protected final String TEXT_1 = " "; + protected final String TEXT_2 = NL + "package "; + protected final String TEXT_3 = ";"; + protected final String TEXT_4 = NL + NL + "import javax.inject.Inject;" + NL + "import javax.annotation.PostConstruct;" + NL + "import javax.annotation.PreDestroy;" + NL + "" + NL + "import org.eclipse.e4.core.services.events.IEventBroker;" + NL + "" + NL + "public class "; + protected final String TEXT_5 = " {" + NL + "\t@Inject" + NL + "\tIEventBroker eventBroker;" + NL + "\t" + NL + "\t@PostConstruct" + NL + "\tvoid hookListeners() {" + NL + "\t\t// Hook event listeners" + NL + "\t}" + NL + "\t" + NL + "\t@PreDestroy" + NL + "\tvoid unhookListeners() {" + NL + "\t\t// Unhook event listeners" + NL + "\t}" + NL + "}"; public String generate(Object argument) { final StringBuffer stringBuffer = new StringBuffer(); JavaClass domainClass = (JavaClass)argument; stringBuffer.append(TEXT_1); - stringBuffer.append( domainClass.getPackageFragment().getElementName() ); + if( domainClass.getPackageFragment() != null && domainClass.getPackageFragment().getElementName().trim().length() > 0 ) { stringBuffer.append(TEXT_2); - stringBuffer.append( domainClass.getName() ); + stringBuffer.append( domainClass.getPackageFragment().getElementName() ); stringBuffer.append(TEXT_3); + } + stringBuffer.append(TEXT_4); + stringBuffer.append( domainClass.getName() ); + stringBuffer.append(TEXT_5); return stringBuffer.toString(); } } diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/HandlerTemplate.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/HandlerTemplate.java index 70ec397a07..f94d6cdb93 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/HandlerTemplate.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/HandlerTemplate.java @@ -14,37 +14,43 @@ public static synchronized HandlerTemplate create(String lineSeparator) } public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = " " + NL + "package "; - protected final String TEXT_2 = ";" + NL + "" + NL + "import org.eclipse.e4.core.di.annotations.Execute;"; - protected final String TEXT_3 = NL + "import org.eclipse.e4.core.di.annotations.CanExecute;"; - protected final String TEXT_4 = NL + NL + "public class "; - protected final String TEXT_5 = " {" + NL + "\t@Execute" + NL + "\tpublic void "; - protected final String TEXT_6 = "() {" + NL + "\t\t//TODO Your code goes here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_7 = NL + "\t" + NL + "\t@CanExecute" + NL + "\tpublic boolean "; - protected final String TEXT_8 = "() {" + NL + "\t\t//TODO Your code goes here" + NL + "\t\treturn true;" + NL + "\t}" + NL + "\t"; - protected final String TEXT_9 = "\t" + NL + "}"; + protected final String TEXT_1 = " "; + protected final String TEXT_2 = NL + "package "; + protected final String TEXT_3 = ";"; + protected final String TEXT_4 = NL + NL + "import org.eclipse.e4.core.di.annotations.Execute;"; + protected final String TEXT_5 = NL + "import org.eclipse.e4.core.di.annotations.CanExecute;"; + protected final String TEXT_6 = NL + NL + "public class "; + protected final String TEXT_7 = " {" + NL + "\t@Execute" + NL + "\tpublic void "; + protected final String TEXT_8 = "() {" + NL + "\t\t//TODO Your code goes here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_9 = NL + "\t" + NL + "\t@CanExecute" + NL + "\tpublic boolean "; + protected final String TEXT_10 = "() {" + NL + "\t\t//TODO Your code goes here" + NL + "\t\treturn true;" + NL + "\t}" + NL + "\t"; + protected final String TEXT_11 = "\t" + NL + "}"; public String generate(Object argument) { final StringBuffer stringBuffer = new StringBuffer(); HandlerClass domainClass = (HandlerClass)argument; stringBuffer.append(TEXT_1); - stringBuffer.append( domainClass.getPackageFragment().getElementName() ); + if( domainClass.getPackageFragment() != null && domainClass.getPackageFragment().getElementName().trim().length() > 0 ) { stringBuffer.append(TEXT_2); - if( domainClass.isUseCanExecute() ) { + stringBuffer.append( domainClass.getPackageFragment().getElementName() ); stringBuffer.append(TEXT_3); } stringBuffer.append(TEXT_4); - stringBuffer.append( domainClass.getName() ); + if( domainClass.isUseCanExecute() ) { stringBuffer.append(TEXT_5); - stringBuffer.append( domainClass.getExecuteMethodName() ); + } stringBuffer.append(TEXT_6); - if( domainClass.isUseCanExecute() ) { + stringBuffer.append( domainClass.getName() ); stringBuffer.append(TEXT_7); - stringBuffer.append( domainClass.getCanExecuteMethodName() ); + stringBuffer.append( domainClass.getExecuteMethodName() ); stringBuffer.append(TEXT_8); - } + if( domainClass.isUseCanExecute() ) { stringBuffer.append(TEXT_9); + stringBuffer.append( domainClass.getCanExecuteMethodName() ); + stringBuffer.append(TEXT_10); + } + stringBuffer.append(TEXT_11); return stringBuffer.toString(); } } diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/PartTemplate.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/PartTemplate.java index 7180c49822..5cdb9871b8 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/PartTemplate.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/PartTemplate.java @@ -14,76 +14,82 @@ public static synchronized PartTemplate create(String lineSeparator) } public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = " " + NL + "package "; - protected final String TEXT_2 = ";" + NL + "" + NL + "import javax.inject.Inject;"; - protected final String TEXT_3 = NL + "import javax.annotation.PostConstruct;"; - protected final String TEXT_4 = NL + "import javax.annotation.PreDestroy;"; - protected final String TEXT_5 = NL + "import org.eclipse.e4.ui.di.Focus;"; - protected final String TEXT_6 = NL + "import org.eclipse.e4.ui.di.Persist;"; - protected final String TEXT_7 = NL + NL + "public class "; - protected final String TEXT_8 = " {" + NL + "\t@Inject" + NL + "\tpublic "; - protected final String TEXT_9 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_10 = NL + "\t@PostConstruct" + NL + "\tpublic void "; + protected final String TEXT_1 = " "; + protected final String TEXT_2 = NL + "package "; + protected final String TEXT_3 = ";"; + protected final String TEXT_4 = NL + NL + "import javax.inject.Inject;"; + protected final String TEXT_5 = NL + "import javax.annotation.PostConstruct;"; + protected final String TEXT_6 = NL + "import javax.annotation.PreDestroy;"; + protected final String TEXT_7 = NL + "import org.eclipse.e4.ui.di.Focus;"; + protected final String TEXT_8 = NL + "import org.eclipse.e4.ui.di.Persist;"; + protected final String TEXT_9 = NL + NL + "public class "; + protected final String TEXT_10 = " {" + NL + "\t@Inject" + NL + "\tpublic "; protected final String TEXT_11 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_12 = NL + "\t"; - protected final String TEXT_13 = NL + "\t@PreDestroy" + NL + "\tpublic void "; - protected final String TEXT_14 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_15 = NL + "\t"; - protected final String TEXT_16 = NL + "\t@Focus" + NL + "\tpublic void "; - protected final String TEXT_17 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_18 = NL + "\t"; - protected final String TEXT_19 = NL + "\t@Persist" + NL + "\tpublic void "; - protected final String TEXT_20 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_21 = NL + "}"; + protected final String TEXT_12 = NL + "\t@PostConstruct" + NL + "\tpublic void "; + protected final String TEXT_13 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_14 = NL + "\t"; + protected final String TEXT_15 = NL + "\t@PreDestroy" + NL + "\tpublic void "; + protected final String TEXT_16 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_17 = NL + "\t"; + protected final String TEXT_18 = NL + "\t@Focus" + NL + "\tpublic void "; + protected final String TEXT_19 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_20 = NL + "\t"; + protected final String TEXT_21 = NL + "\t@Persist" + NL + "\tpublic void "; + protected final String TEXT_22 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; + protected final String TEXT_23 = NL + "}"; public String generate(Object argument) { final StringBuffer stringBuffer = new StringBuffer(); PartClass domainClass = (PartClass)argument; stringBuffer.append(TEXT_1); - stringBuffer.append( domainClass.getPackageFragment().getElementName() ); + if( domainClass.getPackageFragment() != null && domainClass.getPackageFragment().getElementName().trim().length() > 0 ) { stringBuffer.append(TEXT_2); - if( domainClass.isUsePostConstruct() ) { + stringBuffer.append( domainClass.getPackageFragment().getElementName() ); stringBuffer.append(TEXT_3); } - if( domainClass.isUsePredestroy() ) { stringBuffer.append(TEXT_4); - } - if( domainClass.isUseFocus() ) { + if( domainClass.isUsePostConstruct() ) { stringBuffer.append(TEXT_5); } - if( domainClass.isUsePersist() ) { + if( domainClass.isUsePredestroy() ) { stringBuffer.append(TEXT_6); } + if( domainClass.isUseFocus() ) { stringBuffer.append(TEXT_7); - stringBuffer.append( domainClass.getName() ); + } + if( domainClass.isUsePersist() ) { stringBuffer.append(TEXT_8); - stringBuffer.append( domainClass.getName() ); + } stringBuffer.append(TEXT_9); - if( domainClass.isUsePostConstruct() ) { + stringBuffer.append( domainClass.getName() ); stringBuffer.append(TEXT_10); - stringBuffer.append( domainClass.getPostConstructMethodName() ); + stringBuffer.append( domainClass.getName() ); stringBuffer.append(TEXT_11); - } + if( domainClass.isUsePostConstruct() ) { stringBuffer.append(TEXT_12); - if( domainClass.isUsePredestroy() ) { + stringBuffer.append( domainClass.getPostConstructMethodName() ); stringBuffer.append(TEXT_13); - stringBuffer.append( domainClass.getPreDestroyMethodName() ); - stringBuffer.append(TEXT_14); } + stringBuffer.append(TEXT_14); + if( domainClass.isUsePredestroy() ) { stringBuffer.append(TEXT_15); - if( domainClass.isUseFocus() ) { + stringBuffer.append( domainClass.getPreDestroyMethodName() ); stringBuffer.append(TEXT_16); - stringBuffer.append( domainClass.getFocusMethodName() ); - stringBuffer.append(TEXT_17); } + stringBuffer.append(TEXT_17); + if( domainClass.isUseFocus() ) { stringBuffer.append(TEXT_18); - if( domainClass.isUsePersist() ) { + stringBuffer.append( domainClass.getFocusMethodName() ); stringBuffer.append(TEXT_19); - stringBuffer.append( domainClass.getPersistMethodName() ); - stringBuffer.append(TEXT_20); } + stringBuffer.append(TEXT_20); + if( domainClass.isUsePersist() ) { stringBuffer.append(TEXT_21); + stringBuffer.append( domainClass.getPersistMethodName() ); + stringBuffer.append(TEXT_22); + } + stringBuffer.append(TEXT_23); return stringBuffer.toString(); } } diff --git a/bundles/org.eclipse.e4.tools/templates/addon.txtjet b/bundles/org.eclipse.e4.tools/templates/addon.txtjet index 32436d2b30..b980609312 100644 --- a/bundles/org.eclipse.e4.tools/templates/addon.txtjet +++ b/bundles/org.eclipse.e4.tools/templates/addon.txtjet @@ -1,6 +1,8 @@ <%@ jet package="org.eclipse.e4.internal.tools.wizards.classes.templates" class="AddonTemplate" imports="org.eclipse.e4.internal.tools.wizards.classes.AbstractNewClassPage.JavaClass" %> <% JavaClass domainClass = (JavaClass)argument; %> +<% if( domainClass.getPackageFragment() != null && domainClass.getPackageFragment().getElementName().trim().length() > 0 ) { %> package <%= domainClass.getPackageFragment().getElementName() %>; +<% } %> import javax.inject.Inject; import javax.annotation.PostConstruct; diff --git a/bundles/org.eclipse.e4.tools/templates/handler.txtjet b/bundles/org.eclipse.e4.tools/templates/handler.txtjet index 7dfd8fd6e6..e425325ed7 100644 --- a/bundles/org.eclipse.e4.tools/templates/handler.txtjet +++ b/bundles/org.eclipse.e4.tools/templates/handler.txtjet @@ -1,6 +1,8 @@ <%@ jet package="org.eclipse.e4.internal.tools.wizards.classes.templates" class="HandlerTemplate" imports="org.eclipse.e4.internal.tools.wizards.classes.NewHandlerClassWizard.HandlerClass" %> <% HandlerClass domainClass = (HandlerClass)argument; %> +<% if( domainClass.getPackageFragment() != null && domainClass.getPackageFragment().getElementName().trim().length() > 0 ) { %> package <%= domainClass.getPackageFragment().getElementName() %>; +<% } %> import org.eclipse.e4.core.di.annotations.Execute; <% if( domainClass.isUseCanExecute() ) { %> diff --git a/bundles/org.eclipse.e4.tools/templates/part.txtjet b/bundles/org.eclipse.e4.tools/templates/part.txtjet index 03a2b1b668..f79efd96c9 100644 --- a/bundles/org.eclipse.e4.tools/templates/part.txtjet +++ b/bundles/org.eclipse.e4.tools/templates/part.txtjet @@ -1,6 +1,8 @@ <%@ jet package="org.eclipse.e4.internal.tools.wizards.classes.templates" class="PartTemplate" imports="org.eclipse.e4.internal.tools.wizards.classes.NewPartClassWizard.PartClass" %> <% PartClass domainClass = (PartClass)argument; %> +<% if( domainClass.getPackageFragment() != null && domainClass.getPackageFragment().getElementName().trim().length() > 0 ) { %> package <%= domainClass.getPackageFragment().getElementName() %>; +<% } %> import javax.inject.Inject; <% if( domainClass.isUsePostConstruct() ) { %> From 36b6dd86c4feb1df322431d611317d7f8bfc411c Mon Sep 17 00:00:00 2001 From: Paul Webster Date: Tue, 15 Feb 2011 18:03:08 +0000 Subject: [PATCH 0300/1286] Bug 320171 - [Model] Use real Java-References in the Binding-Model-Elements --- .../common/component/ApplicationEditor.java | 18 ++--- .../common/component/BindingTableEditor.java | 71 ++++++++++--------- .../wizards/project/E4NewProjectWizard.java | 13 +++- 3 files changed, 59 insertions(+), 43 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 47c41be24d..39c886936e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -128,14 +128,16 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry(ModelEditor.VIRTUAL_ROOT_CONTEXTS, BINDING_TABLE_CONTAINER__ROOT_CONTEXT, element, Messages.ApplicationEditor_RootContexts) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); + // list.add(new VirtualEntry(ModelEditor.VIRTUAL_ROOT_CONTEXTS, + // BINDING_TABLE_CONTAINER__ROOT_CONTEXT, element, + // Messages.ApplicationEditor_RootContexts) { + // + // @Override + // protected boolean accepted(Object o) { + // return true; + // } + // + // }); list.add(new VirtualEntry(ModelEditor.VIRTUAL_BINDING_TABLE, BINDING_CONTAINER__BINDINGS, element, Messages.ApplicationEditor_BindingTables) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index 862cba0a4a..95bbc38d5f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -22,8 +22,6 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BindingContextSelectionDialog; import org.eclipse.e4.ui.model.application.commands.MBindingTable; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MKeyBinding; @@ -39,7 +37,6 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -161,33 +158,41 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.BindingTableEditor_ContextId); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID).observeDetail(getMaster())); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - BindingContextSelectionDialog dialog = new BindingContextSelectionDialog(b.getShell(), getEditor().getModelProvider(), Messages); - if (dialog.open() == BindingContextSelectionDialog.OK) { - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID, dialog.getSelectedId()); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } + // { + // Label l = new Label(parent, SWT.NONE); + // l.setText(Messages.BindingTableEditor_ContextId); + // l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + // + // Text t = new Text(parent, SWT.BORDER); + // TextPasteHandler.createFor(t); + // t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + // context.bindValue(textProp.observeDelayed(200, t), + // EMFEditProperties.value(getEditingDomain(), + // CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID).observeDetail(getMaster())); + // + // final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + // b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, + // false)); + // b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); + // b.setText(Messages.ModelTooling_Common_FindEllipsis); + // b.addSelectionListener(new SelectionAdapter() { + // @Override + // public void widgetSelected(SelectionEvent e) { + // BindingContextSelectionDialog dialog = new + // BindingContextSelectionDialog(b.getShell(), + // getEditor().getModelProvider(), Messages); + // if (dialog.open() == BindingContextSelectionDialog.OK) { + // Command cmd = SetCommand.create(getEditingDomain(), + // getMaster().getValue(), + // CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID, + // dialog.getSelectedId()); + // if (cmd.canExecute()) { + // getEditingDomain().getCommandStack().execute(cmd); + // } + // } + // } + // }); + // } { Label l = new Label(parent, SWT.NONE); @@ -309,8 +314,8 @@ public IObservableList getChildList(Object element) { @Override public String getDetailLabel(Object element) { MBindingTable cmd = (MBindingTable) element; - if (cmd.getBindingContextId() != null && cmd.getBindingContextId().trim().length() > 0) { - return cmd.getBindingContextId(); + if (cmd.getBindingContext() != null && cmd.getBindingContext().getName() != null && cmd.getBindingContext().getName().trim().length() > 0) { + return cmd.getBindingContext().getName(); } return null; @@ -318,7 +323,7 @@ public String getDetailLabel(Object element) { @Override public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID) }; + return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT, CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME) }; } @Override diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java index 50ef617d8d..4c9c95da40 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java @@ -392,7 +392,7 @@ public void createApplicationResources(IProject project, rootContext.getChildren().add(childContext); application.getRootContext().add(rootContext); - application.getBindingContexts().add("org.eclipse.ui.contexts.dialogAndWindow"); + application.getBindingContexts().add(rootContext); resource.getContents().add((EObject) application); @@ -606,8 +606,17 @@ private MCommand createCommand(String name, String className, binding.setCommand(command); List tables = application.getBindingTables(); if (tables.size()==0) { + MBindingContext rootContext = null; + if (application.getRootContext().size()>0) { + rootContext = application.getRootContext().get(0); + } else { + rootContext = MCommandsFactory.INSTANCE.createBindingContext(); + rootContext.setElementId("org.eclipse.ui.contexts.dialogAndWindow"); + rootContext.setName("In Dialog and Windows"); + application.getRootContext().add(rootContext); + } MBindingTable table = MCommandsFactory.INSTANCE.createBindingTable(); - table.setBindingContextId("org.eclipse.ui.contexts.dialogAndWindow"); + table.setBindingContext(rootContext); tables.add(table); } tables.get(0).getBindings().add(binding); From 6f61fe9423d2fa9905b873ced11174ee17a195d1 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 15 Feb 2011 21:26:42 +0000 Subject: [PATCH 0301/1286] Bug 320171 - [Model] Use real Java-References in the Binding-Model-Elements --- .../common/component/ApplicationEditor.java | 21 ++-- .../common/component/BindingTableEditor.java | 64 +++++----- .../common/component/ControlFactory.java | 115 ++++++++++++++++++ .../component/PartDescriptorEditor.java | 1 + .../internal/common/component/PartEditor.java | 2 +- .../common/component/WindowEditor.java | 2 +- .../BindingContextSelectionDialog.java | 10 +- 7 files changed, 161 insertions(+), 54 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 39c886936e..d4da526150 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -109,9 +109,8 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - + ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.ApplicationEditor_BindingContexts); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ApplicationEditor_BindingContexts, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); return parent; } @@ -128,16 +127,14 @@ protected boolean accepted(Object o) { }); - // list.add(new VirtualEntry(ModelEditor.VIRTUAL_ROOT_CONTEXTS, - // BINDING_TABLE_CONTAINER__ROOT_CONTEXT, element, - // Messages.ApplicationEditor_RootContexts) { - // - // @Override - // protected boolean accepted(Object o) { - // return true; - // } - // - // }); + list.add(new VirtualEntry(ModelEditor.VIRTUAL_ROOT_CONTEXTS, BINDING_TABLE_CONTAINER__ROOT_CONTEXT, element, Messages.ApplicationEditor_RootContexts) { + + @Override + protected boolean accepted(Object o) { + return true; + } + + }); list.add(new VirtualEntry(ModelEditor.VIRTUAL_BINDING_TABLE, BINDING_CONTAINER__BINDINGS, element, Messages.ApplicationEditor_BindingTables) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index 95bbc38d5f..ba06650ea8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -22,6 +22,7 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BindingContextSelectionDialog; import org.eclipse.e4.ui.model.application.commands.MBindingTable; import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; import org.eclipse.e4.ui.model.application.commands.MKeyBinding; @@ -37,6 +38,7 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -158,41 +160,33 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); } - // { - // Label l = new Label(parent, SWT.NONE); - // l.setText(Messages.BindingTableEditor_ContextId); - // l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - // - // Text t = new Text(parent, SWT.BORDER); - // TextPasteHandler.createFor(t); - // t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - // context.bindValue(textProp.observeDelayed(200, t), - // EMFEditProperties.value(getEditingDomain(), - // CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID).observeDetail(getMaster())); - // - // final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - // b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, - // false)); - // b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - // b.setText(Messages.ModelTooling_Common_FindEllipsis); - // b.addSelectionListener(new SelectionAdapter() { - // @Override - // public void widgetSelected(SelectionEvent e) { - // BindingContextSelectionDialog dialog = new - // BindingContextSelectionDialog(b.getShell(), - // getEditor().getModelProvider(), Messages); - // if (dialog.open() == BindingContextSelectionDialog.OK) { - // Command cmd = SetCommand.create(getEditingDomain(), - // getMaster().getValue(), - // CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID, - // dialog.getSelectedId()); - // if (cmd.canExecute()) { - // getEditingDomain().getCommandStack().execute(cmd); - // } - // } - // } - // }); - // } + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.BindingTableEditor_ContextId); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + Text t = new Text(parent, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + t.setEditable(false); + context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT, CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME)).observeDetail(getMaster())); + + final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); + b.setText(Messages.ModelTooling_Common_FindEllipsis); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + BindingContextSelectionDialog dialog = new BindingContextSelectionDialog(b.getShell(), getEditor().getModelProvider(), Messages); + if (dialog.open() == BindingContextSelectionDialog.OK) { + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT, dialog.getSelectedContext()); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } { Label l = new Label(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index b73d1b9e5a..d1fc058c7b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -24,6 +24,8 @@ import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BindingContextSelectionDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; import org.eclipse.e4.tools.emf.ui.internal.common.properties.ProjectOSGiTranslationProvider; import org.eclipse.e4.tools.services.IClipboardService.Handler; @@ -31,6 +33,8 @@ import org.eclipse.e4.ui.internal.workbench.E4XMIResource; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationElement; +import org.eclipse.e4.ui.model.application.commands.MBindings; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationFactoryImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MContext; @@ -58,6 +62,7 @@ import org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider; import org.eclipse.jface.databinding.viewers.ViewerProperties; import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.ColumnLabelProvider; import org.eclipse.jface.viewers.ComboViewer; @@ -442,6 +447,116 @@ public void handleValueChange(ValueChangeEvent event) { }); } + public static void createBindingContextWiget(Composite parent, final Messages Messages, final AbstractComponentEditor editor, String label) { + { + Label l = new Label(parent, SWT.NONE); + l.setText(label); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final TableViewer viewer = new TableViewer(parent); + GridData gd = new GridData(GridData.FILL_BOTH); + gd.heightHint = 120; + viewer.getControl().setLayoutData(gd); + viewer.setContentProvider(new ObservableListContentProvider()); + viewer.setLabelProvider(new ComponentLabelProvider(editor.getEditor(), Messages)); + viewer.setInput(EMFProperties.list(CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS).observeDetail(editor.getMaster())); + + final Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Up); + b.setImage(editor.createImage(ResourceProvider.IMG_Obj16_arrow_up)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MBindings container = (MBindings) editor.getMaster().getValue(); + int idx = container.getBindingContexts().indexOf(obj) - 1; + if (idx >= 0) { + Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); + + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Down); + b.setImage(editor.createImage(ResourceProvider.IMG_Obj16_arrow_down)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MBindings container = (MBindings) editor.getMaster().getValue(); + int idx = container.getBindingContexts().indexOf(obj) + 1; + if (idx < container.getBindingContexts().size()) { + Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, obj, idx); + + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_AddEllipsis); + b.setImage(editor.createImage(ResourceProvider.IMG_Obj16_table_add)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + BindingContextSelectionDialog dialog = new BindingContextSelectionDialog(buttonComp.getShell(), editor.getEditor().getModelProvider(), Messages); + if (dialog.open() == IDialogConstants.OK_ID) { + Command cmd = AddCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, dialog.getSelectedContext()); + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Remove); + b.setImage(editor.createImage(ResourceProvider.IMG_Obj16_table_delete)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + Command cmd = RemoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, ((IStructuredSelection) viewer.getSelection()).toList()); + if (cmd.canExecute()) { + editor.getEditingDomain().getCommandStack().execute(cmd); + } + } + }); + } + } + public static void createStringListWidget(Composite parent, Messages Messages, final AbstractComponentEditor editor, String label, final EStructuralFeature feature, int vIndent) { Label l = new Label(parent, SWT.NONE); l.setText(label); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 4161f1bb0d..b8a4d6f2cf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -301,6 +301,7 @@ public void widgetSelected(SelectionEvent e) { context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CATEGORY).observeDetail(master)); } + ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.PartEditor_BindingContexts); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); return parent; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index f2fd78d3f7..4df2f2348b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -277,7 +277,7 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.PartEditor_BindingContexts, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.PartEditor_BindingContexts); ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index afd72eb246..a7723b900f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -275,7 +275,7 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ ControlFactory.createSelectedElement(parent, this, context, Messages.WindowEditor_SelectedElement); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.WindowEditor_BindingContexts, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.WindowEditor_BindingContexts); ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java index 05a63e2378..bffd28ba97 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java @@ -49,7 +49,7 @@ public class BindingContextSelectionDialog extends TitleAreaDialog { private IModelResource resource; private TableViewer viewer; - private String selectedId; + private MBindingContext selectedContext; private Messages Messages; public BindingContextSelectionDialog(Shell parentShell, IModelResource resource, Messages Messages) { @@ -58,8 +58,8 @@ public BindingContextSelectionDialog(Shell parentShell, IModelResource resource, this.Messages = Messages; } - public String getSelectedId() { - return selectedId; + public MBindingContext getSelectedContext() { + return selectedContext; } @Override @@ -132,8 +132,8 @@ public void modifyText(ModifyEvent e) { protected void okPressed() { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (!s.isEmpty()) { - selectedId = ((MBindingContext) s.getFirstElement()).getElementId(); - if (selectedId != null && selectedId.trim().length() > 0) { + selectedContext = ((MBindingContext) s.getFirstElement()); + if (selectedContext != null) { super.okPressed(); } else { setErrorMessage(Messages.BindingContextSelectionDialog_NoIdReference); From 054948c4c56ad5d784883704367214c82b94809e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 15 Feb 2011 21:47:27 +0000 Subject: [PATCH 0302/1286] Bug 335767 - [ModelTooling] Add support for NLS --- .../tools/emf/ui/internal/common/component/ControlFactory.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index d1fc058c7b..853b4558e2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -341,6 +341,8 @@ public static void createTranslatedTextField(Composite parent, String label, IOb GridData gd = new GridData(GridData.FILL_HORIZONTAL); if (project == null) { gd.horizontalSpan = 2; + } else { + gd.horizontalSpan = 2; } t.setLayoutData(gd); From f0c8adf3fe6c92ce8be79ea0232f97e95009c942 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 15 Feb 2011 22:36:00 +0000 Subject: [PATCH 0303/1286] Bug 337260 - Improve Forward Compat Layer --- bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF | 3 ++- .../e4/tools/compat/internal/ContextServiceFactory.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF index 0b4aea4d40..8e138e6925 100644 --- a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF @@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.tools.services;bundle-version="1.0.0", org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0", org.eclipse.e4.ui.di;bundle-version="0.9.0", - javax.inject;bundle-version="1.0.0" + javax.inject;bundle-version="1.0.0", + org.eclipse.core.databinding;bundle-version="1.4.0" Service-Component: OSGI-INF/selectionproviderfunction.xml Export-Package: org.eclipse.e4.tools.compat.parts Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java index 632d0fbe2d..b1ef1c58ba 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java @@ -63,6 +63,7 @@ public Object create(@SuppressWarnings("rawtypes") Class serviceInterface, IServ IEclipseContext serviceContext = EclipseContextFactory.getServiceContext(bundleContext); final IEclipseContext appContext = serviceContext.createChild("WorkbenchContext"); //$NON-NLS-1$ + appContext.set(Display.class, Display.getCurrent()); appContext.set(Logger.class, new WorkbenchLogger()); appContext.set(IClipboardService.class, new ClipboardServiceImpl()); IContributionFactory contributionFactory = ContextInjectionFactory.make(ReflectionContributionFactory.class, appContext); From 9fe004221563cef72d9ac448aad99869dd6e598c Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 15 Feb 2011 22:36:01 +0000 Subject: [PATCH 0304/1286] Bug 337260 - Improve Forward Compat Layer --- .../eclipse/e4/tools/compat/internal/ContextServiceFactory.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java index b1ef1c58ba..8cf22228ba 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java @@ -10,6 +10,7 @@ ******************************************************************************/ package org.eclipse.e4.tools.compat.internal; +import org.eclipse.core.databinding.observable.Realm; import org.eclipse.e4.core.contexts.ContextInjectionFactory; import org.eclipse.e4.core.contexts.EclipseContextFactory; import org.eclipse.e4.core.contexts.IEclipseContext; @@ -66,6 +67,7 @@ public Object create(@SuppressWarnings("rawtypes") Class serviceInterface, IServ appContext.set(Display.class, Display.getCurrent()); appContext.set(Logger.class, new WorkbenchLogger()); appContext.set(IClipboardService.class, new ClipboardServiceImpl()); + appContext.set(Realm.class, Realm.getDefault()); IContributionFactory contributionFactory = ContextInjectionFactory.make(ReflectionContributionFactory.class, appContext); appContext.set(IContributionFactory.class.getName(),contributionFactory); From 90246b5619bd81fbd33d9559d62af4af65c21274 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 16 Feb 2011 17:21:32 +0000 Subject: [PATCH 0305/1286] Bug 336730 - Bug e 4.1 m5 application creation wizard --- .../wizards/project/E4NewProjectWizard.java | 93 ++++++++++++------- 1 file changed, 58 insertions(+), 35 deletions(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java index 4c9c95da40..541ebdf860 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java @@ -29,6 +29,7 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.e4.ui.model.application.MAddon; import org.eclipse.e4.ui.model.application.MApplication; @@ -72,6 +73,7 @@ import org.eclipse.pde.internal.core.ICoreConstants; import org.eclipse.pde.internal.core.bundle.WorkspaceBundlePluginModel; import org.eclipse.pde.internal.core.plugin.WorkspacePluginModelBase; +import org.eclipse.pde.internal.core.util.CoreUtility; import org.eclipse.pde.internal.ui.PDEPlugin; import org.eclipse.pde.internal.ui.PDEUIMessages; import org.eclipse.pde.internal.ui.wizards.IProjectProvider; @@ -316,8 +318,24 @@ public void createApplicationResources(IProject project, String xmiPath = map .get(NewApplicationWizardPage.APPLICATION_XMI_PROPERTY); + // If there's no Activator created we create default package + if (!fPluginData.doGenerateClass()) { + String packageName = fPluginData.getId(); + IPath path = new Path(packageName.replace('.', '/')); + if (fPluginData.getSourceFolderName().trim().length() > 0) + path = new Path(fPluginData.getSourceFolderName()).append(path); + + try { + CoreUtility.createFolder(project.getFolder(path)); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + IJavaProject javaProject = JavaCore.create(project); IPackageFragment fragment = null; + try { for (IPackageFragment element : javaProject.getPackageFragments()) { if (element.getKind() == IPackageFragmentRoot.K_SOURCE) { @@ -344,56 +362,58 @@ public void createApplicationResources(IProject project, MApplication application = MApplicationFactory.INSTANCE .createApplication(); - + application.setElementId("org.eclipse.e4.ide.application"); - + MAddon addon = MApplicationFactory.INSTANCE.createAddon(); addon.setElementId("org.eclipse.e4.core.commands.service"); addon.setContributionURI("platform:/plugin/org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"); application.getAddons().add(addon); - + addon = MApplicationFactory.INSTANCE.createAddon(); addon.setElementId("org.eclipse.e4.ui.contexts.service"); addon.setContributionURI("platform:/plugin/org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"); application.getAddons().add(addon); - + addon = MApplicationFactory.INSTANCE.createAddon(); addon.setElementId("org.eclipse.e4.ui.bindings.service"); addon.setContributionURI("platform:/plugin/org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"); application.getAddons().add(addon); - + addon = MApplicationFactory.INSTANCE.createAddon(); addon.setElementId("org.eclipse.e4.ui.workbench.commands.model"); addon.setContributionURI("platform:/plugin/org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon"); application.getAddons().add(addon); - + addon = MApplicationFactory.INSTANCE.createAddon(); addon.setElementId("org.eclipse.e4.ui.workbench.contexts.model"); addon.setContributionURI("platform:/plugin/org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon"); application.getAddons().add(addon); - + addon = MApplicationFactory.INSTANCE.createAddon(); addon.setElementId("org.eclipse.e4.ui.workbench.bindings.model"); addon.setContributionURI("platform:/plugin/org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon"); application.getAddons().add(addon); - - MBindingContext rootContext = MCommandsFactory.INSTANCE.createBindingContext(); + + MBindingContext rootContext = MCommandsFactory.INSTANCE + .createBindingContext(); rootContext.setElementId("org.eclipse.ui.contexts.dialogAndWindow"); rootContext.setName("In Dialog and Windows"); - - MBindingContext childContext = MCommandsFactory.INSTANCE.createBindingContext(); + + MBindingContext childContext = MCommandsFactory.INSTANCE + .createBindingContext(); childContext.setElementId("org.eclipse.ui.contexts.window"); childContext.setName("In Windows"); rootContext.getChildren().add(childContext); - + childContext = MCommandsFactory.INSTANCE.createBindingContext(); childContext.setElementId("org.eclipse.ui.contexts.dialog"); childContext.setName("In Dialogs"); rootContext.getChildren().add(childContext); - + application.getRootContext().add(rootContext); application.getBindingContexts().add(rootContext); - + resource.getContents().add((EObject) application); // Create Quit command @@ -410,7 +430,8 @@ public void createApplicationResources(IProject project, "AboutHandler", "Ctrl+A", projectName, fragment, application); - MTrimmedWindow mainWindow = MBasicFactory.INSTANCE.createTrimmedWindow(); + MTrimmedWindow mainWindow = MBasicFactory.INSTANCE + .createTrimmedWindow(); application.getChildren().add(mainWindow); { mainWindow.setLabel(projectName); @@ -423,8 +444,7 @@ public void createApplicationResources(IProject project, mainWindow.setMainMenu(menu); menu.setElementId("menu:org.eclipse.ui.main.menu"); - MMenu fileMenuItem = MMenuFactory.INSTANCE - .createMenu(); + MMenu fileMenuItem = MMenuFactory.INSTANCE.createMenu(); menu.getChildren().add(fileMenuItem); fileMenuItem.setLabel("File"); { @@ -450,8 +470,7 @@ public void createApplicationResources(IProject project, menuItemQuit.setLabel("Quit"); menuItemQuit.setCommand(quitCommand); } - MMenu helpMenuItem = MMenuFactory.INSTANCE - .createMenu(); + MMenu helpMenuItem = MMenuFactory.INSTANCE.createMenu(); menu.getChildren().add(helpMenuItem); helpMenuItem.setLabel("Help"); { @@ -481,15 +500,17 @@ public void createApplicationResources(IProject project, MPartStack partStack = MBasicFactory.INSTANCE .createPartStack(); partSashContainer.getChildren().add(partStack); -// -// MPart part = MApplicationFactory.eINSTANCE.createPart(); -// partStack.getChildren().add(part); -// part.setLabel("Main"); + // + // MPart part = + // MApplicationFactory.eINSTANCE.createPart(); + // partStack.getChildren().add(part); + // part.setLabel("Main"); } // WindowTrim { - MTrimBar trimBar = MBasicFactory.INSTANCE.createTrimBar(); + MTrimBar trimBar = MBasicFactory.INSTANCE + .createTrimBar(); mainWindow.getTrimBars().add(trimBar); MToolBar toolBar = MMenuFactory.INSTANCE @@ -593,29 +614,31 @@ private MCommand createCommand(String name, String className, application.getCommands().add(command); { // Create Quit handler for command - MHandler quitHandler =MCommandsFactory.INSTANCE - .createHandler(); + MHandler quitHandler = MCommandsFactory.INSTANCE.createHandler(); quitHandler.setCommand(command); - quitHandler.setContributionURI("platform:/plugin/" + projectName + "/" - + fragment.getElementName() + ".handlers." + className); + quitHandler.setContributionURI("platform:/plugin/" + projectName + + "/" + fragment.getElementName() + ".handlers." + + className); application.getHandlers().add(quitHandler); - MKeyBinding binding = MCommandsFactory.INSTANCE - .createKeyBinding(); + MKeyBinding binding = MCommandsFactory.INSTANCE.createKeyBinding(); binding.setKeySequence(keyBinding); binding.setCommand(command); List tables = application.getBindingTables(); - if (tables.size()==0) { + if (tables.size() == 0) { MBindingContext rootContext = null; - if (application.getRootContext().size()>0) { + if (application.getRootContext().size() > 0) { rootContext = application.getRootContext().get(0); } else { - rootContext = MCommandsFactory.INSTANCE.createBindingContext(); - rootContext.setElementId("org.eclipse.ui.contexts.dialogAndWindow"); + rootContext = MCommandsFactory.INSTANCE + .createBindingContext(); + rootContext + .setElementId("org.eclipse.ui.contexts.dialogAndWindow"); rootContext.setName("In Dialog and Windows"); application.getRootContext().add(rootContext); } - MBindingTable table = MCommandsFactory.INSTANCE.createBindingTable(); + MBindingTable table = MCommandsFactory.INSTANCE + .createBindingTable(); table.setBindingContext(rootContext); tables.add(table); } From d4ba8b7f839dd0d0f6a98aa20a722d901d354b7a Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 16 Feb 2011 19:41:36 +0000 Subject: [PATCH 0306/1286] Bug 337174 - [ModelTooling] Creating class is default package fails --- .../classes/AbstractNewClassWizard.java | 32 ++++++++++++++++++- .../wizards/classes/NewAddonClassWizard.java | 6 ++++ .../classes/NewHandlerClassWizard.java | 5 +++ .../wizards/classes/NewPartClassWizard.java | 6 ++++ 4 files changed, 48 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java index 16974d80e1..355a41c726 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java @@ -13,9 +13,12 @@ import java.io.ByteArrayInputStream; import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.e4.internal.tools.wizards.classes.AbstractNewClassPage.JavaClass; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; @@ -111,11 +114,21 @@ public JavaClass getDomainClass() { return ((AbstractNewClassPage) getPages()[0]).getClazz(); } + protected void checkRequiredBundles() { + + } + @Override public boolean performFinish() { JavaClass clazz = getDomainClass(); String content = getContent(); + if( clazz.getFragmentRoot() == null ) { + return false; + } + + checkRequiredBundles(); + IPackageFragment fragment = clazz.getPackageFragment(); if (fragment != null) { String cuName = clazz.getName() + ".java"; @@ -131,7 +144,24 @@ public boolean performFinish() { IFile.FORCE | IFile.KEEP_HISTORY, null); } IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file); - unit.open(null); +// unit.open(null); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + String cuName = clazz.getName() + ".java"; + IFolder p = (IFolder) clazz.getFragmentRoot().getResource(); + file = p.getFile(cuName); + try { + if (!file.exists()) { + file.create(new ByteArrayInputStream(content.getBytes()), + true, null); + } else { + file.setContents(new ByteArrayInputStream(content.getBytes()), + IFile.FORCE | IFile.KEEP_HISTORY, null); + } + IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file); } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java index fba02f96fb..48793ef0ac 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java @@ -40,5 +40,11 @@ protected String getContent() { AddonTemplate template = new AddonTemplate(); return template.generate(getDomainClass()); } + + @Override + protected void checkRequiredBundles() { + // TODO Auto-generated method stub + + } } diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java index 4fc4f47930..100fb1888a 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java @@ -86,6 +86,11 @@ protected void createFields(Composite parent, DataBindingContext dbc) { }); } + @Override + protected void checkRequiredBundles() { + // TODO Auto-generated method stub + + } public static class HandlerClass extends JavaClass { diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java index d33ffbdc7e..a28bdb1922 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java @@ -134,6 +134,12 @@ protected JavaClass createInstance() { }); } + + @Override + protected void checkRequiredBundles() { + // TODO Auto-generated method stub + + } @Override protected String getContent() { From aa024bf54e3f934a30fe66af3b4c026ae493e19a Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 16 Feb 2011 20:14:07 +0000 Subject: [PATCH 0307/1286] Bug 337174 - [ModelTooling] Creating class is default package fails --- .../classes/AbstractNewClassWizard.java | 46 ++++++++++++++++++- .../wizards/classes/NewAddonClassWizard.java | 13 ++++-- .../classes/NewHandlerClassWizard.java | 10 ++-- .../wizards/classes/NewPartClassWizard.java | 14 ++++-- 4 files changed, 70 insertions(+), 13 deletions(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java index 355a41c726..523e003bc4 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java @@ -11,9 +11,15 @@ package org.eclipse.e4.internal.tools.wizards.classes; import java.io.ByteArrayInputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; @@ -29,10 +35,16 @@ import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.Wizard; +import org.eclipse.pde.core.project.IBundleProjectDescription; +import org.eclipse.pde.core.project.IBundleProjectService; +import org.eclipse.pde.core.project.IRequiredBundleDescription; import org.eclipse.ui.INewWizard; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.ide.IDE; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; public abstract class AbstractNewClassWizard extends Wizard implements INewWizard { protected IPackageFragmentRoot root; @@ -115,7 +127,39 @@ public JavaClass getDomainClass() { } protected void checkRequiredBundles() { - + IProject project = getDomainClass().getFragmentRoot().getJavaProject().getProject(); + BundleContext context = FrameworkUtil.getBundle(NewAddonClassWizard.class).getBundleContext(); + ServiceReference ref = context.getServiceReference(IBundleProjectService.class); + IBundleProjectService service = context.getService(ref); + try { + IBundleProjectDescription description = service.getDescription(project); + Set requiredBundles = getRequiredBundles(); + IRequiredBundleDescription[] arTmp = description.getRequiredBundles(); + List descs = new ArrayList(); + if( arTmp != null ) { + descs.addAll(Arrays.asList(arTmp)); + } + for( IRequiredBundleDescription bd : descs ) { + requiredBundles.remove(bd.getName()); + } + + if( requiredBundles.size() > 0 ) { + for( String b : requiredBundles ) { + descs.add(service.newRequiredBundle(b, null, false, false)); + } + description.setRequiredBundles(descs.toArray(new IRequiredBundleDescription[0])); + description.apply(new NullProgressMonitor()); + } + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + protected Set getRequiredBundles() { + Set rv = new HashSet(); + rv.add("javax.inject"); + return rv; } @Override diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java index 48793ef0ac..58432912b2 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.internal.tools.wizards.classes; +import java.util.Set; + import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.e4.internal.tools.wizards.classes.templates.AddonTemplate; @@ -42,9 +44,10 @@ protected String getContent() { } @Override - protected void checkRequiredBundles() { - // TODO Auto-generated method stub - + protected Set getRequiredBundles() { + Set rv = super.getRequiredBundles(); + rv.add("javax.annotation"); + rv.add("org.eclipse.e4.core.services"); + return rv; } - -} +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java index 100fb1888a..f970424a4c 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.internal.tools.wizards.classes; +import java.util.Set; + import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.beans.BeanProperties; import org.eclipse.core.resources.ResourcesPlugin; @@ -87,12 +89,12 @@ protected void createFields(Composite parent, DataBindingContext dbc) { } @Override - protected void checkRequiredBundles() { - // TODO Auto-generated method stub - + protected Set getRequiredBundles() { + Set set = super.getRequiredBundles(); + set.add("org.eclipse.e4.core.di"); + return set; } - public static class HandlerClass extends JavaClass { private String executeMethodName = "execute"; private String canExecuteMethodName = "canExecute"; diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java index a28bdb1922..db3d3bf679 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java @@ -12,6 +12,7 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; +import java.util.Set; import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.beans.BeanProperties; @@ -136,11 +137,18 @@ protected JavaClass createInstance() { } @Override - protected void checkRequiredBundles() { - // TODO Auto-generated method stub + protected Set getRequiredBundles() { + Set rv = super.getRequiredBundles(); + PartClass cl = (PartClass)getDomainClass(); + if( cl.usePostConstruct || cl.usePredestroy ) { + rv.add("javax.annotation"); + } else if( cl.useFocus || cl.usePersist ) { + rv.add("org.eclipse.e4.ui.di"); + } + return rv; } - + @Override protected String getContent() { PartTemplate template = new PartTemplate(); From 1a466bea7b36bd5fd59967ec9ed32d649d5b5e49 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 16 Feb 2011 22:19:09 +0000 Subject: [PATCH 0308/1286] Bug 306619 - [ModelTooling] e4 WorkbenchModel Editor should support wildcard searches --- .../emf/editor3x/PDEClassContributionProvider.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java index cf55a477d1..76f37692b3 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java @@ -49,6 +49,14 @@ public void findContribution(final Filter filter, final ContributionResultHandl // There is no package qualification // Perform the search only on the type name typeName = currentContent.toCharArray(); + if( currentContent.startsWith("*") ) { + typeName = "".toCharArray(); + if( ! currentContent.endsWith("*") ) { + currentContent += "*"; + } + packageName = currentContent.toCharArray(); + } + } else if ((index + 1) == currentContent.length()) { // There is a package qualification and the last character is a // dot @@ -132,7 +140,7 @@ public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, try { searchEngine.searchAllTypeNames( packageName, - SearchPattern.R_EXACT_MATCH, + SearchPattern.R_PATTERN_MATCH, typeName, SearchPattern.R_PREFIX_MATCH, IJavaSearchConstants.CLASS, From 42e76ce20a442073700a3c419dc3cb54779197c7 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 18 Feb 2011 22:00:47 +0000 Subject: [PATCH 0309/1286] Bug 337560 - [ModelTooling] Split form area in tabs * a first split --- .../component/AbstractComponentEditor.java | 37 +++++++ .../e4/tools/emf/ui/internal/Messages.java | 2 + .../tools/emf/ui/internal/Messages.properties | 2 + .../emf/ui/internal/common/ModelEditor.java | 49 +++++---- .../common/component/AddonsEditor.java | 25 ++++- .../common/component/ApplicationEditor.java | 31 ++++-- .../internal/common/component/AreaEditor.java | 104 +++++++++++++++--- .../component/BindingContextEditor.java | 30 +++-- .../common/component/BindingTableEditor.java | 30 +++-- .../common/component/CategoryEditor.java | 25 ++++- .../common/component/CommandEditor.java | 41 ++++--- .../component/CommandParameterEditor.java | 26 ++++- .../component/CoreExpressionEditor.java | 27 ++++- .../common/component/HandlerEditor.java | 27 +++-- .../common/component/KeyBindingEditor.java | 27 +++-- .../component/MenuContributionEditor.java | 27 +++-- .../internal/common/component/MenuEditor.java | 30 +++-- .../common/component/MenuItemEditor.java | 30 +++-- .../common/component/MenuSeparatorEditor.java | 26 +++-- .../component/ModelFragmentsEditor.java | 21 ++-- .../common/component/ParameterEditor.java | 26 ++++- .../component/PartDescriptorEditor.java | 27 +++-- .../internal/common/component/PartEditor.java | 27 +++-- .../component/PartSashContainerEditor.java | 27 +++-- .../common/component/PartStackEditor.java | 27 +++-- .../common/component/PerspectiveEditor.java | 28 +++-- .../component/PerspectiveStackEditor.java | 27 +++-- .../common/component/PlaceholderEditor.java | 26 +++-- .../common/component/StringModelFragment.java | 23 ++-- .../component/ToolBarContributionEditor.java | 27 +++-- .../common/component/ToolBarEditor.java | 27 ++++- .../component/ToolBarSeparatorEditor.java | 27 +++-- .../common/component/ToolControlEditor.java | 27 +++-- .../common/component/ToolItemEditor.java | 28 +++-- .../common/component/TrimBarEditor.java | 27 +++-- .../component/TrimContributionEditor.java | 27 +++-- .../common/component/WindowEditor.java | 26 ++++- .../component/virtual/VApplicationAddons.java | 19 +++- .../virtual/VApplicationCategoriesEditor.java | 19 +++- .../virtual/VBindingTableEditor.java | 19 +++- .../component/virtual/VCommandEditor.java | 19 +++- .../component/virtual/VHandlerEditor.java | 19 +++- .../virtual/VItemParametersEditor.java | 19 +++- .../virtual/VMenuContributionsEditor.java | 19 +++- .../common/component/virtual/VMenuEditor.java | 19 +++- .../virtual/VModelFragmentsEditor.java | 19 +++- .../virtual/VModelImportsEditor.java | 19 +++- .../component/virtual/VPartDescriptor.java | 19 +++- .../virtual/VRootBindingContexts.java | 19 +++- .../virtual/VToolBarContributionsEditor.java | 19 +++- .../virtual/VTrimContributionsEditor.java | 19 +++- .../virtual/VWindowControlEditor.java | 19 +++- .../component/virtual/VWindowEditor.java | 19 +++- .../virtual/VWindowSharedElementsEditor.java | 19 +++- .../component/virtual/VWindowTrimEditor.java | 19 +++- 55 files changed, 1023 insertions(+), 390 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java index 3234f2753d..f914f28009 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java @@ -33,12 +33,21 @@ import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; public abstract class AbstractComponentEditor { + private static final String CSS_CLASS_KEY = "org.eclipse.e4.ui.css.CssClassName"; //$NON-NLS-1$ + private WritableValue master = new WritableValue(); public static final int SEARCH_IMAGE = 0; @@ -164,4 +173,32 @@ public void handleCut() { } } } + + protected Composite createScrollableContainer(Composite parent) { + final ScrolledComposite scrolling = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL); + scrolling.setBackgroundMode(SWT.INHERIT_DEFAULT); + scrolling.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ + + final Composite contentContainer = new Composite(scrolling, SWT.NONE); + + contentContainer.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ + scrolling.setExpandHorizontal(true); + scrolling.setExpandVertical(true); + scrolling.setContent(contentContainer); + + scrolling.addControlListener(new ControlAdapter() { + public void controlResized(ControlEvent e) { + Rectangle r = scrolling.getClientArea(); + scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); + } + }); + + scrolling.setLayoutData(new GridData(GridData.FILL_BOTH)); + + GridLayout gl = new GridLayout(3, false); + gl.horizontalSpacing = 10; + contentContainer.setLayout(gl); + + return contentContainer; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 777352ec49..2ffd3964a4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -20,6 +20,8 @@ public class Messages { public String ModelTooling_Common_Id; public String ModelTooling_Common_RefId; public String ModelTooling_Common_FindEllipsis; + public String ModelTooling_Common_TabDefault; + public String ModelTooling_Common_TabSupplementary; public String ModelTooling_UIElement_ToBeRendered; public String ModelTooling_UIElement_Visible; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 30b91f9f43..f200a6aa57 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -16,6 +16,8 @@ ModelTooling_Common_Remove=Remove ModelTooling_Common_Id=Id ModelTooling_Common_RefId=Reference-Id ModelTooling_Common_FindEllipsis=Find ... +ModelTooling_Common_TabDefault=Default +ModelTooling_Common_TabSupplementary=Supplementary ModelTooling_UIElement_ToBeRendered=To Be Rendered ModelTooling_UIElement_Visible=Visible diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 4b9b691638..1a6899606d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -182,18 +182,14 @@ import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.dnd.Clipboard; import org.eclipse.swt.dnd.DND; import org.eclipse.swt.dnd.DragSourceAdapter; import org.eclipse.swt.dnd.DragSourceEvent; import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.dnd.TransferData; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -413,25 +409,29 @@ private Composite createFormTab(Composite composite) { textLabel.setData(CSS_CLASS_KEY, "sectionHeader"); //$NON-NLS-1$ textLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - final ScrolledComposite scrolling = new ScrolledComposite(editingArea, SWT.H_SCROLL | SWT.V_SCROLL); - scrolling.setBackgroundMode(SWT.INHERIT_DEFAULT); - scrolling.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ + // final ScrolledComposite scrolling = new + // ScrolledComposite(editingArea, SWT.H_SCROLL | SWT.V_SCROLL); + // scrolling.setBackgroundMode(SWT.INHERIT_DEFAULT); + // scrolling.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ final EStackLayout layout = new EStackLayout(); - final Composite contentContainer = new Composite(scrolling, SWT.NONE); - contentContainer.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ - scrolling.setExpandHorizontal(true); - scrolling.setExpandVertical(true); - scrolling.setContent(contentContainer); - - scrolling.addControlListener(new ControlAdapter() { - public void controlResized(ControlEvent e) { - Rectangle r = scrolling.getClientArea(); - scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); - } - }); + final Composite contentContainer = new Composite(editingArea, SWT.NONE); + contentContainer.setLayoutData(new GridData(GridData.FILL_BOTH)); - scrolling.setLayoutData(new GridData(GridData.FILL_BOTH)); + // contentContainer.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ + // scrolling.setExpandHorizontal(true); + // scrolling.setExpandVertical(true); + // scrolling.setContent(contentContainer); + // + // scrolling.addControlListener(new ControlAdapter() { + // public void controlResized(ControlEvent e) { + // Rectangle r = scrolling.getClientArea(); + // scrolling.setMinSize(contentContainer.computeSize(r.width, + // SWT.DEFAULT)); + // } + // }); + // + // scrolling.setLayoutData(new GridData(GridData.FILL_BOTH)); contentContainer.setLayout(layout); viewer.addSelectionChangedListener(new ISelectionChangedListener() { @@ -476,10 +476,11 @@ public void run() { } } - Rectangle r = scrolling.getClientArea(); - scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); - scrolling.setOrigin(0, 0); - scrolling.layout(true, true); + // Rectangle r = scrolling.getClientArea(); + // scrolling.setMinSize(contentContainer.computeSize(r.width, + // SWT.DEFAULT)); + // scrolling.setOrigin(0, 0); + // scrolling.layout(true, true); if (selectionService != null) { selectionService.setSelection(s.getFirstElement()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index a85b73d9a2..1f0a3784a8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -33,11 +33,12 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -119,10 +120,13 @@ public Composite doGetEditor(Composite parent, Object object) { } protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -175,9 +179,18 @@ public void widgetSelected(SelectionEvent e) { } ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); + + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.AddonsEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - return parent; + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index d4da526150..e2abbe9d81 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -31,8 +31,9 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; @@ -93,10 +94,13 @@ public Composite doGetEditor(Composite parent, Object object) { } protected Composite createForm(Composite parent, EMFDataBindingContext context) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -105,14 +109,25 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + + ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.ApplicationEditor_BindingContexts); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.ApplicationEditor_BindingContexts); + + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.AddonsEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); - return parent; + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java index 0adaf8b07a..4e01654a52 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java @@ -10,7 +10,9 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -46,6 +48,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.IViewerValueProperty; @@ -58,6 +61,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -78,6 +83,8 @@ public class AreaEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; + private List actions = new ArrayList(); + @Inject @Optional private IProject project; @@ -87,6 +94,46 @@ public AreaEditor() { super(); } + @PostConstruct + void init() { + actions.add(new Action(Messages.PartSashContainerEditor_AddPartSashContainer, createImageDescriptor(ResourceProvider.IMG_PartSashContainer)) { + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.PART_SASH_CONTAINER); + } + }); + actions.add(new Action(Messages.PartSashContainerEditor_AddPartStack, createImageDescriptor(ResourceProvider.IMG_PartStack)) { + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.PART_STACK); + } + }); + actions.add(new Action(Messages.PartSashContainerEditor_AddPart, createImageDescriptor(ResourceProvider.IMG_Part)) { + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.PART); + } + }); + actions.add(new Action(Messages.PartSashContainerEditor_AddInputPart, createImageDescriptor(ResourceProvider.IMG_Part)) { + @Override + public void run() { + handleAddChild(BasicPackageImpl.Literals.INPUT_PART); + } + }); + actions.add(new Action(Messages.PartSashContainerEditor_AddArea, createImageDescriptor(ResourceProvider.IMG_Area)) { + @Override + public void run() { + handleAddChild(AdvancedPackageImpl.Literals.AREA); + } + }); + actions.add(new Action(Messages.PartSashContainerEditor_AddPlaceholder, createImageDescriptor(ResourceProvider.IMG_Placeholder)) { + @Override + public void run() { + handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER); + } + }); + } + @Override public Image getImage(Object element, Display display) { boolean horizontal = ((MPartSashContainer) element).isHorizontal(); @@ -155,10 +202,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -173,7 +223,6 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.AreaEditor_LabelLabel, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); ControlFactory.createTextField(parent, Messages.AreaEditor_Tooltip, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP)); // ------------------------------------------------------------ @@ -244,8 +293,7 @@ public String getText(Object element) { l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer viewer = new TableViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 200; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); @@ -256,7 +304,7 @@ public String getText(Object element) { Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -332,15 +380,7 @@ public String getText(Object element) { public void widgetSelected(SelectionEvent e) { if (!childrenDropDown.getSelection().isEmpty()) { EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - EObject eObject = EcoreUtil.create(eClass); - setElementId(eObject); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } + handleAddChild(eClass); } } }); @@ -367,9 +407,30 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - return parent; + folder.setSelection(0); + + return folder; + } + + protected void handleAddChild(EClass eClass) { + EObject eObject = EcoreUtil.create(eClass); + setElementId(eObject); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(eObject); + } } @Override @@ -386,4 +447,11 @@ public String getDetailLabel(Object element) { public FeaturePath[] getLabelProperties() { return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java index cf1434ab99..931cb7dd81 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java @@ -43,6 +43,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -138,10 +140,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -166,8 +171,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); @@ -176,7 +180,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -265,7 +269,17 @@ public void widgetSelected(SelectionEvent e) { } }); - return parent; + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index ba06650ea8..28ebe2494c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -47,6 +47,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -132,10 +134,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -197,8 +202,7 @@ public void widgetSelected(SelectionEvent e) { ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); @@ -207,7 +211,7 @@ public void widgetSelected(SelectionEvent e) { Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -297,7 +301,17 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java index c561544156..30f37e8d17 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java @@ -25,8 +25,9 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; @@ -96,10 +97,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -116,9 +120,18 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.CategoryEditor_Name, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.CATEGORY__NAME)); ControlFactory.createTextField(parent, Messages.CategoryEditor_Description, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.CATEGORY__DESCRIPTION)); + + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - return parent; + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index d86773c3f9..55a348ff25 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -45,6 +45,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -130,10 +132,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -149,21 +154,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField(parent, Messages.CommandEditor_Name, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME)); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.CommandEditor_LabelDescription); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - Text t = new Text(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); - TextPasteHandler.createFor(t); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - gd.heightHint = 100; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__DESCRIPTION).observeDetail(getMaster())); - } + ControlFactory.createTextField(parent, Messages.CommandEditor_LabelDescription, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__DESCRIPTION)); // ------------------------------------------------------------ { @@ -211,7 +202,7 @@ public void widgetSelected(SelectionEvent e) { Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -301,9 +292,17 @@ public void widgetSelected(SelectionEvent e) { }); } + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - return parent; + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java index 7bf53d2c84..90e05c4042 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java @@ -27,9 +27,10 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -107,10 +108,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -141,7 +145,17 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); } - return parent; + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java index d67a3153e8..0f8129e152 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java @@ -17,6 +17,7 @@ import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ExpressionIdDialog; +import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MCoreExpression; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; @@ -24,12 +25,13 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; @@ -81,10 +83,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -118,7 +123,17 @@ public void widgetSelected(SelectionEvent e) { } } - return parent; + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 9ec6853c4a..6aea831483 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -39,11 +39,12 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -118,10 +119,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); @@ -199,9 +203,18 @@ public void widgetSelected(SelectionEvent e) { }); } ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - return parent; + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 490fda82a6..ef07c0c360 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -54,6 +54,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -142,10 +144,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -217,7 +222,7 @@ public void widgetSelected(SelectionEvent e) { Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -308,9 +313,17 @@ public void widgetSelected(SelectionEvent e) { b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); - return parent; + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index 11a523c505..f83618bc58 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -47,6 +47,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -144,10 +146,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -185,7 +190,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -299,9 +304,17 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); - return parent; + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index b844c4c7b5..90a8c5da6d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -71,6 +71,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -195,10 +197,13 @@ public Composite doGetEditor(Composite parent, Object object) { } protected Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean rootMenu, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -230,8 +235,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); @@ -240,7 +244,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -414,9 +418,17 @@ public String getText(Object element) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); - return parent; + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 71bd5672d2..b6b9d8fd28 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -49,11 +49,12 @@ import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -123,10 +124,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); IWidgetValueProperty checkProp = WidgetProperties.selection(); @@ -161,8 +165,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } } - ControlFactory.createTranslatedTextField(parent, Messages.MenuItemEditor_Label, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); ControlFactory.createTranslatedTextField(parent, Messages.MenuItemEditor_Label, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project); ControlFactory.createTextField(parent, Messages.MenuItemEditor_Mnemonics, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_ELEMENT__MNEMONICS)); ControlFactory.createTranslatedTextField(parent, Messages.MenuItemEditor_Tooltip, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool, project); @@ -274,9 +276,19 @@ public String getText(Object element) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); - return parent; + return folder; } protected abstract void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, WritableValue master); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index 66a86641f3..17c051342e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -25,8 +25,9 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; @@ -95,10 +96,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -116,9 +120,17 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); - return parent; + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java index 4d243152fb..c6ac79e056 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java @@ -48,6 +48,8 @@ import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerComparator; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -95,10 +97,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -121,7 +126,7 @@ private Composite createForm(Composite parent) { Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -262,7 +267,7 @@ public void widgetSelected(SelectionEvent e) { Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -360,7 +365,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } public void addClasses(EPackage ePackage, List list) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java index 7595fe5c59..b3f4572e71 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java @@ -26,8 +26,9 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; @@ -103,10 +104,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -123,7 +127,17 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr ControlFactory.createTextField(parent, Messages.ParameterEditor_Name, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__NAME)); ControlFactory.createTextField(parent, Messages.ParameterEditor_Value, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__VALUE)); - return parent; + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index b8a4d6f2cf..0e1a99bcd7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -49,11 +49,12 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -131,10 +132,13 @@ public Composite doGetEditor(Composite parent, Object object) { } protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -302,9 +306,18 @@ public void widgetSelected(SelectionEvent e) { } ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.PartEditor_BindingContexts); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - return parent; + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); + + return folder; } private void addToolBar() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 4df2f2348b..c4eb4239d2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -55,11 +55,12 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -150,10 +151,13 @@ public Composite doGetEditor(Composite parent, Object object) { } protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -281,9 +285,18 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - return parent; + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); + + return folder; } private void addToolBar() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index b22e2e9bb8..75a8a65a6d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -53,6 +53,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -186,10 +188,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -248,7 +253,7 @@ public String getText(Object element) { Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -351,9 +356,17 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); - return parent; + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 014342c2d9..f0d82e6a2b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -50,6 +50,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.custom.StackLayout; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -155,10 +157,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -194,7 +199,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -295,9 +300,17 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); - return parent; + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 852c38996b..b28457a186 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -58,6 +58,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -195,10 +197,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -270,7 +275,7 @@ public void widgetSelected(SelectionEvent e) { Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -375,9 +380,18 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - return parent; + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 050891670d..62544cbd6c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -45,6 +45,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -142,10 +144,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -180,7 +185,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -268,9 +273,17 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); - return parent; + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 57bade472c..1be26f8753 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -34,11 +34,12 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -140,10 +141,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -213,9 +217,17 @@ public void widgetSelected(SelectionEvent e) { } ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); - return parent; + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index 247f65ff93..1852a4fad4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -50,6 +50,8 @@ import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerComparator; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -103,10 +105,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -122,7 +127,7 @@ private Composite createForm(Composite parent) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; comp.setLayoutData(gd); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginWidth = gl.marginHeight = 0; gl.verticalSpacing = 0; gl.marginLeft = gl.marginBottom = gl.marginRight = gl.marginTop = 0; @@ -155,7 +160,7 @@ public void widgetSelected(SelectionEvent e) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; comp.setLayoutData(gd); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginWidth = gl.marginHeight = 0; gl.verticalSpacing = 0; gl.marginLeft = gl.marginBottom = gl.marginRight = gl.marginTop = 0; @@ -199,7 +204,7 @@ public void widgetSelected(SelectionEvent e) { Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -323,7 +328,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } public void dispose() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index 488cd656b5..a1c719bbfe 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -47,6 +47,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -145,10 +147,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -186,7 +191,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -301,9 +306,17 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); - return parent; + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 6ea78a7bf2..6d6b1b52a9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -50,6 +50,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -173,10 +175,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -212,7 +217,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -317,7 +322,17 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ - return parent; + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index 8f6b6dfc6b..29e386a7d2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -27,8 +27,9 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; @@ -106,10 +107,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -126,9 +130,18 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - return parent; + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index ff437a247f..19bf8146b1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -32,11 +32,12 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -122,10 +123,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -169,9 +173,18 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - return parent; + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 7e7266edde..2f2313ed40 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -48,10 +48,11 @@ import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -106,10 +107,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -124,12 +128,14 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - createFormSubTypeForm(parent, context, master); + createFormSubTypeForm(parent, folder, context, master); + + folder.setSelection(0); - return parent; + return folder; } - protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, final WritableValue master) { + protected void createFormSubTypeForm(Composite parent, CTabFolder folder, EMFDataBindingContext context, final WritableValue master) { IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); IWidgetValueProperty checkProp = WidgetProperties.selection(); IWidgetValueProperty enabled = WidgetProperties.enabled(); @@ -262,6 +268,12 @@ public String getText(Object element) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index 2109295acf..1cb7531fd6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -54,6 +54,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -156,10 +158,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -209,7 +214,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -308,9 +313,17 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); - return parent; + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index 4e796d85fd..1b9d79be6e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -46,6 +46,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -132,10 +134,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -171,7 +176,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -277,9 +282,17 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); - return parent; + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index a7723b900f..acdb2c8e6e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -52,6 +52,8 @@ import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -161,10 +163,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); @@ -278,9 +283,18 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.WindowEditor_BindingContexts); ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - return parent; + item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabSupplementary); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + + folder.setSelection(0); + + return folder; } void removeMenu() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java index ee3ba01ebc..aab20496df 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java @@ -35,6 +35,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -100,10 +102,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); { Label l = new Label(parent, SWT.NONE); @@ -120,7 +125,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -206,7 +211,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } private void handleAddAddon() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java index 0b8524dade..5677b445d4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java @@ -35,6 +35,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -100,10 +102,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); { Label l = new Label(parent, SWT.NONE); @@ -120,7 +125,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -210,7 +215,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index 6e48adf6ca..b3919f6f29 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -35,6 +35,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -99,10 +101,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); { Label l = new Label(parent, SWT.NONE); @@ -119,7 +124,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -209,7 +214,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } protected void handleAdd() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index 77a7003a47..51502b305d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -36,6 +36,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -103,10 +105,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); { Label l = new Label(parent, SWT.NONE); @@ -123,7 +128,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -213,7 +218,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } protected void handleAdd() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index 5a5d7deff5..522c6e2a8d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -35,6 +35,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -99,10 +101,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); { Label l = new Label(parent, SWT.NONE); @@ -119,7 +124,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -209,7 +214,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java index d412d3df28..3b76887c74 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java @@ -37,6 +37,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -103,10 +105,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); { Label l = new Label(parent, SWT.NONE); @@ -123,7 +128,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -213,7 +218,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java index ef39aec75e..0d670a8268 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java @@ -35,6 +35,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -100,10 +102,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); { Label l = new Label(parent, SWT.NONE); @@ -120,7 +125,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -210,7 +215,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java index b1d755a4be..4d2b8fefd4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -36,6 +36,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -101,10 +103,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); Label l = new Label(parent, SWT.NONE); l.setText(Messages.VMenuEditor_Menus); @@ -120,7 +125,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -210,7 +215,9 @@ public void widgetSelected(SelectionEvent e) { } }); - return parent; + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java index b81404add4..97ccd900b9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java @@ -32,6 +32,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -85,10 +87,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); { Label l = new Label(parent, SWT.NONE); @@ -106,7 +111,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -205,7 +210,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java index f7d052f0a2..137bb68eed 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java @@ -43,6 +43,8 @@ import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerComparator; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -96,10 +98,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); { Label l = new Label(parent, SWT.NONE); @@ -115,7 +120,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -239,7 +244,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } public void addClasses(EPackage ePackage, List list) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java index c79019d817..7a1c9343c6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java @@ -35,6 +35,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -99,10 +101,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); { Label l = new Label(parent, SWT.NONE); @@ -119,7 +124,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -209,7 +214,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java index 459644ec10..66a4d1be15 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java @@ -35,6 +35,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -100,10 +102,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); { Label l = new Label(parent, SWT.NONE); @@ -120,7 +125,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -206,7 +211,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } private void handleAddContext() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java index 4f7dcaf82c..4ed0eb526a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java @@ -35,6 +35,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -99,10 +101,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); { Label l = new Label(parent, SWT.NONE); @@ -119,7 +124,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -209,7 +214,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java index 8565227248..2dace79524 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java @@ -35,6 +35,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -99,10 +101,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); { Label l = new Label(parent, SWT.NONE); @@ -119,7 +124,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -209,7 +214,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index 981869255c..c2589abc43 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -42,6 +42,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -141,10 +143,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); { Label l = new Label(parent, SWT.NONE); @@ -161,7 +166,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -260,7 +265,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index 5e9b5d8750..91802d82fc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -41,6 +41,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -111,10 +113,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); Label l = new Label(parent, SWT.NONE); l.setText(Messages.VWindowEditor_Windows); @@ -130,7 +135,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -230,7 +235,9 @@ public void widgetSelected(SelectionEvent e) { } }); - return parent; + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java index 52969346d4..f8b8c4d46a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java @@ -41,6 +41,8 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -119,10 +121,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); { Label l = new Label(parent, SWT.NONE); @@ -143,7 +148,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(2, false); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -249,7 +254,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java index 491c87e837..be6a55de78 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -32,6 +32,8 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; @@ -96,10 +98,13 @@ public Composite doGetEditor(Composite parent, Object object) { } private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - parent.setLayout(gl); + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); { Label l = new Label(parent, SWT.NONE); @@ -117,7 +122,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - gl = new GridLayout(); + GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -153,7 +158,9 @@ public void widgetSelected(SelectionEvent e) { }); } - return parent; + folder.setSelection(0); + + return folder; } @Override From 145e21aaa8c2c6f8d06b5ae3a0f3dcb43ec201a8 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 18 Feb 2011 22:05:17 +0000 Subject: [PATCH 0310/1286] Bug 337560 - [ModelTooling] Split form area in tabs * a first split --- .../internal/common/component/virtual/VApplicationAddons.java | 3 +-- .../common/component/virtual/VApplicationCategoriesEditor.java | 3 +-- .../internal/common/component/virtual/VBindingTableEditor.java | 3 +-- .../ui/internal/common/component/virtual/VCommandEditor.java | 3 +-- .../ui/internal/common/component/virtual/VHandlerEditor.java | 3 +-- .../common/component/virtual/VItemParametersEditor.java | 3 +-- .../common/component/virtual/VMenuContributionsEditor.java | 3 +-- .../emf/ui/internal/common/component/virtual/VMenuEditor.java | 3 +-- .../common/component/virtual/VModelFragmentsEditor.java | 3 +-- .../internal/common/component/virtual/VModelImportsEditor.java | 3 +-- .../ui/internal/common/component/virtual/VPartDescriptor.java | 3 +-- .../common/component/virtual/VRootBindingContexts.java | 3 +-- .../common/component/virtual/VToolBarContributionsEditor.java | 3 +-- .../common/component/virtual/VTrimContributionsEditor.java | 3 +-- .../common/component/virtual/VWindowControlEditor.java | 3 +-- .../ui/internal/common/component/virtual/VWindowEditor.java | 3 +-- .../common/component/virtual/VWindowSharedElementsEditor.java | 3 +-- .../internal/common/component/virtual/VWindowTrimEditor.java | 3 +-- 18 files changed, 18 insertions(+), 36 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java index aab20496df..e8c9bd44c6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java @@ -118,8 +118,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java index 5677b445d4..2b1af264b3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java @@ -118,8 +118,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index b3919f6f29..01a74ca6f3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -117,8 +117,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr bindingViewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); bindingViewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); bindingViewer.getControl().setLayoutData(gd); bindingViewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index 51502b305d..5661672ae9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -121,8 +121,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index 522c6e2a8d..ab57532a34 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -117,8 +117,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java index 3b76887c74..637f240953 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java @@ -121,8 +121,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java index 0d670a8268..8870e43ac6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java @@ -118,8 +118,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java index 4d2b8fefd4..7204aabb1a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -118,8 +118,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java index 97ccd900b9..257c8e305a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java @@ -105,8 +105,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer.setContentProvider(cp); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); Composite buttonComp = new Composite(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java index 137bb68eed..2e289aa0b2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java @@ -114,8 +114,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); Composite buttonComp = new Composite(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java index 7a1c9343c6..3175fe16df 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java @@ -117,8 +117,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java index 66a4d1be15..e792c05ebc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java @@ -118,8 +118,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java index 4ed0eb526a..9b5552c295 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java @@ -117,8 +117,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java index 2dace79524..4a2c6b5d7a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java @@ -117,8 +117,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index c2589abc43..1842987d61 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -160,8 +160,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); Composite buttonComp = new Composite(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index 91802d82fc..9a78f13000 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -129,8 +129,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); Composite buttonComp = new Composite(parent, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java index f8b8c4d46a..64587f8ab6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java @@ -139,8 +139,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer.setContentProvider(cp); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java index be6a55de78..70fe2b3cde 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -116,8 +116,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer.setContentProvider(cp); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); Composite buttonComp = new Composite(parent, SWT.NONE); From 36a18d4f760121752f8ab0c1453fce7ba1d56347 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 18 Feb 2011 22:49:16 +0000 Subject: [PATCH 0311/1286] Bug 337560 - [ModelTooling] Split form area in tabs * a first split --- .../tools/emf/ui/internal/common/component/CommandEditor.java | 3 +-- .../emf/ui/internal/common/component/KeyBindingEditor.java | 3 +-- .../ui/internal/common/component/MenuContributionEditor.java | 3 +-- .../e4/tools/emf/ui/internal/common/component/MenuEditor.java | 2 +- .../e4/tools/emf/ui/internal/common/component/PartEditor.java | 2 +- .../ui/internal/common/component/PartSashContainerEditor.java | 3 +-- .../emf/ui/internal/common/component/PartStackEditor.java | 3 +-- .../emf/ui/internal/common/component/PerspectiveEditor.java | 3 +-- .../ui/internal/common/component/PerspectiveStackEditor.java | 3 +-- .../internal/common/component/ToolBarContributionEditor.java | 3 +-- .../tools/emf/ui/internal/common/component/ToolBarEditor.java | 3 +-- .../tools/emf/ui/internal/common/component/TrimBarEditor.java | 3 +-- .../ui/internal/common/component/TrimContributionEditor.java | 3 +-- .../tools/emf/ui/internal/common/component/WindowEditor.java | 4 ++-- 14 files changed, 15 insertions(+), 26 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 55a348ff25..1dded8232f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -193,8 +193,7 @@ public void widgetSelected(SelectionEvent e) { viewer.setContentProvider(cp); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 120; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); IEMFEditListProperty mProp = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__PARAMETERS); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index ef07c0c360..c3dd441b54 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -214,8 +214,7 @@ public void widgetSelected(SelectionEvent e) { viewer.setContentProvider(cp); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 120; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setInput(KEY_BINDING__PARAMETERS.observeDetail(getMaster())); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index f83618bc58..c4b267fc23 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -181,8 +181,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr viewer.setContentProvider(cp); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 90a8c5da6d..9ac70683c2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -223,7 +223,6 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, ControlFactory.createTranslatedTextField(parent, Messages.MenuEditor_LabelLabel, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project); } - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); ControlFactory.createTextField(parent, Messages.MenuEditor_Mnemonics, master, context, textProp, EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_ELEMENT__MNEMONICS)); { @@ -424,6 +423,7 @@ public String getText(Object element) { parent = createScrollableContainer(folder); item.setControl(parent.getParent()); + ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); folder.setSelection(0); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index c4eb4239d2..47e13464d6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -284,7 +284,6 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.PartEditor_BindingContexts); ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); item = new CTabItem(folder, SWT.NONE); item.setText(Messages.ModelTooling_Common_TabSupplementary); @@ -292,6 +291,7 @@ public void widgetSelected(SelectionEvent e) { parent = createScrollableContainer(folder); item.setControl(parent.getParent()); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); folder.setSelection(0); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 75a8a65a6d..d8d5257590 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -241,8 +241,7 @@ public String getText(Object element) { l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer viewer = new TableViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 200; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index f0d82e6a2b..5dcb31a804 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -190,8 +190,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index b28457a186..e594033288 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -263,8 +263,7 @@ public void widgetSelected(SelectionEvent e) { l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer viewer = new TableViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 200; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 62544cbd6c..940a717592 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -176,8 +176,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index a1c719bbfe..7f1d781328 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -181,8 +181,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 120; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 6d6b1b52a9..f0745f574e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -207,8 +207,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 120; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index 1cb7531fd6..af979b7ab9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -205,8 +205,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr final TableViewer viewer = new TableViewer(parent); viewer.setLabelProvider(new ComponentLabelProvider(editor, Messages)); viewer.setContentProvider(new ObservableListContentProvider()); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index 1b9d79be6e..f61fe50da2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -167,8 +167,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr final TableViewer viewer = new TableViewer(parent); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); viewer.setContentProvider(new ObservableListContentProvider()); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; + GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index acdb2c8e6e..06c827f907 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -218,7 +218,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr ControlFactory.createTranslatedTextField(parent, Messages.WindowEditor_Label, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project); ControlFactory.createTranslatedTextField(parent, Messages.WindowEditor_Tooltip, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool, project); - ControlFactory.createTranslatedTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE), resourcePool, project); // ------------------------------------------------------------ { @@ -282,7 +281,6 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createSelectedElement(parent, this, context, Messages.WindowEditor_SelectedElement); ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.WindowEditor_BindingContexts); ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); item = new CTabItem(folder, SWT.NONE); item.setText(Messages.ModelTooling_Common_TabSupplementary); @@ -290,6 +288,8 @@ public void widgetSelected(SelectionEvent e) { parent = createScrollableContainer(folder); item.setControl(parent.getParent()); + ControlFactory.createTranslatedTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE), resourcePool, project); + ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); folder.setSelection(0); From 8092e54b5ad9dd278051aa789c827d45203483c2 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 18 Feb 2011 22:56:46 +0000 Subject: [PATCH 0312/1286] Bug 337579 - [UI] Update model before API freeze * added new attribute to tooling --- .../src/org/eclipse/e4/tools/emf/ui/internal/Messages.java | 1 + .../org/eclipse/e4/tools/emf/ui/internal/Messages.properties | 1 + .../emf/ui/internal/common/component/PlaceholderEditor.java | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 2ffd3964a4..89b4f1687d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -225,6 +225,7 @@ public class Messages { public String PlaceholderEditor_Label; public String PlaceholderEditor_Descriptor; public String PlaceholderEditor_Reference; + public String PlaceholderEditor_Closeable; public String ToolBarEditor_Label; public String ToolBarEditor_Description; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index f200a6aa57..bfb745adf4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -225,6 +225,7 @@ PerspectiveStackEditor_AddPerspective=Add Perspective PlaceholderEditor_Label=Placeholder PlaceholderEditor_Descriptor=Placeholder Bla Bla Bla Bla PlaceholderEditor_Reference=Reference +PlaceholderEditor_Closeable=Closeable ToolBarEditor_Label=Toolbar ToolBarEditor_Description=Toolbar bla bla bla diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 1be26f8753..53dfa3509e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -215,8 +215,12 @@ public void widgetSelected(SelectionEvent e) { } }); } + + ControlFactory.createCheckBox(parent, Messages.PlaceholderEditor_Closeable, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), AdvancedPackageImpl.Literals.PLACEHOLDER__CLOSEABLE)); + ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); + item = new CTabItem(folder, SWT.NONE); item.setText(Messages.ModelTooling_Common_TabSupplementary); From 40254f0c41b9d56eec8e9ffc9cf9680b9fab809a Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 18 Feb 2011 23:27:34 +0000 Subject: [PATCH 0313/1286] Bug 337560 - [ModelTooling] Split form area in tabs * fixed context menus --- .../e4/tools/emf/ui/internal/Messages.java | 3 + .../tools/emf/ui/internal/Messages.properties | 113 +++++++++--------- .../emf/ui/internal/common/ModelEditor.java | 33 ++++- .../internal/common/component/MenuEditor.java | 17 +++ .../common/component/MenuItemEditor.java | 30 +++++ 5 files changed, 135 insertions(+), 61 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 89b4f1687d..14b4a2c931 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -22,6 +22,7 @@ public class Messages { public String ModelTooling_Common_FindEllipsis; public String ModelTooling_Common_TabDefault; public String ModelTooling_Common_TabSupplementary; + public String ModelEditor_AddChild; public String ModelTooling_UIElement_ToBeRendered; public String ModelTooling_UIElement_Visible; @@ -134,6 +135,7 @@ public class Messages { public String MenuEditor_AddMenu; public String MenuEditor_AddDirectMenuItem; public String MenuEditor_AddSeparator; + public String MenuEditor_AddCoreExpression; public String MenuItemEditor_Type; public String MenuItemEditor_Label; @@ -144,6 +146,7 @@ public class Messages { public String MenuItemEditor_Selected; public String MenuItemEditor_Mnemonics; public String MenuItemEditor_NoExpression; + public String MenuItemEditor_AddCoreExpression; public String MenuSeparatorEditor_Label; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index bfb745adf4..f21c4840af 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -18,6 +18,7 @@ ModelTooling_Common_RefId=Reference-Id ModelTooling_Common_FindEllipsis=Find ... ModelTooling_Common_TabDefault=Default ModelTooling_Common_TabSupplementary=Supplementary +ModelEditor_AddChild=Add child ModelTooling_UIElement_ToBeRendered=To Be Rendered ModelTooling_UIElement_Visible=Visible @@ -54,7 +55,7 @@ BindingTableEditor_ContextId=Context Id BindingTableEditor_Keybindings=Keybindings BindingTableEditor_KeySequence=KeySequence BindingTableEditor_Command=Command -BindingTableEditor_AddKeyBinding=Add Keybinding +BindingTableEditor_AddKeyBinding=Keybinding CommandEditor_Label=Command CommandEditor_Description=Command bla bla bla @@ -68,7 +69,7 @@ CommandEditor_ParameterOptional_Yes=yes CommandEditor_ParameterOptional_No=no CommandEditor_ParameterId=Id CommandEditor_Category=Category -CommandEditor_AddCommandParameter=Add Command Parameter +CommandEditor_AddCommandParameter=Command Parameter DirectMenuItemEditor_Label=DirectMenuItem DirectMenuItemEditor_Description=DirectMenuItem bla bla bla @@ -111,7 +112,7 @@ KeyBindingEditor_Command=Command KeyBindingEditor_Parameters=Parameters KeyBindingEditor_SequenceNotComplete=Keysequence is not complete KeyBindingEditor_SequenceEmpty=Keysequence must not be empty! -KeyBindingEditor_AddParameter=Add Parameter +KeyBindingEditor_AddParameter=Parameter MenuEditor_Label=Menu MenuEditor_Description=Menu bla bla bla @@ -128,10 +129,11 @@ MenuEditor_IconURI=Icon URI MenuEditor_MainMenu=Main Menu MenuEditor_Children=Children MenuEditor_Mnemonics=Mnemonics -MenuEditor_AddHandledMenuItem=Add HandledMenuItem -MenuEditor_AddMenu=Add Menu -MenuEditor_AddDirectMenuItem=Add DirectMenuItem -MenuEditor_AddSeparator=Add Separator +MenuEditor_AddHandledMenuItem=HandledMenuItem +MenuEditor_AddMenu=Menu +MenuEditor_AddDirectMenuItem=DirectMenuItem +MenuEditor_AddSeparator=Separator +MenuEditor_AddCoreExpression=VisibleWhen Core Expression MenuItemEditor_Type=Type @@ -142,6 +144,7 @@ MenuItemEditor_Enabled=Enabled MenuItemEditor_Selected=Selected MenuItemEditor_Mnemonics=Mnemonics MenuItemEditor_NoExpression= +MenuItemEditor_AddCoreExpression=VisibleWhen Core Expression MenuSeparatorEditor_Label=Separator @@ -184,21 +187,21 @@ PartSashContainerEditor_Horizontal=Horizontal PartSashContainerEditor_SelectedElement=Selected Element PartSashContainerEditor_Controls=Controls PartSashContainerEditor_ContainerData=Container Data -PartSashContainerEditor_AddPartSashContainer=Add PartSashContainer -PartSashContainerEditor_AddPartStack=Add PartStack -PartSashContainerEditor_AddPart=Add Part -PartSashContainerEditor_AddInputPart=Add Input Part -PartSashContainerEditor_AddArea=Add Area -PartSashContainerEditor_AddPlaceholder=Add Placeholder +PartSashContainerEditor_AddPartSashContainer=PartSashContainer +PartSashContainerEditor_AddPartStack=PartStack +PartSashContainerEditor_AddPart=Part +PartSashContainerEditor_AddInputPart=Input Part +PartSashContainerEditor_AddArea=Area +PartSashContainerEditor_AddPlaceholder=Placeholder PartStackEditor_Label=Part Stack PartStackEditor_Description=Stack bla bla bla PartStackEditor_SelectedElement=Selected Element PartStackEditor_Parts=Parts PartStackEditor_ContainerData=Container Data -PartStackEditor_AddPart=Add Part -PartStackEditor_AddInputPart=Add Input Part -PartStackEditor_AddPlaceholder=Add Placeholder +PartStackEditor_AddPart=Part +PartStackEditor_AddInputPart=Input Part +PartStackEditor_AddPlaceholder=Placeholder PerspectiveEditor_Label=Perspective PerspectiveEditor_Description=Perspective Bla Bla Bla @@ -208,19 +211,19 @@ PerspectiveEditor_Label=Label PerspectiveEditor_Tooltip=Tooltip PerspectiveEditor_IconURI=Icon URI PerspectiveEditor_Controls=Controls -PerspectiveEditor_AddPartSashContainer=Add PartSashContainer -PerspectiveEditor_AddPartStack=Add PartStack -PerspectiveEditor_AddPart=Add Part -PerspectiveEditor_AddInputPart=Add InputPart -PerspectiveEditor_AddArea=Add Area -PerspectiveEditor_AddPlaceholder=Add Placeholder +PerspectiveEditor_AddPartSashContainer=PartSashContainer +PerspectiveEditor_AddPartStack=PartStack +PerspectiveEditor_AddPart=Part +PerspectiveEditor_AddInputPart=InputPart +PerspectiveEditor_AddArea=Area +PerspectiveEditor_AddPlaceholder=Placeholder PerspectiveStackEditor_Label=Perspective Stack PerspectiveStackEditor_Description=Perspective Stack Bla Bla Bla PerspectiveStackEditor_SelectedElement=Selected Element PerspectiveStackEditor_Perspectives=Perspectives -PerspectiveStackEditor_AddPerspective=Add Perspective +PerspectiveStackEditor_AddPerspective=Perspective PlaceholderEditor_Label=Placeholder PlaceholderEditor_Descriptor=Placeholder Bla Bla Bla Bla @@ -236,10 +239,10 @@ ToolBarEditor_HandledToolItem=Handled ToolItem ToolBarEditor_DirectToolItem=Direct ToolItem ToolBarEditor_ToolControl=Tool Control ToolBarEditor_Separator=Separator -ToolBarEditor_AddHandledToolItem=Add Handled ToolItem -ToolBarEditor_AddDirectToolItem=Add Direct ToolItem -ToolBarEditor_AddToolControl=Add Toolcontrol -ToolBarEditor_AddToolBarSeparator=Add Sepatator +ToolBarEditor_AddHandledToolItem=Handled ToolItem +ToolBarEditor_AddDirectToolItem=Direct ToolItem +ToolBarEditor_AddToolControl=Toolcontrol +ToolBarEditor_AddToolBarSeparator=Sepatator ToolBarSeparatorEditor_Label=Separator @@ -253,7 +256,7 @@ VBindingTableEditor_Contexts=Contexts VBindingTableEditor_Name=Name VBindingTableEditor_LabelDescription=Description VBindingTableEditor_BindingTables=Binding Tables -VBindingTableEditor_AddBindingTable=Add Binding Table +VBindingTableEditor_AddBindingTable=Binding Table AddonsEditor_ClassURI=Class URI AddonsEditor_TreeLabel=Addon @@ -311,7 +314,7 @@ BindingContextEditor_TreeLabelDescription=Binding Context Bla Bla Bla BindingContextEditor_Name=Name BindingContextEditor_Description=Description BindingContextEditor_Subcontexts=Subcontexts -BindingContextEditor_AddContext=Add Binding Context +BindingContextEditor_AddContext=Binding Context CommandParameterEditor_TreeLabel=Command Parameter CommandParameterEditor_TreeLabelDescritpion=Command Parameter Bla Bla Bla @@ -349,8 +352,8 @@ TrimBarEditor_TreeLabel=Window Trim TrimBarEditor_TreeLabelDescription=Window Trim bla bla bla TrimBarEditor_Side=Side TrimBarEditor_Controls=Controls -TrimBarEditor_AddToolBar=Add Toolbar -TrimBarEditor_AddToolControl=Add Toolcontrol +TrimBarEditor_AddToolBar=Toolbar +TrimBarEditor_AddToolControl=Toolcontrol TrimContributionEditor_TreeLabel=Trim Contribution @@ -362,7 +365,7 @@ TrimContributionEditor_Controls=Controls TrimmedWindowEditor_TrimBars=TrimBars TrimmedWindowEditor_TreeLabel=Trimmed Window -WindowEditor_AddMainMenu=Add Main Menu +WindowEditor_AddMainMenu=Main Menu WindowEditor_TreeLabel=Window WindowEditor_TreeLabelDescription=Window bla bla bla WindowEditor_Bounds=Bounds(x,y,w,h) @@ -377,7 +380,7 @@ WindowEditor_Windows=Windows WindowEditor_Controls=Controls WindowEditor_SharedElements=Shared Elements -VApplicationAddons_AddAddon=Add Addon +VApplicationAddons_AddAddon=Addon VApplicationAddons_TreeLabel=Addons VApplicationAddons_TreeLabelDescription=Addons bla bla bla bla VApplicationAddons_Commands=Commands @@ -385,27 +388,27 @@ VApplicationAddons_Commands=Commands VApplicationCategoriesEditor_TreeLabel=Command Categories VApplicationCategoriesEditor_TreeLabelDescription=Command Categories bla bla bla bla VApplicationCategoriesEditor_Categories=Categories -VApplicationCategoriesEditor_AddCategory=Add Category +VApplicationCategoriesEditor_AddCategory=Category VCommandEditor_TreeLabel=Commands VCommandEditor_TreeLabelDescription=Commands Bla Bla Bla Bla Bla VCommandEditor_Commands=Commands -VCommandEditor_AddCommand=Add Command +VCommandEditor_AddCommand=Command VHandlerEditor_TreeLabel=Handlers VHandlerEditor_TreeLabelDescription=Handlers Bla Bla Bla Bla Bla VHandlerEditor_Handlers=Handlers -VHandlerEditor_AddHandler=Add Handler +VHandlerEditor_AddHandler=Handler VMenuContributionsEditor_TreeLabel=Menu Contributions VMenuContributionsEditor_TreeLabelDescription=Menu Contributions Bla Bla Bla Bla Bla VMenuContributionsEditor_MenuContributions=Menu Contributions -VMenuContributionsEditor_AddMenuContribution=Add Menu Contribution +VMenuContributionsEditor_AddMenuContribution=Menu Contribution VMenuEditor_TreeLabel=Menus VMenuEditor_TreeLabelDescription=Menus Bla Bla Bla Bla Bla VMenuEditor_Menus=Menus -VMenuEditor_AddMenuContribution=Add Menu +VMenuEditor_AddMenuContribution=Menu VModelFragmentsEditor_TreeLabel=Fragments VModelFragmentsEditor_TreeLabelDescription=Fragments Bla Bla Bla Bla Bla @@ -418,45 +421,45 @@ VModelImportsEditor_Imports=Imports VPartDescriptor_TreeLabel=Part Descriptors VPartDescriptor_TreeLabelDescription=Part Descriptors Bla Bla Bla Bla Bla VPartDescriptor_Descriptors=Descriptors -VPartDescriptor_AddPartDescriptor=Add Descriptor +VPartDescriptor_AddPartDescriptor=Descriptor VToolBarContributionsEditor_TreeLabel=ToolBar Contributions VToolBarContributionsEditor_TreeLabelDescription=ToolBar Contributions Bla Bla Bla Bla Bla VToolBarContributionsEditor_Contributions=ToolBar Contributions -VToolBarContributionsEditor_AddToolBarContribution=Add ToolBar Contribution +VToolBarContributionsEditor_AddToolBarContribution=ToolBar Contribution VTrimContributionsEditor_TreeLabel=Trim Contributions VTrimContributionsEditor_TreeLabelDescription=Trim Contributions Bla Bla Bla Bla Bla VTrimContributionsEditor_Contributions=Trim Contributions -VTrimContributionsEditor_AddTrimContribution=Add Trim Contribution +VTrimContributionsEditor_AddTrimContribution=Trim Contribution VWindowControlEditor_TreeLabel=Controls VWindowControlEditor_TreeLabelDescription=Controls Bla Bla Bla Bla Bla VWindowControlEditor_Controls=Controls -VWindowControlEditor_AddPerspectiveStack=Add Perspective Stack -VWindowControlEditor_AddPartSashContainer=Add Part Sash Container -VWindowControlEditor_AddPartStack=Add Part Stack -VWindowControlEditor_AddPart=Add Part -VWindowControlEditor_AddInputPart=Add Input Part -VWindowControlEditor_AddArea=Add Area +VWindowControlEditor_AddPerspectiveStack=Perspective Stack +VWindowControlEditor_AddPartSashContainer=Part Sash Container +VWindowControlEditor_AddPartStack=Part Stack +VWindowControlEditor_AddPart=Part +VWindowControlEditor_AddInputPart=Input Part +VWindowControlEditor_AddArea=Area VWindowEditor_TreeLabel=Windows VWindowEditor_TreeLabelDescription=Windows Bla Bla Bla Bla Bla VWindowEditor_Windows=Windows -VWindowEditor_AddTrimmedWindow=Add Trimmed Window -VWindowEditor_AddWindow=Add Window +VWindowEditor_AddTrimmedWindow=Trimmed Window +VWindowEditor_AddWindow=Window VWindowSharedElementsEditor_TreeLabel=Shared Elements VWindowSharedElementsEditor_TreeLabelDescription=Shared Elements Bla Bla Bla Bla VWindowSharedElementsEditor_Controls=Controls -VWindowSharedElementsEditor_AddPartSashContainer=Add Part Sash Container -VWindowSharedElementsEditor_AddPart=Add Part -VWindowSharedElementsEditor_AddInputPart=Add Input Part +VWindowSharedElementsEditor_AddPartSashContainer=Part Sash Container +VWindowSharedElementsEditor_AddPart=Part +VWindowSharedElementsEditor_AddInputPart=Input Part VWindowTrimEditor_TreeLabel=Window Trims VWindowTrimEditor_TreeLabelDescription=Window Trims Bla Bla Bla Bla Bla VWindowTrimEditor_Controls=Controls -VWindowTrimEditor_AddWindowTrim=Add Window Trim +VWindowTrimEditor_AddWindowTrim=Window Trim AbstractIconDialog_IconName=IconName @@ -545,7 +548,7 @@ ImageTooltip_FileSize=File-Size VItemParametersEditor_TreeLabel=Parameters VItemParametersEditor_TreeLabelDescription=Parameters Bla Bla Bla VItemParametersEditor_Parameters=Parameters -VItemParametersEditor_AddParameter=Add Parameter +VItemParametersEditor_AddParameter=Parameter CoreExpressionEditor_TreeLabel=Core Expression CoreExpressionEditor_TreeLabelDescription=Core Expression Bla Bla Bla @@ -557,7 +560,7 @@ ExpressionIdDialog_DialogMessage=Find the expression id defined through the 'org ExpressionIdDialog_Id=Id CommandToStringConverter_None= -VRootBindingContexts_AddContext=Add Binding Context +VRootBindingContexts_AddContext=Binding Context VRootBindingContexts_TreeLabel=Binding Context VRootBindingContexts_TreeLabelDescription=Binding Context Bla Bla Bla VRootBindingContexts_Contexts=Binding Contexts diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 1a6899606d..ee0d897abe 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -159,6 +159,7 @@ import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; import org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider; import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor; import org.eclipse.jface.resource.ImageDescriptor; @@ -498,10 +499,20 @@ public void run() { public void menuAboutToShow(IMenuManager manager) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + boolean addSeparator = false; if (!s.isEmpty()) { List actions; if (s.getFirstElement() instanceof VirtualEntry) { actions = virtualEditors.get(((VirtualEntry) s.getFirstElement()).getId()).getActions(s.getFirstElement()); + + if (actions.size() > 0) { + MenuManager addMenu = new MenuManager(messages.ModelEditor_AddChild); + for (Action a : actions) { + addSeparator = true; + addMenu.add(a); + } + manager.add(addMenu); + } } else { final EObject o = (EObject) s.getFirstElement(); AbstractComponentEditor editor = getEditor(o.eClass()); @@ -511,8 +522,18 @@ public void menuAboutToShow(IMenuManager manager) { actions = new ArrayList(); } + if (actions.size() > 0) { + MenuManager addMenu = new MenuManager(messages.ModelEditor_AddChild); + for (Action a : actions) { + addSeparator = true; + addMenu.add(a); + } + manager.add(addMenu); + } + if (o.eContainer() != null) { - actions.add(new Action(messages.ModelEditor_Delete, ImageDescriptor.createFromImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_cross))) { + addSeparator = true; + manager.add(new Action(messages.ModelEditor_Delete, ImageDescriptor.createFromImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_cross))) { public void run() { if (o.eContainingFeature().isMany()) { Command cmd = RemoveCommand.create(ModelEditor.this.modelProvider.getEditingDomain(), o.eContainer(), o.eContainingFeature(), o); @@ -528,15 +549,15 @@ public void run() { } }); } - - } - - for (Action a : actions) { - manager.add(a); } } if (project != null) { + + if (addSeparator) { + manager.add(new Separator()); + } + Action nlsAction = new Action(messages.ModelEditor_ExternalizeStrings) { public void run() { ExternalizeStringHandler h = ContextInjectionFactory.make(ExternalizeStringHandler.class, context); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 9ac70683c2..3e30b5b6c0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -41,6 +41,7 @@ import org.eclipse.e4.ui.model.application.ui.MExpression; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; +import org.eclipse.e4.ui.model.application.ui.MUiFactory; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.MMenu; @@ -59,6 +60,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; @@ -99,6 +101,8 @@ public class MenuEditor extends AbstractComponentEditor { @Optional private IProject project; + private Action addExpression; + private static class Struct { private final String label; private final EClass eClass; @@ -142,6 +146,16 @@ public void run() { handleAdd(MenuPackageImpl.Literals.MENU_SEPARATOR, true); } }); + addExpression = new Action(Messages.MenuEditor_AddCoreExpression, createImageDescriptor(ResourceProvider.IMG_CoreExpression)) { + @Override + public void run() { + MUIElement e = (MUIElement) getMaster().getValue(); + Command cmd = SetCommand.create(getEditingDomain(), e, UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN, MUiFactory.INSTANCE.createCoreExpression()); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + }; } @Override @@ -523,6 +537,9 @@ protected void handleAdd(EClass eClass, boolean separator) { public List getActions(Object element) { ArrayList l = new ArrayList(super.getActions(element)); l.addAll(actions); + if (((MUIElement) getMaster().getValue()).getVisibleWhen() == null) { + l.add(addExpression); + } return l; } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index b6b9d8fd28..4a476842cd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -12,6 +12,7 @@ import java.util.ArrayList; import java.util.List; +import javax.annotation.PostConstruct; import javax.inject.Inject; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.conversion.Converter; @@ -31,10 +32,12 @@ import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; +import org.eclipse.e4.ui.model.application.ui.MUiFactory; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.ItemType; import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.FeaturePath; @@ -42,6 +45,8 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerProperties; @@ -73,10 +78,26 @@ public abstract class MenuItemEditor extends AbstractComponentEditor { @Optional protected IProject project; + private Action addExpression; + public MenuItemEditor() { super(); } + @PostConstruct + void init() { + addExpression = new Action(Messages.MenuItemEditor_AddCoreExpression, createImageDescriptor(ResourceProvider.IMG_CoreExpression)) { + @Override + public void run() { + MUIElement e = (MUIElement) getMaster().getValue(); + Command cmd = SetCommand.create(getEditingDomain(), e, UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN, MUiFactory.INSTANCE.createCoreExpression()); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + }; + } + @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { @@ -308,6 +329,15 @@ public FeaturePath[] getLabelProperties() { return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + if (((MUIElement) getMaster().getValue()).getVisibleWhen() == null) { + l.add(addExpression); + } + return l; + } + static class EObject2EClass extends Converter { Messages Messages; From 8b652f64aad08b9f87286b54c62d86850adb6ac3 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 20 Feb 2011 15:04:19 +0000 Subject: [PATCH 0314/1286] Bug 337622 - [ModelTooling] Show runtime Informations MContribution --- .../OSGI-INF/resources.properties | 4 + .../icons/full/obj16/class_default_obj.gif | Bin 0 -> 604 bytes .../icons/full/obj16/field_default_obj.gif | Bin 0 -> 118 bytes .../icons/full/obj16/field_private_obj.gif | Bin 0 -> 87 bytes .../icons/full/obj16/field_protected_obj.gif | Bin 0 -> 119 bytes .../e4/tools/emf/ui/internal/Messages.java | 1 + .../tools/emf/ui/internal/Messages.properties | 1 + .../emf/ui/internal/ResourceProvider.java | 4 + .../common/component/AddonsEditor.java | 20 +++ .../component/DirectMenuItemEditor.java | 29 ++++ .../component/DirectToolItemEditor.java | 28 ++++ .../common/component/HandlerEditor.java | 18 +++ .../common/component/MenuItemEditor.java | 4 +- .../internal/common/component/PartEditor.java | 20 +++ .../common/component/ToolControlEditor.java | 18 ++- .../common/component/ToolItemEditor.java | 4 +- .../common/objectdata/AccessLevel.java | 11 ++ .../common/objectdata/JavaAttribute.java | 106 +++++++++++++ .../common/objectdata/JavaMethod.java | 5 + .../common/objectdata/JavaObject.java | 52 ++++++ .../common/objectdata/ObjectViewer.java | 149 ++++++++++++++++++ 21 files changed, 469 insertions(+), 5 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/class_default_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_default_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_private_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_protected_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/AccessLevel.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaAttribute.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaMethod.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaObject.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties index 300c6bab2b..b4e477f3df 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties @@ -74,9 +74,13 @@ IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.WindowTrim=/icons/full/modelel IMG_org.eclipse.e4.tools.emf.ui.obj16.arrow_down=/icons/full/obj16/arrow_down.png IMG_org.eclipse.e4.tools.emf.ui.obj16.arrow_up=/icons/full/obj16/arrow_up.png IMG_org.eclipse.e4.tools.emf.ui.obj16.class_obj=/icons/full/obj16/class_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.obj16.class_default_obj=/icons/full/obj16/class_default_obj.gif IMG_org.eclipse.e4.tools.emf.ui.obj16.cross=/icons/full/obj16/cross.png IMG_org.eclipse.e4.tools.emf.ui.obj16.EPackage=/icons/full/obj16/EPackage.gif IMG_org.eclipse.e4.tools.emf.ui.obj16.field_public_obj=/icons/full/obj16/field_public_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.obj16.field_default_obj=/icons/full/obj16/field_default_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.obj16.field_private_obj=/icons/full/obj16/field_private_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.obj16.field_protected_obj=/icons/full/obj16/field_protected_obj.gif IMG_org.eclipse.e4.tools.emf.ui.obj16.headermenu=/icons/full/obj16/headermenu.png IMG_org.eclipse.e4.tools.emf.ui.obj16.table_add=/icons/full/obj16/table_add.png IMG_org.eclipse.e4.tools.emf.ui.obj16.table_delete=/icons/full/obj16/table_delete.png diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/class_default_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/class_default_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..4244a7f39d32695bf6e435665a8775ca8458ff19 GIT binary patch literal 604 zcmZ?wbhEHb6krfwc*ejG(zwmBe0@;cuHd#^aw&_I)0bG5Z?LS`AP_T0C~mH3{5-LQ z`I5;CWKtH%q%M+4StygbP%d?`QpQrX?B(h?%iWtchc7J5UDvYi(r)7>U$_3asM!T& z>pJQ-PiWja>BNHzXCGa;{_?I$nVnvZn{lJJWm`b(yu#!~<;%`&y7lV5ZjFmxt*d^m zn?W5=*3)}Zg4cw&@^$Ssn|hkIPS|_v=#7_mjT+p|TD+{={p~x0`u5J6eQcRshreA% zfL(ilTVHt4w506iRsH*B9lm?=(fg-ivr@ulrtGo_~DSg5$Gy-`IZW&i-Tf4sW=y`ac*j zkPZ}ovM@3*#VJ%rLAXf zqq4`sFxSP>&d$hK!&;_U-PY4D*WJ-7*GEKHzS&gCBhYK5H!BmfP>-y#{XB<>Oi#HQ znc0*~UL9ca5L7nNvMFF#$k^0R|L*vM@3*urTO=1VCyTm}NY6-T7y5 e%JVgg#C-#%9nL>I8Pt0Mmqq5h-si)_U=0A%@f=A2 literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_protected_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_protected_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..3377b1ebe7e36d3956926b027d48bb8765d768e2 GIT binary patch literal 119 zcmZ?wbhEHb6krfw*v!DNZ;r<98S1-ds;_I8-`uOTsaI)voy@96*;P$)>)I9m-JACB ze9nI`U;qQfpDc_F47?0FARfpJ1{ReKCp}m1wRnBj^abyNn&<@vT?<6HAM3SD+j9DV PEH{%>!u$U-IT)+~%PKA; literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 14b4a2c931..05b6cb0557 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -23,6 +23,7 @@ public class Messages { public String ModelTooling_Common_TabDefault; public String ModelTooling_Common_TabSupplementary; public String ModelEditor_AddChild; + public String ModelTooling_Common_TabRuntime; public String ModelTooling_UIElement_ToBeRendered; public String ModelTooling_UIElement_Visible; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index f21c4840af..e19d8ed591 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -19,6 +19,7 @@ ModelTooling_Common_FindEllipsis=Find ... ModelTooling_Common_TabDefault=Default ModelTooling_Common_TabSupplementary=Supplementary ModelEditor_AddChild=Add child +ModelTooling_Common_TabRuntime=Runtime ModelTooling_UIElement_ToBeRendered=To Be Rendered ModelTooling_UIElement_Visible=Visible diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java index 44381e6669..18a8568c5c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java @@ -79,9 +79,13 @@ public class ResourceProvider extends BasicResourceProvider { public static final String IMG_Obj16_arrow_down = "IMG_org.eclipse.e4.tools.emf.ui.obj16.arrow_down"; //$NON-NLS-1$ public static final String IMG_Obj16_arrow_up = "IMG_org.eclipse.e4.tools.emf.ui.obj16.arrow_up"; //$NON-NLS-1$ public static final String IMG_Obj16_class_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.class_obj"; //$NON-NLS-1$ + public static final String IMG_Obj16_class_default_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.class_default_obj"; //$NON-NLS-1$ public static final String IMG_Obj16_cross = "IMG_org.eclipse.e4.tools.emf.ui.obj16.cross"; //$NON-NLS-1$ public static final String IMG_Obj16_EPackage = "IMG_org.eclipse.e4.tools.emf.ui.obj16.EPackage"; //$NON-NLS-1$ public static final String IMG_Obj16_field_public_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.field_public_obj"; //$NON-NLS-1$ + public static final String IMG_Obj16_field_default_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.field_default_obj"; //$NON-NLS-1$ + public static final String IMG_Obj16_field_private_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.field_private_obj"; //$NON-NLS-1$ + public static final String IMG_Obj16_field_protected_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.field_protected_obj"; //$NON-NLS-1$ public static final String IMG_Obj16_headermenu = "IMG_org.eclipse.e4.tools.emf.ui.obj16.headermenu"; //$NON-NLS-1$ public static final String IMG_Obj16_table_add = "IMG_org.eclipse.e4.tools.emf.ui.obj16.table_add"; //$NON-NLS-1$ public static final String IMG_Obj16_table_delete = "IMG_org.eclipse.e4.tools.emf.ui.obj16.table_delete"; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index 1f0a3784a8..a5a75ac677 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -25,6 +25,7 @@ import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; +import org.eclipse.e4.tools.emf.ui.internal.common.objectdata.ObjectViewer; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; @@ -32,6 +33,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; @@ -39,6 +41,7 @@ import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -188,11 +191,28 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createStringListWidget(parent, Messages, this, Messages.AddonsEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + if (project == null) { + createInstanceInspection(folder); + } + folder.setSelection(0); return folder; } + private void createInstanceInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabRuntime); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + ObjectViewer objectViewer = new ObjectViewer(); + TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + + } + @Override public IObservableList getChildList(Object element) { return null; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index 886fa2eaba..c730065cac 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -24,6 +24,7 @@ import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; +import org.eclipse.e4.tools.emf.ui.internal.common.objectdata.ObjectViewer; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -36,11 +37,15 @@ import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; @@ -70,6 +75,30 @@ public Image getImage(Object element, Display display) { return null; } + @Override + protected CTabFolder createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { + if (!isImport) { + CTabFolder folder = super.createForm(parent, context, master, isImport); + createInstanceInspection(folder); + return folder; + } else { + return super.createForm(parent, context, master, isImport); + } + } + + private void createInstanceInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabRuntime); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + ObjectViewer objectViewer = new ObjectViewer(); + TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + + } + @Override public String getLabel(Object element) { return Messages.DirectMenuItemEditor_Label; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index d1cd523839..43af670ed2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -24,6 +24,7 @@ import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; +import org.eclipse.e4.tools.emf.ui.internal.common.objectdata.ObjectViewer; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -36,11 +37,15 @@ import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; @@ -110,6 +115,29 @@ public void widgetSelected(SelectionEvent e) { }); } + protected CTabFolder createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { + if (!isImport) { + CTabFolder folder = super.createForm(parent, context, master, isImport); + createInstanceInspection(folder); + return folder; + } else { + return super.createForm(parent, context, master, isImport); + } + } + + private void createInstanceInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabRuntime); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + ObjectViewer objectViewer = new ObjectViewer(); + TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + + } + @Override public String getLabel(Object element) { return Messages.DirectToolItemEditor_Label; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 6aea831483..8ae4bc5971 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -28,6 +28,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandlerCommandSelectionDialog; +import org.eclipse.e4.tools.emf.ui.internal.common.objectdata.ObjectViewer; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.commands.MHandler; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; @@ -38,6 +39,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; @@ -45,6 +47,7 @@ import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -212,11 +215,26 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + createInstanceInspection(folder); + folder.setSelection(0); return folder; } + private void createInstanceInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabRuntime); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + ObjectViewer objectViewer = new ObjectViewer(); + TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + + } + @Override public IObservableList getChildList(Object element) { return null; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 4a476842cd..3561de7cc4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -144,7 +144,7 @@ public Composite doGetEditor(Composite parent, Object object) { return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { + protected CTabFolder createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); CTabItem item = new CTabItem(folder, SWT.NONE); @@ -163,7 +163,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 47e13464d6..cf7dfbff41 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -34,6 +34,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartIconDialogEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.objectdata.ObjectViewer; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -54,6 +55,7 @@ import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; @@ -61,6 +63,7 @@ import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -294,11 +297,28 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + if (project == null) { + createInstanceInspection(folder); + } + folder.setSelection(0); return folder; } + private void createInstanceInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabRuntime); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + ObjectViewer objectViewer = new ObjectViewer(); + TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + + } + private void addToolBar() { MToolBar menu = MMenuFactory.INSTANCE.createToolBar(); setElementId(menu); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index 19bf8146b1..3b95184d43 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -21,6 +21,7 @@ import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; +import org.eclipse.e4.tools.emf.ui.internal.common.objectdata.ObjectViewer; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -31,6 +32,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; @@ -38,6 +40,7 @@ import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -181,12 +184,25 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - + createInstanceInspection(folder); folder.setSelection(0); return folder; } + private void createInstanceInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabRuntime); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + ObjectViewer objectViewer = new ObjectViewer(); + TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + + } + @Override public IObservableList getChildList(Object element) { // TODO Auto-generated method stub diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 2f2313ed40..8f100cf0e0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -106,7 +106,7 @@ public Composite doGetEditor(Composite parent, Object object) { return composite; } - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { + protected CTabFolder createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); CTabItem item = new CTabItem(folder, SWT.NONE); @@ -123,7 +123,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/AccessLevel.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/AccessLevel.java new file mode 100644 index 0000000000..fc5d6dc896 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/AccessLevel.java @@ -0,0 +1,11 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.objectdata; + +public enum AccessLevel { + PUBLIC(3), PROTECTED(2), DEFAULT(1), PRIVATE(0); + + public final int value; + + private AccessLevel(int value) { + this.value = value; + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaAttribute.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaAttribute.java new file mode 100644 index 0000000000..1ba218f151 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaAttribute.java @@ -0,0 +1,106 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.objectdata; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.Collections; +import java.util.List; +import javax.inject.Inject; + +public class JavaAttribute { + private JavaObject object; + private JavaAttribute attribute; + + private Field field; + + public JavaAttribute(JavaObject object, Field field) { + this.object = object; + this.field = field; + this.field.setAccessible(true); + } + + public JavaAttribute(JavaObject object, JavaAttribute attribute, Field field) { + this.object = object; + this.field = field; + this.field.setAccessible(true); + this.attribute = attribute; + } + + public boolean isInjected() { + return this.field.getAnnotation(Inject.class) != null; + } + + public boolean isStatic() { + return (this.field.getModifiers() & Modifier.STATIC) == Modifier.STATIC; + } + + public String getValue() { + if (field.getType().isPrimitive()) { + try { + return field.get(object.getInstance()) + ""; + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + try { + Object o = field.get(object.getInstance()); + if (o == null) { + return ""; + } else { + return "id=" + Integer.toHexString(System.identityHashCode(o)); + } + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + return ""; + } + + public List getAttributes() { + try { + if (field.getType().isPrimitive()) { + return Collections.emptyList(); + } else { + return new JavaObject(field.get(object.getInstance())).getAttributes(); + } + + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return Collections.emptyList(); + } + + public String getName() { + return field.getName(); + } + + public String getType() { + return field.getType().getSimpleName(); + } + + public AccessLevel getAccessLevel() { + int m = field.getModifiers(); + if ((m & Modifier.PUBLIC) == Modifier.PUBLIC) { + return AccessLevel.PUBLIC; + } else if ((m & Modifier.PRIVATE) == Modifier.PRIVATE) { + return AccessLevel.PRIVATE; + } else if ((m & Modifier.PROTECTED) == Modifier.PROTECTED) { + return AccessLevel.PROTECTED; + } else { + return AccessLevel.DEFAULT; + } + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaMethod.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaMethod.java new file mode 100644 index 0000000000..09dc0ea5c7 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaMethod.java @@ -0,0 +1,5 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.objectdata; + +public class JavaMethod { + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaObject.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaObject.java new file mode 100644 index 0000000000..841f9103da --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaObject.java @@ -0,0 +1,52 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.objectdata; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; + +public class JavaObject { + private Object instance; + private List attributes; + private List methods; + + public JavaObject(Object instance) { + this.instance = instance; + } + + public Object getInstance() { + return instance; + } + + public List getAttributes() { + if (attributes == null) { + initAttributes(); + } + return attributes; + } + + private void initAttributes() { + attributes = new ArrayList(); + + if (instance == null) { + return; + } + + Class clazz = instance.getClass(); + addDeclaredFields(clazz); + clazz = clazz.getSuperclass(); + while (clazz != null) { + addDeclaredFields(clazz); + clazz = clazz.getSuperclass(); + } + } + + private void addDeclaredFields(Class clazz) { + for (Field f : clazz.getDeclaredFields()) { + attributes.add(new JavaAttribute(this, f)); + } + } + + public String getName() { + return instance.getClass().getSimpleName(); + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java new file mode 100644 index 0000000000..0f9f70651c --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java @@ -0,0 +1,149 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.objectdata; + +import java.util.Collection; +import java.util.Collections; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.services.IResourcePool; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFValueProperty; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.jface.viewers.ViewerComparator; +import org.eclipse.swt.widgets.Composite; + +public class ObjectViewer { + public TreeViewer createViewer(Composite parent, EStructuralFeature feature, IObservableValue master, IResourcePool resourcePool) { + final TreeViewer viewer = new TreeViewer(parent); + viewer.setContentProvider(new ContentProviderImpl()); + viewer.setLabelProvider(new LabelProviderImpl(resourcePool)); + viewer.setComparator(new ViewerComparatorImpl()); + IEMFValueProperty property = EMFProperties.value(feature); + IObservableValue value = property.observeDetail(master); + value.addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + if (event.diff.getNewValue() != null) { + viewer.setInput(Collections.singleton(new JavaObject(event.diff.getNewValue()))); + } else { + viewer.setInput(Collections.emptyList()); + } + } + }); + return viewer; + } + + class ViewerComparatorImpl extends ViewerComparator { + @Override + public int compare(Viewer viewer, Object e1, Object e2) { + if (e1 instanceof JavaAttribute) { + if (e2 instanceof JavaAttribute) { + JavaAttribute a1 = (JavaAttribute) e1; + JavaAttribute a2 = (JavaAttribute) e2; + + if (a1.isStatic() && !a2.isStatic()) { + return -1; + } else if (!a1.isStatic() && a2.isStatic()) { + return 1; + } + + int rv = Integer.valueOf(a1.getAccessLevel().value).compareTo(a2.getAccessLevel().value); + if (rv == 0) { + return a1.getName().compareTo(a2.getName()); + } else { + return rv; + } + } else { + return -1; + } + } + return super.compare(viewer, e1, e2); + } + } + + class LabelProviderImpl extends StyledCellLabelProvider { + + private IResourcePool resourcePool; + + public LabelProviderImpl(IResourcePool resourcePool) { + this.resourcePool = resourcePool; + } + + @Override + public void update(ViewerCell cell) { + if (cell.getElement() instanceof JavaObject) { + JavaObject o = (JavaObject) cell.getElement(); + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_class_obj)); + cell.setText(o.getName()); + } else if (cell.getElement() instanceof JavaAttribute) { + JavaAttribute o = (JavaAttribute) cell.getElement(); + StyledString string = new StyledString(); + if (o.isInjected()) { + string.append(" ", StyledString.COUNTER_STYLER); + } + string.append(o.getName()); + string.append(" : " + o.getType() + " - " + o.getValue(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ //$NON-NLS-2$ + cell.setText(string.getString()); + cell.setStyleRanges(string.getStyleRanges()); + switch (o.getAccessLevel()) { + case PUBLIC: + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_field_public_obj)); + break; + case PRIVATE: + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_field_private_obj)); + break; + case DEFAULT: + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_field_default_obj)); + break; + default: + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_field_protected_obj)); + break; + } + } + + super.update(cell); + } + } + + class ContentProviderImpl implements ITreeContentProvider { + + public void dispose() { + + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + + } + + public Object[] getElements(Object inputElement) { + return ((Collection) inputElement).toArray(); + + } + + public Object[] getChildren(Object parentElement) { + if (parentElement instanceof JavaObject) { + return ((JavaObject) parentElement).getAttributes().toArray(); + } else if (parentElement instanceof JavaAttribute) { + return ((JavaAttribute) parentElement).getAttributes().toArray(); + } + return new Object[0]; + } + + public Object getParent(Object element) { + // TODO Auto-generated method stub + return null; + } + + public boolean hasChildren(Object element) { + return getChildren(element).length > 0; + } + + } +} From 5c025a10842862b3add94c523bbaeea4e2a3a64d Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 20 Feb 2011 18:19:57 +0000 Subject: [PATCH 0315/1286] Bug 337622 - [ModelTooling] Show runtime Informations MContribution --- .../OSGI-INF/resources.properties | 1 + .../icons/full/obj16/bullet_go.png | Bin 0 -> 410 bytes .../e4/tools/emf/ui/internal/Messages.java | 3 + .../tools/emf/ui/internal/Messages.properties | 5 +- .../emf/ui/internal/ResourceProvider.java | 1 + .../emf/ui/internal/common/ModelEditor.java | 2 +- .../common/component/AddonsEditor.java | 4 +- .../internal/common/component/AreaEditor.java | 2 +- .../component/BindingContextEditor.java | 2 +- .../common/component/BindingTableEditor.java | 2 +- .../common/component/CategoryEditor.java | 2 +- .../common/component/CommandEditor.java | 2 +- .../component/CommandParameterEditor.java | 2 +- .../component/DirectMenuItemEditor.java | 2 +- .../component/DirectToolItemEditor.java | 2 +- .../common/component/HandlerEditor.java | 4 +- .../common/component/KeyBindingEditor.java | 2 +- .../component/MenuContributionEditor.java | 2 +- .../internal/common/component/MenuEditor.java | 2 +- .../common/component/MenuSeparatorEditor.java | 2 +- .../common/component/ParameterEditor.java | 2 +- .../component/PartDescriptorEditor.java | 2 +- .../internal/common/component/PartEditor.java | 4 +- .../component/PartSashContainerEditor.java | 2 +- .../common/component/PartStackEditor.java | 2 +- .../common/component/PerspectiveEditor.java | 2 +- .../component/PerspectiveStackEditor.java | 2 +- .../common/component/PlaceholderEditor.java | 2 +- .../component/ToolBarContributionEditor.java | 2 +- .../common/component/ToolBarEditor.java | 2 +- .../component/ToolBarSeparatorEditor.java | 2 +- .../common/component/ToolControlEditor.java | 4 +- .../common/component/TrimBarEditor.java | 2 +- .../component/TrimContributionEditor.java | 2 +- .../common/component/WindowEditor.java | 2 +- .../common/objectdata/JavaAttribute.java | 93 +++++++++++++----- .../common/objectdata/ObjectViewer.java | 79 ++++++++++++++- 37 files changed, 190 insertions(+), 60 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/bullet_go.png diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties index b4e477f3df..4ad8645f14 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties @@ -89,6 +89,7 @@ IMG_org.eclipse.e4.tools.emf.ui.obj16.application_form=/icons/full/obj16/applica IMG_org.eclipse.e4.tools.emf.ui.obj16.chart_organisation=/icons/full/obj16/chart_organisation.png IMG_org.eclipse.e4.tools.emf.ui.obj16.error_obj=/icons/full/obj16/error_obj.gif IMG_org.eclipse.e4.tools.emf.ui.obj16.world_edit=/icons/full/obj16/world_edit.png +IMG_org.eclipse.e4.tools.emf.ui.obj16.bullet_go=/icons/full/obj16/bullet_go.png IMG_org.eclipse.e4.tools.emf.ui.wizban.fieldrefact_wiz=/icons/full/wizban/fieldrefact_wiz.png IMG_org.eclipse.e4.tools.emf.ui.wizban.import_wiz=/icons/full/wizban/import_wiz.png diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/bullet_go.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/bullet_go.png new file mode 100644 index 0000000000000000000000000000000000000000..bc4faa709e7980514e6aaa5360e6208e63248c65 GIT binary patch literal 410 zcmV;L0cHM)P)ZD2*!*kie8d0ob9Fh%G9Y=r;n&8^QUAkdX#Dq|D$hyKfc&Ml|8p0c z|4m?!%b@Oan%jHPb>P21W3>NYd-<1_&1WU%JGUHShzcVz!>-In&hVRPdDrmgA!XB=w& zAG5&bziK_hADjk6&({3E^3;U?OHcIvUwEwR|Gc9eKtr;M1&07*qoM6N<$ Ef*qF6bpQYW literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 05b6cb0557..7074aa2d62 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -597,4 +597,7 @@ public class Messages { public String ExternalizeStringHandler_Dialog_DialogTitle; public String ExternalizeStringHandler_Dialog_DialogMessage; + public String ObjectViewer_Tooltip_Value; + public String ObjectViewer_Tooltip_InjectionKey; + } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index e19d8ed591..cc70fd5380 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -593,4 +593,7 @@ ExternalizeStringHandler_Dialog_Key=Key ExternalizeStringHandler_Dialog_Value=Value ExternalizeStringHandler_Dialog_ShellTitle=Externalize Strings ExternalizeStringHandler_Dialog_DialogTitle=Externalize Strings -ExternalizeStringHandler_Dialog_DialogMessage=Externalizing manifest files extracts translatable strings and stores them in a properties file for multi-language support. \ No newline at end of file +ExternalizeStringHandler_Dialog_DialogMessage=Externalizing manifest files extracts translatable strings and stores them in a properties file for multi-language support. + +ObjectViewer_Tooltip_Value=Value +ObjectViewer_Tooltip_InjectionKey=Injection key \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java index 18a8568c5c..e0d490356c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java @@ -94,6 +94,7 @@ public class ResourceProvider extends BasicResourceProvider { public static final String IMG_Obj16_chart_organisation = "IMG_org.eclipse.e4.tools.emf.ui.obj16.chart_organisation"; //$NON-NLS-1$ public static final String IMG_Obj16_error_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.error_obj"; //$NON-NLS-1$ public static final String IMG_Obj16_world_edit = "IMG_org.eclipse.e4.tools.emf.ui.obj16.world_edit"; //$NON-NLS-1$ + public static final String IMG_Obj16_bullet_go = "IMG_org.eclipse.e4.tools.emf.ui.obj16.bullet_go"; //$NON-NLS-1$ public static final String IMG_Wizban16_fieldrefact_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.fieldrefact_wiz"; //$NON-NLS-1$ public static final String IMG_Wizban16_import_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.import_wiz"; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index ee0d897abe..9472e98c3c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -200,7 +200,7 @@ import org.eclipse.swt.widgets.TreeItem; public class ModelEditor { - private static final String CSS_CLASS_KEY = "org.eclipse.e4.ui.css.CssClassName"; //$NON-NLS-1$ + public static final String CSS_CLASS_KEY = "org.eclipse.e4.ui.css.CssClassName"; //$NON-NLS-1$ public static final String VIRTUAL_PART_MENU = ModelEditor.class.getName() + ".VIRTUAL_PART_MENU"; //$NON-NLS-1$ public static final String VIRTUAL_HANDLER = ModelEditor.class.getName() + ".VIRTUAL_HANDLER"; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index a5a75ac677..fe964e6d23 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -139,7 +139,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, if (getEditor().isModelFragment() && isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); @@ -208,7 +208,7 @@ private void createInstanceInspection(CTabFolder folder) { item.setControl(container); ObjectViewer objectViewer = new ObjectViewer(); - TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool); + TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool, Messages); viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java index 4e01654a52..146e20a65a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java @@ -218,7 +218,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java index 931cb7dd81..0b4f7d1776 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java @@ -156,7 +156,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index 28ebe2494c..5d5dc408a3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -150,7 +150,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java index 30f37e8d17..173cb52e9d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java @@ -114,7 +114,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 1dded8232f..f913a326be 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -149,7 +149,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java index 90e05c4042..cf6a42150f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java @@ -124,7 +124,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index c730065cac..f452e92082 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -94,7 +94,7 @@ private void createInstanceInspection(CTabFolder folder) { item.setControl(container); ObjectViewer objectViewer = new ObjectViewer(); - TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool); + TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool, Messages); viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index 43af670ed2..13b8741b59 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -133,7 +133,7 @@ private void createInstanceInspection(CTabFolder folder) { item.setControl(container); ObjectViewer objectViewer = new ObjectViewer(); - TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool); + TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool, Messages); viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 8ae4bc5971..558024b341 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -138,7 +138,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); @@ -230,7 +230,7 @@ private void createInstanceInspection(CTabFolder folder) { item.setControl(container); ObjectViewer objectViewer = new ObjectViewer(); - TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool); + TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool, Messages); viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index c3dd441b54..1c85beaeaf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -160,7 +160,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index c4b267fc23..c6e5731efc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -162,7 +162,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 3e30b5b6c0..3245d567c8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -227,7 +227,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index 17c051342e..19368822ec 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -112,7 +112,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java index b3f4572e71..4569c8d79e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java @@ -120,7 +120,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 0e1a99bcd7..65530756f1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -148,7 +148,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index cf7dfbff41..1939c2f44a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -170,7 +170,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context, if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); @@ -314,7 +314,7 @@ private void createInstanceInspection(CTabFolder folder) { item.setControl(container); ObjectViewer objectViewer = new ObjectViewer(); - TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool); + TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool, Messages); viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index d8d5257590..c8fe39bd2c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -204,7 +204,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 5dcb31a804..7b018a32b2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -173,7 +173,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index e594033288..51bf75568f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -213,7 +213,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 940a717592..2cbbcf6890 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -160,7 +160,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 53dfa3509e..6196954511 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -157,7 +157,7 @@ private Composite createForm(Composite parent, final EMFDataBindingContext conte if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index 7f1d781328..d0bcef2ddc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -163,7 +163,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index f0745f574e..683b7004c8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -191,7 +191,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index 29e386a7d2..b2b3382064 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -123,7 +123,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index 3b95184d43..fbb8f0941a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -142,7 +142,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); @@ -198,7 +198,7 @@ private void createInstanceInspection(CTabFolder folder) { item.setControl(container); ObjectViewer objectViewer = new ObjectViewer(); - TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool); + TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool, Messages); viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index af979b7ab9..c302c3da34 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -174,7 +174,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index f61fe50da2..024b7973e4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -150,7 +150,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 06c827f907..d16e3b9d13 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -179,7 +179,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); - return parent; + return folder; } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaAttribute.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaAttribute.java index 1ba218f151..5a0c9a7ec8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaAttribute.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaAttribute.java @@ -5,6 +5,12 @@ import java.util.Collections; import java.util.List; import javax.inject.Inject; +import javax.inject.Named; +import org.eclipse.e4.core.di.extensions.EventTopic; +import org.eclipse.e4.core.di.extensions.Preference; +import org.eclipse.e4.tools.services.Translation; +import org.eclipse.e4.ui.di.UIEventTopic; +import org.osgi.framework.FrameworkUtil; public class JavaAttribute { private JavaObject object; @@ -34,35 +40,25 @@ public boolean isStatic() { } public String getValue() { + Object value = getFieldValue(); if (field.getType().isPrimitive()) { - try { - return field.get(object.getInstance()) + ""; - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return value + ""; //$NON-NLS-1$ } else { - try { - Object o = field.get(object.getInstance()); - if (o == null) { - return ""; + if (value == null) { + return ""; //$NON-NLS-1$ + } else if (value instanceof String) { + return value.toString(); + } else { + String name; + if (value.getClass().isAnonymousClass()) { + name = value.getClass().getName().substring(value.getClass().getPackage().getName().length() + 1); } else { - return "id=" + Integer.toHexString(System.identityHashCode(o)); + name = value.getClass().getSimpleName(); } - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return name + " (id = " + Integer.toHexString(System.identityHashCode(value)) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ + } } - - return ""; } public List getAttributes() { @@ -103,4 +99,55 @@ public AccessLevel getAccessLevel() { return AccessLevel.DEFAULT; } } + + public String getContextKey() { + if (isInjected()) { + Named named = field.getAnnotation(Named.class); + if (named != null) { + return "@Named(" + named.value() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ + } + + Preference preference = field.getAnnotation(Preference.class); + if (preference != null) { + String path = preference.nodePath(); + if (path == null || path.trim().length() == 0) { + path = FrameworkUtil.getBundle(getFieldValue().getClass()).getSymbolicName(); + } + return "@Preference(" + preference.nodePath() + "/" + preference.value() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + EventTopic topic = field.getAnnotation(EventTopic.class); + + if (topic != null) { + return "@Topic(" + topic.value() + ")"; //$NON-NLS-1$//$NON-NLS-2$ + } + + UIEventTopic uiTopic = field.getAnnotation(UIEventTopic.class); + if (uiTopic != null) { + return "@UITopic(" + uiTopic.value() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ + } + + Translation translation = field.getAnnotation(Translation.class); + if (translation != null) { + return "@Translation(" + field.getType().getName() + ")"; //$NON-NLS-1$//$NON-NLS-2$ + } + + return field.getType().getName(); + } + + return ""; //$NON-NLS-1$ + } + + private Object getFieldValue() { + try { + return field.get(object.getInstance()); + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java index 0f9f70651c..318ddc6658 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java @@ -5,11 +5,15 @@ import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; +import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.jface.viewers.ColumnViewer; +import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.StyledCellLabelProvider; import org.eclipse.jface.viewers.StyledString; @@ -17,10 +21,16 @@ import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerCell; import org.eclipse.jface.viewers.ViewerComparator; +import org.eclipse.jface.window.ToolTip; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; public class ObjectViewer { - public TreeViewer createViewer(Composite parent, EStructuralFeature feature, IObservableValue master, IResourcePool resourcePool) { + public TreeViewer createViewer(Composite parent, EStructuralFeature feature, IObservableValue master, IResourcePool resourcePool, Messages messages) { final TreeViewer viewer = new TreeViewer(parent); viewer.setContentProvider(new ContentProviderImpl()); viewer.setLabelProvider(new LabelProviderImpl(resourcePool)); @@ -37,9 +47,66 @@ public void handleValueChange(ValueChangeEvent event) { } } }); + new TooltipSupportImpl(viewer, ToolTip.NO_RECREATE, false, resourcePool, messages); return viewer; } + class TooltipSupportImpl extends ColumnViewerToolTipSupport { + private IResourcePool resourcePool; + private Messages messages; + + protected TooltipSupportImpl(ColumnViewer viewer, int style, boolean manualActivation, IResourcePool resourcePool, Messages messages) { + super(viewer, style, manualActivation); + this.resourcePool = resourcePool; + this.messages = messages; + } + + @Override + protected Composite createViewerToolTipContentArea(Event event, ViewerCell cell, Composite parent) { + JavaAttribute attribute = (JavaAttribute) cell.getElement(); + + Composite container = new Composite(parent, SWT.NONE); + container.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_WHITE)); + container.setLayout(new GridLayout(2, false)); + + { + Composite headerContainer = new Composite(container, SWT.NONE); + headerContainer.setBackgroundMode(SWT.INHERIT_DEFAULT); + headerContainer.setData(ModelEditor.CSS_CLASS_KEY, "headerSectionContainer"); //$NON-NLS-1$ + GridLayout fl = new GridLayout(); + fl.marginHeight = 5; + fl.marginWidth = 5; + headerContainer.setLayout(fl); + headerContainer.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 2, 1)); + + Label iconLabel = new Label(parent, SWT.NONE); + iconLabel.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_bullet_go)); + + Label textLabel = new Label(headerContainer, SWT.NONE); + textLabel.setText(attribute.getName()); + textLabel.setData(ModelEditor.CSS_CLASS_KEY, "sectionHeader"); //$NON-NLS-1$ + } + + { + Label l = new Label(container, SWT.NONE); + l.setText(messages.ObjectViewer_Tooltip_Value); + + l = new Label(container, SWT.NONE); + l.setText(attribute.getValue()); + } + + { + Label l = new Label(container, SWT.NONE); + l.setText(messages.ObjectViewer_Tooltip_InjectionKey); + + l = new Label(container, SWT.NONE); + l.setText(attribute.getContextKey()); + } + + return container; + } + } + class ViewerComparatorImpl extends ViewerComparator { @Override public int compare(Viewer viewer, Object e1, Object e2) { @@ -76,6 +143,14 @@ public LabelProviderImpl(IResourcePool resourcePool) { this.resourcePool = resourcePool; } + @Override + public String getToolTipText(Object element) { + if (element instanceof JavaAttribute && ((JavaAttribute) element).isInjected()) { + return "Show Tooltip"; //$NON-NLS-1$ + } + return super.getToolTipText(element); + } + @Override public void update(ViewerCell cell) { if (cell.getElement() instanceof JavaObject) { @@ -86,7 +161,7 @@ public void update(ViewerCell cell) { JavaAttribute o = (JavaAttribute) cell.getElement(); StyledString string = new StyledString(); if (o.isInjected()) { - string.append(" ", StyledString.COUNTER_STYLER); + string.append(" ", StyledString.COUNTER_STYLER); //$NON-NLS-1$ } string.append(o.getName()); string.append(" : " + o.getType() + " - " + o.getValue(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ //$NON-NLS-2$ From 3263926d443157ed42763b89d635f0af8964d325 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sun, 20 Feb 2011 19:18:58 +0000 Subject: [PATCH 0316/1286] Bug 337622 - [ModelTooling] Show runtime Informations MContribution --- .../emf/ui/internal/common/objectdata/ObjectViewer.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java index 318ddc6658..970021dbe9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java @@ -42,6 +42,7 @@ public TreeViewer createViewer(Composite parent, EStructuralFeature feature, IOb public void handleValueChange(ValueChangeEvent event) { if (event.diff.getNewValue() != null) { viewer.setInput(Collections.singleton(new JavaObject(event.diff.getNewValue()))); + viewer.expandToLevel(2); } else { viewer.setInput(Collections.emptyList()); } @@ -73,13 +74,13 @@ protected Composite createViewerToolTipContentArea(Event event, ViewerCell cell, Composite headerContainer = new Composite(container, SWT.NONE); headerContainer.setBackgroundMode(SWT.INHERIT_DEFAULT); headerContainer.setData(ModelEditor.CSS_CLASS_KEY, "headerSectionContainer"); //$NON-NLS-1$ - GridLayout fl = new GridLayout(); + GridLayout fl = new GridLayout(2, false); fl.marginHeight = 5; fl.marginWidth = 5; headerContainer.setLayout(fl); headerContainer.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 2, 1)); - Label iconLabel = new Label(parent, SWT.NONE); + Label iconLabel = new Label(headerContainer, SWT.NONE); iconLabel.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_bullet_go)); Label textLabel = new Label(headerContainer, SWT.NONE); From 42f0111a89f87e997dfa63c5eafb0603ad714a4a Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 28 Feb 2011 18:04:06 +0000 Subject: [PATCH 0317/1286] Bug 321019 - [ModelTooling] Copy&Paste does not work in DetailArea --- .../ui/internal/common/component/ControlFactory.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 853b4558e2..6e678f3ae7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -76,7 +76,6 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.dnd.Clipboard; import org.eclipse.swt.dnd.TextTransfer; -import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.SelectionAdapter; @@ -112,21 +111,16 @@ public void paste() { } if (validate(o.toString())) { - t.insert(o.toString()); + t.paste(); } } public void cut() { - Clipboard cp = new Clipboard(t.getDisplay()); - cp.setContents(new Object[] { t.getSelectionText() }, new Transfer[] { TextTransfer.getInstance() }); - cp.dispose(); - t.insert(""); //$NON-NLS-1$ + t.cut(); } public void copy() { - Clipboard cp = new Clipboard(t.getDisplay()); - cp.setContents(new Object[] { t.getSelectionText() }, new Transfer[] { TextTransfer.getInstance() }); - cp.dispose(); + t.copy(); } public boolean validate(String text) { From 3b880b60cd0281ddb99af10461b38a36becdc262 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 2 Mar 2011 18:05:47 +0000 Subject: [PATCH 0318/1286] Bug 337302 - [Build] Add features to install forward compat layer in 3.x easily From 736bdd860626a752b9ba46d86c929a66a74ddc21 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 2 Mar 2011 18:27:32 +0000 Subject: [PATCH 0319/1286] Bug 337302 - [Build] Add features to install forward compat layer in 3.x easily From 3502596ac6a599e568e20cc6f1369c3cc4cc335f Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 3 Mar 2011 21:38:17 +0000 Subject: [PATCH 0320/1286] Bug 338860 - [ModelTooling] Highlight Model-Element in the Running UI --- .../internal/common/ControlHighlighter.java | 40 +++++++++++++++++++ .../emf/ui/internal/common/ModelEditor.java | 25 ++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ControlHighlighter.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ControlHighlighter.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ControlHighlighter.java new file mode 100644 index 0000000000..bfe4148208 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ControlHighlighter.java @@ -0,0 +1,40 @@ +package org.eclipse.e4.tools.emf.ui.internal.common; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; + +public class ControlHighlighter { + private Control control; + private Shell s; + + public ControlHighlighter(Control control) { + this.control = control; + } + + public void show(Shell dialog) { + s = new Shell(control.getShell(), SWT.NO_TRIM); + Point p1 = control.toDisplay(0, 0); + Point p2 = control.getSize(); + s.setBounds(p1.x, p1.y, p2.x, p2.y); + s.setBackground(s.getDisplay().getSystemColor(SWT.COLOR_RED)); + s.setAlpha(100); + s.open(); + s.addListener(SWT.MouseDown, new Listener() { + + public void handleEvent(Event event) { + hide(); + } + }); + } + + public void hide() { + if (s != null) { + s.dispose(); + s = null; + } + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 9472e98c3c..914692bdfd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -267,6 +267,8 @@ public class ModelEditor { private AbstractComponentEditor currentEditor; + private ControlHighlighter currentControlHighlighter; + public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project, final IResourcePool resourcePool) { this.resourcePool = resourcePool; this.modelProvider = modelProvider; @@ -565,6 +567,29 @@ public void run() { } }; manager.add(nlsAction); + } else { + if (addSeparator) { + manager.add(new Separator()); + } + + if (s.getFirstElement() instanceof MUIElement) { + final MUIElement el = (MUIElement) s.getFirstElement(); + if (el.getWidget() instanceof Control) { + manager.add(new Action("Show control") { + + public void run() { + if (currentControlHighlighter != null) { + currentControlHighlighter.hide(); + } + + currentControlHighlighter = new ControlHighlighter((Control) el.getWidget()); + currentControlHighlighter.show(viewer.getTree().getShell()); + } + }); + + } + } + } } }); From 86492ef4a86592944a45a1b3fd482f979baec1b6 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 4 Mar 2011 14:51:25 +0000 Subject: [PATCH 0321/1286] Bug 338938 - [ModelTooling] XMI-Editor should use Monospaced Text Font --- .../eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 914692bdfd..6a4f43ba29 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -163,6 +163,7 @@ import org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider; import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocumentPartitioner; @@ -346,6 +347,7 @@ private Control createXMITab(Composite composite) { SourceViewer viewer = new SourceViewer(composite, verticalRuler, styles); viewer.configure(new XMLConfiguration(resourcePool)); viewer.setEditable(project != null); + viewer.getTextWidget().setFont(JFaceResources.getTextFont()); final IDocument document = emfDocumentProvider.getDocument(); IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT }); From 234ef929a198267205fa67f4ad5a76e1ba36531c Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 4 Mar 2011 15:11:43 +0000 Subject: [PATCH 0322/1286] Bug 335767 - [ModelTooling] Add support for NLS --- .../properties/ExternalizeStringHandler.java | 46 +++++++++++++------ 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java index e7a699538c..e6525b7f63 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java @@ -8,7 +8,9 @@ import java.util.Properties; import javax.inject.Named; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.NullProgressMonitor; @@ -203,25 +205,29 @@ protected void okPressed() { if (els.length > 0) { try { IFile f = getBasePropertyFile(); - if (f.exists()) { - StringBuilder b = new StringBuilder(System.getProperty("line.separator")); - for (Object o : els) { - Entry e = (Entry) o; - b.append(e.key + " = " + e.value + System.getProperty("line.separator")); //$NON-NLS-1$//$NON-NLS-2$ - } - System.err.println("Appending: " + b); + StringBuilder b = new StringBuilder(System.getProperty("line.separator")); + for (Object o : els) { + Entry e = (Entry) o; + b.append(e.key + " = " + e.value + System.getProperty("line.separator")); //$NON-NLS-1$//$NON-NLS-2$ + } - ByteArrayInputStream stream = new ByteArrayInputStream(b.toString().getBytes()); + ByteArrayInputStream stream = new ByteArrayInputStream(b.toString().getBytes()); + if (f.exists()) { f.appendContents(stream, IFile.KEEP_HISTORY, new NullProgressMonitor()); + } else { + createParent(f.getParent()); + f.create(stream, IFile.KEEP_HISTORY, new NullProgressMonitor()); + } + + stream.close(); - for (Object o : els) { - Entry e = (Entry) o; - Command cmd = SetCommand.create(resource.getEditingDomain(), e.object, e.feature, "%" + e.key); + for (Object o : els) { + Entry e = (Entry) o; + Command cmd = SetCommand.create(resource.getEditingDomain(), e.object, e.feature, "%" + e.key); //$NON-NLS-1$ - if (cmd.canExecute()) { - resource.getEditingDomain().getCommandStack().execute(cmd); - } + if (cmd.canExecute()) { + resource.getEditingDomain().getCommandStack().execute(cmd); } } super.okPressed(); @@ -236,6 +242,18 @@ protected void okPressed() { } } + private void createParent(IContainer container) throws CoreException { + if (!container.exists()) { + + createParent(container.getParent()); + + if (container instanceof IFolder) { + IFolder f = (IFolder) container; + f.create(true, true, new NullProgressMonitor()); + } + } + } + private IFile getBasePropertyFile() throws CoreException, IOException { IFile file = project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$ String base = ProjectOSGiTranslationProvider.extractBasenameFromManifest(file); From 698dfb7d99cd2bbadb2f7e5bd3072915fd2f1d68 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 8 Mar 2011 23:22:13 +0000 Subject: [PATCH 0323/1286] Bug 339299 - [ModelTooling] Add scripting support --- .../build.properties | 3 +- .../org.eclipse.e4.tools.emf.ui/plugin.xml | 1 + ...org.eclipse.e4.tools.emf.ui.scripting.exsd | 112 ++++++++++++++++++ .../emf/ui/common/IScriptingSupport.java | 8 ++ .../e4/tools/emf/ui/internal/Messages.java | 1 + .../tools/emf/ui/internal/Messages.properties | 3 +- .../common/objectdata/JavaAttribute.java | 2 +- .../common/objectdata/ObjectViewer.java | 62 +++++++++- 8 files changed, 187 insertions(+), 5 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.scripting.exsd create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IScriptingSupport.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/build.properties b/bundles/org.eclipse.e4.tools.emf.ui/build.properties index b51da18453..e0bc710666 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/build.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/build.properties @@ -5,8 +5,7 @@ bin.includes = .,\ about.html,\ plugin.xml,\ css/,\ - OSGI-INF/,\ - OSGI-INF/resourceprovider.xml + OSGI-INF/ output.. = bin/ jars.compile.order = . source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml b/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml index b532b6c1b4..e01f13b902 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml +++ b/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml @@ -2,6 +2,7 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IScriptingSupport.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IScriptingSupport.java new file mode 100644 index 0000000000..ef2a071492 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IScriptingSupport.java @@ -0,0 +1,8 @@ +package org.eclipse.e4.tools.emf.ui.common; + +import java.util.Map; +import org.eclipse.swt.widgets.Shell; + +public interface IScriptingSupport { + public void openEditor(Shell shell, Object scope, Map additionalData); +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 7074aa2d62..0dd425e40c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -599,5 +599,6 @@ public class Messages { public String ObjectViewer_Tooltip_Value; public String ObjectViewer_Tooltip_InjectionKey; + public String ObjectViewer_Script; } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index cc70fd5380..a26f112bc9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -596,4 +596,5 @@ ExternalizeStringHandler_Dialog_DialogTitle=Externalize Strings ExternalizeStringHandler_Dialog_DialogMessage=Externalizing manifest files extracts translatable strings and stores them in a properties file for multi-language support. ObjectViewer_Tooltip_Value=Value -ObjectViewer_Tooltip_InjectionKey=Injection key \ No newline at end of file +ObjectViewer_Tooltip_InjectionKey=Injection key +ObjectViewer_Script=Execute Script \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaAttribute.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaAttribute.java index 5a0c9a7ec8..b47d1e832b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaAttribute.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaAttribute.java @@ -138,7 +138,7 @@ public String getContextKey() { return ""; //$NON-NLS-1$ } - private Object getFieldValue() { + public Object getFieldValue() { try { return field.get(object.getInstance()); } catch (IllegalArgumentException e) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java index 970021dbe9..100b7a731c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java @@ -2,9 +2,16 @@ import java.util.Collection; import java.util.Collections; +import java.util.HashMap; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.RegistryFactory; +import org.eclipse.e4.tools.emf.ui.common.IScriptingSupport; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; @@ -12,8 +19,13 @@ import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.viewers.ColumnViewer; import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.StyledCellLabelProvider; import org.eclipse.jface.viewers.StyledString; @@ -30,7 +42,7 @@ import org.eclipse.swt.widgets.Label; public class ObjectViewer { - public TreeViewer createViewer(Composite parent, EStructuralFeature feature, IObservableValue master, IResourcePool resourcePool, Messages messages) { + public TreeViewer createViewer(Composite parent, EStructuralFeature feature, IObservableValue master, IResourcePool resourcePool, final Messages messages) { final TreeViewer viewer = new TreeViewer(parent); viewer.setContentProvider(new ContentProviderImpl()); viewer.setLabelProvider(new LabelProviderImpl(resourcePool)); @@ -48,6 +60,54 @@ public void handleValueChange(ValueChangeEvent event) { } } }); + + IExtensionRegistry registry = RegistryFactory.getRegistry(); + IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.scripting"); //$NON-NLS-1$ + final IConfigurationElement[] elements = extPoint.getConfigurationElements(); + + if (elements.length > 0) { + final MenuManager mgr = new MenuManager(); + mgr.setRemoveAllWhenShown(true); + mgr.addMenuListener(new IMenuListener() { + + public void menuAboutToShow(IMenuManager manager) { + if (viewer.getSelection().isEmpty()) { + return; + } + + MenuManager scriptExecute = new MenuManager(messages.ObjectViewer_Script); + mgr.add(scriptExecute); + for (IConfigurationElement e : elements) { + final IConfigurationElement le = e; + scriptExecute.add(new Action(e.getAttribute("label")) { //$NON-NLS-1$ + @Override + public void run() { + try { + IScriptingSupport support = (IScriptingSupport) le.createExecutableExtension("class"); //$NON-NLS-1$ + Object o = ((IStructuredSelection) viewer.getSelection()).getFirstElement(); + Object mainObject = null; + if (o instanceof JavaObject) { + mainObject = ((JavaObject) o).getInstance(); + } else if (o instanceof JavaAttribute) { + mainObject = ((JavaAttribute) o).getFieldValue(); + } + + if (mainObject != null) { + support.openEditor(viewer.getControl().getShell(), mainObject, new HashMap()); + } + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + } + } + }); + + viewer.getControl().setMenu(mgr.createContextMenu(viewer.getControl())); + } + new TooltipSupportImpl(viewer, ToolTip.NO_RECREATE, false, resourcePool, messages); return viewer; } From 67fba58e2ae506e32798c8a1ee0ce33887a8ef84 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 8 Mar 2011 23:30:12 +0000 Subject: [PATCH 0324/1286] Bug 339299 - [ModelTooling] Add scripting support --- .../emf/ui/internal/common/ModelEditor.java | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 6a4f43ba29..f88e737630 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -48,6 +48,7 @@ import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; import org.eclipse.e4.tools.emf.ui.common.IExtensionLookup; import org.eclipse.e4.tools.emf.ui.common.IModelResource; +import org.eclipse.e4.tools.emf.ui.common.IScriptingSupport; import org.eclipse.e4.tools.emf.ui.common.ISelectionProviderService; import org.eclipse.e4.tools.emf.ui.common.MemoryTransfer; import org.eclipse.e4.tools.emf.ui.common.Util; @@ -502,7 +503,7 @@ public void run() { mgr.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + final IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); boolean addSeparator = false; if (!s.isEmpty()) { List actions; @@ -574,6 +575,30 @@ public void run() { manager.add(new Separator()); } + IExtensionRegistry registry = RegistryFactory.getRegistry(); + IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.scripting"); //$NON-NLS-1$ + final IConfigurationElement[] elements = extPoint.getConfigurationElements(); + + if (elements.length > 0 && !s.isEmpty() && s.getFirstElement() instanceof MApplicationElement) { + MenuManager scriptExecute = new MenuManager(messages.ObjectViewer_Script); + manager.add(scriptExecute); + for (IConfigurationElement e : elements) { + final IConfigurationElement le = e; + scriptExecute.add(new Action(e.getAttribute("label")) { //$NON-NLS-1$ + @Override + public void run() { + try { + IScriptingSupport support = (IScriptingSupport) le.createExecutableExtension("class"); //$NON-NLS-1$ + support.openEditor(viewer.getControl().getShell(), s.getFirstElement(), new HashMap()); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + } + } + if (s.getFirstElement() instanceof MUIElement) { final MUIElement el = (MUIElement) s.getFirstElement(); if (el.getWidget() instanceof Control) { From 52702ba6f89029837e901a40969f1ce7ff1baf67 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 8 Mar 2011 23:49:05 +0000 Subject: [PATCH 0325/1286] Bug 339299 - [ModelTooling] Add scripting support --- .../e4/tools/emf/ui/internal/Messages.java | 2 + .../tools/emf/ui/internal/Messages.properties | 2 + .../internal/common/ControlHighlighter.java | 14 ++-- .../emf/ui/internal/common/ModelEditor.java | 65 +++++++++---------- 4 files changed, 42 insertions(+), 41 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 0dd425e40c..475fb90bde 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -588,6 +588,8 @@ public class Messages { public String ModelEditor_Form; public String ModelEditor_XMI; public String ModelEditor_ExternalizeStrings; + public String ModelEditor_Script; + public String ModelEditor_ShowControl; public String ExternalizeStringHandler_Dialog_ElementName; public String ExternalizeStringHandler_Dialog_AttributeName; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index a26f112bc9..b45be4ff6b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -586,6 +586,8 @@ ModelEditor_Delete=Remove ModelEditor_Form=Form ModelEditor_XMI=XMI ModelEditor_ExternalizeStrings=Externalize Strings +ModelEditor_Script=Execute Script +ModelEditor_ShowControl=Show control ExternalizeStringHandler_Dialog_ElementName=Element ExternalizeStringHandler_Dialog_AttributeName=Attribute diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ControlHighlighter.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ControlHighlighter.java index bfe4148208..da74a4d7e7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ControlHighlighter.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ControlHighlighter.java @@ -8,14 +8,12 @@ import org.eclipse.swt.widgets.Shell; public class ControlHighlighter { - private Control control; - private Shell s; + private static Shell s; - public ControlHighlighter(Control control) { - this.control = control; - } - - public void show(Shell dialog) { + public static void show(Control control) { + if (s != null && !s.isDisposed()) { + s.dispose(); + } s = new Shell(control.getShell(), SWT.NO_TRIM); Point p1 = control.toDisplay(0, 0); Point p2 = control.getSize(); @@ -31,7 +29,7 @@ public void handleEvent(Event event) { }); } - public void hide() { + public static void hide() { if (s != null) { s.dispose(); s = null; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index f88e737630..c5f16b0401 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -269,8 +269,6 @@ public class ModelEditor { private AbstractComponentEditor currentEditor; - private ControlHighlighter currentControlHighlighter; - public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project, final IResourcePool resourcePool) { this.resourcePool = resourcePool; this.modelProvider = modelProvider; @@ -557,6 +555,36 @@ public void run() { } } + IExtensionRegistry registry = RegistryFactory.getRegistry(); + IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.scripting"); //$NON-NLS-1$ + final IConfigurationElement[] elements = extPoint.getConfigurationElements(); + + if (elements.length > 0 && !s.isEmpty() && s.getFirstElement() instanceof MApplicationElement) { + if (addSeparator) { + manager.add(new Separator()); + } + + addSeparator = false; + + MenuManager scriptExecute = new MenuManager(messages.ModelEditor_Script); + manager.add(scriptExecute); + for (IConfigurationElement e : elements) { + final IConfigurationElement le = e; + scriptExecute.add(new Action(e.getAttribute("label")) { //$NON-NLS-1$ + @Override + public void run() { + try { + IScriptingSupport support = (IScriptingSupport) le.createExecutableExtension("class"); //$NON-NLS-1$ + support.openEditor(viewer.getControl().getShell(), s.getFirstElement(), new HashMap()); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + } + } + if (project != null) { if (addSeparator) { @@ -575,42 +603,13 @@ public void run() { manager.add(new Separator()); } - IExtensionRegistry registry = RegistryFactory.getRegistry(); - IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.scripting"); //$NON-NLS-1$ - final IConfigurationElement[] elements = extPoint.getConfigurationElements(); - - if (elements.length > 0 && !s.isEmpty() && s.getFirstElement() instanceof MApplicationElement) { - MenuManager scriptExecute = new MenuManager(messages.ObjectViewer_Script); - manager.add(scriptExecute); - for (IConfigurationElement e : elements) { - final IConfigurationElement le = e; - scriptExecute.add(new Action(e.getAttribute("label")) { //$NON-NLS-1$ - @Override - public void run() { - try { - IScriptingSupport support = (IScriptingSupport) le.createExecutableExtension("class"); //$NON-NLS-1$ - support.openEditor(viewer.getControl().getShell(), s.getFirstElement(), new HashMap()); - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - } - } - if (s.getFirstElement() instanceof MUIElement) { final MUIElement el = (MUIElement) s.getFirstElement(); if (el.getWidget() instanceof Control) { - manager.add(new Action("Show control") { + manager.add(new Action(messages.ModelEditor_ShowControl) { public void run() { - if (currentControlHighlighter != null) { - currentControlHighlighter.hide(); - } - - currentControlHighlighter = new ControlHighlighter((Control) el.getWidget()); - currentControlHighlighter.show(viewer.getTree().getShell()); + ControlHighlighter.show((Control) el.getWidget()); } }); From 2b3127674c9c68ba77d0a63025269861bd96772f Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 9 Mar 2011 00:01:40 +0000 Subject: [PATCH 0326/1286] Bug 339299 - [ModelTooling] Add scripting support From 165542978d4f046ca95a6810baac4dd19115af69 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 9 Mar 2011 00:10:49 +0000 Subject: [PATCH 0327/1286] Bug 339299 - [ModelTooling] Add scripting support From 550a6044749185d819562ee375b5e6f16bbf0905 Mon Sep 17 00:00:00 2001 From: Andrew Niefer Date: Wed, 9 Mar 2011 18:30:10 +0000 Subject: [PATCH 0328/1286] bug 339301 - add tools.emf.ui.script.js --- .../org.eclipse.e4.core.tools.feature/feature.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/features/org.eclipse.e4.core.tools.feature/feature.xml b/features/org.eclipse.e4.core.tools.feature/feature.xml index 1ce569e119..488acb9168 100644 --- a/features/org.eclipse.e4.core.tools.feature/feature.xml +++ b/features/org.eclipse.e4.core.tools.feature/feature.xml @@ -58,5 +58,20 @@ install-size="0" version="0.0.0" unpack="false"/> + + + + + From 983ca10a9a60daffc1290a42713acbd2a3ed5c09 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 10 Mar 2011 22:06:50 +0000 Subject: [PATCH 0329/1286] Bug 339598 - [ModelTooling] Add UI-Widget-Tree inspector --- .../META-INF/MANIFEST.MF | 3 +- .../OSGI-INF/resources.properties | 26 +++ .../icons/full/widgets/button_obj.gif | Bin 0 -> 344 bytes .../icons/full/widgets/ccombo_obj.gif | Bin 0 -> 634 bytes .../icons/full/widgets/checkbox_obj.gif | Bin 0 -> 343 bytes .../icons/full/widgets/clabel_obj.gif | Bin 0 -> 341 bytes .../icons/full/widgets/comboviewer_obj.gif | Bin 0 -> 946 bytes .../icons/full/widgets/composite_obj.gif | Bin 0 -> 377 bytes .../icons/full/widgets/coolbar_obj.gif | Bin 0 -> 613 bytes .../icons/full/widgets/ctabfolder_obj.gif | Bin 0 -> 367 bytes .../icons/full/widgets/group_obj.gif | Bin 0 -> 398 bytes .../icons/full/widgets/label_obj.gif | Bin 0 -> 582 bytes .../icons/full/widgets/progressbar_obj.gif | Bin 0 -> 327 bytes .../icons/full/widgets/radiobutton_obj.gif | Bin 0 -> 166 bytes .../icons/full/widgets/sashform_obj.gif | Bin 0 -> 378 bytes .../icons/full/widgets/separator_obj.gif | Bin 0 -> 868 bytes .../icons/full/widgets/shell_obj.gif | Bin 0 -> 358 bytes .../icons/full/widgets/tabfolder_obj.gif | Bin 0 -> 607 bytes .../icons/full/widgets/table_obj.gif | Bin 0 -> 573 bytes .../icons/full/widgets/text_obj.gif | Bin 0 -> 343 bytes .../icons/full/widgets/toolbar_obj.gif | Bin 0 -> 607 bytes .../icons/full/widgets/toolitemcheck_obj.gif | Bin 0 -> 354 bytes .../icons/full/widgets/toolitemdrop_obj.gif | Bin 0 -> 607 bytes .../icons/full/widgets/toolitempush_obj.gif | Bin 0 -> 216 bytes .../icons/full/widgets/toolitemradio_obj.gif | Bin 0 -> 563 bytes .../full/widgets/toolitemseparator_obj.gif | Bin 0 -> 608 bytes .../icons/full/widgets/tree_obj.gif | Bin 0 -> 372 bytes .../e4/tools/emf/ui/internal/Messages.java | 3 +- .../tools/emf/ui/internal/Messages.properties | 3 +- .../emf/ui/internal/ResourceProvider.java | 26 +++ .../common/component/AddonsEditor.java | 2 +- .../common/component/ApplicationEditor.java | 26 +++ .../internal/common/component/AreaEditor.java | 18 ++ .../component/DirectMenuItemEditor.java | 2 +- .../component/DirectToolItemEditor.java | 2 +- .../common/component/HandlerEditor.java | 2 +- .../internal/common/component/MenuEditor.java | 18 ++ .../common/component/MenuItemEditor.java | 19 ++ .../common/component/MenuSeparatorEditor.java | 27 ++- .../internal/common/component/PartEditor.java | 15 +- .../component/PartSashContainerEditor.java | 24 +++ .../common/component/PartStackEditor.java | 24 +++ .../common/component/PerspectiveEditor.java | 18 ++ .../component/PerspectiveStackEditor.java | 24 +++ .../common/component/PlaceholderEditor.java | 25 +++ .../component/ToolBarContributionEditor.java | 24 +++ .../component/ToolBarSeparatorEditor.java | 26 +++ .../common/component/ToolControlEditor.java | 22 ++- .../common/component/ToolItemEditor.java | 19 ++ .../common/component/TrimBarEditor.java | 24 +++ .../component/TrimContributionEditor.java | 24 +++ .../common/component/WindowEditor.java | 18 ++ .../internal/common/uistructure/UIViewer.java | 72 ++++++++ .../uistructure/WidgetContentProvider.java | 113 ++++++++++++ .../uistructure/WidgetLabelProvider.java | 165 ++++++++++++++++++ 55 files changed, 803 insertions(+), 11 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/button_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/ccombo_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/checkbox_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/clabel_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/comboviewer_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/composite_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/coolbar_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/ctabfolder_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/group_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/label_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/progressbar_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/radiobutton_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/sashform_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/separator_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/shell_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/tabfolder_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/table_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/text_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolbar_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemcheck_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemdrop_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitempush_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemradio_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemseparator_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/tree_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetContentProvider.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 8af951f288..92554df36a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -29,7 +29,8 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", javax.annotation;bundle-version="1.0.0", org.eclipse.e4.tools.services;bundle-version="1.0.0", org.eclipse.e4.core.di.extensions;bundle-version="0.9.0", - org.eclipse.jface.text;bundle-version="3.7.0" + org.eclipse.jface.text;bundle-version="3.7.0", + org.eclipse.e4.ui.widgets;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Import-Package: javax.inject;version="1.0.0", org.eclipse.core.runtime.jobs, diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties index 4ad8645f14..43901a3af5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties @@ -98,6 +98,32 @@ IMG_org.eclipse.e4.tools.emf.ui.wizban.newexp_wiz=/icons/full/wizban/newexp_wiz. IMG_org.eclipse.e4.tools.emf.ui.wizban.typerefact_wiz=/icons/full/wizban/typerefact_wiz.png IMG_org.eclipse.e4.tools.emf.ui.wizban.extstr_wiz=/icons/full/wizban/extstr_wiz.png +IMG_org.eclipse.e4.tools.emf.ui.widgets.ctabfolder_obj = /icons/full/widgets/ctabfolder_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.tabfolder_obj = /icons/full/widgets/tabfolder_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.shell_obj = /icons/full/widgets/shell_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.group_obj = /icons/full/widgets/group_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.ccombo_obj = /icons/full/widgets/ccombo_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.comboviewer_obj = /icons/full/widgets/comboviewer_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.table_obj = /icons/full/widgets/table_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.tree_obj = /icons/full/widgets/tree_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.sashform_obj = /icons/full/widgets/sashform_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.text_obj = /icons/full/widgets/text_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.label_obj = /icons/full/widgets/label_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.button_obj = /icons/full/widgets/button_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.composite_obj = /icons/full/widgets/composite_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.progressbar_obj = /icons/full/widgets/progressbar_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.separator_obj = /icons/full/widgets/separator_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.clabel_obj = /icons/full/widgets/clabel_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.coolbar_obj = /icons/full/widgets/coolbar_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.toolbar_obj = /icons/full/widgets/toolbar_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemcheck_obj = /icons/full/widgets/toolitemcheck_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemdrop_obj = /icons/full/widgets/toolitemdrop_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitempush_obj = /icons/full/widgets/toolitempush_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemradio_obj = /icons/full/widgets/toolitemradio_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemseparator_obj = /icons/full/widgets/toolitemseparator_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.checkbox_obj = /icons/full/widgets/checkbox_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.group_obj = /icons/full/widgets/group_obj.gif + COLOR_org.eclipse.e4.tools.emf.ui.XML_COMMENT=rgb(128, 0, 0) COLOR_org.eclipse.e4.tools.emf.ui.PROC_INSTR=rgb(128, 128, 128) COLOR_org.eclipse.e4.tools.emf.ui.STRING=rgb(0, 128, 0) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/button_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/button_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..d143fcf6213917833ea4b7a97bc919b3ff390760 GIT binary patch literal 344 zcmZ?wbhEHb6krfwxXQpVsiCX0y05lma!tvkyzCjdIWuCD=f@_`d->|i<0tPPKY2TG z+Rix(4$N7wfA#uPbqy2t9=Nvmz|{+v9$mQf&^K!7Y@pP_1FP4c^od$Bd*Ojq>rbs( ze{#~a)q4+K+k5cph0BjFTz>fI$vfMiRga#$)o|Nv=)J+vd;O!QZ=bz*XX6^Vc-5}| zV8B2wQ2fcl$iScjgg^lD69ZeR!?Xeq9jX2kDus+0R`buXYBxkgu8)|abwFs1mZW#; zoWvQ@a~M}|D6%l=>#i0qFW^{n_>^#?gO#A1K$D;hn~sRKki4*vf_%5Uyn>8`j*_Q{^jIO%g&v)ZTp$@>>24<)05I?y?pg0CS^`y#;mY}`C*CkV^ZgMMK1A*S`rYu zC?IyBh5s5$|24KjEA4_;xr8lmo^V{lZL_xfCT)*RdR`m!y*B**^Y7R1zi|~SvMVO! zRrcAt`uhaMynO%j%lAJ90reT}TZ?MC-+cP@{>yI%_kd^be!O`92Va+8UdnlB|Hn-CS`;OH<*K3-z2gs?(Fbda5cx4W-myyPB9A(e!fAZG_3 zXJ_?z@zdgh$_bG{9u9sko@();w?z3>6T*W69qjGBwBl`TTy5pF6T+6Q@b}k}28H+t8Yq1J*FjxZsdPxxm literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/checkbox_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/checkbox_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..9cacb96dca98b0bdcf7e7bb62e491f8760b244ce GIT binary patch literal 343 zcmZ?wbhEHb6krfwxXQq=a?`PC3wLx+TirNeg?n^`Z$foW?Q~|F3@j|LW)e*FXQi`}P0h@Bcsk{(tl9|Jz^xzx?_C z`q%$=zyH7g{r~fy|G)qJ|M=(sx4-{?{rmsx|NlS#|Ns3D0u0mxia%Kx85qF&s24FDJgfQZ>p<)`ta-BXQ1q#^EY3-c>nX`*WcfN{wc2QK6mrQ+t0t>eg5_0!>{M>f4=$%WB|#Z zZ$JO4ZfvV=Y`yyYadTTkPft}(PxX|ErBf%C%$=6Ed``yVS=n=^=KufypMhea_>+Z^ zfkBf&2V@e+PYi5D2c{Hw=t%XSP`P*{$7-(A<#eyLe!hn;vmbt2WvHI`lKEnWLU(uN z!pH?Ji~ZY@ZrJb?+cc|))Jk!%$ux>`vWbZ*Iw{Bt_VqFMa|tRq$;tE0g-sR4PgeF#Q5xul60fr4NY|;Wg2PPbJ zVwNS`tbGp@AUfU@cHWT`R?@ld4PxR^!k5;gnomA)#u}c zhk%5Ke~OEHii>=Zj(3obc$JcLmXdUvm2an2n`1Uio_U`lnZ~f4+PF z>;A*fZ{B{tb@%Jzr(ZvP{*{!`my*?A-@2-%X<0+ts=AgH4Q(r5zW(;<^Us*%jsu4; zz5n>bJAbiGc)wxvB=dx6R>?DLQ)fA3%yrC|>yka+J$Ip3!D8RyW&S10{Y#ezmaWhZ z>(vSG)r*{97&FN@cCvBYWV3{6mOx!;vs}tn?YjDQ#p#zDFTOc=^PS(EtHJZGrLMS@ zxAtz;=KFJwJ&##(qhTWp(uo42_JHR8(cuHMOElEUoOVZEPJJ?aa(gEoNxz z=*sEKD<~>YR#VrQAt|wA=T2!JadDw20Y294JNAhSFmtnr9OUIV#L9n}L5k!0Spjw? zf%9B)52P5`m~ILP-eTf>z$qmvEGiZi>FzGT#`gNP)K~Y&sPI08Mu&iAM_##>iijjv z?y1UdlT;L)To$<$cx}j7S+s;>vXb)*14$#6IqgcpTWlIPUGkiw5wOT4Q)%fkVV4dj HMh0sDrS0%9 literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/ctabfolder_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/ctabfolder_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..7a93c669a28b9def0f4417da1100024b1be8f1e5 GIT binary patch literal 367 zcmZ?wbhEHb6krfwxXQp_;h1FMnCRdUxpLDncdtMP&qynecq{j4O^3<&TF2zc@1$E%+|UjoS=Ki>TO`R>=R55IqZ{`2R{@8944{Q2|m->aWL zKK}mo<;>-2wSqn`*RInPZ;1MvqqO@|N8s>Xnv{m_x{P_F+_xk<%{Qmv^|NQ;_`TYKWgM@yAgZ}^j{r>*` z|NexBfP{yCii>-Si+qrdcaV;Fm6CLpl60GuZ>OASq?&4=m~EVtaG95t|Nj2|{{H{} z{{R30A^8LW002G!EC2ui01yBW000K7K;LahEEJzX!l4J0ZF|0RYJ+ sEX@Hu0L4BOJ3KurEh_=r+&dIL5P9O`;}AXz=;`X~KJD)B@IFBRJC?lOwg3PC literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/label_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/label_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..cf00ad26ffb8b308cd51369b5544187ba14c8002 GIT binary patch literal 582 zcmZ?wbhEHb6krfwc*el+|KEQ`2ByFNfb{>9HxB;$|M%MMg$c=KiAffnU0EHSnI0ZG zo}Rj$o$3Go|Gjl%X=g`fa-zkZn@hYr^lx8Ze*gBGmZr?-PY$LeSoL&fT{zZw<#^?- z^Zie5FFCv^;po<^6T9-y?k~G~tntIMt+!53m{KJ>rCNUH;(#3s19vPAI<_Ht=aSGX z`-*NJt+{))f9Il*or}UQ?an>5CHu;rqAUA~uk0$aJHlGmMYTG&wxoY-SeU>>Pnvxk4KoB=>j9Z)=rbQzy5! zUj9J0>d{H+d%HE(HL4xx(>~a*b8w>Wp@~MvrkU)YWYQJO(Hqa%6U#k4m9Ia6Z(g?0 zyd2@#IUbA(p4Wi+ftK zKyM8H{7m85>B3v8#QS4-|NsC0@83TLUDb&R|B&!6LQPJ_*M^yauf*I>*}Ex~u~fyQ_)2jxlb39Alc%b* zRD#82RtC!?rTFG7T?N-z_k6d+xEQ+wiXzL|xg>`d%R$~=6$(hQy5(u@q89I6UpVsf(F(`U*ua&xgLEL^mB$wKet LD^{*_WUvMRR+oct literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/radiobutton_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/radiobutton_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..3901d05500d31f28a9df58e4089ec4e0c7a4b691 GIT binary patch literal 166 zcmZ?wbhEHb6krfw*v!D-8J~Le=AGqxw{$J)&1y`2^y$vgn_K?>|Ifg{03m@4WT5zy zg^_`QlR*b02r`3#CD`Dk=jy!{q6b}1GBFA~5{OYu5NUO+2vw9T$*r5bK#sAArTuK9 zkd{o1-K>Ne$`TVfq$ccm{kQ3|XQIQ3s|`Cm9SjVTHgDXhz>pGmW=lbu-*OiQ25SIK CNI6FU literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/sashform_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/sashform_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..bbbdd559a918bb27921ae8feb93d597c3c4cfb75 GIT binary patch literal 378 zcmZ?wbhEHb6krfwxXQrr^Vh#0KmUIF@$cJ@zcmwfCsnV`Y1vfJzNNf(XZ@7DP1E+b z%s7})HtGH6-(SA}O{iL#TDLZ{ab0ouw(N=t`BlAdKK}an_0O}nKTB%6UVixXQD%Ty=D{`L=jry~!AaOm5~t@6>9J7(sa^L<>ggUVxK&9nue2_s@MWCw)qRi)SZ-7`Bw7@u3E#V z;v}ug#Kg=juyy+m2`3R%DJe!q)`N$Sh&TzWGMr=JKYN}**oo)*jhi>!?zlKISOWmH C)28qM literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/separator_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/separator_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..579587dccbec503e6dbd01273afc3f362288064a GIT binary patch literal 868 zcmZ?wbhEHb6krfw_|Cxa^Vh#0KmUIF@$cJ@zcmwfCsnV`Y1vfJzNNf(XZ@7DP1E+b z%s7})HtGH6-(SA}O{iL#TDLZ{ab0ouw(N=t`BlAdKK}an_0O}nKTB%6UVixXNbQm zZi;N#65GD*$FDz^pME*>=<|~EZ+6}KaOD1{jLi@8wmmA_^|)c*)1D*Gr=NVa{_4B0 zzy5yv_2<#Ie~-WY`~2(gy>I{TfBXO7+rNk3{=NP6@8hq(Z+`uI|LgCx&eTPHv2(i< zW_G3Qo8`TGhVS<20h^`-t(_dUd_vU!|Nj|?1ByRc7#SFh7<53&L4IOjYj&7f;Gx6C z+s3T4Fv38pp&`LRKukmQH0$Kf3>D!Miwk`8W}kntMJu`S-iIHvRZC{S`?04}FT3$e zgRYaFqDotPhl-w)zM^{ngo*0chP0Fl$Aa{vGU literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/tabfolder_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/tabfolder_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..edd6060d56111462e76a9d24fd82ad3987855ee4 GIT binary patch literal 607 zcmd6k&ri~E9L7IwZ6t&-=gCl@Fz}ng*O{rIfQZ0n9qQgiHx4eH2i+R38pscsV+D(b z)rv{3b?MM8+PbuLvHp$L0*#3{{JuXw!~Tk%`|I^Q+Y`p2$*DyXGNE4x2_csrJX?w7 z*B<6pHu7taavO;(7c!Q}0vD%@w;4a7tVw8#vO^#ZATFf{ zcs!HjQZT`@+mG{4W2NGH{z*(b*xo6wNAD?bN~`Z*FYUd$-~3tLd%0XLt>)slGt1M9 zUZa%qpI)N>J~lXi4k3(&&z7Ejf^=UJIGIXk(!rUTAf69}=C^{g;qYwG^TJa|`JR`< zzRKGQ_C*}ZxNc}jK{|(H+=ugCoa3ptr6F;(d-(Tz&H9#CiUY&Wpj5cH5|2%7QP1N vvX?AgeZ~|9k)Q|Mx%t-~asg z`|rQ|U;n@U@$br~f0sZ0z4!J1I)+!7lcX83znW6AUnrbZnn4lEKm7a?h60^|7RG)K=CIF zBLjmsgAT}zpg3V*pVi>q)ZEhA*52mj>EZ6?>f-F^U~gyJ>|||YWnpP$*krD- z88&P4aBxU-adAjJ9nemrivxmou4Gave%?w&H VCWb3o4z~-)E6wt_7@)vl4FI!MxNQIc literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/text_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/text_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..cf20952b60e303848367cf5f8ba874246cac6d1f GIT binary patch literal 343 zcmZ?wbhEHb6krfwxXQrLF?HRyAAfphtlo9}{=3h=zyA2^owq2ZWoz%u)em3&c=+o3 zi}ybtzW(w43sCCMgV#TvzyJCE%dZEozrXwPd+OY!Uw{7n_VdrzpMTE3{XKv2y!ngf ztyno@#fljl*G=5HxqB0k+|;vwTgU(Z{~2fl6o0ZXGB7AH=zxp|`H6w8#9?BAhYlZa z`@w?=IYzVnGz?u#1J*~Z;%GT2vFm}sG38eYB5bV62d8<+@gH+Pa?pXNn>A(rd1o^v zNeN*#7T$JVLBS3wB@qd6HdayAsf>(M#YB`iB>33)_@*;1Tqw?@#ITBO)!KEdT>OJJ PZg%(d-n!Gtk--`O1IB$- literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolbar_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolbar_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..64173281d286c3eaad051b4f19e6393d1e6f7f40 GIT binary patch literal 607 zcmZ?wbhEHb6krfwc*el+;K8TUXMyPB{Rf{PJp6qB!KcShzMVez>D1Yer_X)7c;)NW z>z}gnrrdw{`OVw!8M%|wvil3m=G?mb_3_iMNf~`9S^YUhGfJu!(UZ&*rdcJ=uuYxi zkTKUWW3Ef~eD~aiUImMNi=g^ zZDXsWr>|ycY?5r}?BeO_=I-U~;oxZRG{e-)T*FdROIvrcfuYe1CB+>(cdGCyC`cuX z2(y{;s3^%GTjmp72xL)lMob_RF;;N zOHK;>@$=Wuq~wIapj9kWlv+C-n?v{YycA+RHAT~Jj?Em4R<9X`af@trep+&Js*| literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemcheck_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemcheck_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..9421f5633a48b475cd4720da3e266a93d98198b4 GIT binary patch literal 354 zcmZ?wbhEHb6krfwxXQpVsiCX0y05lma&FFy*yMRHUwxT4ZRhIsr|KFe>^*R8?}4iq zE7j4b(%B0R%vpF~_4<>u7amx({?y)s*Y+N~dg1b;3zr|-2CaJZy>5*;Zm-p?@|DS*VzyJ0B z>gWIOe*ORW`~Q!>|G)hC|L*ty_rL#t{`3F$zyBZq{Qvg%|F3`lA%FoJQ2fcl$iQI1 zpaYTw`H6w8-eFFGhmKVLi6<8rGOXtNG3y2Fh+H4hr`{lZM`mLCVMeXlXPa+7RIqe# zSiPf$Rq2jKmrD{;`q2a}Sxp6Ab8b-{Zm|Mg6BBtQGX-&TiD?qj1&T(Bs(_l#u|W-t5k`|tU;zyJUL&oIzH@h1x-149Ud4#**(IALJl(-6|s z+|t^l+|k+9#So&RG-2XIb$&%f=@3y7c5gmSHg7gfMixF+*_pyTJPK>ptzErBl$)88 zi(>~f(=IONO`>9g0=(jqLK0G{GIH`w&cPQhUhveivhr*S40gG5*Co)z*e0;aH`w*X zOVBKH s28n$SHY_~2!bhQfOI2-#&l$e98ozWE5z(fk^Y1^WYd1D&D>7IE0Mn{Y0RR91 literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemradio_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemradio_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..3cf1226406df3c017362975760fd80e5273b55a9 GIT binary patch literal 563 zcmZ?wbhEHb6krfwc*ejmsiCX0y05lma!tvk+?*M)$@5;m`ttb6+lkY5u3mqtu3^I7 z1K0K*xO(BzqYIZF`bI6Cz2Lx{g$GuzKRJ8hfmQ2I?LByH@4>4VEDy;7-Ys6W>)PX2D_5^sv1;|rXD@C(d%kSt%H=CpE?co;)tWW`{{KI7 z=labTk565{bo0fdm!ICv+p_A^^^1uWxo7WP>s>tK_y50rOJ=S~>%gA%ReP`gF!t;Zq#^Ov-pzO#vDR6_uZD;tlH8HZNP2?GHJYXGTk)=~ff literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemseparator_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemseparator_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..81d54f3192b7255ee504a683afe2e25fc72a0140 GIT binary patch literal 608 zcmZ?wbhEHb6krfwc*el+;K8TUXMyPBgNL6VKlyg*?8npRK3=@?_3HIc_aA`qou7P0JeER@JqvXlPrx@9_PXufKiz{4*xG zqq1R%gHPG}k3U?3YO4DVR`(rfoO-aReN#r+B>SL}_Spv&oGKKZD%3q{z4I6Ag!dap zPjbng@1DERt6;Hj@iPCC<^HA11It!ST5+7os!ltsS0}tzFLHum%p~L3$;NS$oys@3 zl&uPH+qUcK+ZCr@ZoK&B;LUe_bFK!@yOz4*)|_L{W0u@_`ThULU;p3!{Qu$C|2IGX zU;X_5<nY`ilPe6{3e4u# z=>G=;23i8epDc_F3<(T6AWJ}T!oa?_A)%?crM0ao-n2czOxwcJTD?_YP~;X30S0RTeCPCY literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/tree_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/tree_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..82b3bed1240131ea22e24beac479e32353ee01c5 GIT binary patch literal 372 zcmZ?wbhEHb6krfwxXQrr{m0*L-~ash`Sz{Qmsy&$l0cax42|s#Yb` ztxap*IC1Img6iHE?|;4e@ax^@-)}$t`uy#8PS^I5+O8Mxf4=$j`{UQ&MH6C@x+p#N)yZZ0qQ;y#+vKquQ8JrKDCDTsQcuF24ayjKcw!BlA9Os!f-xkwA#cZ z<(oO{ss;3%bkxKf8WIJiwVkxoWVj?G*c2Kh1T~%1)g-vs*@YJ@me6ogRTJi7Wo2Y- xkY!hKQdVQ`2v1~TR(29qV_-UTsDX(?)QL~+@R>7wPMjAnUB2vg&Bc+y8UU-9s5t-t literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 475fb90bde..97ca0695dd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -23,7 +23,8 @@ public class Messages { public String ModelTooling_Common_TabDefault; public String ModelTooling_Common_TabSupplementary; public String ModelEditor_AddChild; - public String ModelTooling_Common_TabRuntime; + public String ModelTooling_Common_RuntimeContributionInstance; + public String ModelTooling_Common_RuntimeWidgetTree; public String ModelTooling_UIElement_ToBeRendered; public String ModelTooling_UIElement_Visible; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index b45be4ff6b..d517011088 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -19,7 +19,8 @@ ModelTooling_Common_FindEllipsis=Find ... ModelTooling_Common_TabDefault=Default ModelTooling_Common_TabSupplementary=Supplementary ModelEditor_AddChild=Add child -ModelTooling_Common_TabRuntime=Runtime +ModelTooling_Common_RuntimeContributionInstance=Contrib. Instance +ModelTooling_Common_RuntimeWidgetTree=Widget Tree ModelTooling_UIElement_ToBeRendered=To Be Rendered ModelTooling_UIElement_Visible=Visible diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java index e0d490356c..fd80845dd1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java @@ -103,6 +103,32 @@ public class ResourceProvider extends BasicResourceProvider { public static final String IMG_Wizban16_typerefact_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.typerefact_wiz"; //$NON-NLS-1$ public static final String IMG_Wizban16_extstr_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.extstr_wiz"; //$NON-NLS-1$ + public static final String IMG_Widgets_ctabfolder_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.ctabfolder_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_tabfolder_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.tabfolder_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_shell_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.shell_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_group_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.group_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_ccombo_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.ccombo_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_comboviewer_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.comboviewer_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_table_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.table_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_tree_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.tree_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_sashform_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.sashform_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_text_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.text_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_label_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.label_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_button_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.button_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_composite_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.composite_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_progressbar_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.progressbar_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_separator_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.separator_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_clabel_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.clabel_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_coolbar_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.coolbar_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_toolbar_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.toolbar_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_toolitemcheck_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemcheck_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_toolitemdrop_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemdrop_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_toolitempush_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitempush_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_toolitemradio_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemradio_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_toolitemseparator_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemseparator_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_checkbox_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.checkbox_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_radiobutton_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.radiobutton_obj"; //$NON-NLS-1$ + public static final String COLOR_XML_COMMENT = "COLOR_org.eclipse.e4.tools.emf.ui.XML_COMMENT"; //$NON-NLS-1$ public static final String COLOR_PROC_INSTR = "COLOR_org.eclipse.e4.tools.emf.ui.PROC_INSTR"; //$NON-NLS-1$ public static final String COLOR_STRING = "COLOR_org.eclipse.e4.tools.emf.ui.STRING"; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index fe964e6d23..8b934ef325 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -202,7 +202,7 @@ public void widgetSelected(SelectionEvent e) { private void createInstanceInspection(CTabFolder folder) { CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabRuntime); + item.setText(Messages.ModelTooling_Common_RuntimeContributionInstance); Composite container = new Composite(folder, SWT.NONE); container.setLayout(new GridLayout()); item.setControl(container); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index e2abbe9d81..f926d05ca3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -14,10 +14,13 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -30,10 +33,13 @@ import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; @@ -55,6 +61,10 @@ public class ApplicationEditor extends AbstractComponentEditor { private IListProperty BINDING_TABLE_CONTAINER__ROOT_CONTEXT = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT); + @Inject + @Optional + private IProject project; + @Inject public ApplicationEditor() { super(); @@ -125,11 +135,27 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, Messages, this, Messages.AddonsEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + if (project == null) { + createUITreeInspection(folder); + } + folder.setSelection(0); return folder; } + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + @Override public IObservableList getChildList(final Object element) { final WritableList list = new WritableList(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java index 146e20a65a..0e1f878fa1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java @@ -27,6 +27,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.AreaIconDialogEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -60,6 +61,7 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; @@ -416,11 +418,27 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + if (project == null) { + createUITreeInspection(folder); + } + folder.setSelection(0); return folder; } + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + protected void handleAddChild(EClass eClass) { EObject eObject = EcoreUtil.create(eClass); setElementId(eObject); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java index f452e92082..9cb85eef7c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java @@ -88,7 +88,7 @@ protected CTabFolder createForm(Composite parent, EMFDataBindingContext context, private void createInstanceInspection(CTabFolder folder) { CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabRuntime); + item.setText(Messages.ModelTooling_Common_RuntimeContributionInstance); Composite container = new Composite(folder, SWT.NONE); container.setLayout(new GridLayout()); item.setControl(container); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index 13b8741b59..c22e08eb1b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -127,7 +127,7 @@ protected CTabFolder createForm(Composite parent, EMFDataBindingContext context, private void createInstanceInspection(CTabFolder folder) { CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabRuntime); + item.setText(Messages.ModelTooling_Common_RuntimeContributionInstance); Composite container = new Composite(folder, SWT.NONE); container.setLayout(new GridLayout()); item.setControl(container); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 558024b341..53a58181a1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -224,7 +224,7 @@ public void widgetSelected(SelectionEvent e) { private void createInstanceInspection(CTabFolder folder) { CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabRuntime); + item.setText(Messages.ModelTooling_Common_RuntimeContributionInstance); Composite container = new Composite(folder, SWT.NONE); container.setLayout(new GridLayout()); item.setControl(container); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 3245d567c8..8aadbcad14 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -36,6 +36,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor.EClass2EObject; import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor.EObject2EClass; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MExpression; @@ -72,6 +73,7 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; @@ -440,11 +442,27 @@ public String getText(Object element) { ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + if (project == null) { + createUITreeInspection(folder); + } + folder.setSelection(0); return folder; } + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + @Override public IObservableList getChildList(Object element) { final WritableList list = new WritableList(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 3561de7cc4..5b1542fff7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -29,6 +29,7 @@ import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuItemIconDialogEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; @@ -53,6 +54,7 @@ import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; @@ -60,6 +62,7 @@ import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -307,6 +310,10 @@ public String getText(Object element) { ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + if (project == null) { + createUITreeInspection(folder); + } + folder.setSelection(0); return folder; @@ -314,6 +321,18 @@ public String getText(Object element) { protected abstract void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, WritableValue master); + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + @Override public IObservableList getChildList(Object element) { return null; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index 19368822ec..1fa6af050e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -13,10 +13,13 @@ import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.databinding.EMFDataBindingContext; @@ -24,10 +27,13 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; @@ -37,6 +43,10 @@ public class MenuSeparatorEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private EStackLayout stackLayout; + @Inject + @Optional + private IProject project; + @Inject public MenuSeparatorEditor() { super(); @@ -128,14 +138,29 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + if (project == null) { + createUITreeInspection(folder); + } + folder.setSelection(0); return folder; } + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + @Override public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 1939c2f44a..1fe518a5c1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -35,6 +35,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartIconDialogEditor; import org.eclipse.e4.tools.emf.ui.internal.common.objectdata.ObjectViewer; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; @@ -299,6 +300,7 @@ public void widgetSelected(SelectionEvent e) { if (project == null) { createInstanceInspection(folder); + createUITreeInspection(folder); } folder.setSelection(0); @@ -308,7 +310,7 @@ public void widgetSelected(SelectionEvent e) { private void createInstanceInspection(CTabFolder folder) { CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabRuntime); + item.setText(Messages.ModelTooling_Common_RuntimeContributionInstance); Composite container = new Composite(folder, SWT.NONE); container.setLayout(new GridLayout()); item.setControl(container); @@ -316,7 +318,18 @@ private void createInstanceInspection(CTabFolder folder) { ObjectViewer objectViewer = new ObjectViewer(); TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool, Messages); viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); } private void addToolBar() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index c8fe39bd2c..71ed478853 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -17,11 +17,14 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -52,6 +55,7 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; @@ -75,6 +79,10 @@ public class PartSashContainerEditor extends AbstractComponentEditor { private EStackLayout stackLayout; private List actions = new ArrayList(); + @Inject + @Optional + private IProject project; + @Inject public PartSashContainerEditor() { super(); @@ -363,11 +371,27 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + if (project == null) { + createUITreeInspection(folder); + } + folder.setSelection(0); return folder; } + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + @Override public IObservableList getChildList(Object element) { return ELEMENT_CONTAINER__CHILDREN.observe(element); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 7b018a32b2..b46d543208 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -17,11 +17,14 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -49,6 +52,7 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; @@ -73,6 +77,10 @@ public class PartStackEditor extends AbstractComponentEditor { private StackLayout stackLayout; private List actions = new ArrayList(); + @Inject + @Optional + private IProject project; + @Inject public PartStackEditor() { super(); @@ -307,11 +315,27 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + if (project == null) { + createUITreeInspection(folder); + } + folder.setSelection(0); return folder; } + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + @Override public IObservableList getChildList(Object element) { return ELEMENT_CONTAINER__CHILDREN.observe(element); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 51bf75568f..c5f8bc0683 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -27,6 +27,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PerspectiveIconDialogEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -57,6 +58,7 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; @@ -388,11 +390,27 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + if (project == null) { + createUITreeInspection(folder); + } + folder.setSelection(0); return folder; } + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + @Override public IObservableList getChildList(Object element) { return ELEMENT_CONTAINER__CHILDREN.observe(element); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 2cbbcf6890..0e6ba7cb6f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -17,11 +17,14 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -44,6 +47,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; @@ -66,6 +70,10 @@ public class PerspectiveStackEditor extends AbstractComponentEditor { private EStackLayout stackLayout; private List actions = new ArrayList(); + @Inject + @Optional + private IProject project; + @Inject public PerspectiveStackEditor() { super(); @@ -280,11 +288,27 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + if (project == null) { + createUITreeInspection(folder); + } + folder.setSelection(0); return folder; } + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + @Override public IObservableList getChildList(Object element) { return ELEMENT_CONTAINER__CHILDREN.observe(element); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 6196954511..0e14cfdf3a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -15,6 +15,8 @@ import org.eclipse.core.databinding.conversion.Converter; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.Util; @@ -22,6 +24,7 @@ import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.SharedElementsDialog; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; @@ -33,6 +36,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; @@ -40,6 +44,7 @@ import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -52,6 +57,10 @@ public class PlaceholderEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private EStackLayout stackLayout; + @Inject + @Optional + private IProject project; + @Inject private IModelResource resource; @@ -229,11 +238,27 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + if (project == null) { + createUITreeInspection(folder); + } + folder.setSelection(0); return folder; } + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + @Override public IObservableList getChildList(Object element) { return null; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index d0bcef2ddc..88110efa35 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -15,11 +15,14 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -46,6 +49,7 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; @@ -67,6 +71,10 @@ public class ToolBarContributionEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; + @Inject + @Optional + private IProject project; + private static class Struct { private final String label; private final EClass eClass; @@ -313,11 +321,27 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + if (project == null) { + createUITreeInspection(folder); + } + folder.setSelection(0); return folder; } + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + @Override public IObservableList getChildList(Object element) { return ELEMENT_CONTAINER__CHILDREN.observe(element); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index b2b3382064..4cc8b945db 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -13,10 +13,13 @@ import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -26,10 +29,13 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; @@ -39,6 +45,10 @@ public class ToolBarSeparatorEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private EStackLayout stackLayout; + @Inject + @Optional + private IProject project; + @Inject public ToolBarSeparatorEditor() { super(); @@ -139,11 +149,27 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + if (project == null) { + createUITreeInspection(folder); + } + folder.setSelection(0); return folder; } + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + @Override public IObservableList getChildList(Object element) { return null; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index fbb8f0941a..0e90d536df 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -22,6 +22,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; import org.eclipse.e4.tools.emf.ui.internal.common.objectdata.ObjectViewer; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.MContribution; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -184,7 +185,12 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - createInstanceInspection(folder); + + if (project == null) { + createInstanceInspection(folder); + createUITreeInspection(folder); + } + folder.setSelection(0); return folder; @@ -192,7 +198,7 @@ public void widgetSelected(SelectionEvent e) { private void createInstanceInspection(CTabFolder folder) { CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabRuntime); + item.setText(Messages.ModelTooling_Common_RuntimeContributionInstance); Composite container = new Composite(folder, SWT.NONE); container.setLayout(new GridLayout()); item.setControl(container); @@ -203,6 +209,18 @@ private void createInstanceInspection(CTabFolder folder) { } + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + @Override public IObservableList getChildList(Object element) { // TODO Auto-generated method stub diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index 8f100cf0e0..db0ce04681 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -28,6 +28,7 @@ import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ToolItemIconDialogEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -47,12 +48,14 @@ import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -130,11 +133,27 @@ protected CTabFolder createForm(Composite parent, EMFDataBindingContext context, createFormSubTypeForm(parent, folder, context, master); + if (project == null) { + createUITreeInspection(folder); + } + folder.setSelection(0); return folder; } + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + protected void createFormSubTypeForm(Composite parent, CTabFolder folder, EMFDataBindingContext context, final WritableValue master) { IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); IWidgetValueProperty checkProp = WidgetProperties.selection(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index c302c3da34..072ba2f1c5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -18,12 +18,15 @@ import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MGenericTrimContainer; @@ -53,6 +56,7 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; @@ -76,6 +80,10 @@ public class TrimBarEditor extends AbstractComponentEditor { private EStackLayout stackLayout; private List actions = new ArrayList(); + @Inject + @Optional + protected IProject project; + @Inject private ModelEditor editor; @@ -320,11 +328,27 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + if (project == null) { + createUITreeInspection(folder); + } + folder.setSelection(0); return folder; } + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + @Override public IObservableList getChildList(Object element) { return ELEMENT_CONTAINER__CHILDREN.observe(element); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index 024b7973e4..bd85be0f80 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -15,11 +15,14 @@ import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.core.resources.IProject; +import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -45,6 +48,7 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; @@ -66,6 +70,10 @@ public class TrimContributionEditor extends AbstractComponentEditor { private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); private EStackLayout stackLayout; + @Inject + @Optional + protected IProject project; + @Inject public TrimContributionEditor() { super(); @@ -289,11 +297,27 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + if (project == null) { + createUITreeInspection(folder); + } + folder.setSelection(0); return folder; } + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + @Override public IObservableList getChildList(Object element) { return ELEMENT_CONTAINER__CHILDREN.observe(element); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index d16e3b9d13..efc20524d9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -31,6 +31,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.WindowIconDialogEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -51,6 +52,7 @@ import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; @@ -292,11 +294,27 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + if (project == null) { + createUITreeInspection(folder); + } + folder.setSelection(0); return folder; } + private void createUITreeInspection(CTabFolder folder) { + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); + Composite container = new Composite(folder, SWT.NONE); + container.setLayout(new GridLayout()); + item.setControl(container); + + UIViewer objectViewer = new UIViewer(); + TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); + viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); + } + void removeMenu() { Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__MAIN_MENU, null); if (cmd.canExecute()) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java new file mode 100644 index 0000000000..e27d5befe7 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2011 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.uistructure; + +import java.util.Collections; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; +import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.common.ControlHighlighter; +import org.eclipse.e4.tools.services.IResourcePool; +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.databinding.IEMFValueProperty; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +public class UIViewer { + public TreeViewer createViewer(Composite parent, EStructuralFeature feature, IObservableValue master, IResourcePool resourcePool, final Messages messages) { + final TreeViewer viewer = new TreeViewer(parent); + viewer.setContentProvider(new WidgetContentProvider()); + viewer.setLabelProvider(new WidgetLabelProvider(resourcePool)); + IEMFValueProperty property = EMFProperties.value(feature); + IObservableValue value = property.observeDetail(master); + value.addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + if (event.diff.getNewValue() != null) { + viewer.setInput(Collections.singleton(event.diff.getNewValue())); + viewer.expandToLevel(2); + } else { + viewer.setInput(Collections.emptyList()); + } + } + }); + + MenuManager mgr = new MenuManager(); + mgr.setRemoveAllWhenShown(true); + mgr.addMenuListener(new IMenuListener() { + + public void menuAboutToShow(IMenuManager manager) { + final Object o = ((IStructuredSelection) viewer.getSelection()).getFirstElement(); + if (o instanceof Control) { + manager.add(new Action(messages.ModelEditor_ShowControl) { + @Override + public void run() { + ControlHighlighter.show((Control) o); + } + }); + } + } + }); + + viewer.getControl().setMenu(mgr.createContextMenu(viewer.getControl())); + + return viewer; + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetContentProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetContentProvider.java new file mode 100644 index 0000000000..f3f6e13ce1 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetContentProvider.java @@ -0,0 +1,113 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.uistructure; + +import java.util.Collection; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.CoolBar; +import org.eclipse.swt.widgets.CoolItem; +import org.eclipse.swt.widgets.List; +import org.eclipse.swt.widgets.TabFolder; +import org.eclipse.swt.widgets.TabItem; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.swt.widgets.Tree; + +public class WidgetContentProvider implements ITreeContentProvider { + + public void dispose() { + + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + + } + + public Object[] getElements(Object inputElement) { + return ((Collection) inputElement).toArray(); + } + + public Object[] getChildren(Object parentElement) { + if (parentElement instanceof ToolBar) { + ToolBar toolbar = (ToolBar) parentElement; + ToolItem[] items = toolbar.getItems(); + Object[] rv = new Object[items.length]; + System.arraycopy(items, 0, rv, 0, rv.length); + return rv; + } else if (parentElement instanceof CoolBar) { + CoolBar coolbar = (CoolBar) parentElement; + CoolItem[] items = coolbar.getItems(); + Object[] rv = new Object[items.length]; + System.arraycopy(items, 0, rv, 0, rv.length); + return rv; + } else if (parentElement instanceof TabItem) { + TabItem item = (TabItem) parentElement; + if (item.getControl() != null) { + return new Object[] { item.getControl() }; + } + } else if (parentElement instanceof CTabItem) { + CTabItem item = (CTabItem) parentElement; + if (item.getControl() != null) { + return new Object[] { item.getControl() }; + } + } else if (parentElement instanceof org.eclipse.e4.ui.widgets.CTabItem) { + org.eclipse.e4.ui.widgets.CTabItem item = (org.eclipse.e4.ui.widgets.CTabItem) parentElement; + if (item.getControl() != null) { + return new Object[] { item.getControl() }; + } + } else if (parentElement instanceof Tree) { + Tree tree = (Tree) parentElement; + + } else if (parentElement instanceof Tree) { + Table table = (Table) parentElement; + + } else if (parentElement instanceof List) { + List list = (List) parentElement; + + } else if (parentElement instanceof Combo) { + Combo combo = (Combo) parentElement; + + } else if (parentElement instanceof CTabFolder) { + CTabFolder tabFolder = (CTabFolder) parentElement; + CTabItem[] items = tabFolder.getItems(); + Object[] rv = new Object[items.length]; + System.arraycopy(items, 0, rv, 0, rv.length); + return rv; + } else if (parentElement instanceof org.eclipse.e4.ui.widgets.CTabFolder) { + org.eclipse.e4.ui.widgets.CTabFolder tabFolder = (org.eclipse.e4.ui.widgets.CTabFolder) parentElement; + org.eclipse.e4.ui.widgets.CTabItem[] items = tabFolder.getItems(); + Object[] rv = new Object[items.length]; + System.arraycopy(items, 0, rv, 0, rv.length); + return rv; + } else if (parentElement instanceof TabFolder) { + TabFolder tabFolder = (TabFolder) parentElement; + TabItem[] items = tabFolder.getItems(); + Object[] rv = new Object[items.length]; + System.arraycopy(items, 0, rv, 0, rv.length); + return rv; + } else if (parentElement instanceof Composite) { + Composite comp = (Composite) parentElement; + Control controls[] = comp.getChildren(); + Object[] rv = new Object[controls.length]; + System.arraycopy(controls, 0, rv, 0, rv.length); + return rv; + } + + return new Object[0]; + } + + public Object getParent(Object element) { + // TODO Auto-generated method stub + return null; + } + + public boolean hasChildren(Object element) { + return getChildren(element).length > 0; + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java new file mode 100644 index 0000000000..9aa305ced1 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java @@ -0,0 +1,165 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.uistructure; + +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.services.IResourcePool; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CCombo; +import org.eclipse.swt.custom.CLabel; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.CoolBar; +import org.eclipse.swt.widgets.CoolItem; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.ProgressBar; +import org.eclipse.swt.widgets.Sash; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.TabFolder; +import org.eclipse.swt.widgets.TabItem; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.swt.widgets.Tree; + +public class WidgetLabelProvider extends StyledCellLabelProvider { + private IResourcePool resourcePool; + + public WidgetLabelProvider(IResourcePool resourcePool) { + this.resourcePool = resourcePool; + } + + @Override + public void update(ViewerCell cell) { + Object element = cell.getElement(); + if (element instanceof CLabel) { + StyledString s = new StyledString("Label"); //$NON-NLS-1$ + s.append(" - " + ((CLabel) element).getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + cell.setStyleRanges(s.getStyleRanges()); + cell.setText(s.getString()); + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_clabel_obj)); + } else if (element instanceof ToolBar) { + cell.setText("Toolbar"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolbar_obj)); + } else if (element instanceof ToolItem) { + cell.setText("ToolItem"); //$NON-NLS-1$ + ToolItem item = (ToolItem) element; + if ((item.getStyle() & SWT.PUSH) == SWT.PUSH) { + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitempush_obj)); + } else if ((item.getStyle() & SWT.DROP_DOWN) == SWT.DROP_DOWN) { + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitemdrop_obj)); + } else if ((item.getStyle() & SWT.CHECK) == SWT.CHECK) { + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitemcheck_obj)); + } else if ((item.getStyle() & SWT.RADIO) == SWT.RADIO) { + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitemradio_obj)); + } else if ((item.getStyle() & SWT.SEPARATOR) == SWT.SEPARATOR) { + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitemseparator_obj)); + } + } else if (element instanceof CoolItem) { + cell.setText("CoolItem"); //$NON-NLS-1$ + CoolItem item = (CoolItem) element; + if ((item.getStyle() & SWT.PUSH) == SWT.PUSH) { + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitempush_obj)); + } else if ((item.getStyle() & SWT.DROP_DOWN) == SWT.DROP_DOWN) { + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitemdrop_obj)); + } else if ((item.getStyle() & SWT.CHECK) == SWT.CHECK) { + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitemcheck_obj)); + } else if ((item.getStyle() & SWT.RADIO) == SWT.RADIO) { + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitemradio_obj)); + } else if ((item.getStyle() & SWT.SEPARATOR) == SWT.SEPARATOR) { + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitemseparator_obj)); + } + } else if (element instanceof CoolBar) { + cell.setText("Coolbar"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_coolbar_obj)); + } else if (element instanceof Shell) { + StyledString s = new StyledString("Shell"); //$NON-NLS-1$ + s.append(" - " + ((Shell) element).getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + cell.setStyleRanges(s.getStyleRanges()); + cell.setText(s.getString()); + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_shell_obj)); + } else if (element instanceof ProgressBar) { + cell.setText("ProgressBar"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_progressbar_obj)); + } else if (element instanceof Group) { + StyledString s = new StyledString("Group"); //$NON-NLS-1$ + s.append(" - " + ((Group) element).getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + cell.setStyleRanges(s.getStyleRanges()); + cell.setText(s.getString()); + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_group_obj)); + } else if (element instanceof TabFolder) { + cell.setText("TabFolder"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_tabfolder_obj)); + } else if (element instanceof CTabFolder || element instanceof org.eclipse.e4.ui.widgets.CTabFolder) { + cell.setText("CTabFolder"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_ctabfolder_obj)); + } else if (element instanceof Combo) { + cell.setText("Combo"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_comboviewer_obj)); + } else if (element instanceof CCombo) { + cell.setText("CCombo"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_ccombo_obj)); + } else if (element instanceof Table) { + cell.setText("Table"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_table_obj)); + } else if (element instanceof Tree) { + cell.setText("Tree"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_tree_obj)); + } else if (element instanceof Text) { + cell.setText("Text"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_text_obj)); + } else if (element instanceof Sash) { + cell.setText("Sash"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_sashform_obj)); + } else if (element instanceof Label) { + Label l = (Label) element; + if ((l.getStyle() & SWT.SEPARATOR) == SWT.SEPARATOR) { + cell.setText("Separator"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_separator_obj)); + } else { + StyledString s = new StyledString("Label"); //$NON-NLS-1$ + s.append(" - " + l.getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_label_obj)); + } + + } else if (element instanceof TabItem) { + cell.setText("TabItem"); //$NON-NLS-1$ + } else if (element instanceof CTabItem) { + StyledString s = new StyledString("CTabItem"); //$NON-NLS-1$ + s.append(" - " + ((CTabItem) element).getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + cell.setStyleRanges(s.getStyleRanges()); + cell.setText(s.getString()); + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_clabel_obj)); + } else if (element instanceof org.eclipse.e4.ui.widgets.CTabItem) { + StyledString s = new StyledString("CTabItem"); //$NON-NLS-1$ + s.append(" - " + ((org.eclipse.e4.ui.widgets.CTabItem) element).getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + cell.setStyleRanges(s.getStyleRanges()); + cell.setText(s.getString()); + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_clabel_obj)); + } else if (element instanceof Button) { + Button b = (Button) element; + if ((b.getStyle() & SWT.PUSH) == SWT.PUSH) { + cell.setText("Button"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_button_obj)); + } else if ((b.getStyle() & SWT.CHECK) == SWT.CHECK) { + cell.setText("Checkbox"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_checkbox_obj)); + } else if ((b.getStyle() & SWT.RADIO) == SWT.RADIO) { + cell.setText("Radiobox"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_radiobutton_obj)); + } + } else if (element instanceof Composite) { + cell.setText("Composite"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_composite_obj)); + } else { + cell.setText(element + ""); //$NON-NLS-1$ + } + super.update(cell); + } +} From 21ba38ee90a2e85c2307d576d30ea85e335c21ad Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 10 Mar 2011 22:08:52 +0000 Subject: [PATCH 0330/1286] Bug 339299 - [ModelTooling] Add scripting support From 0d21227b387e8cc55d78bf9420d928cb57cc0a29 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 10 Mar 2011 22:30:58 +0000 Subject: [PATCH 0331/1286] Bug 339598 - [ModelTooling] Add UI-Widget-Tree inspector --- .../OSGI-INF/resources.properties | 4 ++ .../icons/full/widgets/menu_obj.gif | Bin 0 -> 351 bytes .../icons/full/widgets/menubar_obj.gif | Bin 0 -> 607 bytes .../icons/full/widgets/menuitem_obj.gif | Bin 0 -> 348 bytes .../icons/full/widgets/menuseparator_obj.gif | Bin 0 -> 352 bytes .../emf/ui/internal/ResourceProvider.java | 4 ++ .../internal/common/uistructure/UIViewer.java | 36 +++++++++++++++++- .../uistructure/WidgetContentProvider.java | 18 ++++++++- .../uistructure/WidgetLabelProvider.java | 26 ++++++++++++- 9 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menu_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menubar_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menuitem_obj.gif create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menuseparator_obj.gif diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties index 43901a3af5..31acf1b154 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties @@ -123,6 +123,10 @@ IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemradio_obj = /icons/full/widgets/ IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemseparator_obj = /icons/full/widgets/toolitemseparator_obj.gif IMG_org.eclipse.e4.tools.emf.ui.widgets.checkbox_obj = /icons/full/widgets/checkbox_obj.gif IMG_org.eclipse.e4.tools.emf.ui.widgets.group_obj = /icons/full/widgets/group_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.menu_obj = /icons/full/widgets/menu_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.menubar_obj = /icons/full/widgets/menubar_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.menuitem_obj = /icons/full/widgets/menuitem_obj.gif +IMG_org.eclipse.e4.tools.emf.ui.widgets.menuseparator_obj = /icons/full/widgets/menuseparator_obj.gif COLOR_org.eclipse.e4.tools.emf.ui.XML_COMMENT=rgb(128, 0, 0) COLOR_org.eclipse.e4.tools.emf.ui.PROC_INSTR=rgb(128, 128, 128) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menu_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menu_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..9235de52db3a054121eccb9146ebcf6ce92c1324 GIT binary patch literal 351 zcmZ?wbhEHb6krfwxXQqgUb`}EDW*0#y(x~8r!Y~NTrX=n3{z3p=j^v+oM;{DH0 z-~PP$^lS3$rO)60{P^w9`!Byfef$05!_QYAf4=?v>-mSDZ$AI}^!?BGUw?o7`S;`3 zpFe;9J^%3I)A!$Be*y*n%$&FI3y|^q@9)3=e*FQGfB*jb_vi251&ih`TQ+meswtb+ zP29e*cmKAIJzKi||NqZGB2fIv!pOj&&!7X+2l5jGTg`##1s*z5{l}*joy-x9UbZ6S zmC7!kj%LRI4hElfO4%W|a@>{&XCBd7XLK`H+#yOdbOwLg|BDGOTCSRkg)wn*nywmx zvf_f=f`a_q8mD1Yer_X)7c;)NW z>z}gnrrdw{`OVw!8M%|wvil3m=G?mb_3_iMNf~`9S^YUhGfJu!(UZ&*rdcJ=uuYxi zkTKUWW3Ef~eD~aiUImMNi=g^ zZDXsWr>|ycY?5r}?BeO_=I-U~;oxZRG{e-)T*FdROIvrcfuYe1CB+>(cdGCyC`cuX z2(y{;s3^%GTjmp72xL)lMob_RF;;N zOHK;>@$=Wuq~wIapj9kWlv+C-n?v{YycA+RHAT~Jj?Em4R<9X`af@trep+&Js*| literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menuitem_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menuitem_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..b7c3c562a84a27efbd225a694b4e00311ddd0781 GIT binary patch literal 348 zcmZ?wbhEHb6krfwxXQrr{qvviUx4WEx9`8de*cqRyE3O~Z9sf&dC%6i$?G~ME&ul8 z&)4t2fByO-q2piJzOi=F&gL0=J0>r0pL1aKjZhcJ!>TKmKUuAJNR- zsg<=;D|w}M%uMa@{(CRKzx(p*`_JFEUw_|w|I6M7U$$=O+qibp&Q0ArH}`DY(7%6M z$KEYnd$)F7JbmQi>7)Pu|7RctDE?$&WMD90&;e-z`H6w8(qTq{hmKJAi6up$DW>xR zGFHzJ@>LQzayVeef-bE?2?rul#8{eER;-HIeB0@1NC_tkqfLT-g`jCeV^gEEjADC7 zr=qm8tg>=`R7}6Dvz*F|nJTI?C7k6KEL^nEg->MpiWPjWVhR%r71&*c6t-^L#^uVn Md(U1@Cr1Wr0A~!CQUCw| literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menuseparator_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menuseparator_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..16d63ff2495cf72b733d25700545d6bc28b6a506 GIT binary patch literal 352 zcmZ?wbhEHb6krfwxXQrr{qvviUx4WEx9`6NW$nLy|0AR0C#&OUysuRn>E%Mz=WB~~u=PiiS_-&i|oXY-7`#jQ&dtCprzFG{Uh)IR6H>K$jF zz5V&|>+kPB|9t!L`@yRp4_l({rK&Vr|*9J z`1NPfr0Pi%s{{NjrcWuGJ*{xg^r9uRvlh(ET|Osc$*imeGxGj}0Rsk5{K>+|z+lOs z1CjyxiGi*5z?=dP9ii+KOE!gVv78t1VogPIrq-0BE)zdo=-PNb;X*=>L~GL;j_jDt zw^=yDa+b0%+9cdB6pa^aY--YXwrKC@?6Oqt?dzZ5%pyHy>Qok2cJ2JA7#TKK4kab6 n#Y!5BIb4O*=M<_7xk@UkZQZ7(AmJ(?$S=O{fPjFLBZD;n(S@u* literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java index fd80845dd1..1ef5275651 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java @@ -128,6 +128,10 @@ public class ResourceProvider extends BasicResourceProvider { public static final String IMG_Widgets_toolitemseparator_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemseparator_obj"; //$NON-NLS-1$ public static final String IMG_Widgets_checkbox_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.checkbox_obj"; //$NON-NLS-1$ public static final String IMG_Widgets_radiobutton_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.radiobutton_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_menu_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.menu_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_menubar_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.menubar_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_menuitem_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.menuitem_obj"; //$NON-NLS-1$ + public static final String IMG_Widgets_menuseparator_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.menuseparator_obj"; //$NON-NLS-1$ public static final String COLOR_XML_COMMENT = "COLOR_org.eclipse.e4.tools.emf.ui.XML_COMMENT"; //$NON-NLS-1$ public static final String COLOR_PROC_INSTR = "COLOR_org.eclipse.e4.tools.emf.ui.PROC_INSTR"; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java index e27d5befe7..14eb553a4b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java @@ -11,12 +11,20 @@ package org.eclipse.e4.tools.emf.ui.internal.common.uistructure; import java.util.Collections; +import java.util.HashMap; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.RegistryFactory; +import org.eclipse.e4.tools.emf.ui.common.IScriptingSupport; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ControlHighlighter; import org.eclipse.e4.tools.services.IResourcePool; +import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.ecore.EStructuralFeature; @@ -48,7 +56,7 @@ public void handleValueChange(ValueChangeEvent event) { } }); - MenuManager mgr = new MenuManager(); + final MenuManager mgr = new MenuManager(); mgr.setRemoveAllWhenShown(true); mgr.addMenuListener(new IMenuListener() { @@ -62,6 +70,32 @@ public void run() { } }); } + + IExtensionRegistry registry = RegistryFactory.getRegistry(); + IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.scripting"); //$NON-NLS-1$ + final IConfigurationElement[] elements = extPoint.getConfigurationElements(); + + final IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + + if (elements.length > 0 && !s.isEmpty() && s.getFirstElement() instanceof MApplicationElement) { + MenuManager scriptExecute = new MenuManager(messages.ModelEditor_Script); + manager.add(scriptExecute); + for (IConfigurationElement e : elements) { + final IConfigurationElement le = e; + scriptExecute.add(new Action(e.getAttribute("label")) { //$NON-NLS-1$ + @Override + public void run() { + try { + IScriptingSupport support = (IScriptingSupport) le.createExecutableExtension("class"); //$NON-NLS-1$ + support.openEditor(viewer.getControl().getShell(), s.getFirstElement(), new HashMap()); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + } + } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetContentProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetContentProvider.java index f3f6e13ce1..5e74fa251a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetContentProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetContentProvider.java @@ -11,6 +11,8 @@ import org.eclipse.swt.widgets.CoolBar; import org.eclipse.swt.widgets.CoolItem; import org.eclipse.swt.widgets.List; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.TabFolder; import org.eclipse.swt.widgets.TabItem; import org.eclipse.swt.widgets.Table; @@ -33,7 +35,21 @@ public Object[] getElements(Object inputElement) { } public Object[] getChildren(Object parentElement) { - if (parentElement instanceof ToolBar) { + if (parentElement instanceof Menu) { + Menu m = (Menu) parentElement; + MenuItem[] items = m.getItems(); + Object[] rv = new Object[items.length]; + System.arraycopy(items, 0, rv, 0, rv.length); + return rv; + } else if (parentElement instanceof MenuItem) { + MenuItem item = (MenuItem) parentElement; + if (item.getMenu() != null) { + MenuItem[] items = item.getMenu().getItems(); + Object[] rv = new Object[items.length]; + System.arraycopy(items, 0, rv, 0, rv.length); + return rv; + } + } else if (parentElement instanceof ToolBar) { ToolBar toolbar = (ToolBar) parentElement; ToolItem[] items = toolbar.getItems(); Object[] rv = new Object[items.length]; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java index 9aa305ced1..b7cd68a35c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java @@ -17,6 +17,8 @@ import org.eclipse.swt.widgets.CoolItem; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.ProgressBar; import org.eclipse.swt.widgets.Sash; import org.eclipse.swt.widgets.Shell; @@ -38,7 +40,29 @@ public WidgetLabelProvider(IResourcePool resourcePool) { @Override public void update(ViewerCell cell) { Object element = cell.getElement(); - if (element instanceof CLabel) { + if (element instanceof Menu) { + Menu m = (Menu) element; + if ((m.getStyle() & SWT.BAR) == SWT.BAR) { + cell.setText("MenuBar"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_menubar_obj)); + } else { + cell.setText("Menu"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_menu_obj)); + } + } else if (element instanceof MenuItem) { + MenuItem item = (MenuItem) element; + if ((item.getStyle() & SWT.SEPARATOR) == SWT.SEPARATOR) { + cell.setText("Separator"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_menuseparator_obj)); + } else { + StyledString s = new StyledString("MenuItem"); //$NON-NLS-1$ + s.append(" - " + ((MenuItem) element).getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + cell.setStyleRanges(s.getStyleRanges()); + cell.setText(s.getString()); + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_menuitem_obj)); + } + + } else if (element instanceof CLabel) { StyledString s = new StyledString("Label"); //$NON-NLS-1$ s.append(" - " + ((CLabel) element).getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ cell.setStyleRanges(s.getStyleRanges()); From ef01acbad6a37c3de1df71c0d7986ebc009f63cd Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 10 Mar 2011 22:43:12 +0000 Subject: [PATCH 0332/1286] Bug 339299 - [ModelTooling] Add scripting support --- .../e4/tools/emf/ui/internal/common/uistructure/UIViewer.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java index 14eb553a4b..7cf82cb935 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java @@ -24,7 +24,6 @@ import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ControlHighlighter; import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.ecore.EStructuralFeature; @@ -77,7 +76,7 @@ public void run() { final IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (elements.length > 0 && !s.isEmpty() && s.getFirstElement() instanceof MApplicationElement) { + if (elements.length > 0 && !s.isEmpty()) { MenuManager scriptExecute = new MenuManager(messages.ModelEditor_Script); manager.add(scriptExecute); for (IConfigurationElement e : elements) { From f95ca06f088db71f4aa720f08df47a8a9b598bd9 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 10 Mar 2011 23:15:53 +0000 Subject: [PATCH 0333/1286] Bug 339598 - [ModelTooling] Add UI-Widget-Tree inspector --- .../common/uistructure/WidgetLabelProvider.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java index b7cd68a35c..0318e46cf6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java @@ -10,6 +10,7 @@ import org.eclipse.swt.custom.CLabel; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.custom.SashForm; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; @@ -140,6 +141,9 @@ public void update(ViewerCell cell) { cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_text_obj)); } else if (element instanceof Sash) { cell.setText("Sash"); //$NON-NLS-1$ + cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_separator_obj)); + } else if (element instanceof SashForm) { + cell.setText("Sash Form"); //$NON-NLS-1$ cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_sashform_obj)); } else if (element instanceof Label) { Label l = (Label) element; @@ -149,23 +153,28 @@ public void update(ViewerCell cell) { } else { StyledString s = new StyledString("Label"); //$NON-NLS-1$ s.append(" - " + l.getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + cell.setStyleRanges(s.getStyleRanges()); + cell.setText(s.getString()); cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_label_obj)); } } else if (element instanceof TabItem) { - cell.setText("TabItem"); //$NON-NLS-1$ + StyledString s = new StyledString("TabItem"); //$NON-NLS-1$ + s.append(" - " + ((TabItem) element).getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + cell.setStyleRanges(s.getStyleRanges()); + cell.setText(s.getString()); } else if (element instanceof CTabItem) { StyledString s = new StyledString("CTabItem"); //$NON-NLS-1$ s.append(" - " + ((CTabItem) element).getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ cell.setStyleRanges(s.getStyleRanges()); cell.setText(s.getString()); - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_clabel_obj)); + // cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_clabel_obj)); } else if (element instanceof org.eclipse.e4.ui.widgets.CTabItem) { StyledString s = new StyledString("CTabItem"); //$NON-NLS-1$ s.append(" - " + ((org.eclipse.e4.ui.widgets.CTabItem) element).getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ cell.setStyleRanges(s.getStyleRanges()); cell.setText(s.getString()); - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_clabel_obj)); + // cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_clabel_obj)); } else if (element instanceof Button) { Button b = (Button) element; if ((b.getStyle() & SWT.PUSH) == SWT.PUSH) { From d6d6314faaa7e7d6abc0b598eb873518df2ceb92 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 12 Mar 2011 00:42:48 +0000 Subject: [PATCH 0334/1286] Bug 339299 - [ModelTooling] Add scripting support From b2f563f117dea9c126ec9236719b35e8a649169b Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Sat, 12 Mar 2011 16:26:35 +0000 Subject: [PATCH 0335/1286] Bug 339299 - [ModelTooling] Add scripting support --- .../emf/ui/common/IScriptingSupport.java | 4 +- .../emf/ui/internal/common/ModelEditor.java | 57 ++++++++++++++++++- .../common/objectdata/ObjectViewer.java | 8 ++- .../internal/common/uistructure/UIViewer.java | 8 ++- 4 files changed, 68 insertions(+), 9 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IScriptingSupport.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IScriptingSupport.java index ef2a071492..b9690d4dcf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IScriptingSupport.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IScriptingSupport.java @@ -1,8 +1,8 @@ package org.eclipse.e4.tools.emf.ui.common; -import java.util.Map; +import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.swt.widgets.Shell; public interface IScriptingSupport { - public void openEditor(Shell shell, Object scope, Map additionalData); + public void openEditor(Shell shell, Object scope, IEclipseContext context); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index c5f16b0401..7b184305d7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -134,6 +134,7 @@ import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; @@ -198,7 +199,10 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.TreeItem; public class ModelEditor { @@ -269,6 +273,8 @@ public class ModelEditor { private AbstractComponentEditor currentEditor; + private Listener keyListener; + public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project, final IResourcePool resourcePool) { this.resourcePool = resourcePool; this.modelProvider = modelProvider; @@ -295,6 +301,18 @@ public void run() { @PostConstruct void postCreate(Composite composite) { + if (project == null) { + keyListener = new Listener() { + + public void handleEvent(Event event) { + if ((event.stateMask & SWT.ALT) == SWT.ALT) { + findAndHighlight(context.get(Display.class).getFocusControl()); + } + } + }; + context.get(Display.class).addFilter(SWT.MouseUp, keyListener); + } + context.set(ModelEditor.class, this); context.set(IResourcePool.class, resourcePool); context.set(EditingDomain.class, modelProvider.getEditingDomain()); @@ -338,6 +356,38 @@ public void widgetSelected(SelectionEvent e) { folder.setSelection(0); } + private void findAndHighlight(Control control) { + if (control != null) { + MApplicationElement m = findModelElement(control); + MApplicationElement o = m; + if (m != null) { + List l = new ArrayList(); + do { + l.add(m); + m = (MApplicationElement) ((EObject) m).eContainer(); + } while (m != null); + + if (o instanceof MPart) { + System.err.println(o); + System.err.println(((EObject) o).eContainingFeature()); + } + + viewer.setSelection(new StructuredSelection(o)); + } + } + } + + private MApplicationElement findModelElement(Control control) { + do { + if (control.getData("modelElement") != null) { //$NON-NLS-1$ + return (MApplicationElement) control.getData("modelElement"); //$NON-NLS-1$ + } + control = control.getParent(); + } while (control != null); + + return null; + } + private Control createXMITab(Composite composite) { final AnnotationModel model = new AnnotationModel(); @@ -574,8 +624,9 @@ public void run() { @Override public void run() { try { + MApplicationElement o = (MApplicationElement) s.getFirstElement(); IScriptingSupport support = (IScriptingSupport) le.createExecutableExtension("class"); //$NON-NLS-1$ - support.openEditor(viewer.getControl().getShell(), s.getFirstElement(), new HashMap()); + support.openEditor(viewer.getControl().getShell(), s.getFirstElement(), project == null ? ModelUtils.getContainingContext(o) : null); } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -976,6 +1027,10 @@ void dispose() { // TODO: handle exception e.printStackTrace(); } + + if (project == null) { + context.get(Display.class).removeFilter(SWT.MouseUp, keyListener); + } } public IModelResource getModelProvider() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java index 100b7a731c..27b3f11fa1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java @@ -2,7 +2,6 @@ import java.util.Collection; import java.util.Collections; -import java.util.HashMap; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; @@ -16,6 +15,8 @@ import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.services.IResourcePool; +import org.eclipse.e4.ui.model.application.MApplicationElement; +import org.eclipse.e4.ui.model.internal.ModelUtils; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.ecore.EStructuralFeature; @@ -42,7 +43,7 @@ import org.eclipse.swt.widgets.Label; public class ObjectViewer { - public TreeViewer createViewer(Composite parent, EStructuralFeature feature, IObservableValue master, IResourcePool resourcePool, final Messages messages) { + public TreeViewer createViewer(Composite parent, EStructuralFeature feature, final IObservableValue master, IResourcePool resourcePool, final Messages messages) { final TreeViewer viewer = new TreeViewer(parent); viewer.setContentProvider(new ContentProviderImpl()); viewer.setLabelProvider(new LabelProviderImpl(resourcePool)); @@ -93,7 +94,8 @@ public void run() { } if (mainObject != null) { - support.openEditor(viewer.getControl().getShell(), mainObject, new HashMap()); + MApplicationElement value = (MApplicationElement) master.getValue(); + support.openEditor(viewer.getControl().getShell(), mainObject, ModelUtils.getContainingContext(value)); } } catch (CoreException e) { // TODO Auto-generated catch block diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java index 7cf82cb935..ac02009ff7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java @@ -11,7 +11,6 @@ package org.eclipse.e4.tools.emf.ui.internal.common.uistructure; import java.util.Collections; -import java.util.HashMap; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; @@ -24,6 +23,8 @@ import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.common.ControlHighlighter; import org.eclipse.e4.tools.services.IResourcePool; +import org.eclipse.e4.ui.model.application.MApplicationElement; +import org.eclipse.e4.ui.model.internal.ModelUtils; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.IEMFValueProperty; import org.eclipse.emf.ecore.EStructuralFeature; @@ -37,7 +38,7 @@ import org.eclipse.swt.widgets.Control; public class UIViewer { - public TreeViewer createViewer(Composite parent, EStructuralFeature feature, IObservableValue master, IResourcePool resourcePool, final Messages messages) { + public TreeViewer createViewer(Composite parent, EStructuralFeature feature, final IObservableValue master, IResourcePool resourcePool, final Messages messages) { final TreeViewer viewer = new TreeViewer(parent); viewer.setContentProvider(new WidgetContentProvider()); viewer.setLabelProvider(new WidgetLabelProvider(resourcePool)); @@ -85,8 +86,9 @@ public void run() { @Override public void run() { try { + MApplicationElement o = (MApplicationElement) master.getValue(); IScriptingSupport support = (IScriptingSupport) le.createExecutableExtension("class"); //$NON-NLS-1$ - support.openEditor(viewer.getControl().getShell(), s.getFirstElement(), new HashMap()); + support.openEditor(viewer.getControl().getShell(), s.getFirstElement(), ModelUtils.getContainingContext(o)); } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); From e00ea1d44fc25812ba03dcb4b20b33623be26a25 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 15 Mar 2011 00:29:43 +0000 Subject: [PATCH 0336/1286] Bug 339299 - [ModelTooling] Add scripting support From 4694f707789646e6a9af5245e674401f5af4d3c3 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 15 Mar 2011 00:32:26 +0000 Subject: [PATCH 0337/1286] Bug 339299 - [ModelTooling] Add scripting support --- .../e4/tools/emf/ui/internal/ResourceProvider.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java index 1ef5275651..41e626817a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2011 BestSolution.at + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + *******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal; import org.eclipse.e4.tools.services.BasicResourceProvider; From 10b416968dbb1bf643ebf9f8cbcaf68adeaec4e8 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 15 Mar 2011 00:42:37 +0000 Subject: [PATCH 0338/1286] Bug 339299 - [ModelTooling] Add scripting support From c9946d49443785f241c933855c64342fadc9ccf6 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 15 Mar 2011 00:44:26 +0000 Subject: [PATCH 0339/1286] Bug 339299 - [ModelTooling] Add scripting support From f461a2100bd84c20bebaac946afa12db41d94af8 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 15 Mar 2011 14:06:58 +0000 Subject: [PATCH 0340/1286] Bug 340023 - [ModelTooling] Infinite SWT error dialog after closing a part with the live editor dialog up From 592bbe872b8fe70dfcbff9f3f4eb85c5e8f11bc5 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 15 Mar 2011 18:49:11 +0000 Subject: [PATCH 0341/1286] Bug 340042 - [ModelTooling] Perspective tree node in the editor doesn't include windows --- .../eclipse/e4/tools/emf/ui/common/Util.java | 25 ++ .../emf/ui/internal/common/ModelEditor.java | 15 +- .../common/component/ApplicationEditor.java | 2 +- .../common/component/PerspectiveEditor.java | 151 ++------- .../common/component/WindowEditor.java | 2 +- .../virtual/VApplicationWindowEditor.java | 13 + .../virtual/VPerspectiveControlEditor.java | 289 ++++++++++++++++++ .../virtual/VPerspectiveWindowsEditor.java | 13 + .../component/virtual/VWindowEditor.java | 32 +- .../virtual/VWindowWindowsEditor.java | 13 + .../build.properties | 6 +- 11 files changed, 408 insertions(+), 153 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationWindowEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveControlEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveWindowsEditor.java create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowWindowsEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java index 9c41f212c4..caa8211363 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java @@ -146,6 +146,31 @@ public static List loadPackages() { return packs; } + public static boolean moveElementByIndex(EditingDomain editingDomain, MUIElement element, boolean liveModel, int index, EStructuralFeature feature) { + if (liveModel) { + EObject container = ((EObject) element).eContainer(); + List l = (List) container.eGet(feature); + l.remove(element); + + if (index >= 0) { + l.add(index, element); + } else { + l.add(element); + } + + return true; + } else { + EObject container = ((EObject) element).eContainer(); + Command cmd = MoveCommand.create(editingDomain, container, feature, element, index); + + if (cmd.canExecute()) { + editingDomain.getCommandStack().execute(cmd); + return true; + } + return false; + } + } + public static boolean moveElementByIndex(EditingDomain editingDomain, MUIElement element, boolean liveModel, int index) { if (liveModel) { MElementContainer container = element.getParent(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 7b184305d7..19c35dccbf 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -99,6 +99,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VApplicationAddons; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VApplicationCategoriesEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VApplicationWindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VBindingTableEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VCommandEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; @@ -109,13 +110,15 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptorMenuEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartMenuEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPerspectiveControlEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPerspectiveWindowsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VRootBindingContexts; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VToolBarContributionsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VTrimContributionsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowControlEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowSharedElementsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowWindowsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.properties.ExternalizeStringHandler; import org.eclipse.e4.tools.emf.ui.internal.common.properties.ProjectOSGiTranslationProvider; import org.eclipse.e4.tools.emf.ui.internal.common.xml.AnnotationAccess; @@ -212,7 +215,9 @@ public class ModelEditor { public static final String VIRTUAL_HANDLER = ModelEditor.class.getName() + ".VIRTUAL_HANDLER"; //$NON-NLS-1$ public static final String VIRTUAL_BINDING_TABLE = ModelEditor.class.getName() + ".VIRTUAL_BINDING_TABLE"; //$NON-NLS-1$ public static final String VIRTUAL_COMMAND = ModelEditor.class.getName() + ".VIRTUAL_COMMAND"; //$NON-NLS-1$ - public static final String VIRTUAL_WINDOWS = ModelEditor.class.getName() + ".VIRTUAL_WINDOWS"; //$NON-NLS-1$ + public static final String VIRTUAL_APPLICATION_WINDOWS = ModelEditor.class.getName() + ".VIRTUAL_APPLICATION_WINDOWS"; //$NON-NLS-1$ + public static final String VIRTUAL_PERSPECTIVE_WINDOWS = ModelEditor.class.getName() + ".VIRTUAL_PERSPECTIVE_WINDOWS"; //$NON-NLS-1$ + public static final String VIRTUAL_WINDOW_WINDOWS = ModelEditor.class.getName() + ".VIRTUAL_WINDOW_WINDOWS"; //$NON-NLS-1$ public static final String VIRTUAL_WINDOW_CONTROLS = ModelEditor.class.getName() + ".VIRTUAL_WINDOW_CONTROLS"; //$NON-NLS-1$ public static final String VIRTUAL_PART_DESCRIPTORS = ModelEditor.class.getName() + ".VIRTUAL_PART_DESCRIPTORS"; //$NON-NLS-1$ public static final String VIRTUAL_PARTDESCRIPTOR_MENU = ModelEditor.class.getName() + ".VIRTUAL_PARTDESCRIPTOR_MENU"; //$NON-NLS-1$ @@ -228,6 +233,7 @@ public class ModelEditor { public static final String VIRTUAL_PARAMETERS = ModelEditor.class.getName() + ".VIRTUAL_PARAMETERS"; //$NON-NLS-1$ public static final String VIRTUAL_MENUELEMENTS = ModelEditor.class.getName() + ".VIRTUAL_MENUELEMENTS"; //$NON-NLS-1$ public static final String VIRTUAL_ROOT_CONTEXTS = ModelEditor.class.getName() + ".VIRTUAL_ROOT_CONTEXTS"; //$NON-NLS-1$ + public static final String VIRTUAL_PERSPECTIVE_CONTROLS = ModelEditor.class.getName() + "VIRTUAL_PERSPECTIVE_CONTROLS"; //$NON-NLS-1$ private static final int VERTICAL_RULER_WIDTH = 20; @@ -855,7 +861,9 @@ private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_HANDLER, ContextInjectionFactory.make(VHandlerEditor.class, context)); registerVirtualEditor(VIRTUAL_BINDING_TABLE, ContextInjectionFactory.make(VBindingTableEditor.class, context)); registerVirtualEditor(VIRTUAL_COMMAND, ContextInjectionFactory.make(VCommandEditor.class, context)); - registerVirtualEditor(VIRTUAL_WINDOWS, ContextInjectionFactory.make(VWindowEditor.class, context)); + registerVirtualEditor(VIRTUAL_APPLICATION_WINDOWS, ContextInjectionFactory.make(VApplicationWindowEditor.class, context)); + registerVirtualEditor(VIRTUAL_WINDOW_WINDOWS, ContextInjectionFactory.make(VWindowWindowsEditor.class, context)); + registerVirtualEditor(VIRTUAL_PERSPECTIVE_WINDOWS, ContextInjectionFactory.make(VPerspectiveWindowsEditor.class, context)); registerVirtualEditor(VIRTUAL_WINDOW_CONTROLS, ContextInjectionFactory.make(VWindowControlEditor.class, context)); registerVirtualEditor(VIRTUAL_PART_DESCRIPTORS, ContextInjectionFactory.make(VPartDescriptor.class, context)); registerVirtualEditor(VIRTUAL_PARTDESCRIPTOR_MENU, ContextInjectionFactory.make(VPartDescriptorMenuEditor.class, context)); @@ -870,6 +878,7 @@ private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_CATEGORIES, ContextInjectionFactory.make(VApplicationCategoriesEditor.class, context)); registerVirtualEditor(VIRTUAL_PARAMETERS, ContextInjectionFactory.make(VItemParametersEditor.class, context)); registerVirtualEditor(VIRTUAL_ROOT_CONTEXTS, ContextInjectionFactory.make(VRootBindingContexts.class, context)); + registerVirtualEditor(VIRTUAL_PERSPECTIVE_CONTROLS, ContextInjectionFactory.make(VPerspectiveControlEditor.class, context)); } private void registerVirtualEditor(String id, AbstractComponentEditor editor) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index f926d05ca3..85f51b6953 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -222,7 +222,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry(ModelEditor.VIRTUAL_WINDOWS, ELEMENT_CONTAINER__CHILDREN, element, Messages.ApplicationEditor_Windows) { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_APPLICATION_WINDOWS, ELEMENT_CONTAINER__CHILDREN, element, Messages.ApplicationEditor_Windows) { @Override protected boolean accepted(Object o) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index c5f8bc0683..59361c49b4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -15,6 +15,7 @@ import javax.annotation.PostConstruct; import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.core.databinding.property.list.IListProperty; import org.eclipse.core.resources.IProject; @@ -24,12 +25,12 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PerspectiveIconDialogEditor; import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; @@ -41,23 +42,14 @@ import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; @@ -79,6 +71,7 @@ public class PerspectiveEditor extends AbstractComponentEditor { private EMFDataBindingContext context; private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + private IListProperty PERSPECTIVE__WINDOWS = EMFProperties.list(AdvancedPackageImpl.Literals.PERSPECTIVE__WINDOWS); private EStackLayout stackLayout; private List actions = new ArrayList(); @@ -259,123 +252,6 @@ public void widgetSelected(SelectionEvent e) { }); } - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PerspectiveEditor_Controls); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer viewer = new TableViewer(parent); - GridData gd = new GridData(GridData.FILL_BOTH); - viewer.getControl().setLayoutData(gd); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); - - IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Up); - b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer container = (MElementContainer) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; - if (idx >= 0) { - if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Down); - b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer container = (MElementContainer) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if (idx < container.getChildren().size()) { - if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - EClass eclass = (EClass) element; - return eclass.getName(); - } - }); - childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, AdvancedPackageImpl.Literals.AREA, AdvancedPackageImpl.Literals.PLACEHOLDER }); - childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!childrenDropDown.getSelection().isEmpty()) { - EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - handleAddChild(eClass); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List elements = ((IStructuredSelection) viewer.getSelection()).toList(); - - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); @@ -413,7 +289,24 @@ private void createUITreeInspection(CTabFolder folder) { @Override public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); + final WritableList list = new WritableList(); + list.add(new VirtualEntry(ModelEditor.VIRTUAL_PERSPECTIVE_WINDOWS, PERSPECTIVE__WINDOWS, element, Messages.WindowEditor_Windows) { + + @Override + protected boolean accepted(Object o) { + return true; + } + }); + + list.add(new VirtualEntry(ModelEditor.VIRTUAL_PERSPECTIVE_CONTROLS, ELEMENT_CONTAINER__CHILDREN, element, Messages.PerspectiveEditor_Controls) { + + @Override + protected boolean accepted(Object o) { + return true; + } + }); + + return list; } protected void handleAddChild(EClass eClass) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index efc20524d9..15f5739843 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -348,7 +348,7 @@ protected boolean accepted(Object o) { }); - list.add(new VirtualEntry(ModelEditor.VIRTUAL_WINDOWS, WINDOW__WINDOWS, element, Messages.WindowEditor_Windows) { + list.add(new VirtualEntry(ModelEditor.VIRTUAL_WINDOW_WINDOWS, WINDOW__WINDOWS, element, Messages.WindowEditor_Windows) { @Override protected boolean accepted(Object o) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationWindowEditor.java new file mode 100644 index 0000000000..325af803bf --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationWindowEditor.java @@ -0,0 +1,13 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import javax.inject.Inject; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; + +public class VApplicationWindowEditor extends VWindowEditor { + + @Inject + public VApplicationWindowEditor() { + super(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + } + +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveControlEditor.java new file mode 100644 index 0000000000..9aaba3ec59 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveControlEditor.java @@ -0,0 +1,289 @@ +/******************************************************************************* + * Copyright (c) 2010 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import java.util.ArrayList; +import java.util.List; +import javax.annotation.PostConstruct; +import javax.inject.Inject; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; +import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VPerspectiveControlEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private TableViewer viewer; + private List actions = new ArrayList(); + + @Inject + public VPerspectiveControlEditor() { + super(); + } + + @PostConstruct + void init() { + actions.add(new Action(Messages.VWindowControlEditor_AddPartSashContainer, createImageDescriptor(ResourceProvider.IMG_PartSashContainer_vertical)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART_SASH_CONTAINER); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddPartStack, createImageDescriptor(ResourceProvider.IMG_PartStack)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART_STACK); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddPart, createImageDescriptor(ResourceProvider.IMG_Part)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddInputPart, createImageDescriptor(ResourceProvider.IMG_Part)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddArea, createImageDescriptor(ResourceProvider.IMG_Area_vertical)) { + @Override + public void run() { + handleAdd(AdvancedPackageImpl.Literals.AREA); + } + }); + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return Messages.VWindowControlEditor_TreeLabel; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return Messages.VWindowControlEditor_TreeLabelDescription; + } + + @Override + public Composite doGetEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + composite = createForm(parent, context, getMaster()); + } + VirtualEntry o = (VirtualEntry) object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.VWindowControlEditor_Controls); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); + GridData gd = new GridData(GridData.FILL_BOTH); + viewer.getControl().setLayoutData(gd); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Up); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) - 1; + if (idx >= 0) { + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Down); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + int idx = container.getChildren().indexOf(obj) + 1; + if (idx < container.getChildren().size()) { + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { + viewer.setSelection(new StructuredSelection(obj)); + } + } + } + } + } + }); + + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + EClass eclass = (EClass) element; + return eclass.getName(); + } + }); + childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, AdvancedPackageImpl.Literals.AREA, AdvancedPackageImpl.Literals.PLACEHOLDER }); + childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!childrenDropDown.getSelection().isEmpty()) { + EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); + handleAdd(eClass); + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Remove); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List elements = ((IStructuredSelection) viewer.getSelection()).toList(); + + Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + } + }); + } + + folder.setSelection(0); + + return folder; + } + + @Override + public IObservableList getChildList(Object element) { + return null; + } + + private void handleAdd(EClass eClass) { + EObject eObject = EcoreUtil.create(eClass); + + setElementId(eObject); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(eObject); + } + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveWindowsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveWindowsEditor.java new file mode 100644 index 0000000000..3d3865a7f8 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveWindowsEditor.java @@ -0,0 +1,13 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import javax.inject.Inject; +import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; + +public class VPerspectiveWindowsEditor extends VWindowEditor { + + @Inject + public VPerspectiveWindowsEditor() { + super(AdvancedPackageImpl.Literals.PERSPECTIVE__WINDOWS); + } + +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index 9a78f13000..500042f7f1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -13,7 +13,6 @@ import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; -import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.tools.emf.ui.common.Util; @@ -24,11 +23,11 @@ import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; @@ -53,15 +52,16 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; -public class VWindowEditor extends AbstractComponentEditor { +public abstract class VWindowEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private TableViewer viewer; private List actions = new ArrayList(); + private EStructuralFeature targetFeature; - @Inject - public VWindowEditor() { + public VWindowEditor(EStructuralFeature targetFeature) { super(); + this.targetFeature = targetFeature; } @PostConstruct @@ -147,16 +147,18 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { + @SuppressWarnings("unchecked") @Override public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (s.size() == 1) { Object obj = s.getFirstElement(); - MElementContainer container = (MElementContainer) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; + EObject container = (EObject) getMaster().getValue(); + List l = (List) container.eGet(targetFeature); + int idx = l.indexOf(obj) - 1; if (idx >= 0) { - if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx, targetFeature)) { viewer.setSelection(new StructuredSelection(obj)); } } @@ -171,16 +173,18 @@ public void widgetSelected(SelectionEvent e) { b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { + @SuppressWarnings("unchecked") @Override public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (s.size() == 1) { Object obj = s.getFirstElement(); - MElementContainer container = (MElementContainer) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if (idx < container.getChildren().size()) { - if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { + EObject container = (EObject) getMaster().getValue(); + List l = (List) container.eGet(targetFeature); + int idx = l.indexOf(obj) + 1; + if (idx < l.size()) { + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx, targetFeature)) { viewer.setSelection(new StructuredSelection(obj)); } } @@ -223,7 +227,7 @@ public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { List windows = ((IStructuredSelection) viewer.getSelection()).toList(); MElementContainer container = (MElementContainer) getMaster().getValue(); - Command cmd = RemoveCommand.create(getEditingDomain(), container, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, windows); + Command cmd = RemoveCommand.create(getEditingDomain(), container, targetFeature, windows); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); if (container.getChildren().size() > 0) { @@ -255,7 +259,7 @@ protected void handleAdd(EClass eClass) { EObject handler = EcoreUtil.create(eClass); setElementId(handler); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, handler); + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), targetFeature, handler); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowWindowsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowWindowsEditor.java new file mode 100644 index 0000000000..7e1dd2df67 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowWindowsEditor.java @@ -0,0 +1,13 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import javax.inject.Inject; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; + +public class VWindowWindowsEditor extends VWindowEditor { + + @Inject + public VWindowWindowsEditor() { + super(BasicPackageImpl.Literals.WINDOW__WINDOWS); + } + +} \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.services/build.properties b/bundles/org.eclipse.e4.tools.services/build.properties index e611dd6a4e..67344cd64d 100644 --- a/bundles/org.eclipse.e4.tools.services/build.properties +++ b/bundles/org.eclipse.e4.tools.services/build.properties @@ -2,9 +2,5 @@ output.. = bin/ bin.includes = META-INF/,\ .,\ about.html,\ - OSGI-INF/,\ - OSGI-INF/resourcepoolfunction.xml,\ - OSGI-INF/resourceservice.xml,\ - OSGI-INF/messagefactoryservice.xml,\ - OSGI-INF/translationsupplier.xml + OSGI-INF/ source.. = src/ From 73fc6d5293fa8c18814fa58be74a62bfb50ca180 Mon Sep 17 00:00:00 2001 From: Remy Suen Date: Thu, 17 Mar 2011 20:24:00 +0000 Subject: [PATCH 0342/1286] Ignore bin/ folders. --- bundles/org.eclipse.e4.tools.emf.ui/.cvsignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/.cvsignore diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.cvsignore b/bundles/org.eclipse.e4.tools.emf.ui/.cvsignore new file mode 100644 index 0000000000..ba077a4031 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/.cvsignore @@ -0,0 +1 @@ +bin From 5376d1e28356a34b70271b7c37d4c31370a2a06f Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 30 Mar 2011 18:33:48 +0000 Subject: [PATCH 0343/1286] Bug 320380 - [ModelTooling] Integration in Renaming Operations --- .../META-INF/MANIFEST.MF | 5 +- .../plugin.xml | 18 +++ .../emf/editor3x/ClassRenameParticipant.java | 105 ++++++++++++++++++ 3 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassRenameParticipant.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index 1691e76e64..20ae981b14 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -26,7 +26,10 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.tools.compat;bundle-version="1.0.0", org.eclipse.e4.tools.services;bundle-version="1.0.0", org.eclipse.e4.tools;bundle-version="0.9.0", - org.eclipse.jdt.ui;bundle-version="3.6.0" + org.eclipse.jdt.ui;bundle-version="3.6.0", + org.eclipse.ltk.core.refactoring;bundle-version="3.5.200", + org.eclipse.search;bundle-version="3.7.0", + org.eclipse.text;bundle-version="3.5.100" Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/xmiresourcecontextfunction.xml, OSGI-INF/projectfunction.xml, OSGI-INF/pdee4xmiprovider.xml, OSGI-INF/pdeextensionlookup.xml Bundle-ActivationPolicy: lazy Bundle-Vendor: %Bundle-Vendor diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml index 0ca898f300..ac5ff7689c 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml @@ -32,5 +32,23 @@ name="%page.name"> + + + + + + + + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassRenameParticipant.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassRenameParticipant.java new file mode 100644 index 0000000000..43275b1db3 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassRenameParticipant.java @@ -0,0 +1,105 @@ +/******************************************************************************* + * Copyright (c) 2011 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.editor3x; + +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Pattern; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.jdt.core.IType; +import org.eclipse.ltk.core.refactoring.Change; +import org.eclipse.ltk.core.refactoring.CompositeChange; +import org.eclipse.ltk.core.refactoring.RefactoringStatus; +import org.eclipse.ltk.core.refactoring.TextChange; +import org.eclipse.ltk.core.refactoring.TextFileChange; +import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; +import org.eclipse.search.core.text.TextSearchEngine; +import org.eclipse.search.core.text.TextSearchMatchAccess; +import org.eclipse.search.core.text.TextSearchRequestor; +import org.eclipse.search.ui.text.FileTextSearchScope; +import org.eclipse.text.edits.MultiTextEdit; +import org.eclipse.text.edits.ReplaceEdit; +import org.eclipse.text.edits.TextEditGroup; + +public class ClassRenameParticipant extends + org.eclipse.ltk.core.refactoring.participants.RenameParticipant { + private IType type; + + @Override + protected boolean initialize(Object element) { + if( element instanceof IType ) { + type = (IType) element; + } else { + type = null; + } + + return type != null; + } + + @Override + public String getName() { + return "Workbench Model Contribution Participant"; + } + + @Override + public RefactoringStatus checkConditions(IProgressMonitor pm, + CheckConditionsContext context) throws OperationCanceledException { + return new RefactoringStatus(); + } + + @Override + public Change createChange(IProgressMonitor pm) throws CoreException, + OperationCanceledException { + final Map changes= new HashMap(); + final String newName = type.getPackageFragment().getElementName().length() == 0 ? getArguments().getNewName() : type.getPackageFragment().getElementName() + "." + getArguments().getNewName(); + String oldName = type.getFullyQualifiedName().replace(".", "\\."); + + String[] filenames = { "*.e4xmi" }; + FileTextSearchScope scope= FileTextSearchScope.newWorkspaceScope(filenames, false); + Pattern pattern= Pattern.compile(oldName); + + TextSearchRequestor searchRequestor = new TextSearchRequestor() { + public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException { + IFile file = matchAccess.getFile(); + TextFileChange change= (TextFileChange) changes.get(file); + + if (change == null) { + TextChange textChange = getTextChange(file); + if (textChange != null) { + return false; + } + change= new TextFileChange(file.getName(), file); + change.setEdit(new MultiTextEdit()); + changes.put(file, change); + } + ReplaceEdit edit= new ReplaceEdit(matchAccess.getMatchOffset(), matchAccess.getMatchLength(), newName); + change.addEdit(edit); + change.addTextEditGroup(new TextEditGroup("Update contribution reference", edit)); //$NON-NLS-1$ + return true; + } + }; + TextSearchEngine.create().search(scope, searchRequestor, pattern, pm); + + if (changes.isEmpty()) + return null; + + CompositeChange result= new CompositeChange("Update contribution reference"); //$NON-NLS-1$ + for (TextFileChange c : changes.values()) { + result.add(c); + } + return result; + } + +} From 05aa4c63cd7f7f334c2742103ef78aa3fd7855fa Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 30 Mar 2011 18:42:21 +0000 Subject: [PATCH 0344/1286] Bug 341412 - [ModelTooling] Path construction for Contribution in is wrong --- .../e4/tools/emf/editor3x/PDEClassContributionProvider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java index 76f37692b3..0fb63750bd 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java @@ -83,7 +83,7 @@ public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, String cName = new String(simpleTypeName); String pName = new String(packageName); // String label = cName + " - " + pName; //$NON-NLS-1$ - String content = pName + "." + cName; //$NON-NLS-1$ + String content = pName.length() == 0 ? cName : pName + "." + cName; //$NON-NLS-1$ // System.err.println("Found: " + label + " => " + pName + " => " + path); From 032b75ea442b9133d691c95cbf0a6286143743fb Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 30 Mar 2011 18:44:43 +0000 Subject: [PATCH 0345/1286] Bug 341412 - [ModelTooling] Path construction for Contribution in is wrong --- .../e4/tools/emf/editor3x/PDEClassContributionProvider.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java index 0fb63750bd..7ae0019c62 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java @@ -36,8 +36,6 @@ public PDEClassContributionProvider() { @SuppressWarnings("restriction") public void findContribution(final Filter filter, final ContributionResultHandler handler) { - System.err.println("Searching for: " + filter.namePattern); - IJavaSearchScope scope = PDEJavaHelper.getSearchScope(filter.project); char[] packageName = null; From 94e8aea3e786cf1d2c2fc496731829e8a6670a4e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 30 Mar 2011 20:56:45 +0000 Subject: [PATCH 0346/1286] Bug 320380 - [ModelTooling] Integration in Renaming Operations --- .../plugin.xml | 20 ++++- .../emf/editor3x/ClassMoveParticipant.java | 52 ++++++++++++ .../emf/editor3x/ClassRenameParticipant.java | 57 ++----------- .../editor3x/RefactorParticipantDelegate.java | 80 +++++++++++++++++++ 4 files changed, 156 insertions(+), 53 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassMoveParticipant.java create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RefactorParticipantDelegate.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml index ac5ff7689c..f47fd93ed8 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml @@ -41,7 +41,7 @@ - + @@ -50,5 +50,23 @@ + + + + + + + + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassMoveParticipant.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassMoveParticipant.java new file mode 100644 index 0000000000..0c883aa0c7 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassMoveParticipant.java @@ -0,0 +1,52 @@ +package org.eclipse.e4.tools.emf.editor3x; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.e4.tools.emf.editor3x.extension.Util; +import org.eclipse.jdt.core.IPackageFragment; +import org.eclipse.jdt.core.IType; +import org.eclipse.ltk.core.refactoring.Change; +import org.eclipse.ltk.core.refactoring.RefactoringStatus; +import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; + +public class ClassMoveParticipant extends + org.eclipse.ltk.core.refactoring.participants.MoveParticipant { + private IType type; + + @Override + protected boolean initialize(Object element) { + if( element instanceof IType ) { + type = (IType) element; + } else { + type = null; + } + + return type != null; + } + + @Override + public String getName() { + return "Workbench Model Contribution Participant"; + } + + @Override + public RefactoringStatus checkConditions(IProgressMonitor pm, + CheckConditionsContext context) throws OperationCanceledException { + return new RefactoringStatus(); + } + + @Override + public Change createChange(IProgressMonitor pm) throws CoreException, + OperationCanceledException { + String fromBundle = Util.getBundleSymbolicName(type.getJavaProject().getProject()); + String fromClassname = type.getFullyQualifiedName(); + + IPackageFragment fragment = (IPackageFragment) getArguments().getDestination(); + String toBundle = Util.getBundleSymbolicName(fragment.getJavaProject().getProject()); + String toClassName = fragment.getElementName().length() == 0 ? type.getElementName() : fragment.getElementName() + "." + type.getElementName(); + + return RefactorParticipantDelegate.createChange(pm, this, "platform:/plugin/"+fromBundle+"/"+fromClassname, "platform:/plugin/"+toBundle+"/"+toClassName); + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassRenameParticipant.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassRenameParticipant.java index 43275b1db3..7547109159 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassRenameParticipant.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassRenameParticipant.java @@ -10,28 +10,14 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x; -import java.util.HashMap; -import java.util.Map; -import java.util.regex.Pattern; - -import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.e4.tools.emf.editor3x.extension.Util; import org.eclipse.jdt.core.IType; import org.eclipse.ltk.core.refactoring.Change; -import org.eclipse.ltk.core.refactoring.CompositeChange; import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.ltk.core.refactoring.TextChange; -import org.eclipse.ltk.core.refactoring.TextFileChange; import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; -import org.eclipse.search.core.text.TextSearchEngine; -import org.eclipse.search.core.text.TextSearchMatchAccess; -import org.eclipse.search.core.text.TextSearchRequestor; -import org.eclipse.search.ui.text.FileTextSearchScope; -import org.eclipse.text.edits.MultiTextEdit; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.text.edits.TextEditGroup; public class ClassRenameParticipant extends org.eclipse.ltk.core.refactoring.participants.RenameParticipant { @@ -62,44 +48,11 @@ public RefactoringStatus checkConditions(IProgressMonitor pm, @Override public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException { - final Map changes= new HashMap(); - final String newName = type.getPackageFragment().getElementName().length() == 0 ? getArguments().getNewName() : type.getPackageFragment().getElementName() + "." + getArguments().getNewName(); - String oldName = type.getFullyQualifiedName().replace(".", "\\."); - - String[] filenames = { "*.e4xmi" }; - FileTextSearchScope scope= FileTextSearchScope.newWorkspaceScope(filenames, false); - Pattern pattern= Pattern.compile(oldName); - - TextSearchRequestor searchRequestor = new TextSearchRequestor() { - public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException { - IFile file = matchAccess.getFile(); - TextFileChange change= (TextFileChange) changes.get(file); - - if (change == null) { - TextChange textChange = getTextChange(file); - if (textChange != null) { - return false; - } - change= new TextFileChange(file.getName(), file); - change.setEdit(new MultiTextEdit()); - changes.put(file, change); - } - ReplaceEdit edit= new ReplaceEdit(matchAccess.getMatchOffset(), matchAccess.getMatchLength(), newName); - change.addEdit(edit); - change.addTextEditGroup(new TextEditGroup("Update contribution reference", edit)); //$NON-NLS-1$ - return true; - } - }; - TextSearchEngine.create().search(scope, searchRequestor, pattern, pm); + String bundle = Util.getBundleSymbolicName(type.getJavaProject().getProject()); - if (changes.isEmpty()) - return null; - - CompositeChange result= new CompositeChange("Update contribution reference"); //$NON-NLS-1$ - for (TextFileChange c : changes.values()) { - result.add(c); - } - return result; + final String newUrl = "platform:/plugin/" + bundle + "/" + (type.getPackageFragment().getElementName().length() == 0 ? getArguments().getNewName() : type.getPackageFragment().getElementName() + "." + getArguments().getNewName()); + String oldUrl = "platform:/plugin/" + bundle + "/" + type.getFullyQualifiedName().replace(".", "\\."); + return RefactorParticipantDelegate.createChange(pm, this, oldUrl, newUrl); } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RefactorParticipantDelegate.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RefactorParticipantDelegate.java new file mode 100644 index 0000000000..0ba52ad123 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RefactorParticipantDelegate.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * Copyright (c) 2011 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.editor3x; + +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Pattern; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.ltk.core.refactoring.Change; +import org.eclipse.ltk.core.refactoring.CompositeChange; +import org.eclipse.ltk.core.refactoring.TextChange; +import org.eclipse.ltk.core.refactoring.TextFileChange; +import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant; +import org.eclipse.search.core.text.TextSearchEngine; +import org.eclipse.search.core.text.TextSearchMatchAccess; +import org.eclipse.search.core.text.TextSearchRequestor; +import org.eclipse.search.ui.text.FileTextSearchScope; +import org.eclipse.text.edits.MultiTextEdit; +import org.eclipse.text.edits.ReplaceEdit; +import org.eclipse.text.edits.TextEditGroup; + +class RefactorParticipantDelegate { + public static Change createChange(IProgressMonitor pm, + final RefactoringParticipant p, String oldUrl, final String newUrl) + throws CoreException, OperationCanceledException { + String[] filenames = { "*.e4xmi" }; + FileTextSearchScope scope = FileTextSearchScope.newWorkspaceScope( + filenames, false); + Pattern pattern = Pattern.compile(oldUrl); + + final Map changes = new HashMap(); + TextSearchRequestor searchRequestor = new TextSearchRequestor() { + public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) + throws CoreException { + IFile file = matchAccess.getFile(); + TextFileChange change = (TextFileChange) changes.get(file); + + if (change == null) { + TextChange textChange = p.getTextChange(file); + if (textChange != null) { + return false; + } + change = new TextFileChange(file.getName(), file); + change.setEdit(new MultiTextEdit()); + changes.put(file, change); + } + ReplaceEdit edit = new ReplaceEdit( + matchAccess.getMatchOffset(), + matchAccess.getMatchLength(), newUrl); + change.addEdit(edit); + change.addTextEditGroup(new TextEditGroup( + "Update contribution reference", edit)); //$NON-NLS-1$ + return true; + } + }; + TextSearchEngine.create().search(scope, searchRequestor, pattern, pm); + + if (changes.isEmpty()) + return null; + + CompositeChange result = new CompositeChange( + "Update contribution reference"); //$NON-NLS-1$ + for (TextFileChange c : changes.values()) { + result.add(c); + } + return result; + } +} From 51ee6fbc9f3ee34254925db88f8b4cc54f2ede22 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 30 Mar 2011 21:08:18 +0000 Subject: [PATCH 0347/1286] Bug 341400 - [ModelTooling] C&P not supported in XMI-Area --- .../emf/ui/internal/common/ModelEditor.java | 68 ++++++++++++------- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 19c35dccbf..1feb7bb362 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -281,6 +281,10 @@ public class ModelEditor { private Listener keyListener; + private CTabFolder editorTabFolder; + + private SourceViewer sourceViewer; + public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project, final IResourcePool resourcePool) { this.resourcePool = resourcePool; this.modelProvider = modelProvider; @@ -338,28 +342,28 @@ public void handleEvent(Event event) { fragment = modelProvider.getRoot().get(0) instanceof MModelFragments; - final CTabFolder folder = new CTabFolder(composite, SWT.BOTTOM); - CTabItem item = new CTabItem(folder, SWT.NONE); + editorTabFolder = new CTabFolder(composite, SWT.BOTTOM); + CTabItem item = new CTabItem(editorTabFolder, SWT.NONE); item.setText(messages.ModelEditor_Form); - item.setControl(createFormTab(folder)); + item.setControl(createFormTab(editorTabFolder)); item.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_application_form)); emfDocumentProvider = new EMFDocumentResourceMediator(modelProvider); - item = new CTabItem(folder, SWT.NONE); + item = new CTabItem(editorTabFolder, SWT.NONE); item.setText(messages.ModelEditor_XMI); - item.setControl(createXMITab(folder)); + item.setControl(createXMITab(editorTabFolder)); item.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_chart_organisation)); - folder.addSelectionListener(new SelectionAdapter() { + editorTabFolder.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if (folder.getSelectionIndex() == 1) { + if (editorTabFolder.getSelectionIndex() == 1) { emfDocumentProvider.updateFromEMF(); } } }); - folder.setSelection(0); + editorTabFolder.setSelection(0); } private void findAndHighlight(Control control) { @@ -399,16 +403,16 @@ private Control createXMITab(Composite composite) { final AnnotationModel model = new AnnotationModel(); VerticalRuler verticalRuler = new VerticalRuler(VERTICAL_RULER_WIDTH, new AnnotationAccess(resourcePool)); int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION; - SourceViewer viewer = new SourceViewer(composite, verticalRuler, styles); - viewer.configure(new XMLConfiguration(resourcePool)); - viewer.setEditable(project != null); - viewer.getTextWidget().setFont(JFaceResources.getTextFont()); + sourceViewer = new SourceViewer(composite, verticalRuler, styles); + sourceViewer.configure(new XMLConfiguration(resourcePool)); + sourceViewer.setEditable(project != null); + sourceViewer.getTextWidget().setFont(JFaceResources.getTextFont()); final IDocument document = emfDocumentProvider.getDocument(); IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT }); partitioner.connect(document); document.setDocumentPartitioner(partitioner); - viewer.setDocument(document); + sourceViewer.setDocument(document); verticalRuler.setModel(model); emfDocumentProvider.setValidationChangedCallback(new Runnable() { @@ -431,7 +435,7 @@ public void run() { } }); - return viewer.getControl(); + return sourceViewer.getControl(); } private Composite createFormTab(Composite composite) { @@ -1049,10 +1053,14 @@ public IModelResource getModelProvider() { class ClipboardHandler implements Handler { public void paste() { - if (viewer.getControl().getDisplay().getFocusControl() == viewer.getControl()) { - handleStructurePaste(); - } else if (currentEditor != null) { - currentEditor.handlePaste(); + if (editorTabFolder.getSelectionIndex() == 0) { + if (viewer.getControl().getDisplay().getFocusControl() == viewer.getControl()) { + handleStructurePaste(); + } else if (currentEditor != null) { + currentEditor.handlePaste(); + } + } else { + sourceViewer.getTextWidget().paste(); } } @@ -1114,10 +1122,14 @@ private void handleStructurePaste() { } public void copy() { - if (viewer.getControl().getDisplay().getFocusControl() == viewer.getControl()) { - handleStructureCopy(); - } else if (currentEditor != null) { - currentEditor.handleCopy(); + if (editorTabFolder.getSelectionIndex() == 0) { + if (viewer.getControl().getDisplay().getFocusControl() == viewer.getControl()) { + handleStructureCopy(); + } else if (currentEditor != null) { + currentEditor.handleCopy(); + } + } else { + sourceViewer.getTextWidget().copy(); } } @@ -1131,10 +1143,14 @@ private void handleStructureCopy() { } public void cut() { - if (viewer.getControl().getDisplay().getFocusControl() == viewer.getControl()) { - handleStructureCut(); - } else if (currentEditor != null) { - currentEditor.handleCut(); + if (editorTabFolder.getSelectionIndex() == 0) { + if (viewer.getControl().getDisplay().getFocusControl() == viewer.getControl()) { + handleStructureCut(); + } else if (currentEditor != null) { + currentEditor.handleCut(); + } + } else { + sourceViewer.getTextWidget().cut(); } } From cf7fd09ec870fed6c160214a7ccb5c986143c28e Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 30 Mar 2011 22:05:10 +0000 Subject: [PATCH 0348/1286] Bug 340413 - [ModelTooling] Make the live editor into a part so that it can be opened in 4.1 From baad914243b3cd13f223f2908c0b6be0a8569c71 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 30 Mar 2011 22:10:50 +0000 Subject: [PATCH 0349/1286] Bug 340012 - [ModelTooling] Label of an identified MPlaceholder of an MArea seems to be concatenated --- .../emf/ui/internal/common/component/PlaceholderEditor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 0e14cfdf3a..978294e729 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -96,7 +96,7 @@ public String getDetailLabel(Object element) { b.append(" (" + label.getTooltip() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ } else { if (pl.getRef().getElementId() != null && pl.getRef().getElementId().trim().length() > 0) { - b.append(pl.getRef().getElementId()); + b.append(" (" + pl.getRef().getElementId() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ } } } else { From 01ac8966b82dfaf863dc6c81c7af4a57fab987d9 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 5 Apr 2011 22:16:59 +0000 Subject: [PATCH 0350/1286] Bug 340413 - [ModelTooling] Make the live editor into a part so that it can be opened in 4.1 From e62bf02cc393ac6ff845afcdde3ff58e4ca61cdd Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 19 Apr 2011 20:14:11 +0000 Subject: [PATCH 0351/1286] Bug 337223 - [Model] Missing NLS-Support for various Model-Attributes --- .../common/component/ControlFactory.java | 24 ++++++-- .../properties/ExternalizeStringHandler.java | 55 ++++++++++++------- 2 files changed, 53 insertions(+), 26 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 6e678f3ae7..1218ca93ea 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -10,6 +10,7 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import java.lang.reflect.InvocationTargetException; import java.util.Arrays; import java.util.List; import java.util.Map.Entry; @@ -49,6 +50,7 @@ import org.eclipse.emf.databinding.edit.IEMFEditListProperty; import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EOperation; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.edit.command.AddCommand; @@ -713,17 +715,29 @@ public static void createCheckBox(Composite parent, String label, IObservableVal } public static String getLocalizedLabel(ProjectOSGiTranslationProvider translationProvider, MUILabel element, String locale) { + return getLocalizedValue(translationProvider, (MApplicationElement) element, UiPackageImpl.Literals.UI_LABEL__LABEL, UiPackageImpl.Literals.UI_LABEL___GET_LOCALIZED_LABEL, locale); + } + + public static String getLocalizedValue(ProjectOSGiTranslationProvider translationProvider, MApplicationElement element, EStructuralFeature feature, EOperation operation, String locale) { + EObject eo = (EObject) element; if (translationProvider == null) { - if (element.getLocalizedLabel() != null && element.getLocalizedLabel().trim().length() > 0) { - return element.getLocalizedLabel(); + try { + String value = (String) eo.eInvoke(operation, null); + if (value != null && value.trim().length() > 0) { + return value; + } + } catch (InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } } - if (element.getLabel() != null && element.getLabel().trim().length() > 0) { - String label = element.getLabel(); - return tr(translationProvider, locale, label); + String value = (String) eo.eGet(feature); + if (value != null && value.trim().length() > 0) { + return tr(translationProvider, locale, value); } return null; + } public static String tr(ProjectOSGiTranslationProvider translationProvider, String locale, String label) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java index e6525b7f63..1ea30b803f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java @@ -20,11 +20,14 @@ import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.tools.services.Translation; -import org.eclipse.e4.ui.model.application.ui.MUILabel; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; +import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.e4.ui.services.IServiceConstants; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.util.EcoreUtil; @@ -76,7 +79,9 @@ protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); Table t = new Table(container, SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK); - t.setLayoutData(new GridData(GridData.FILL_BOTH)); + GridData gd = new GridData(GridData.FILL_BOTH); + gd.heightHint = t.getItemHeight() * 15; + t.setLayoutData(gd); t.setHeaderVisible(true); t.setLinesVisible(true); @@ -147,16 +152,27 @@ public String getText(Object element) { List ids = new ArrayList(); + List translatedFeatures = new ArrayList(); + translatedFeatures.add(UiPackageImpl.Literals.UI_LABEL__LABEL); + translatedFeatures.add(UiPackageImpl.Literals.UI_LABEL__TOOLTIP); + translatedFeatures.add(CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME); + translatedFeatures.add(CommandsPackageImpl.Literals.COMMAND__DESCRIPTION); + translatedFeatures.add(CommandsPackageImpl.Literals.CATEGORY__NAME); + translatedFeatures.add(CommandsPackageImpl.Literals.CATEGORY__DESCRIPTION); + translatedFeatures.add(org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl.Literals.PART__DESCRIPTION); + translatedFeatures.add(BasicPackageImpl.Literals.PART_DESCRIPTOR__DESCRIPTION); + translatedFeatures.add(MenuPackageImpl.Literals.MENU_ELEMENT__MNEMONICS); + while (it.hasNext()) { EObject o = it.next(); - if (o instanceof MUILabel) { - MUILabel l = (MUILabel) o; - if (l.getLabel() != null && l.getLabel().startsWith("%")) { //$NON-NLS-1$ - ids.add(l.getLabel()); - } - if (l.getTooltip() != null && l.getTooltip().startsWith("%")) { //$NON-NLS-1$ - ids.add(l.getTooltip()); + for (EAttribute a : o.eClass().getEAllAttributes()) { + if (translatedFeatures.contains(a)) { + String v = (String) o.eGet(a); + + if (v != null && v.startsWith("%")) { //$NON-NLS-1$ + ids.add(v); + } } } } @@ -169,18 +185,15 @@ public String getText(Object element) { it = EcoreUtil.getAllContents(list); while (it.hasNext()) { EObject o = it.next(); - if (o instanceof MUILabel) { - MUILabel l = (MUILabel) o; - if (l.getLabel() != null && l.getLabel().trim().length() != 0 && !l.getLabel().startsWith("%")) { //$NON-NLS-1$ - String id = findId(ids, o.eClass().getName().toLowerCase() + ".label"); //$NON-NLS-1$ - entries.add(new Entry(o, UiPackageImpl.Literals.UI_LABEL__LABEL, id, l.getLabel())); - ids.add(id); - } - if (l.getTooltip() != null && l.getTooltip().trim().length() != 0 && !l.getTooltip().startsWith("%")) { //$NON-NLS-1$ - String id = findId(ids, o.eClass().getName().toLowerCase() + ".tooltip"); //$NON-NLS-1$ - entries.add(new Entry(o, UiPackageImpl.Literals.UI_LABEL__TOOLTIP, id, l.getTooltip())); - ids.add(id); + for (EAttribute a : o.eClass().getEAllAttributes()) { + if (translatedFeatures.contains(a)) { + String v = (String) o.eGet(a); + if (v != null && v.trim().length() > 0 && !v.startsWith("%")) { //$NON-NLS-1$ + String id = findId(ids, o.eClass().getName().toLowerCase() + "." + a.getName().toLowerCase()); //$NON-NLS-1$ + entries.add(new Entry(o, a, id, v)); + ids.add(id); + } } } } @@ -206,7 +219,7 @@ protected void okPressed() { try { IFile f = getBasePropertyFile(); - StringBuilder b = new StringBuilder(System.getProperty("line.separator")); + StringBuilder b = new StringBuilder(System.getProperty("line.separator")); //$NON-NLS-1$ for (Object o : els) { Entry e = (Entry) o; b.append(e.key + " = " + e.value + System.getProperty("line.separator")); //$NON-NLS-1$//$NON-NLS-2$ From 46a4e0801f26674e408686fb9393463a52b4255f Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Wed, 20 Apr 2011 16:19:07 +0000 Subject: [PATCH 0352/1286] Bug 343410 - [ModelTooling] Model editor's tree's label provider doesn't seem to update when 'visible' changes --- .../eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 1feb7bb362..d704b82c9b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -307,6 +307,8 @@ public void run() { }; context.set(ProjectOSGiTranslationProvider.class, translationProvider); } + labelFeaturePaths.add(FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); + labelFeaturePaths.add(FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); } @PostConstruct From f2bc14a91eabdf95f499af3eab60c518c6e43380 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Mon, 25 Apr 2011 06:59:25 +0000 Subject: [PATCH 0353/1286] Bug 343717 - [ModelTooling] Make rendered / visible color a preference --- .../editor3x/ModelEditorPreferencePage.java | 105 +++++++++++------- .../META-INF/MANIFEST.MF | 3 +- .../org.eclipse.e4.tools.emf.ui/plugin.xml | 6 + .../ui/internal/PreferenceInitializer.java | 31 ++++++ .../common/ComponentLabelProvider.java | 33 ++++-- .../emf/ui/internal/common/ModelEditor.java | 44 ++++++++ 6 files changed, 171 insertions(+), 51 deletions(-) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PreferenceInitializer.java diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java index 7bb2547f74..64315c76c1 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java @@ -1,28 +1,27 @@ package org.eclipse.e4.tools.emf.editor3x; -import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.jface.preference.BooleanFieldEditor; +import org.eclipse.jface.preference.ColorFieldEditor; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; -import org.osgi.service.prefs.BackingStoreException; +import org.eclipse.ui.preferences.ScopedPreferenceStore; public class ModelEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - private boolean autoCreateElementId; - private boolean showXMIId; - - private IEclipsePreferences node; - + private BooleanFieldEditor fAutoGeneratedId; + private BooleanFieldEditor fShowXMIId; + private ColorFieldEditor fColorValueNotRendered; + private ColorFieldEditor fColorValueNotVisible; + private ColorFieldEditor fColorValueNotVisibleAndRendered; + public ModelEditorPreferencePage() { } @@ -35,56 +34,76 @@ public ModelEditorPreferencePage(String title, ImageDescriptor image) { } public void init(IWorkbench workbench) { - node = new InstanceScope().getNode("org.eclipse.e4.tools.emf.ui"); - autoCreateElementId = node.getBoolean("autoCreateElementId", false); - showXMIId = node.getBoolean("showXMIId", false); + setPreferenceStore(new ScopedPreferenceStore(InstanceScope.INSTANCE,"org.eclipse.e4.tools.emf.ui")); } @Override protected Control createContents(Composite parent) { - Composite result= new Composite(parent, SWT.NONE); - result.setLayout(new GridLayout(2,false)); + Composite result = new Composite(parent, SWT.NONE); + result.setLayout(new GridLayout()); + + { + fColorValueNotRendered = new ColorFieldEditor("notRenderedColor", "Not rendered color", result); + fColorValueNotRendered.setPage(this); + fColorValueNotRendered.setPreferenceStore(getPreferenceStore()); + fColorValueNotRendered.load(); + } + + { + fColorValueNotVisible = new ColorFieldEditor("notVisibleColor", "Not visible color", result); + fColorValueNotVisible.setPage(this); + fColorValueNotVisible.setPreferenceStore(getPreferenceStore()); + fColorValueNotVisible.load(); + } { - Label l = new Label(result, SWT.NONE); - l.setText("Autogenerate Element-Id"); - final Button b = new Button(result, SWT.CHECK); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - autoCreateElementId = b.getSelection(); - } - }); + fColorValueNotVisibleAndRendered = new ColorFieldEditor("notVisibleAndRenderedColor", "Not visible and not rendered color", result); + fColorValueNotVisibleAndRendered.setPage(this); + fColorValueNotVisibleAndRendered.setPreferenceStore(getPreferenceStore()); + fColorValueNotVisibleAndRendered.load(); } { - Label l = new Label(result, SWT.NONE); - l.setText("Show XMI:ID"); - final Button b = new Button(result, SWT.CHECK); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - showXMIId = b.getSelection(); - } - }); + Composite container = new Composite(result, SWT.NONE); + container.setLayoutData(new GridData(GridData.FILL,GridData.CENTER,false,false,2,1)); + fAutoGeneratedId = new BooleanFieldEditor("autoCreateElementId", "Autogenerate Element-Id", container); + fAutoGeneratedId.setPage(this); + fAutoGeneratedId.setPreferenceStore(getPreferenceStore()); + fAutoGeneratedId.load(); + } + + { + Composite container = new Composite(result, SWT.NONE); + container.setLayoutData(new GridData(GridData.FILL,GridData.CENTER,false,false,2,1)); + fShowXMIId = new BooleanFieldEditor("showXMIId", "Show XMI:ID", container); + fShowXMIId.setPage(this); + fShowXMIId.setPreferenceStore(getPreferenceStore()); + fShowXMIId.load(); } return result; } - + @Override public boolean performOk() { - node.putBoolean("autoCreateElementId", autoCreateElementId); - node.putBoolean("showXMIId", showXMIId); - try { - node.flush(); - } catch (BackingStoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + fAutoGeneratedId.store(); + fShowXMIId.store(); + fColorValueNotRendered.store(); + fColorValueNotVisible.store(); + fColorValueNotVisibleAndRendered.store(); return super.performOk(); } + @Override + protected void performDefaults() { + fAutoGeneratedId.loadDefault(); + fShowXMIId.loadDefault(); + fColorValueNotRendered.loadDefault(); + fColorValueNotVisible.loadDefault(); + fColorValueNotVisibleAndRendered.loadDefault(); + super.performDefaults(); + } + @Override public void dispose() { super.dispose(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 92554df36a..8d3f7496ce 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -30,7 +30,8 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.e4.tools.services;bundle-version="1.0.0", org.eclipse.e4.core.di.extensions;bundle-version="0.9.0", org.eclipse.jface.text;bundle-version="3.7.0", - org.eclipse.e4.ui.widgets;bundle-version="1.0.0" + org.eclipse.e4.ui.widgets;bundle-version="1.0.0", + org.eclipse.equinox.preferences;bundle-version="3.4.0" Bundle-ActivationPolicy: lazy Import-Package: javax.inject;version="1.0.0", org.eclipse.core.runtime.jobs, diff --git a/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml b/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml index e01f13b902..91859ac65a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml +++ b/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml @@ -9,5 +9,11 @@ uri="css/default.css"> + + + + diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PreferenceInitializer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PreferenceInitializer.java new file mode 100644 index 0000000000..bcfc2bbe2b --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PreferenceInitializer.java @@ -0,0 +1,31 @@ +package org.eclipse.e4.tools.emf.ui.internal; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.jface.resource.StringConverter; +import org.eclipse.swt.graphics.RGB; + +public class PreferenceInitializer extends AbstractPreferenceInitializer { + + @Override + public void initializeDefaultPreferences() { + IEclipsePreferences pref = InstanceScope.INSTANCE.getNode("org.eclipse.e4.tools.emf.ui"); + + if (pref.get("notRenderedColor", null) == null) { + String val = StringConverter.asString(new RGB(200, 200, 200)); + pref.put("notRenderedColor", val); + } + + if (pref.get("notVisibleColor", null) == null) { + String val = StringConverter.asString(new RGB(200, 200, 200)); + pref.put("notVisibleColor", val); + } + + if (pref.get("notVisibleAndRenderedColor", null) == null) { + String val = StringConverter.asString(new RGB(200, 200, 200)); + pref.put("notVisibleAndRenderedColor", val); + } + } + +} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java index f7e54e99f7..187d5d0896 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java @@ -22,27 +22,42 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.TextStyle; public class ComponentLabelProvider extends StyledCellLabelProvider { private ModelEditor editor; - private static final String NOT_RENDERED_KEY = "NOT_RENDERED_STYLER";//$NON-NLS-1$ + public static final String NOT_RENDERED_KEY = "NOT_RENDERED_STYLER";//$NON-NLS-1$ + + public static final String NOT_VISIBLE_KEY = "NOT_VISIBLE_KEY";//$NON-NLS-1$ + + public static final String NOT_VISIBLE_AND_RENDERED_KEY = "NOT_VISIBLE_AND_RENDERED_KEY";//$NON-NLS-1$ private Font font; private Messages Messages; - private static Styler NOT_RENDERED_STYLER = new Styler() { - { - JFaceResources.getColorRegistry().put(NOT_RENDERED_KEY, new RGB(200, 200, 200)); + private static Styler BOTH_STYLER = new Styler() { + @Override + public void applyStyles(TextStyle textStyle) { + textStyle.foreground = JFaceResources.getColorRegistry().get(NOT_VISIBLE_AND_RENDERED_KEY); + textStyle.strikeout = true; } + }; + private static Styler NOT_RENDERED_STYLER = new Styler() { @Override public void applyStyles(TextStyle textStyle) { textStyle.foreground = JFaceResources.getColorRegistry().get(NOT_RENDERED_KEY); + textStyle.strikeout = true; + } + }; + + private static Styler NOT_VISIBLE_STYLER = new Styler() { + @Override + public void applyStyles(TextStyle textStyle) { + textStyle.foreground = JFaceResources.getColorRegistry().get(NOT_VISIBLE_KEY); } }; @@ -63,9 +78,13 @@ public void update(final ViewerCell cell) { Styler styler = null; if (o instanceof MUIElement) { - if (!((MUIElement) o).isVisible()) { + + if (!((MUIElement) o).isVisible() && !((MUIElement) o).isToBeRendered()) { + label += "<" + Messages.ComponentLabelProvider_invisible + "/" + Messages.ComponentLabelProvider_notrendered + ">"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + styler = BOTH_STYLER; + } else if (!((MUIElement) o).isVisible()) { label += "<" + Messages.ComponentLabelProvider_invisible + ">"; //$NON-NLS-1$//$NON-NLS-2$ - styler = NOT_RENDERED_STYLER; + styler = NOT_VISIBLE_STYLER; } else if (!((MUIElement) o).isToBeRendered()) { label += "<" + Messages.ComponentLabelProvider_notrendered + ">"; //$NON-NLS-1$ //$NON-NLS-2$ styler = NOT_RENDERED_STYLER; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index d704b82c9b..486a16d763 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -169,6 +169,7 @@ import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.resource.StringConverter; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocumentPartitioner; @@ -197,6 +198,7 @@ import org.eclipse.swt.dnd.TransferData; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -971,6 +973,48 @@ private void registerDefaultEditors() { registerEditor(FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT, ContextInjectionFactory.make(StringModelFragment.class, context)); } + @Inject + public void setNotVisibleColor(@Preference("notVisibleColor") String color) { + RGB current = JFaceResources.getColorRegistry().getRGB(ComponentLabelProvider.NOT_VISIBLE_KEY); + + if (current == null || !current.equals(color)) { + JFaceResources.getColorRegistry().put(ComponentLabelProvider.NOT_VISIBLE_KEY, StringConverter.asRGB(color, new RGB(200, 200, 200))); + } + + if (viewer != null) { + viewer.refresh(); + viewer.getControl().redraw(); + } + } + + @Inject + public void setNotRenderedColor(@Preference("notRenderedColor") String color) { + RGB current = JFaceResources.getColorRegistry().getRGB(ComponentLabelProvider.NOT_RENDERED_KEY); + + if (current == null || !current.equals(color)) { + JFaceResources.getColorRegistry().put(ComponentLabelProvider.NOT_RENDERED_KEY, StringConverter.asRGB(color, new RGB(200, 200, 200))); + } + + if (viewer != null) { + viewer.refresh(); + viewer.getControl().redraw(); + } + } + + @Inject + public void setNotVisibleRenderedColor(@Preference("notVisibleAndRenderedColor") String color) { + RGB current = JFaceResources.getColorRegistry().getRGB(ComponentLabelProvider.NOT_VISIBLE_AND_RENDERED_KEY); + + if (current == null || !current.equals(color)) { + JFaceResources.getColorRegistry().put(ComponentLabelProvider.NOT_VISIBLE_AND_RENDERED_KEY, StringConverter.asRGB(color, new RGB(200, 200, 200))); + } + + if (viewer != null) { + viewer.refresh(); + viewer.getControl().redraw(); + } + } + public void registerEditor(EClass eClass, AbstractComponentEditor editor) { editorMap.put(eClass, editor); From d99984bc14d23c9b634b1aa56056d05d80a0a2b0 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Tue, 26 Apr 2011 14:30:20 +0000 Subject: [PATCH 0354/1286] Bug 343850 - [Tooling] NPE in model editor --- .../tools/emf/ui/internal/common/component/PartStackEditor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index b46d543208..ae737f26f0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -272,7 +272,7 @@ public String getText(Object element) { } }); childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, AdvancedPackageImpl.Literals.PLACEHOLDER }); - childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); + childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); From 699918bb50a198616722d172661567025340c14c Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 12 May 2011 17:13:14 +0000 Subject: [PATCH 0355/1286] Bug 345629 - [ModelTooling] Removeing element leaves dangling references --- .../tools/emf/ui/common/XMIModelResource.java | 3 + .../e4/tools/emf/ui/internal/Messages.java | 1 + .../tools/emf/ui/internal/Messages.properties | 5 +- .../emf/ui/internal/common/ModelEditor.java | 15 +- .../common/component/ApplicationEditor.java | 476 ++++++++++++++++++ 5 files changed, 488 insertions(+), 12 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java index ab131ba7b0..bca1aab957 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java @@ -39,6 +39,7 @@ import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; public class XMIModelResource implements IModelResource { private EditingDomain editingDomain; @@ -49,6 +50,8 @@ public class XMIModelResource implements IModelResource { public XMIModelResource(URI uri) { ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); + ResourceSet resourceSet = new ResourceSetImpl(); BasicCommandStack commandStack = new BasicCommandStack(); commandStack.addCommandStackListener(new CommandStackListener() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 97ca0695dd..42e3378c03 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -604,4 +604,5 @@ public class Messages { public String ObjectViewer_Tooltip_InjectionKey; public String ObjectViewer_Script; + public String CommandWizard_ShellTitle; } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index d517011088..41dbdadb04 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -600,4 +600,7 @@ ExternalizeStringHandler_Dialog_DialogMessage=Externalizing manifest files extra ObjectViewer_Tooltip_Value=Value ObjectViewer_Tooltip_InjectionKey=Injection key -ObjectViewer_Script=Execute Script \ No newline at end of file +ObjectViewer_Script=Execute Script + + +CommandWizard_ShellTitle=Command/Handler wizard diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 486a16d763..381dd8bc04 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -156,9 +156,9 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.CommandParameter; +import org.eclipse.emf.edit.command.DeleteCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IMenuListener; @@ -602,16 +602,9 @@ public void menuAboutToShow(IMenuManager manager) { addSeparator = true; manager.add(new Action(messages.ModelEditor_Delete, ImageDescriptor.createFromImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_cross))) { public void run() { - if (o.eContainingFeature().isMany()) { - Command cmd = RemoveCommand.create(ModelEditor.this.modelProvider.getEditingDomain(), o.eContainer(), o.eContainingFeature(), o); - if (cmd.canExecute()) { - ModelEditor.this.modelProvider.getEditingDomain().getCommandStack().execute(cmd); - } - } else { - Command cmd = SetCommand.create(ModelEditor.this.modelProvider.getEditingDomain(), o.eContainer(), o.eContainingFeature(), null); - if (cmd.canExecute()) { - ModelEditor.this.modelProvider.getEditingDomain().getCommandStack().execute(cmd); - } + Command cmd = DeleteCommand.create(ModelEditor.this.modelProvider.getEditingDomain(), o); + if (cmd.canExecute()) { + ModelEditor.this.modelProvider.getEditingDomain().getCommandStack().execute(cmd); } } }); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 85f51b6953..93ef898799 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -10,6 +10,11 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import javax.annotation.PostConstruct; import javax.inject.Inject; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; @@ -18,30 +23,63 @@ import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; +import org.eclipse.e4.ui.model.application.MApplication; +import org.eclipse.e4.ui.model.application.commands.MCommand; +import org.eclipse.e4.ui.model.application.commands.MHandler; +import org.eclipse.e4.ui.model.application.commands.MKeyBinding; +import org.eclipse.e4.ui.model.application.commands.impl.CommandsFactoryImpl; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.ItemType; +import org.eclipse.e4.ui.model.application.ui.menu.MMenu; +import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.common.command.CompoundCommand; import org.eclipse.emf.databinding.EMFDataBindingContext; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class ApplicationEditor extends AbstractComponentEditor { @@ -65,11 +103,33 @@ public class ApplicationEditor extends AbstractComponentEditor { @Optional private IProject project; + private List actions = new ArrayList(); + @Inject public ApplicationEditor() { super(); } + @PostConstruct + void init() { + // actions.add(new Action("Command Wizard ...") { + // @Override + // public void run() { + // doCreateCommandWizard(); + // } + // }); + } + + @Override + public List getActions(Object element) { + return actions; + } + + void doCreateCommandWizard() { + WizardDialog dialog = new WizardDialog(composite.getShell(), new CommandWizard((MApplication) getMaster().getValue())); + dialog.open(); + } + @Override public Image getImage(Object element, Display display) { if (element instanceof MUIElement) { @@ -289,4 +349,420 @@ public String getDetailLabel(Object element) { public FeaturePath[] getLabelProperties() { return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; } + + class CommandWizard extends Wizard { + private MApplication application; + + private HandlerCommandPage handlerPage; + private KeybindingPage keyPage; + private MenuWizardPage menuPage; + private ToolbarWizardPage toolbarPage; + + public CommandWizard(MApplication application) { + this.application = application; + } + + @Override + public void addPages() { + getShell().setText(Messages.CommandWizard_ShellTitle); + setDefaultPageImageDescriptor(ImageDescriptor.createFromImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Wizban16_newexp_wiz))); + handlerPage = new HandlerCommandPage("Handler and Command"); + addPage(handlerPage); + + keyPage = new KeybindingPage("Keybinding", application); + addPage(keyPage); + + menuPage = new MenuWizardPage("Menu", application); + addPage(menuPage); + + toolbarPage = new ToolbarWizardPage("Toolbar", application); + addPage(toolbarPage); + } + + @Override + public boolean performFinish() { + + MCommand command = CommandsFactoryImpl.eINSTANCE.createCommand(); + MHandler handler = CommandsFactoryImpl.eINSTANCE.createHandler(); + MKeyBinding keyBinding = null; + + String parentId = application.getElementId(); + + String prefix = parentId != null && parentId.trim().length() > 0 ? parentId + "." : ""; //$NON-NLS-1$ //$NON-NLS-2$ + + if (handlerPage.idField.getText().trim().length() > 0) { + command.setElementId(prefix + "commands." + handlerPage.idField.getText().trim()); //$NON-NLS-1$ + handler.setElementId(prefix + "handlers." + handlerPage.idField.getText().trim()); //$NON-NLS-1$ + } + + if (!application.getBindingTables().isEmpty()) { + if (keyPage.keyField.getText().trim().length() > 0 && !keyPage.bindtableViewer.getSelection().isEmpty()) { + keyBinding = CommandsFactoryImpl.eINSTANCE.createKeyBinding(); + keyBinding.setKeySequence(keyPage.keyField.getText().trim()); + keyBinding.setCommand(command); + + } + } + + command.setCommandName(handlerPage.nameField.getText()); + handler.setCommand(command); + + CompoundCommand cmd = new CompoundCommand(); + cmd.append(AddCommand.create(getEditingDomain(), application, ApplicationPackageImpl.Literals.APPLICATION__COMMANDS, command)); + cmd.append(AddCommand.create(getEditingDomain(), application, CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, handler)); + + if (keyBinding != null) { + cmd.append(AddCommand.create(getEditingDomain(), ((IStructuredSelection) keyPage.bindtableViewer.getSelection()).getFirstElement(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS, keyBinding)); + } + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + return true; + } + + return false; + } + } + + class HandlerCommandPage extends WizardPage { + public Text idField; + public Text nameField; + + public HandlerCommandPage(String pageName) { + super(pageName); + } + + public void createControl(Composite parent) { + setTitle("Command/Handler"); + setMessage("Insert informations for Command and Handler"); + + Composite group = new Composite(parent, SWT.NONE); + group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + group.setLayout(new GridLayout(3, false)); + + { + Label l = new Label(group, SWT.NONE); + l.setText("Id"); + + idField = new Text(group, SWT.BORDER); + idField.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + } + + { + Label l = new Label(group, SWT.NONE); + l.setText("Name" + "*"); + + nameField = new Text(group, SWT.BORDER); + nameField.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + nameField.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + setPageComplete(nameField.getText().trim().length() > 0); + } + }); + } + + { + Label l = new Label(group, SWT.NONE); + l.setText("Class"); + + Text t = new Text(group, SWT.BORDER); + t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Button b = new Button(group, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_FindEllipsis); + } + + setControl(group); + } + + @Override + public boolean isPageComplete() { + return nameField.getText().trim().length() > 0; + } + } + + class KeybindingPage extends WizardPage { + + private Text keyField; + private TableViewer bindtableViewer; + private MApplication application; + + public KeybindingPage(String pageName, MApplication application) { + super(pageName); + this.application = application; + } + + public void createControl(Composite parent) { + setTitle("Keybinding"); + setMessage("Insert informations for a keybinding"); + + Composite group = new Composite(parent, SWT.NONE); + group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + group.setLayout(new GridLayout(2, false)); + + { + Label l = new Label(group, SWT.NONE); + l.setText("Sequence"); + + keyField = new Text(group, SWT.BORDER); + keyField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + keyField.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + bindtableViewer.getControl().setEnabled(isPageComplete()); + setPageComplete(isPageComplete()); + } + }); + } + + { + Label l = new Label(group, SWT.NONE); + l.setText("Binding Table"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + bindtableViewer = new TableViewer(group); + bindtableViewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); + bindtableViewer.setContentProvider(new ArrayContentProvider()); + bindtableViewer.setInput(application.getBindingTables()); + bindtableViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + setPageComplete(isPageComplete()); + } + }); + bindtableViewer.setSelection(new StructuredSelection(application.getBindingTables().get(0))); + GridData gd = new GridData(GridData.FILL_BOTH); + gd.heightHint = bindtableViewer.getTable().getItemHeight() * 5; + bindtableViewer.getControl().setLayoutData(gd); + bindtableViewer.getControl().setEnabled(false); + } + + setControl(group); + } + + @Override + public boolean isPageComplete() { + if (keyField.getText().trim().isEmpty()) { + return true; + } else { + return !bindtableViewer.getSelection().isEmpty(); + } + } + } + + class MenuWizardPage extends WizardPage { + private MApplication application; + private Text labelField; + private Text iconField; + private ComboViewer typeViewer; + private TableViewer menuViewer; + + public MenuWizardPage(String pageName, MApplication application) { + super(pageName); + this.application = application; + } + + public void createControl(Composite parent) { + setTitle("Handled Menu Item"); + setMessage("Insert informations for a Handled Menu Item"); + + Composite group = new Composite(parent, SWT.NONE); + group.setLayout(new GridLayout(2, false)); + group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + { + Label l = new Label(group, SWT.NONE); + l.setText("Label"); + + labelField = new Text(group, SWT.BORDER); + labelField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + } + + { + Label l = new Label(group, SWT.NONE); + l.setText("Icon"); + + iconField = new Text(group, SWT.BORDER); + iconField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + } + + { + Label l = new Label(group, SWT.NONE); + l.setText("Type"); + + typeViewer = new ComboViewer(group, SWT.READ_ONLY); + typeViewer.setContentProvider(new ArrayContentProvider()); + typeViewer.setInput(ItemType.values()); + typeViewer.setSelection(new StructuredSelection(ItemType.PUSH)); + } + + { + Label l = new Label(group, SWT.NONE); + l.setText("Parent"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + menuViewer = new TableViewer(group); + menuViewer.setLabelProvider(new HiearchyLabelProvider()); + menuViewer.setContentProvider(new ArrayContentProvider()); + + List menuList = new ArrayList(); + Iterator it = EcoreUtil.getAllContents(Collections.singleton(application)); + while (it.hasNext()) { + EObject o = it.next(); + if (MenuPackageImpl.Literals.MENU.isSuperTypeOf(o.eClass())) { + menuList.add((MMenu) o); + } + } + menuViewer.setInput(menuList); + menuViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + setPageComplete(isPageComplete()); + } + }); + GridData gd = new GridData(GridData.FILL_BOTH); + gd.heightHint = menuViewer.getTable().getItemHeight() * 5; + menuViewer.getControl().setLayoutData(gd); + menuViewer.setSelection(new StructuredSelection(menuList.get(0))); + } + + setControl(group); + } + + @Override + public boolean isPageComplete() { + if (labelField.getText().trim().isEmpty() && iconField.getText().trim().isEmpty()) { + return true; + } else { + return !menuViewer.getSelection().isEmpty(); + } + } + } + + class ToolbarWizardPage extends WizardPage { + private MApplication application; + private Text labelField; + private Text iconField; + private ComboViewer typeViewer; + private TableViewer toolbarViewer; + + public ToolbarWizardPage(String pageName, MApplication application) { + super(pageName); + this.application = application; + } + + public void createControl(Composite parent) { + setTitle("Handled Toolbar Item"); + setMessage("Insert informations for a Toolbar Item"); + + Composite group = new Composite(parent, SWT.NONE); + group.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 2, 1)); + group.setLayout(new GridLayout(2, false)); + + { + Label l = new Label(group, SWT.NONE); + l.setText("Label"); + + labelField = new Text(group, SWT.BORDER); + labelField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + } + + { + Label l = new Label(group, SWT.NONE); + l.setText("Icon"); + + iconField = new Text(group, SWT.BORDER); + iconField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + } + + { + Label l = new Label(group, SWT.NONE); + l.setText("Type"); + + typeViewer = new ComboViewer(group, SWT.READ_ONLY); + // viewer.setLabelProvider(labelProvider) + typeViewer.setContentProvider(new ArrayContentProvider()); + typeViewer.setInput(ItemType.values()); + } + + { + Label l = new Label(group, SWT.NONE); + l.setText("Parent"); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + toolbarViewer = new TableViewer(group); + toolbarViewer.setLabelProvider(new HiearchyLabelProvider()); + toolbarViewer.setContentProvider(new ArrayContentProvider()); + + List toolbarList = new ArrayList(); + Iterator it = EcoreUtil.getAllContents(Collections.singleton(application)); + while (it.hasNext()) { + EObject o = it.next(); + if (MenuPackageImpl.Literals.TOOL_BAR.isSuperTypeOf(o.eClass())) { + toolbarList.add((MToolBar) o); + } + } + toolbarViewer.setInput(toolbarList); + toolbarViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + setPageComplete(isPageComplete()); + } + }); + GridData gd = new GridData(GridData.FILL_BOTH); + gd.heightHint = toolbarViewer.getTable().getItemHeight() * 5; + toolbarViewer.getControl().setLayoutData(gd); + toolbarViewer.setSelection(new StructuredSelection(toolbarList.get(0))); + } + + setControl(group); + } + + @Override + public boolean isPageComplete() { + if (labelField.getText().trim().isEmpty() && iconField.getText().trim().isEmpty()) { + return true; + } else { + return !toolbarViewer.getSelection().isEmpty(); + } + } + } + + class HiearchyLabelProvider extends StyledCellLabelProvider { + + @Override + public void update(ViewerCell cell) { + EObject o = (EObject) cell.getElement(); + + String label = ""; //$NON-NLS-1$ + Image img = null; + AbstractComponentEditor elementEditor = getEditor().getEditor(o.eClass()); + if (elementEditor != null) { + label = elementEditor.getDetailLabel(o); + label = label == null ? elementEditor.getLabel(o) : label; + img = elementEditor.getImage(o, composite.getDisplay()); + } + + List parentPath = new ArrayList(); + while (o.eContainer() != null) { + o = o.eContainer(); + elementEditor = getEditor().getEditor(o.eClass()); + if (elementEditor != null) { + parentPath.add(0, elementEditor.getLabel(o)); + } + } + + String parentString = ""; //$NON-NLS-1$ + for (String p : parentPath) { + parentString += "/" + p; //$NON-NLS-1$ + } + + StyledString s = new StyledString(label); + s.append(" - " + parentString, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + cell.setStyleRanges(s.getStyleRanges()); + cell.setText(s.getString()); + cell.setImage(img); + } + } } \ No newline at end of file From 0008a46a5f9927400e0aa05e5b18f2340f2c0745 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Thu, 12 May 2011 17:24:34 +0000 Subject: [PATCH 0356/1286] Bug 345629 - [ModelTooling] Removeing element leaves dangling references --- .../ui/internal/common/component/ApplicationEditor.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 93ef898799..846494bc0c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -395,7 +395,7 @@ public boolean performFinish() { handler.setElementId(prefix + "handlers." + handlerPage.idField.getText().trim()); //$NON-NLS-1$ } - if (!application.getBindingTables().isEmpty()) { + if (application.getBindingTables().size() != 0) { if (keyPage.keyField.getText().trim().length() > 0 && !keyPage.bindtableViewer.getSelection().isEmpty()) { keyBinding = CommandsFactoryImpl.eINSTANCE.createKeyBinding(); keyBinding.setKeySequence(keyPage.keyField.getText().trim()); @@ -543,7 +543,7 @@ public void selectionChanged(SelectionChangedEvent event) { @Override public boolean isPageComplete() { - if (keyField.getText().trim().isEmpty()) { + if (keyField.getText().trim().length() == 0) { return true; } else { return !bindtableViewer.getSelection().isEmpty(); @@ -632,7 +632,7 @@ public void selectionChanged(SelectionChangedEvent event) { @Override public boolean isPageComplete() { - if (labelField.getText().trim().isEmpty() && iconField.getText().trim().isEmpty()) { + if (labelField.getText().trim().length() == 0 && iconField.getText().trim().length() == 0) { return true; } else { return !menuViewer.getSelection().isEmpty(); @@ -721,7 +721,7 @@ public void selectionChanged(SelectionChangedEvent event) { @Override public boolean isPageComplete() { - if (labelField.getText().trim().isEmpty() && iconField.getText().trim().isEmpty()) { + if (labelField.getText().trim().length() == 0 && iconField.getText().trim().length() == 0) { return true; } else { return !toolbarViewer.getSelection().isEmpty(); From 8d47924adb769b4658b083fcd8a2c6670fa5f4c2 Mon Sep 17 00:00:00 2001 From: Thomas Schindl Date: Fri, 3 Jun 2011 15:20:56 +0000 Subject: [PATCH 0357/1286] Bug 348223 - The bridge feature should require same version as ui.css From f718aa48ede7f4e25c248a7f550e00542b381ba0 Mon Sep 17 00:00:00 2001 From: Paul Webster Date: Fri, 3 Jun 2011 15:26:08 +0000 Subject: [PATCH 0358/1286] Bug 348123 - Annotation @PostConstruct not found by injector We use javax.annotation;version="1.0.0" in Eclipse 4 --- bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF | 2 +- bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF | 4 ++-- bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF index 8e138e6925..a030a2864f 100644 --- a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF @@ -13,9 +13,9 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.tools.services;bundle-version="1.0.0", org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0", org.eclipse.e4.ui.di;bundle-version="0.9.0", - javax.inject;bundle-version="1.0.0", org.eclipse.core.databinding;bundle-version="1.4.0" Service-Component: OSGI-INF/selectionproviderfunction.xml Export-Package: org.eclipse.e4.tools.compat.parts Bundle-ActivationPolicy: lazy Bundle-Vendor: %Bundle-Vendor +Import-Package: javax.inject;version="1.0.0" diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 8d3f7496ce..4765b76f2d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -26,14 +26,14 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.equinox.registry;bundle-version="3.5.0", org.eclipse.e4.core.contexts;bundle-version="0.9.0", org.eclipse.e4.ui.di;bundle-version="0.9.0", - javax.annotation;bundle-version="1.0.0", org.eclipse.e4.tools.services;bundle-version="1.0.0", org.eclipse.e4.core.di.extensions;bundle-version="0.9.0", org.eclipse.jface.text;bundle-version="3.7.0", org.eclipse.e4.ui.widgets;bundle-version="1.0.0", org.eclipse.equinox.preferences;bundle-version="3.4.0" Bundle-ActivationPolicy: lazy -Import-Package: javax.inject;version="1.0.0", +Import-Package: javax.annotation;version="1.0.0", + javax.inject;version="1.0.0", org.eclipse.core.runtime.jobs, org.osgi.framework;version="1.5.0" Export-Package: org.eclipse.e4.tools.emf.ui.common, diff --git a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF index 25140262a7..191444710d 100644 --- a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF @@ -10,10 +10,10 @@ Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.swt;bundle-version="3.7.0", org.eclipse.equinox.common;bundle-version="3.6.0", org.eclipse.e4.core.contexts;bundle-version="0.9.0", - javax.annotation;bundle-version="1.0.0", org.eclipse.e4.core.di;bundle-version="0.9.0", - javax.inject;bundle-version="1.0.0", org.eclipse.osgi;bundle-version="3.7.0", org.eclipse.e4.core.services;bundle-version="0.9.1" Service-Component: OSGI-INF/resourcepoolfunction.xml, OSGI-INF/resourceservice.xml, OSGI-INF/messagefactoryservice.xml, OSGI-INF/translationsupplier.xml Bundle-ActivationPolicy: lazy +Import-Package: javax.annotation;version="1.0.0", + javax.inject;version="1.0.0" From 827996460f2d3b4aae99da2259a826ef5a8b972d Mon Sep 17 00:00:00 2001 From: Paul Webster Date: Tue, 14 Jun 2011 00:25:39 +0000 Subject: [PATCH 0359/1286] Bug 349255 - [releng] Change our bundle version numbers for 4.1 --- .../org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF | 4 ++-- .../META-INF/MANIFEST.MF | 6 +++--- .../org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF | 6 +++--- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF | 2 +- .../org.eclipse.e4.core.tools.feature/feature.xml | 11 +++++------ 7 files changed, 16 insertions(+), 17 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF index a030a2864f..0e792e7af8 100644 --- a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.e4.tools.compat;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 0.11.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.core.runtime;bundle-version="3.6.0", @@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.core.services;bundle-version="0.9.1", org.eclipse.e4.ui.services;bundle-version="0.9.1", org.eclipse.e4.core.di;bundle-version="0.9.0", - org.eclipse.e4.tools.services;bundle-version="1.0.0", + org.eclipse.e4.tools.services;bundle-version="0.11.0", org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0", org.eclipse.e4.ui.di;bundle-version="0.9.0", org.eclipse.core.databinding;bundle-version="1.4.0" diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index 20ae981b14..a75d4ceb82 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.e4.tools.emf.editor3x;singleton:=true -Bundle-Version: 0.9.0.qualifier +Bundle-Version: 0.10.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.core.runtime;bundle-version="3.6.0", @@ -23,8 +23,8 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.e4.core.services;bundle-version="0.9.1", org.eclipse.emf.edit;bundle-version="2.6.0", org.eclipse.e4.ui.services;bundle-version="0.9.1", - org.eclipse.e4.tools.compat;bundle-version="1.0.0", - org.eclipse.e4.tools.services;bundle-version="1.0.0", + org.eclipse.e4.tools.compat;bundle-version="0.11.0", + org.eclipse.e4.tools.services;bundle-version="0.11.0", org.eclipse.e4.tools;bundle-version="0.9.0", org.eclipse.jdt.ui;bundle-version="3.6.0", org.eclipse.ltk.core.refactoring;bundle-version="3.5.200", diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 4765b76f2d..7abd03fc96 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.e4.tools.emf.ui;singleton:=true -Bundle-Version: 0.9.0.qualifier +Bundle-Version: 0.10.0.qualifier Bundle-ClassPath: . Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -26,10 +26,10 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", org.eclipse.equinox.registry;bundle-version="3.5.0", org.eclipse.e4.core.contexts;bundle-version="0.9.0", org.eclipse.e4.ui.di;bundle-version="0.9.0", - org.eclipse.e4.tools.services;bundle-version="1.0.0", + org.eclipse.e4.tools.services;bundle-version="0.11.0", org.eclipse.e4.core.di.extensions;bundle-version="0.9.0", org.eclipse.jface.text;bundle-version="3.7.0", - org.eclipse.e4.ui.widgets;bundle-version="1.0.0", + org.eclipse.e4.ui.widgets;bundle-version="0.11.0", org.eclipse.equinox.preferences;bundle-version="3.4.0" Bundle-ActivationPolicy: lazy Import-Package: javax.annotation;version="1.0.0", diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF index 1a967cb340..a38d2608f1 100644 --- a/bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: e4 Templates Bundle-SymbolicName: org.eclipse.e4.tools.jdt.templates;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 0.10.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.jdt.ui;bundle-version="3.6.0", org.eclipse.ui.editors;bundle-version="3.6.0", diff --git a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF index 191444710d..22da85cdd8 100644 --- a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.e4.tools.services -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 0.11.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 Export-Package: org.eclipse.e4.tools.services, org.eclipse.e4.tools.services.impl;x-friends:="org.eclipse.e4.tools.emf.ui" diff --git a/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF index 3e8068527a..51cbe5ed5f 100644 --- a/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.e4.tools;singleton:=true -Bundle-Version: 0.9.0.qualifier +Bundle-Version: 0.10.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.pde.core;bundle-version="3.6.0", diff --git a/features/org.eclipse.e4.core.tools.feature/feature.xml b/features/org.eclipse.e4.core.tools.feature/feature.xml index 488acb9168..c56823a4ff 100644 --- a/features/org.eclipse.e4.core.tools.feature/feature.xml +++ b/features/org.eclipse.e4.core.tools.feature/feature.xml @@ -2,7 +2,7 @@ @@ -58,20 +58,19 @@ install-size="0" version="0.0.0" unpack="false"/> - - - - - From 169082386d56c3fd84eed0c6bd5b2698ea536e45 Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Thu, 4 Aug 2011 20:11:36 +0200 Subject: [PATCH 0360/1286] Bug 352781 - [tools] [0.12] compile errors * adjusted to changed API in internal PDE class --- .../e4/internal/tools/wizards/project/PluginContentPage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/PluginContentPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/PluginContentPage.java index 6fb9ae3f8b..8f0c5ae0cb 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/PluginContentPage.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/PluginContentPage.java @@ -139,7 +139,7 @@ private void createPluginPropertiesGroup(Composite container) { label = new Label(propertiesGroup, SWT.NONE); label.setText(PDEUIMessages.ContentPage_pprovider); - fProviderText = createText(propertiesGroup, propertiesListener, 2); + fProviderCombo = createProviderCombo(propertiesGroup, propertiesListener, 2); createExecutionEnvironmentControls(propertiesGroup); } From be0a3222f2c6a530a4491ee130fa75ed5c148d46 Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Mon, 15 Aug 2011 20:04:01 +0200 Subject: [PATCH 0361/1286] Bug 354748 - [Tooling] Removal of tags not working e.g. on PartStack --- .../common/component/ControlFactory.java | 46 +++++++++++++++---- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 1218ca93ea..5d25804862 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -24,6 +24,7 @@ import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; +import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BindingContextSelectionDialog; @@ -32,13 +33,11 @@ import org.eclipse.e4.tools.services.IClipboardService.Handler; import org.eclipse.e4.tools.services.IResourcePool; import org.eclipse.e4.ui.internal.workbench.E4XMIResource; -import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.e4.ui.model.application.commands.MBindings; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationFactoryImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MContext; import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; @@ -80,8 +79,12 @@ import org.eclipse.swt.dnd.TextTransfer; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.TraverseEvent; +import org.eclipse.swt.events.TraverseListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; @@ -622,8 +625,9 @@ public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (s.size() == 1) { Object obj = s.getFirstElement(); - MContext container = (MContext) editor.getMaster().getValue(); - int idx = container.getVariables().indexOf(obj) - 1; + EObject container = (EObject) editor.getMaster().getValue(); + List l = (List) container.eGet(feature); + int idx = l.indexOf(obj) - 1; if (idx >= 0) { Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), feature, obj, idx); @@ -649,9 +653,10 @@ public void widgetSelected(SelectionEvent e) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (s.size() == 1) { Object obj = s.getFirstElement(); - MContext container = (MApplication) editor.getMaster().getValue(); - int idx = container.getVariables().indexOf(obj) + 1; - if (idx < container.getVariables().size()) { + EObject container = (EObject) editor.getMaster().getValue(); + List l = (List) container.eGet(feature); + int idx = l.indexOf(obj) + 1; + if (idx < l.size()) { Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), feature, obj, idx); if (cmd.canExecute()) { @@ -673,13 +678,13 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { - MContext el = (MContext) editor.getMaster().getValue(); + EObject el = (EObject) editor.getMaster().getValue(); List ids = ((IStructuredSelection) viewer.getSelection()).toList(); Command cmd = RemoveCommand.create(editor.getEditingDomain(), el, feature, ids); if (cmd.canExecute()) { editor.getEditingDomain().getCommandStack().execute(cmd); - if (el.getVariables().size() > 0) { - viewer.setSelection(new StructuredSelection(el.getVariables().get(0))); + if (ids.size() > 0) { + viewer.setSelection(new StructuredSelection(ids.get(0))); } } } @@ -748,4 +753,25 @@ public static String tr(ProjectOSGiTranslationProvider translationProvider, Stri } return label; } + + public static void attachFiltering(Text searchText, final TableViewer viewer, final PatternFilter filter) { + searchText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + filter.setPattern(((Text) e.widget).getText()); + viewer.refresh(); + if (viewer.getTable().getItemCount() > 0) { + Object data = viewer.getTable().getItem(0).getData(); + viewer.setSelection(new StructuredSelection(data)); + } + } + }); + searchText.addTraverseListener(new TraverseListener() { + + public void keyTraversed(TraverseEvent e) { + if (e.keyCode == SWT.ARROW_DOWN && viewer.getTable().getItemCount() > 0) { + viewer.getControl().setFocus(); + } + } + }); + } } \ No newline at end of file From ef082d363e98d094b5006422c5a189b64395ef48 Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Mon, 15 Aug 2011 20:04:18 +0200 Subject: [PATCH 0362/1286] Bug 354053 - [Tooling] [E4XMI Editor Dialogs] Forward Arrow Keys from Textbox to Listbox --- .../dialogs/AbstractCommandSelectionDialog.java | 10 ++-------- .../dialogs/BindingContextSelectionDialog.java | 10 ++-------- .../dialogs/CommandCategorySelectionDialog.java | 9 +++------ .../common/component/dialogs/ExpressionIdDialog.java | 10 ++-------- .../component/dialogs/FeatureSelectionDialog.java | 8 -------- .../common/component/dialogs/SharedElementsDialog.java | 10 ++-------- 6 files changed, 11 insertions(+), 46 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java index b0034d2080..cc0c7086cb 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java @@ -15,6 +15,7 @@ import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory; import org.eclipse.e4.ui.model.application.commands.MCommand; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.emf.common.command.Command; @@ -37,8 +38,6 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -121,12 +120,7 @@ protected boolean isParentMatch(Viewer viewer, Object element) { }; viewer.addFilter(filter); - searchText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - filter.setPattern(((Text) e.widget).getText()); - viewer.refresh(); - } - }); + ControlFactory.attachFiltering(searchText, viewer, filter); return composite; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java index bffd28ba97..faadd680fd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java @@ -15,6 +15,7 @@ import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory; import org.eclipse.e4.ui.model.application.commands.MBindingContext; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.emf.common.util.TreeIterator; @@ -35,8 +36,6 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -118,12 +117,7 @@ protected boolean isParentMatch(Viewer viewer, Object element) { }; viewer.addFilter(filter); - searchText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - filter.setPattern(((Text) e.widget).getText()); - viewer.refresh(); - } - }); + ControlFactory.attachFiltering(searchText, viewer, filter); return composite; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java index 2df3390307..cdb3a163d1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java @@ -10,6 +10,8 @@ ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory; + import java.util.ArrayList; import java.util.List; import org.eclipse.e4.tools.emf.ui.common.IModelResource; @@ -118,12 +120,7 @@ protected boolean isParentMatch(Viewer viewer, Object element) { }; viewer.addFilter(filter); - searchText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - filter.setPattern(((Text) e.widget).getText()); - viewer.refresh(); - } - }); + ControlFactory.attachFiltering(searchText, viewer, filter); return composite; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java index 12eaf29494..7090bf33b8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java @@ -17,6 +17,7 @@ import org.eclipse.e4.tools.emf.ui.common.IExtensionLookup; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory; import org.eclipse.e4.ui.model.application.ui.MCoreExpression; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.common.command.Command; @@ -35,8 +36,6 @@ import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerCell; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -85,13 +84,8 @@ protected boolean isParentMatch(Viewer viewer, Object element) { return viewer instanceof AbstractTreeViewer && super.isParentMatch(viewer, element); } }; - idField.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - filter.setPattern(((Text) e.widget).getText()); - viewer.refresh(); - } - }); + ControlFactory.attachFiltering(idField, viewer, filter); l = new Label(container, SWT.NONE); viewer = new TableViewer(container); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java index d0cfce3825..bf39936e97 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java @@ -43,8 +43,6 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -132,12 +130,6 @@ public int compare(Viewer viewer, Object e1, Object e2) { final ViewerFilterImpl filter = new ViewerFilterImpl(); viewer.addFilter(filter); - searchText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - filter.setPattern(searchText.getText()); - viewer.refresh(); - } - }); viewer.setInput(Util.loadPackages()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java index ce28f7fc02..dd9c7af57b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java @@ -17,6 +17,7 @@ import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.e4.ui.model.application.ui.MUIElement; @@ -45,8 +46,6 @@ import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerCell; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -129,12 +128,7 @@ protected boolean isParentMatch(Viewer viewer, Object element) { }; viewer.addFilter(filter); - searchText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - filter.setPattern(((Text) e.widget).getText()); - viewer.refresh(); - } - }); + ControlFactory.attachFiltering(searchText, viewer, filter); return comp; } From 3b0b3ce1bbd7b855b88fea4de6dfb9da09bac61b Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Wed, 14 Sep 2011 17:15:24 +0200 Subject: [PATCH 0363/1286] Bug 357634 - Application.e4xmi missing entries when created by New>e4>Model>New Application Model --- .../model/BaseApplicationModelWizard.java | 5 +- .../model/NewApplicationModelWizard.java | 49 +++++++++++++++++++ .../model/NewContributionModelWizard.java | 6 +++ .../tools/wizards/model/NewModelFilePage.java | 8 +++ 4 files changed, 67 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java index d6b5699180..72f8463605 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java @@ -33,6 +33,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.wizard.Wizard; +import org.eclipse.jface.wizard.WizardPage; import org.eclipse.ui.INewWizard; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPage; @@ -63,10 +64,12 @@ public BaseApplicationModelWizard() { */ public void addPages() { - page = new NewModelFilePage(selection,getDefaultFileName()); + page = createWizardPage(selection); addPage(page); } + protected abstract NewModelFilePage createWizardPage(ISelection selection); + public abstract String getDefaultFileName(); @Override diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java index 7b625052be..8e030bb61d 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java @@ -11,9 +11,15 @@ package org.eclipse.e4.internal.tools.wizards.model; import org.eclipse.core.runtime.CoreException; +import org.eclipse.e4.ui.model.application.MAddon; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.MApplicationFactory; import org.eclipse.emf.ecore.EObject; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; public class NewApplicationModelWizard extends BaseApplicationModelWizard { @@ -27,10 +33,53 @@ protected EObject createInitialModel() { MApplication application = MApplicationFactory.INSTANCE.createApplication(); try { application.setElementId(getModelFile().getProject().getName() + ".application"); + if( ((ModelFilePageImpl)getPages()[0]).includeDefaultAddons.getSelection() ) { + String[][] addons = { + { "org.eclipse.e4.core.commands.service", "platform:/plugin/org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon" }, + { "org.eclipse.e4.ui.contexts.service", "platform:/plugin/org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon" }, + { "org.eclipse.e4.ui.bindings.service", "platform:/plugin/org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon" }, + { "org.eclipse.e4.ui.workbench.commands.model", "platform:/plugin/org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon" }, + { "org.eclipse.e4.ui.workbench.contexts.model", "platform:/plugin/org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon" }, + { "org.eclipse.e4.ui.workbench.bindings.model", "platform:/plugin/org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon" } + + }; + + for( String[] a : addons ) { + MAddon addon = MApplicationFactory.INSTANCE.createAddon(); + addon.setElementId(a[0]); + addon.setContributionURI(a[1]); + application.getAddons().add(addon); + } + } } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } return (EObject) application; } + + @Override + protected NewModelFilePage createWizardPage(ISelection selection) { + return new ModelFilePageImpl(selection,getDefaultFileName()); + } + + static class ModelFilePageImpl extends NewModelFilePage { + + private Button includeDefaultAddons; + + public ModelFilePageImpl(ISelection selection, String defaultFilename) { + super(selection, defaultFilename); + } + + @Override + protected void createAdditionalControls(Composite parent) { + super.createAdditionalControls(parent); + + new Label(parent, SWT.NONE); + + includeDefaultAddons = new Button(parent, SWT.CHECK); + includeDefaultAddons.setText("Include default addons"); + includeDefaultAddons.setSelection(true); + } + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewContributionModelWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewContributionModelWizard.java index 04d252f610..3c9873e6b2 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewContributionModelWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewContributionModelWizard.java @@ -12,6 +12,7 @@ import org.eclipse.e4.ui.model.fragment.MFragmentFactory; import org.eclipse.emf.ecore.EObject; +import org.eclipse.jface.viewers.ISelection; public class NewContributionModelWizard extends BaseApplicationModelWizard { @@ -24,4 +25,9 @@ public String getDefaultFileName() { protected EObject createInitialModel() { return (EObject) MFragmentFactory.INSTANCE.createModelFragments(); } + + @Override + protected NewModelFilePage createWizardPage(ISelection selection) { + return new NewModelFilePage(selection,getDefaultFileName()); + } } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java index 4cb85960be..634ea30ce8 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java @@ -98,11 +98,19 @@ public void modifyText(ModifyEvent e) { dialogChanged(); } }); + + new Label(container, SWT.NONE); + + createAdditionalControls(container); initialize(); dialogChanged(); setControl(container); } + protected void createAdditionalControls(Composite parent) { + + } + /** * Tests if the current workbench selection is a suitable container to use. */ From 3f7d808eba38669a16b3c8f022b093bb5bfe33f0 Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Sun, 18 Sep 2011 13:21:07 +0200 Subject: [PATCH 0364/1286] Bug 351421 - E4 Application wizard should add Application.e4xmi, plugin.xml and the css and icons folders to build.properties --- .../wizards/project/E4NewProjectWizard.java | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java index 541ebdf860..921f3b4d7a 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java @@ -66,13 +66,17 @@ import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.pde.core.build.IBuildEntry; +import org.eclipse.pde.core.build.IBuildModelFactory; import org.eclipse.pde.core.plugin.IPluginBase; import org.eclipse.pde.core.plugin.IPluginElement; import org.eclipse.pde.core.plugin.IPluginExtension; import org.eclipse.pde.core.plugin.IPluginImport; import org.eclipse.pde.internal.core.ICoreConstants; +import org.eclipse.pde.internal.core.build.WorkspaceBuildModel; import org.eclipse.pde.internal.core.bundle.WorkspaceBundlePluginModel; import org.eclipse.pde.internal.core.plugin.WorkspacePluginModelBase; +import org.eclipse.pde.internal.core.project.PDEProject; import org.eclipse.pde.internal.core.util.CoreUtility; import org.eclipse.pde.internal.ui.PDEPlugin; import org.eclipse.pde.internal.ui.PDEUIMessages; @@ -207,14 +211,41 @@ protected void setPluginLibraries( this.createApplicationResources(fProjectProvider.getProject(), new NullProgressMonitor()); - + // Add the product sources + adjustBuildPropertiesFile(fProjectProvider.getProject()); return true; } catch (InvocationTargetException e) { PDEPlugin.logException(e); } catch (InterruptedException e) { + } catch (CoreException e) { + PDEPlugin.logException(e); } return false; } + + private void adjustBuildPropertiesFile(IProject project) throws CoreException { + IFile file = PDEProject.getBuildProperties(project); + if (file.exists()) { + WorkspaceBuildModel model = new WorkspaceBuildModel(file); + IBuildEntry e = model.getBuild().getEntry(IBuildEntry.BIN_INCLUDES); + + e.addToken("plugin.xml"); + + Map map = fApplicationPage.getData(); + String cssEntry = map.get(NewApplicationWizardPage.APPLICATION_CSS_PROPERTY); + if( cssEntry != null ) { + e.addToken(cssEntry); + } + + String xmiPath = map + .get(NewApplicationWizardPage.APPLICATION_XMI_PROPERTY); + if( xmiPath != null ) { + e.addToken(xmiPath); + } + + model.save(); + } + } /** * create products extension detail From 3eb3228eb3701d860d2392b4aecc2fb671e64710 Mon Sep 17 00:00:00 2001 From: Bogdan Gheorghe Date: Thu, 27 Oct 2011 10:45:12 -0400 Subject: [PATCH 0365/1286] XText-based css editor From 3e3da3ce8dacb300616bf785f1e6d57ff21608b4 Mon Sep 17 00:00:00 2001 From: Bogdan Gheorghe Date: Thu, 27 Oct 2011 11:10:52 -0400 Subject: [PATCH 0366/1286] Added CSS editor ui improvements From 617b36ddaf7d2b0d060264168da1dd54699e863b Mon Sep 17 00:00:00 2001 From: Bogdan Gheorghe Date: Thu, 27 Oct 2011 11:41:20 -0400 Subject: [PATCH 0367/1286] Add feature for CSS editor From a2b9c6c05f8de3020b7f7ce0df60d619dd356c67 Mon Sep 17 00:00:00 2001 From: Bogdan Gheorghe Date: Tue, 1 Nov 2011 16:39:14 -0400 Subject: [PATCH 0368/1286] Add CSSEditorPrefs tweaklet From f802c154d59dadfa5c311f0e1e2324c583918b18 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Wed, 16 Nov 2011 17:17:58 -0500 Subject: [PATCH 0369/1286] Initial contribution of the CSS Spy From d200e33b8738de0768affaaa27c4fd319f27185e Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Thu, 17 Nov 2011 08:08:09 -0500 Subject: [PATCH 0370/1286] Some minor rearrangements of the interesting-details dump, fix highlighting for shells (already in display coordinates), and avoid querying CSS selector for empty string. From 779f57adc34ba81ee03a7b29ddfca4dc970f5f04 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Thu, 17 Nov 2011 09:21:04 -0500 Subject: [PATCH 0371/1286] Apply Eclipse formatting standard From 23c595b1edeb5c119e05fdc6ecf0c29008eb7548 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Thu, 17 Nov 2011 09:22:01 -0500 Subject: [PATCH 0372/1286] Rename CSSHandler to CSSPropertyProvider From ed294fe0998945f7e479b40ee547b95318112c8d Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Thu, 17 Nov 2011 09:22:16 -0500 Subject: [PATCH 0373/1286] Use new CSSEngine#getCSSPropertyHandlers() From c34f848f3684fbe8ec6ab6975a169456344d4095 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Thu, 17 Nov 2011 10:46:46 -0500 Subject: [PATCH 0374/1286] More message tweaking From 7d4ddef19f1776965d7f16c9467b62755b0e872d Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Thu, 17 Nov 2011 17:16:43 -0500 Subject: [PATCH 0375/1286] Add composite layout as it can be helpful for debugging From a5119d54b9aa21f136b9485d66f870224b6cc404 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Fri, 18 Nov 2011 10:27:32 -0500 Subject: [PATCH 0376/1286] Use proper per-column label providers and enable tooltips. From 85e4c24ec9c764f55484a13e11769f5f59a8baef Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Fri, 18 Nov 2011 11:07:09 -0500 Subject: [PATCH 0377/1286] Add support for editing and changing CSS properties for the selected widget From f007009247bdbee8268cc5191e5b692061b0072b Mon Sep 17 00:00:00 2001 From: Bogdan Gheorghe Date: Wed, 30 Nov 2011 23:35:18 -0500 Subject: [PATCH 0378/1286] CSSEditorPreferences page From be31cd1c1db5c50f38f4b4a5c8cc946acd8a84e0 Mon Sep 17 00:00:00 2001 From: Bogdan Gheorghe Date: Thu, 1 Dec 2011 17:50:52 -0500 Subject: [PATCH 0379/1286] Use new model service API for hosting MPart From dfbabb17e7131ec5a5d9242960014a99f29a92f4 Mon Sep 17 00:00:00 2001 From: Bogdan Gheorghe Date: Fri, 2 Dec 2011 16:35:27 -0500 Subject: [PATCH 0380/1286] Updated bundle version for CSS editor & CSS editor UI From fc0e228755ae1ca09a6f4ed5461a1aa3956cb309 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Sun, 4 Dec 2011 21:55:48 -0500 Subject: [PATCH 0381/1286] Make CSS Spy a bit more robust to unexpected inputs, including not assuming children from WidgetElements are themselves widgets (e.g., SWT_AWT bridge) From d1df77e2870ebb8696f35fdf068308f4892dbf7c Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Sun, 4 Dec 2011 21:56:46 -0500 Subject: [PATCH 0382/1286] Add feature for the CSS Spy From 1d026be0dddb71e16dc74f4098a66b55985b05a1 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Mon, 5 Dec 2011 14:06:01 -0500 Subject: [PATCH 0383/1286] CSS Spy: Fix creeping 1.6'isms, and fixup the feature From a1ec7197b6c808bed1cb617c11ece152c8e1e000 Mon Sep 17 00:00:00 2001 From: Paul Webster Date: Mon, 5 Dec 2011 15:35:45 -0500 Subject: [PATCH 0384/1286] Bug 365018 - [CSS] Add missing support to CSS engine Add css spy feature From c196a122763a5754b5c740f6265392da2a5ec140 Mon Sep 17 00:00:00 2001 From: Paul Webster Date: Tue, 6 Dec 2011 10:09:21 -0500 Subject: [PATCH 0385/1286] Bug 365018 - [CSS] Add missing support to CSS engine Need a build.properties, or it won't work. From a5eccef0420dadd8bfd0c36b66b3224db69fabcf Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Tue, 6 Dec 2011 16:44:33 -0500 Subject: [PATCH 0386/1286] [Spy] Guard against possible NPEs From 9af66d890c229980969af712bce4bb07909bda6c Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Thu, 8 Dec 2011 12:33:24 -0500 Subject: [PATCH 0387/1286] Add support for application snippets --- .../e4/tools/emf/ui/internal/Messages.java | 3 + .../tools/emf/ui/internal/Messages.properties | 3 + .../emf/ui/internal/common/ModelEditor.java | 3 + .../common/component/ApplicationEditor.java | 7 + .../component/virtual/VSnippetsEditor.java | 321 ++++++++++++++++++ 5 files changed, 337 insertions(+) create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VSnippetsEditor.java diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 42e3378c03..3b0e0830c1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -48,6 +48,7 @@ public class Messages { public String ApplicationEditor_Windows; public String ApplicationEditor_Addons; public String ApplicationEditor_MenuContributions; + public String ApplicationEditor_Snippets; public String ApplicationEditor_ToolBarContributions; public String ApplicationEditor_TrimContributions; public String ApplicationEditor_RootContexts; @@ -426,6 +427,8 @@ public class Messages { public String VPartDescriptor_Descriptors; public String VPartDescriptor_AddPartDescriptor; + public String VSnippetsEditor_Snippets; + public String VToolBarContributionsEditor_Contributions; public String VToolBarContributionsEditor_TreeLabelDescription; public String VToolBarContributionsEditor_TreeLabel; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 41dbdadb04..27b4e90d58 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -45,6 +45,7 @@ ApplicationEditor_Commands=Commands ApplicationEditor_Windows=Windows ApplicationEditor_Addons=Addons ApplicationEditor_MenuContributions=Menu Contributions +ApplicationEditor_Snippets=Snippets ApplicationEditor_ToolBarContributions=Toolbar Contributions ApplicationEditor_TrimContributions=Trim Contributions ApplicationEditor_RootContexts=Binding Contexts @@ -425,6 +426,8 @@ VPartDescriptor_TreeLabelDescription=Part Descriptors Bla Bla Bla Bla Bla VPartDescriptor_Descriptors=Descriptors VPartDescriptor_AddPartDescriptor=Descriptor +VSnippetsEditor_Snippets=Snippets; + VToolBarContributionsEditor_TreeLabel=ToolBar Contributions VToolBarContributionsEditor_TreeLabelDescription=ToolBar Contributions Bla Bla Bla Bla Bla VToolBarContributionsEditor_Contributions=ToolBar Contributions diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 381dd8bc04..730a1f2ad6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -113,6 +113,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPerspectiveControlEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPerspectiveWindowsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VRootBindingContexts; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VSnippetsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VToolBarContributionsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VTrimContributionsEditor; import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowControlEditor; @@ -236,6 +237,7 @@ public class ModelEditor { public static final String VIRTUAL_MENUELEMENTS = ModelEditor.class.getName() + ".VIRTUAL_MENUELEMENTS"; //$NON-NLS-1$ public static final String VIRTUAL_ROOT_CONTEXTS = ModelEditor.class.getName() + ".VIRTUAL_ROOT_CONTEXTS"; //$NON-NLS-1$ public static final String VIRTUAL_PERSPECTIVE_CONTROLS = ModelEditor.class.getName() + "VIRTUAL_PERSPECTIVE_CONTROLS"; //$NON-NLS-1$ + public static final String VIRTUAL_SNIPPETS = ModelEditor.class.getName() + "VIRTUAL_SNIPPETS"; //$NON-NLS-1$ private static final int VERTICAL_RULER_WIDTH = 20; @@ -880,6 +882,7 @@ private void registerVirtualEditors() { registerVirtualEditor(VIRTUAL_PARAMETERS, ContextInjectionFactory.make(VItemParametersEditor.class, context)); registerVirtualEditor(VIRTUAL_ROOT_CONTEXTS, ContextInjectionFactory.make(VRootBindingContexts.class, context)); registerVirtualEditor(VIRTUAL_PERSPECTIVE_CONTROLS, ContextInjectionFactory.make(VPerspectiveControlEditor.class, context)); + registerVirtualEditor(VIRTUAL_SNIPPETS, ContextInjectionFactory.make(VSnippetsEditor.class, context)); } private void registerVirtualEditor(String id, AbstractComponentEditor editor) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index 846494bc0c..b5675746f3 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -95,6 +95,7 @@ public class ApplicationEditor extends AbstractComponentEditor { private IListProperty MENU_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS); private IListProperty TOOLBAR_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS); private IListProperty TRIM_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS); + private IListProperty APPLICATION__SNIPPETS = EMFProperties.list(UiPackageImpl.Literals.SNIPPET_CONTAINER__SNIPPETS); private IListProperty APPLICATION__CATEGORIES = EMFProperties.list(ApplicationPackageImpl.Literals.APPLICATION__CATEGORIES); private IListProperty BINDING_TABLE_CONTAINER__ROOT_CONTEXT = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT); @@ -311,6 +312,12 @@ protected boolean accepted(Object o) { return true; } }); + list.add(new VirtualEntry(ModelEditor.VIRTUAL_SNIPPETS, APPLICATION__SNIPPETS, element, Messages.ApplicationEditor_Snippets) { + @Override + protected boolean accepted(Object o) { + return true; + } + }); // // MApplication application = (MApplication) element; // if (application.getRootContext() != null) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VSnippetsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VSnippetsEditor.java new file mode 100644 index 0000000000..1932fa060e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VSnippetsEditor.java @@ -0,0 +1,321 @@ +package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; + +import java.util.ArrayList; +import java.util.List; +import javax.annotation.PostConstruct; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.e4.tools.emf.ui.common.Util; +import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; +import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; +import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; +import org.eclipse.e4.ui.model.application.ui.MElementContainer; +import org.eclipse.e4.ui.model.application.ui.MUIElement; +import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; +import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +public class VSnippetsEditor extends AbstractComponentEditor { + private Composite composite; + private EMFDataBindingContext context; + private TableViewer viewer; + private List actions = new ArrayList(); + private EStructuralFeature targetFeature; + + public VSnippetsEditor() { + super(); + this.targetFeature = UiPackageImpl.Literals.SNIPPET_CONTAINER__SNIPPETS; + } + + @PostConstruct + void init() { + actions.add(new Action(Messages.VWindowEditor_AddTrimmedWindow, createImageDescriptor(ResourceProvider.IMG_Window)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.TRIMMED_WINDOW); + } + }); + actions.add(new Action(Messages.VWindowEditor_AddWindow, createImageDescriptor(ResourceProvider.IMG_Window)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.WINDOW); + } + }); + actions.add(new Action(Messages.VWindowControlEditor_AddPerspectiveStack, createImageDescriptor(ResourceProvider.IMG_PerspectiveStack)) { + @Override + public void run() { + handleAdd(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK); + } + }); + actions.add(new Action(Messages.PerspectiveStackEditor_AddPerspective, createImageDescriptor(ResourceProvider.IMG_Perspective)) { + @Override + public void run() { + handleAdd(AdvancedPackageImpl.Literals.PERSPECTIVE); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddPartSashContainer, createImageDescriptor(ResourceProvider.IMG_PartSashContainer_vertical)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART_SASH_CONTAINER); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddPartStack, createImageDescriptor(ResourceProvider.IMG_PartStack)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART_STACK); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddPart, createImageDescriptor(ResourceProvider.IMG_Part)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.PART); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddInputPart, createImageDescriptor(ResourceProvider.IMG_Part)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.INPUT_PART); + } + }); + + actions.add(new Action(Messages.VWindowControlEditor_AddArea, createImageDescriptor(ResourceProvider.IMG_Area_vertical)) { + @Override + public void run() { + handleAdd(AdvancedPackageImpl.Literals.AREA); + } + }); + actions.add(new Action(Messages.VWindowTrimEditor_AddWindowTrim, createImageDescriptor(ResourceProvider.IMG_WindowTrim)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.TRIM_BAR); + } + }); + actions.add(new Action(Messages.VTrimContributionsEditor_AddTrimContribution, createImageDescriptor(ResourceProvider.IMG_TrimContribution)) { + @Override + public void run() { + handleAdd(BasicPackageImpl.Literals.TRIM_ELEMENT); + } + }); + + } + + @Override + public Image getImage(Object element, Display display) { + return null; + } + + @Override + public String getLabel(Object element) { + return Messages.VWindowControlEditor_TreeLabel; + } + + @Override + public String getDetailLabel(Object element) { + return null; + } + + @Override + public String getDescription(Object element) { + return Messages.VWindowControlEditor_TreeLabelDescription; + } + + @Override + public Composite doGetEditor(Composite parent, Object object) { + if (composite == null) { + context = new EMFDataBindingContext(); + composite = createForm(parent, context, getMaster()); + } + VirtualEntry o = (VirtualEntry) object; + viewer.setInput(o.getList()); + getMaster().setValue(o.getOriginalParent()); + return composite; + } + + private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { + CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); + + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Messages.ModelTooling_Common_TabDefault); + + parent = createScrollableContainer(folder); + item.setControl(parent.getParent()); + + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.VSnippetsEditor_Snippets); + l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + viewer = new TableViewer(parent); + ObservableListContentProvider cp = new ObservableListContentProvider(); + viewer.setContentProvider(cp); + viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); + GridData gd = new GridData(GridData.FILL_BOTH); + viewer.getControl().setLayoutData(gd); + + Composite buttonComp = new Composite(parent, SWT.NONE); + buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); + GridLayout gl = new GridLayout(2, false); + gl.marginLeft = 0; + gl.marginRight = 0; + gl.marginWidth = 0; + gl.marginHeight = 0; + buttonComp.setLayout(gl); + + Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + + b.setText(Messages.ModelTooling_Common_Up); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @SuppressWarnings("unchecked") + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + EObject container = (EObject) getMaster().getValue(); + List l = (List) container.eGet(targetFeature); + int idx = l.indexOf(obj) - 1; + if (idx >= 0) { + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx, targetFeature)) { + viewer.setSelection(new StructuredSelection(obj)); + } + } + + } + } + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Down); + b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @SuppressWarnings("unchecked") + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + if (s.size() == 1) { + Object obj = s.getFirstElement(); + EObject container = (EObject) getMaster().getValue(); + List l = (List) container.eGet(targetFeature); + int idx = l.indexOf(obj) + 1; + if (idx < l.size()) { + if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx, targetFeature)) { + viewer.setSelection(new StructuredSelection(obj)); + } + } + } + } + } + }); + + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + EClass eclass = (EClass) element; + return eclass.getName(); + } + }); + childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.TRIMMED_WINDOW, BasicPackageImpl.Literals.WINDOW, AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, AdvancedPackageImpl.Literals.PERSPECTIVE, AdvancedPackageImpl.Literals.AREA, BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, BasicPackageImpl.Literals.TRIM_BAR, BasicPackageImpl.Literals.TRIM_ELEMENT, }); + childrenDropDown.setSelection(new StructuredSelection(AdvancedPackageImpl.Literals.PERSPECTIVE)); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); + handleAdd(eClass); + } + }); + + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_Remove); + b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + b.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (!viewer.getSelection().isEmpty()) { + List windows = ((IStructuredSelection) viewer.getSelection()).toList(); + MElementContainer container = (MElementContainer) getMaster().getValue(); + Command cmd = RemoveCommand.create(getEditingDomain(), container, targetFeature, windows); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + if (container.getChildren().size() > 0) { + viewer.setSelection(new StructuredSelection(container.getChildren().get(0))); + } + } + } + } + }); + + folder.setSelection(0); + + return folder; + } + + @Override + public IObservableList getChildList(Object element) { + return null; + } + + @Override + public List getActions(Object element) { + ArrayList l = new ArrayList(super.getActions(element)); + l.addAll(actions); + return l; + } + + protected void handleAdd(EClass eClass) { + EObject handler = EcoreUtil.create(eClass); + setElementId(handler); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), targetFeature, handler); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(handler); + } + } +} \ No newline at end of file From 8751ad430ce4ab756be880e9f2b9e192c82d714c Mon Sep 17 00:00:00 2001 From: droberts Date: Thu, 19 Jan 2012 12:28:35 -0500 Subject: [PATCH 0388/1286] Bug 307458 - Using 'platform:/plugin' URI on handlers is not a good idea --- .../emf/ui/common/ContributionURIValidator.java | 4 ++-- .../wizards/model/NewApplicationModelWizard.java | 12 ++++++------ .../tools/wizards/project/E4NewProjectWizard.java | 14 +++++++------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ContributionURIValidator.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ContributionURIValidator.java index 77f9dc4c92..115cac4c6b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ContributionURIValidator.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ContributionURIValidator.java @@ -25,8 +25,8 @@ public IStatus validate(Object value) { } else { try { URI uri = URI.createURI(value.toString()); - if (uri.segmentCount() != 3) { - return new Status(IStatus.ERROR, "org.eclipse.e4.tools.emf.ui", "The uri has to have the format 'platform:/plugin/$$bundleId$$/$$className$$'"); + if (uri.authority() == null || uri.authority().length() == 0 || uri.segmentCount() != 1) { + return new Status(IStatus.ERROR, "org.eclipse.e4.tools.emf.ui", "The uri has to have the format 'bundleclass://$$bundleId$$/$$className$$'"); } } catch (Exception e) { return new Status(IStatus.ERROR, "org.eclipse.e4.tools.emf.ui", e.getMessage()); diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java index 8e030bb61d..8d5d78fdc1 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java @@ -35,12 +35,12 @@ protected EObject createInitialModel() { application.setElementId(getModelFile().getProject().getName() + ".application"); if( ((ModelFilePageImpl)getPages()[0]).includeDefaultAddons.getSelection() ) { String[][] addons = { - { "org.eclipse.e4.core.commands.service", "platform:/plugin/org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon" }, - { "org.eclipse.e4.ui.contexts.service", "platform:/plugin/org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon" }, - { "org.eclipse.e4.ui.bindings.service", "platform:/plugin/org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon" }, - { "org.eclipse.e4.ui.workbench.commands.model", "platform:/plugin/org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon" }, - { "org.eclipse.e4.ui.workbench.contexts.model", "platform:/plugin/org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon" }, - { "org.eclipse.e4.ui.workbench.bindings.model", "platform:/plugin/org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon" } + { "org.eclipse.e4.core.commands.service", "bundleclass://org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon" }, + { "org.eclipse.e4.ui.contexts.service", "bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon" }, + { "org.eclipse.e4.ui.bindings.service", "bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon" }, + { "org.eclipse.e4.ui.workbench.commands.model", "bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon" }, + { "org.eclipse.e4.ui.workbench.contexts.model", "bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon" }, + { "org.eclipse.e4.ui.workbench.bindings.model", "bundleclass://org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon" } }; diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java index 921f3b4d7a..32bc24f6dd 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java @@ -398,32 +398,32 @@ public void createApplicationResources(IProject project, MAddon addon = MApplicationFactory.INSTANCE.createAddon(); addon.setElementId("org.eclipse.e4.core.commands.service"); - addon.setContributionURI("platform:/plugin/org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"); + addon.setContributionURI("bundleclass://org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"); application.getAddons().add(addon); addon = MApplicationFactory.INSTANCE.createAddon(); addon.setElementId("org.eclipse.e4.ui.contexts.service"); - addon.setContributionURI("platform:/plugin/org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"); + addon.setContributionURI("bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"); application.getAddons().add(addon); addon = MApplicationFactory.INSTANCE.createAddon(); addon.setElementId("org.eclipse.e4.ui.bindings.service"); - addon.setContributionURI("platform:/plugin/org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"); + addon.setContributionURI("bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"); application.getAddons().add(addon); addon = MApplicationFactory.INSTANCE.createAddon(); addon.setElementId("org.eclipse.e4.ui.workbench.commands.model"); - addon.setContributionURI("platform:/plugin/org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon"); + addon.setContributionURI("bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon"); application.getAddons().add(addon); addon = MApplicationFactory.INSTANCE.createAddon(); addon.setElementId("org.eclipse.e4.ui.workbench.contexts.model"); - addon.setContributionURI("platform:/plugin/org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon"); + addon.setContributionURI("bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon"); application.getAddons().add(addon); addon = MApplicationFactory.INSTANCE.createAddon(); addon.setElementId("org.eclipse.e4.ui.workbench.bindings.model"); - addon.setContributionURI("platform:/plugin/org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon"); + addon.setContributionURI("bundleclass://org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon"); application.getAddons().add(addon); MBindingContext rootContext = MCommandsFactory.INSTANCE @@ -647,7 +647,7 @@ private MCommand createCommand(String name, String className, // Create Quit handler for command MHandler quitHandler = MCommandsFactory.INSTANCE.createHandler(); quitHandler.setCommand(command); - quitHandler.setContributionURI("platform:/plugin/" + projectName + quitHandler.setContributionURI("bundleclass://" + projectName + "/" + fragment.getElementName() + ".handlers." + className); application.getHandlers().add(quitHandler); From 3694f8ff772197fd57ecc5395b41f9bb46566c0b Mon Sep 17 00:00:00 2001 From: Paul Webster Date: Wed, 25 Jan 2012 15:20:35 -0500 Subject: [PATCH 0389/1286] Bugzilla 307458 - Using 'platform:/plugin' URI on handlers Final changes to tools --- .../eclipse/e4/tools/emf/editor3x/ClassMoveParticipant.java | 2 +- .../eclipse/e4/tools/emf/editor3x/ClassRenameParticipant.java | 4 ++-- .../tools/emf/editor3x/extension/AddonContributionEditor.java | 4 ++-- .../emf/editor3x/extension/HandlerContributionEditor.java | 4 ++-- .../tools/emf/editor3x/extension/PartContributionEditor.java | 4 ++-- .../e4/tools/emf/ui/common/ContributionURIValidator.java | 2 +- .../eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java | 4 ++-- .../common/component/dialogs/ContributionClassDialog.java | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassMoveParticipant.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassMoveParticipant.java index 0c883aa0c7..675979aaa4 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassMoveParticipant.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassMoveParticipant.java @@ -46,7 +46,7 @@ public Change createChange(IProgressMonitor pm) throws CoreException, String toBundle = Util.getBundleSymbolicName(fragment.getJavaProject().getProject()); String toClassName = fragment.getElementName().length() == 0 ? type.getElementName() : fragment.getElementName() + "." + type.getElementName(); - return RefactorParticipantDelegate.createChange(pm, this, "platform:/plugin/"+fromBundle+"/"+fromClassname, "platform:/plugin/"+toBundle+"/"+toClassName); + return RefactorParticipantDelegate.createChange(pm, this, "bundleclass://"+fromBundle+"/"+fromClassname, "bundleclass://"+toBundle+"/"+toClassName); } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassRenameParticipant.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassRenameParticipant.java index 7547109159..e053cda698 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassRenameParticipant.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ClassRenameParticipant.java @@ -50,8 +50,8 @@ public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException { String bundle = Util.getBundleSymbolicName(type.getJavaProject().getProject()); - final String newUrl = "platform:/plugin/" + bundle + "/" + (type.getPackageFragment().getElementName().length() == 0 ? getArguments().getNewName() : type.getPackageFragment().getElementName() + "." + getArguments().getNewName()); - String oldUrl = "platform:/plugin/" + bundle + "/" + type.getFullyQualifiedName().replace(".", "\\."); + final String newUrl = "bundleclass://" + bundle + "/" + (type.getPackageFragment().getElementName().length() == 0 ? getArguments().getNewName() : type.getPackageFragment().getElementName() + "." + getArguments().getNewName()); + String oldUrl = "bundleclass://" + bundle + "/" + type.getFullyQualifiedName().replace(".", "\\."); return RefactorParticipantDelegate.createChange(pm, this, oldUrl, newUrl); } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java index a1da6fd58e..a37f124260 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java @@ -53,7 +53,7 @@ public void createOpen(MContribution contribution, EditingDomain domain, private void createOpen(MContribution contribution, EditingDomain domain, IProject project, Shell shell, boolean forceNew) { - if( forceNew || contribution.getContributionURI() == null || contribution.getContributionURI().trim().length() == 0 || !contribution.getContributionURI().startsWith("platform:") ) { + if( forceNew || contribution.getContributionURI() == null || contribution.getContributionURI().trim().length() == 0 || !contribution.getContributionURI().startsWith("bundleclass:") ) { NewAddonClassWizard wizard = new NewAddonClassWizard(); wizard.init( null, new StructuredSelection(project)); WizardDialog dialog = new WizardDialog(shell, wizard); @@ -74,7 +74,7 @@ private void createOpen(MContribution contribution, EditingDomain domain, fullyQualified = wizard.getDomainClass().getName(); } - Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "platform:/plugin/" + Util.getBundleSymbolicName(f.getProject()) + "/" + fullyQualified); + Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "bundleclass://" + Util.getBundleSymbolicName(f.getProject()) + "/" + fullyQualified); if( cmd.canExecute() ) { domain.getCommandStack().execute(cmd); } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java index e8e1ca2a58..d1be445ea5 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java @@ -43,7 +43,7 @@ public void createOpen(MContribution contribution, EditingDomain domain, IProjec } private void createOpen(MContribution contribution, EditingDomain domain, IProject project, Shell shell, boolean forceNew) { - if( contribution.getContributionURI() == null || contribution.getContributionURI().trim().length() == 0 || !contribution.getContributionURI().startsWith("platform:") ) { + if( contribution.getContributionURI() == null || contribution.getContributionURI().trim().length() == 0 || !contribution.getContributionURI().startsWith("bundleclass:") ) { NewHandlerClassWizard wizard = new NewHandlerClassWizard(); wizard.init( null, new StructuredSelection(project)); WizardDialog dialog = new WizardDialog(shell, wizard); @@ -64,7 +64,7 @@ private void createOpen(MContribution contribution, EditingDomain domain, IProje fullyQualified = wizard.getDomainClass().getName(); } - Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "platform:/plugin/" + Util.getBundleSymbolicName(f.getProject()) + "/" + fullyQualified); + Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "bundleclass://" + Util.getBundleSymbolicName(f.getProject()) + "/" + fullyQualified); if( cmd.canExecute() ) { domain.getCommandStack().execute(cmd); } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java index 22561f88c2..7383e50f5d 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java @@ -45,7 +45,7 @@ private void createOpen(MContribution contribution, EditingDomain domain, IProject project, Shell shell, boolean forceNew) { if ( forceNew || contribution.getContributionURI() == null || contribution.getContributionURI().trim().length() == 0 - || !contribution.getContributionURI().startsWith("platform:")) { + || !contribution.getContributionURI().startsWith("bundleclass:")) { NewPartClassWizard wizard = new NewPartClassWizard(); wizard.init(null, new StructuredSelection(project)); WizardDialog dialog = new WizardDialog(shell, wizard); @@ -66,7 +66,7 @@ private void createOpen(MContribution contribution, EditingDomain domain, fullyQualified = wizard.getDomainClass().getName(); } - Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "platform:/plugin/" + Util.getBundleSymbolicName(f.getProject()) + "/" + fullyQualified); + Command cmd = SetCommand.create(domain, contribution, ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, "bundleclass://" + Util.getBundleSymbolicName(f.getProject()) + "/" + fullyQualified); if( cmd.canExecute() ) { domain.getCommandStack().execute(cmd); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ContributionURIValidator.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ContributionURIValidator.java index 115cac4c6b..4ec3193764 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ContributionURIValidator.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ContributionURIValidator.java @@ -20,7 +20,7 @@ public class ContributionURIValidator implements IValidator { public IStatus validate(Object value) { if (value == null) { return new Status(IStatus.ERROR, "org.eclipse.e4.tools.emf.ui", "The URI must not be empty!"); - } else if (!value.toString().startsWith("platform:/plugin")) { + } else if (!value.toString().startsWith("bundleclass:")) { return new Status(IStatus.ERROR, "org.eclipse.e4.tools.emf.ui", "The URI has to start with 'platform:/plugin'"); } else { try { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 730a1f2ad6..31e5bf0e2c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -854,7 +854,7 @@ private void registerContributedVirtualEditors() { } IContributionFactory fact = context.get(IContributionFactory.class); - AbstractComponentEditor editor = (AbstractComponentEditor) fact.create("platform:/plugin/" + el.getContributor().getName() + "/" + el.getAttribute("class"), context); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + AbstractComponentEditor editor = (AbstractComponentEditor) fact.create("bundleclass://" + el.getContributor().getName() + "/" + el.getAttribute("class"), context); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ registerVirtualEditor(el.getAttribute("id"), editor); //$NON-NLS-1$ } } @@ -906,7 +906,7 @@ private void registerContributedEditors() { IEditorDescriptor desc = (IEditorDescriptor) el.createExecutableExtension("descriptorClass"); //$NON-NLS-1$ EClass eClass = desc.getEClass(); IContributionFactory fact = context.get(IContributionFactory.class); - AbstractComponentEditor editor = (AbstractComponentEditor) fact.create("platform:/plugin/" + el.getContributor().getName() + "/" + desc.getEditorClass().getName(), context); //$NON-NLS-1$ //$NON-NLS-2$ + AbstractComponentEditor editor = (AbstractComponentEditor) fact.create("bundleclass://" + el.getContributor().getName() + "/" + desc.getEditorClass().getName(), context); //$NON-NLS-1$ //$NON-NLS-2$ registerEditor(eClass, editor); } catch (CoreException e) { // TODO Auto-generated catch block diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java index d7664cf431..50b4056fb0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -162,7 +162,7 @@ protected void okPressed() { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (!s.isEmpty()) { ContributionData cd = (ContributionData) s.getFirstElement(); - String uri = "platform:/plugin/" + cd.bundleName + "/" + cd.className; //$NON-NLS-1$ //$NON-NLS-2$ + String uri = "bundleclass://" + cd.bundleName + "/" + cd.className; //$NON-NLS-1$ //$NON-NLS-2$ Command cmd = SetCommand.create(editingDomain, contribution, feature, uri); if (cmd.canExecute()) { editingDomain.getCommandStack().execute(cmd); From ad69c4784e2b1c184e17655f8a1ec507996368e0 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Thu, 26 Jan 2012 15:14:47 -0500 Subject: [PATCH 0390/1286] Update class-open actions for new bundleclass URI --- .../extension/AddonContributionEditor.java | 84 ++++++++++--------- .../extension/HandlerContributionEditor.java | 14 ++-- .../extension/PartContributionEditor.java | 84 ++++++++++--------- 3 files changed, 94 insertions(+), 88 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java index a37f124260..023ecb2b24 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java @@ -84,47 +84,49 @@ private void createOpen(MContribution contribution, EditingDomain domain, } } } else { - URI uri = URI.createURI(contribution.getContributionURI()); - if (uri.segmentCount() == 3) { - IProject p = ResourcesPlugin.getWorkspace().getRoot() - .getProject(uri.segment(1)); - - if( ! p.exists() ) { - for( IProject check : ResourcesPlugin.getWorkspace().getRoot().getProjects() ) { - String name = Util.getBundleSymbolicName(check); - if( uri.segment(1).equals(name) ) { - p = check; - break; - } - } - } - - // TODO If this is not a WS-Resource we need to open differently - if (p != null) { - IJavaProject jp = JavaCore.create(p); - try { - IType t = jp.findType(uri.segment(2)); - if( t != null ) { - JavaUI.openInEditor(t); - } else { - if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+uri.segment(2)+"' was not found. Would you like to start the class creation wizard?") ) { - createOpen(contribution, domain, project, shell, true); - } - } - } catch (JavaModelException e) { - if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+uri.segment(2)+"' was not found. Would you like to start the class creation wizard?") ) { - createOpen(contribution, domain, project, shell, true); - } - } catch (PartInitException e) { - MessageDialog.openError(shell, "Failed to open editor", e.getMessage()); - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } else { - MessageDialog.openError(shell, "Invalid URL", - "The current url is invalid"); - } + URI uri = URI.createURI(contribution.getContributionURI()); + if (uri.hasAuthority() && uri.segmentCount() == 1) { + String symbolicName = uri.authority(); + String fullyQualified = uri.segment(0); + IProject p = ResourcesPlugin.getWorkspace().getRoot() + .getProject(symbolicName); + + if( ! p.exists() ) { + for( IProject check : ResourcesPlugin.getWorkspace().getRoot().getProjects() ) { + String name = Util.getBundleSymbolicName(check); + if( symbolicName.equals(name) ) { + p = check; + break; + } + } + } + + // TODO If this is not a WS-Resource we need to open differently + if (p != null) { + IJavaProject jp = JavaCore.create(p); + try { + IType t = jp.findType(fullyQualified); + if( t != null ) { + JavaUI.openInEditor(t); + } else { + if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+fullyQualified+"' was not found. Would you like to start the class creation wizard?") ) { + createOpen(contribution, domain, project, shell, true); + } + } + } catch (JavaModelException e) { + if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+fullyQualified+"' was not found. Would you like to start the class creation wizard?") ) { + createOpen(contribution, domain, project, shell, true); + } + } catch (PartInitException e) { + MessageDialog.openError(shell, "Failed to open editor", e.getMessage()); + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } else { + MessageDialog.openError(shell, "Invalid URL", + "The current url is invalid"); + } } } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java index d1be445ea5..36bc0c2e90 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java @@ -75,14 +75,16 @@ private void createOpen(MContribution contribution, EditingDomain domain, IProje } } else { URI uri = URI.createURI(contribution.getContributionURI()); - if (uri.segmentCount() == 3) { + if (uri.hasAuthority() && uri.segmentCount() == 1) { + String symbolicName = uri.authority(); + String fullyQualified = uri.segment(0); IProject p = ResourcesPlugin.getWorkspace().getRoot() - .getProject(uri.segment(1)); + .getProject(symbolicName); if( ! p.exists() ) { for( IProject check : ResourcesPlugin.getWorkspace().getRoot().getProjects() ) { String name = Util.getBundleSymbolicName(check); - if( uri.segment(1).equals(name) ) { + if( symbolicName.equals(name) ) { p = check; break; } @@ -93,16 +95,16 @@ private void createOpen(MContribution contribution, EditingDomain domain, IProje if (p != null) { IJavaProject jp = JavaCore.create(p); try { - IType t = jp.findType(uri.segment(2)); + IType t = jp.findType(fullyQualified); if( t != null ) { JavaUI.openInEditor(t); } else { - if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+uri.segment(2)+"' was not found. Would you like to start the class creation wizard?") ) { + if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+fullyQualified+"' was not found. Would you like to start the class creation wizard?") ) { createOpen(contribution, domain, project, shell, true); } } } catch (JavaModelException e) { - if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+uri.segment(2)+"' was not found. Would you like to start the class creation wizard?") ) { + if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+fullyQualified+"' was not found. Would you like to start the class creation wizard?") ) { createOpen(contribution, domain, project, shell, true); } } catch (PartInitException e) { diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java index 7383e50f5d..83eadf22eb 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java @@ -76,47 +76,49 @@ private void createOpen(MContribution contribution, EditingDomain domain, } } } else { - URI uri = URI.createURI(contribution.getContributionURI()); - if (uri.segmentCount() == 3) { - IProject p = ResourcesPlugin.getWorkspace().getRoot() - .getProject(uri.segment(1)); - - if( ! p.exists() ) { - for( IProject check : ResourcesPlugin.getWorkspace().getRoot().getProjects() ) { - String name = Util.getBundleSymbolicName(check); - if( uri.segment(1).equals(name) ) { - p = check; - break; - } - } - } - - // TODO If this is not a WS-Resource we need to open differently - if (p != null) { - IJavaProject jp = JavaCore.create(p); - try { - IType t = jp.findType(uri.segment(2)); - if( t != null ) { - JavaUI.openInEditor(t); - } else { - if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+uri.segment(2)+"' was not found. Would you like to start the class creation wizard?") ) { - createOpen(contribution, domain, project, shell, true); - } - } - } catch (JavaModelException e) { - if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+uri.segment(2)+"' was not found. Would you like to start the class creation wizard?") ) { - createOpen(contribution, domain, project, shell, true); - } - } catch (PartInitException e) { - MessageDialog.openError(shell, "Failed to open editor", e.getMessage()); - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } else { - MessageDialog.openError(shell, "Invalid URL", - "The current url is invalid"); - } + URI uri = URI.createURI(contribution.getContributionURI()); + if (uri.hasAuthority() && uri.segmentCount() == 1) { + String symbolicName = uri.authority(); + String fullyQualified = uri.segment(0); + IProject p = ResourcesPlugin.getWorkspace().getRoot() + .getProject(symbolicName); + + if( ! p.exists() ) { + for( IProject check : ResourcesPlugin.getWorkspace().getRoot().getProjects() ) { + String name = Util.getBundleSymbolicName(check); + if( symbolicName.equals(name) ) { + p = check; + break; + } + } + } + + // TODO If this is not a WS-Resource we need to open differently + if (p != null) { + IJavaProject jp = JavaCore.create(p); + try { + IType t = jp.findType(fullyQualified); + if( t != null ) { + JavaUI.openInEditor(t); + } else { + if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+fullyQualified+"' was not found. Would you like to start the class creation wizard?") ) { + createOpen(contribution, domain, project, shell, true); + } + } + } catch (JavaModelException e) { + if( MessageDialog.openQuestion(shell, "Class not found", "The class '"+fullyQualified+"' was not found. Would you like to start the class creation wizard?") ) { + createOpen(contribution, domain, project, shell, true); + } + } catch (PartInitException e) { + MessageDialog.openError(shell, "Failed to open editor", e.getMessage()); + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } else { + MessageDialog.openError(shell, "Invalid URL", + "The current url is invalid"); + } } } From 96c039728c918d2ae7515b27f63c4cd1011186f3 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Thu, 26 Jan 2012 15:15:13 -0500 Subject: [PATCH 0391/1286] Prevent NPE in New E4 Project wizard if bundles not present --- .../tools/wizards/project/E4NewProjectWizard.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java index 32bc24f6dd..ea336265fe 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java @@ -184,11 +184,13 @@ protected void adjustManifests( IPluginImport iimport = model .getPluginFactory().createImport(); iimport.setId(id); - Version version = dependency.getVersion(); - String versionString = version.getMajor() + "." - + version.getMinor() + "." - + version.getMicro(); - iimport.setVersion(versionString); + if(dependency != null) { + Version version = dependency.getVersion(); + String versionString = version.getMajor() + "." + + version.getMinor() + "." + + version.getMicro(); + iimport.setVersion(versionString); + } pluginBase.add(iimport); } } From 309f746f126ba4288fe7d64909cd7d38443dd244 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Thu, 26 Jan 2012 16:04:46 -0500 Subject: [PATCH 0392/1286] Bug 307458 - Using 'platform:/plugin' URI on handlers is not a good Fix up org.eclipse.e4.tools.compat's ReflectionContributionFactory to handle bundleclass:// style URIs --- .../ReflectionContributionFactory.java | 53 +++++++++++++++---- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java index 5b61577cca..ea7e640e5d 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java @@ -60,6 +60,15 @@ private Object doCreate(String uriString, IEclipseContext context, IEclipseConte if (uriString == null) { return null; } + // translate old-style platform:/plugin/ class specifiers into new-style + // bundleclass:// URIs + if (uriString.startsWith("platform:/plugin/")) { //$NON-NLS-1$ + logger.error("platform-style URIs deprecated for referencing types: " + uriString); //$NON-NLS-1$ + uriString = uriString + .replace("platform:/plugin/", "bundleclass://"); //$NON-NLS-1$ //$NON-NLS-2$ + logger.error("URI rewritten as: " + uriString); //$NON-NLS-1$ + } + URI uri = URI.createURI(uriString); Bundle bundle = getBundle(uri); Object contribution; @@ -76,17 +85,22 @@ private Object doCreate(String uriString, IEclipseContext context, IEclipseConte protected Object createFromBundle(Bundle bundle, IEclipseContext context, IEclipseContext staticContext, URI uri) { Object contribution; - if (uri.segmentCount() > 3) { - String prefix = uri.segment(2); + if (uri.segmentCount() > 1) { + String prefix = uri.segment(0); IContributionFactorySpi factory = (IContributionFactorySpi) languages.get(prefix); - StringBuffer resource = new StringBuffer(uri.segment(3)); - for (int i = 4; i < uri.segmentCount(); i++) { + if(factory == null) { + String message = "Unsupported contribution factory type '" + prefix + "'"; //$NON-NLS-1$ //$NON-NLS-2$ + logger.error(message); + return null; + } + StringBuffer resource = new StringBuffer(uri.segment(1)); + for (int i = 2; i < uri.segmentCount(); i++) { resource.append('/'); resource.append(uri.segment(i)); } contribution = factory.create(bundle, resource.toString(), context); } else { - String clazz = uri.segment(2); + String clazz = uri.segment(0); try { Class targetClass = bundle.loadClass(clazz); if (staticContext == null) @@ -136,7 +150,7 @@ protected void processLanguages() { protected Bundle getBundle(URI platformURI) { - return getBundleForName(platformURI.segments[1]); + return getBundleForName(platformURI.authority()); } public Bundle getBundle(String uriString) { @@ -164,14 +178,33 @@ public Bundle getBundleForName(String bundlename) { } static class URI { - String[] segments; - String uri; + String scheme; + String authority; + String[] segments = new String[0]; URI(String uriString) { - segments = uriString.substring(uriString.indexOf('/')+1).split("/"); + int colon = uriString.indexOf(':'); + if(colon < 0) { throw new IllegalArgumentException("invalid URI"); } + scheme = uriString.substring(0, colon); + uriString = uriString.substring(colon + 1); + if(uriString.startsWith("//")) { + int authEnd = uriString.indexOf('/', 2); + if(authEnd < 0) { + authority = uriString.substring(2); + } else { + authority = uriString.substring(2, authEnd); + segments = uriString.substring(authEnd + 1).split("/"); + } + } else { + segments = uriString.substring(uriString.indexOf('/')+1).split("/"); + } } - public String segment(int i) { + public String authority() { + return authority; + } + + public String segment(int i) { return segments[i]; } From 7d82f35089ef196e4d0df92472c8f03f642df07d Mon Sep 17 00:00:00 2001 From: Remy Suen Date: Mon, 30 Jan 2012 13:31:40 -0500 Subject: [PATCH 0393/1286] Bug 368192 Need to persist information in a window but only contributions have a persisted state map Update the model editor with the model changes. --- .../tools/emf/ui/internal/common/component/AddonsEditor.java | 4 ++-- .../tools/emf/ui/internal/common/component/HandlerEditor.java | 4 ++-- .../e4/tools/emf/ui/internal/common/component/PartEditor.java | 4 ++-- .../emf/ui/internal/common/component/ToolControlEditor.java | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java index 8b934ef325..ed553dc500 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. + * Copyright (c) 2010, 2012 BestSolution.at and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -181,7 +181,7 @@ public void widgetSelected(SelectionEvent e) { }); } - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); item = new CTabItem(folder, SWT.NONE); item.setText(Messages.ModelTooling_Common_TabSupplementary); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index 53a58181a1..f2b870a4e8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. + * Copyright (c) 2010, 2012 BestSolution.at and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -205,7 +205,7 @@ public void widgetSelected(SelectionEvent e) { } }); } - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); item = new CTabItem(folder, SWT.NONE); item.setText(Messages.ModelTooling_Common_TabSupplementary); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java index 1fe518a5c1..45475eac95 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. + * Copyright (c) 2010, 2012 BestSolution.at and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -286,7 +286,7 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.PartEditor_BindingContexts); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); item = new CTabItem(folder, SWT.NONE); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index 0e90d536df..ace2bd3a07 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. + * Copyright (c) 2010, 2012 BestSolution.at and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -176,7 +176,7 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); item = new CTabItem(folder, SWT.NONE); item.setText(Messages.ModelTooling_Common_TabSupplementary); From 845a0c8be1e662ac56fe63d710312f89ef16241d Mon Sep 17 00:00:00 2001 From: Eric Moffatt Date: Tue, 7 Feb 2012 14:04:08 -0500 Subject: [PATCH 0394/1286] Fix for Bug 370509 - New E4 Application wizard does not handle spaces in project name --- .../wizards/project/E4NewProjectWizard.java | 28 ++++++++++--------- .../project/NewApplicationWizardPage.java | 19 +++++++++---- .../wizards/project/PluginContentPage.java | 26 ++++++++++++++++- 3 files changed, 54 insertions(+), 19 deletions(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java index ea336265fe..24c84c3da6 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2010 Soyatec(http://www.soyatec.com) and others. + * Copyright (c) 2006, 2012 Soyatec(http://www.soyatec.com) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * Soyatec - initial API and implementation + * IBM Corporation - ongoing enhancements *******************************************************************************/ package org.eclipse.e4.internal.tools.wizards.project; @@ -129,7 +130,7 @@ public IPath getLocationPath() { fContentPage = new PluginContentPage( "page2", fProjectProvider, fMainPage, fPluginData); //$NON-NLS-1$ - fApplicationPage = new NewApplicationWizardPage(fProjectProvider); + fApplicationPage = new NewApplicationWizardPage(fProjectProvider, fPluginData); addPage(fContentPage); addPage(fApplicationPage); @@ -347,7 +348,8 @@ public void createApplicationResources(IProject project, || map.get(NewApplicationWizardPage.PRODUCT_NAME) == null) return; - String projectName = map.get(NewApplicationWizardPage.PRODUCT_NAME); + // If the project has invalid characters, the plug-in name would replace them with underscores, product name does the same + String pluginName = map.get(NewApplicationWizardPage.PRODUCT_NAME); String xmiPath = map .get(NewApplicationWizardPage.APPLICATION_XMI_PROPERTY); @@ -451,23 +453,23 @@ public void createApplicationResources(IProject project, // Create Quit command MCommand quitCommand = createCommand("quitCommand", "QuitHandler", - "Ctrl+Q", projectName, fragment, application); + "Ctrl+Q", pluginName, fragment, application); MCommand openCommand = createCommand("openCommand", "OpenHandler", - "Ctrl+O", projectName, fragment, application); + "Ctrl+O", pluginName, fragment, application); MCommand saveCommand = createCommand("saveCommand", "SaveHandler", - "Ctrl+S", projectName, fragment, application); + "Ctrl+S", pluginName, fragment, application); MCommand aboutCommand = createCommand("aboutCommand", - "AboutHandler", "Ctrl+A", projectName, fragment, + "AboutHandler", "Ctrl+A", pluginName, fragment, application); MTrimmedWindow mainWindow = MBasicFactory.INSTANCE .createTrimmedWindow(); application.getChildren().add(mainWindow); { - mainWindow.setLabel(projectName); + mainWindow.setLabel(pluginName); mainWindow.setWidth(500); mainWindow.setHeight(400); @@ -486,7 +488,7 @@ public void createApplicationResources(IProject project, fileMenuItem.getChildren().add(menuItemOpen); menuItemOpen.setLabel("Open"); menuItemOpen.setIconURI("platform:/plugin/" - + project.getName() + "/icons/sample.gif"); + + pluginName + "/icons/sample.gif"); menuItemOpen.setCommand(openCommand); MHandledMenuItem menuItemSave = MMenuFactory.INSTANCE @@ -494,7 +496,7 @@ public void createApplicationResources(IProject project, fileMenuItem.getChildren().add(menuItemSave); menuItemSave.setLabel("Save"); menuItemSave.setIconURI("platform:/plugin/" - + project.getName() + "/icons/save_edit.gif"); + + pluginName + "/icons/save_edit.gif"); menuItemSave.setCommand(saveCommand); MHandledMenuItem menuItemQuit = MMenuFactory.INSTANCE @@ -555,14 +557,14 @@ public void createApplicationResources(IProject project, .createHandledToolItem(); toolBar.getChildren().add(toolItemOpen); toolItemOpen.setIconURI("platform:/plugin/" - + project.getName() + "/icons/sample.gif"); + + pluginName + "/icons/sample.gif"); toolItemOpen.setCommand(openCommand); MHandledToolItem toolItemSave = MMenuFactory.INSTANCE .createHandledToolItem(); toolBar.getChildren().add(toolItemSave); toolItemSave.setIconURI("platform:/plugin/" - + project.getName() + "/icons/save_edit.gif"); + + pluginName + "/icons/save_edit.gif"); toolItemSave.setCommand(saveCommand); } } @@ -616,7 +618,7 @@ public void createApplicationResources(IProject project, binaryExtentions.add(".png"); Map keys = new HashMap(); - keys.put("projectName", projectName); + keys.put("projectName", pluginName); keys.put("packageName", fragment.getElementName() + ".handlers"); try { diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java index 14bc00b97e..8573dac15c 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2010 Soyatec (http://www.soyatec.com) and others. + * Copyright (c) 2006, 2012 Soyatec (http://www.soyatec.com) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * Soyatec - initial API and implementation + * IBM Corporation - ongoing enhancements *******************************************************************************/ package org.eclipse.e4.internal.tools.wizards.project; @@ -19,6 +20,7 @@ import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.pde.internal.ui.wizards.IProjectProvider; +import org.eclipse.pde.internal.ui.wizards.plugin.AbstractFieldData; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; @@ -58,12 +60,14 @@ public class NewApplicationWizardPage extends WizardPage { private Text proNameText; private Text proApplicationText; private Group propertyGroup; + private AbstractFieldData pluginData; private PropertyData[] PROPERTIES; - protected NewApplicationWizardPage(IProjectProvider projectProvider) { + protected NewApplicationWizardPage(IProjectProvider projectProvider, AbstractFieldData pluginData) { super("New e4 Application Wizard Page"); this.projectProvider = projectProvider; + this.pluginData = pluginData; data = new HashMap(); setTitle("e4 Application"); setMessage("Configure application with special values."); @@ -386,7 +390,9 @@ protected PropertyData[] getPropertyData() { @Override public void setVisible(boolean visible) { if (visible && PROPERTIES == null) { - proNameText.setText(projectProvider.getProjectName()); + + // Use the plug-in name for the product name (not project name which can contain illegal characters) + proNameText.setText(pluginData.getId()); proApplicationText.setText(E4_APPLICATION); @@ -406,8 +412,11 @@ public Map getData() { for (PropertyData property : getPropertyData()) { data.put(property.getName(), property.getValue()); } - - data.put(PRODUCT_NAME, projectProvider.getProjectName()); + + // Use the plug-in name for the product name (not project name which can contain illegal characters) + String productName = pluginData.getId(); + + data.put(PRODUCT_NAME, productName); data.put(APPLICATION, E4_APPLICATION); } Map map = new HashMap(); diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/PluginContentPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/PluginContentPage.java index 8f0c5ae0cb..74d65d95cf 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/PluginContentPage.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/PluginContentPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -50,6 +50,7 @@ import org.eclipse.swt.widgets.Text; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.PreferencesUtil; +import org.osgi.framework.Version; /** * Content wizard page for the New Plugin Project wizard (page 2) @@ -360,4 +361,27 @@ public boolean canFlipToNextPage() { } return super.canFlipToNextPage(); } + + /* (non-Javadoc) + * @see org.eclipse.pde.internal.ui.wizards.plugin.ContentPage#computeId() + */ + protected String computeId() { + String id = super.computeId(); + // In addition to removed illegal characters, the xmi model does not recognize plug-in uris if they end in a version number + // See PlatformURLPluginConnection.parse() + int underScore = id.lastIndexOf('_'); + Version version; + while (underScore >= 0) { + try { + version = Version.parseVersion(id.substring(underScore + 1)); + // name cannot end with a valid version, remove it + id = id.substring(0, underScore); + } catch (IllegalArgumentException iae) { + // valid name so far, continue to next underscore + } + underScore = id.lastIndexOf('_', underScore - 1); + + } + return id; + } } From cf77f529ed8ca0ddc5a5ef504791b73db5cc76b6 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Tue, 14 Feb 2012 17:23:53 -0500 Subject: [PATCH 0395/1286] Bequinox/rt.equinox.p2.gitug 371548 - [Model Editor] Model editor throws exception when used via File > Open File... --- .../eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java | 2 +- .../eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java index eff3aa3a7d..370dfb9cdf 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java @@ -66,7 +66,7 @@ public void dispose() { if (redoAction != null) redoAction.dispose(); - if (listener != null && getComponent().getModelProvider() != null) + if (listener != null && getComponent() != null && getComponent().getModelProvider() != null) getComponent().getModelProvider().removeModelListener(listener); super.dispose(); diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java index c99606b515..742cb743b4 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java @@ -10,7 +10,7 @@ public class EditorProjectFunction extends ContextFunction { @Override public Object compute(IEclipseContext context) { final IEditorInput input = context.get(IEditorInput.class); - if( input != null ) { + if( input != null && input instanceof IFileEditorInput ) { return ((IFileEditorInput)input).getFile().getProject(); } return null; From 29d56958f780fb6d51bc13249b85bbc9cceabfdd Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Tue, 14 Feb 2012 17:30:21 -0500 Subject: [PATCH 0396/1286] Bug 371549 - [Model Editor] Parts can define both menus and popup-menus --- .../e4/tools/emf/ui/internal/Messages.java | 1 + .../tools/emf/ui/internal/Messages.properties | 1 + .../common/component/virtual/VMenuEditor.java | 49 ++++++++++++++----- 3 files changed, 38 insertions(+), 13 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 3b0e0830c1..d8e672f6b1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -413,6 +413,7 @@ public class Messages { public String VMenuEditor_TreeLabelDescription; public String VMenuEditor_Menus; public String VMenuEditor_AddMenuContribution; + public String VMenuEditor_AddPopupMenuContribution; public String VModelFragmentsEditor_TreeLabel; public String VModelFragmentsEditor_TreeLabelDescription; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 27b4e90d58..52deb0acdd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -412,6 +412,7 @@ VMenuEditor_TreeLabel=Menus VMenuEditor_TreeLabelDescription=Menus Bla Bla Bla Bla Bla VMenuEditor_Menus=Menus VMenuEditor_AddMenuContribution=Menu +VMenuEditor_AddPopupMenuContribution=Popup Menu VModelFragmentsEditor_TreeLabel=Fragments VModelFragmentsEditor_TreeLabelDescription=Fragments Bla Bla Bla Bla Bla diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java index 7204aabb1a..7fc2f058a5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -21,18 +21,22 @@ import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.MoveCommand; import org.eclipse.emf.edit.command.RemoveCommand; import org.eclipse.jface.action.Action; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; @@ -52,8 +56,8 @@ public class VMenuEditor extends AbstractComponentEditor { private Composite composite; private EMFDataBindingContext context; private TableViewer viewer; - private EStructuralFeature feature; private List actions = new ArrayList(); + private EStructuralFeature feature; protected VMenuEditor(EStructuralFeature feature) { super(); @@ -65,7 +69,13 @@ void init() { actions.add(new Action(Messages.VMenuEditor_AddMenuContribution, createImageDescriptor(ResourceProvider.IMG_Menu)) { @Override public void run() { - handleAdd(); + handleAdd(MenuPackageImpl.Literals.MENU); + } + }); + actions.add(new Action(Messages.VMenuEditor_AddPopupMenuContribution, createImageDescriptor(ResourceProvider.IMG_Menu)) { + @Override + public void run() { + handleAdd(MenuPackageImpl.Literals.POPUP_MENU); } }); } @@ -124,7 +134,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); + GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; @@ -134,7 +144,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -161,7 +171,7 @@ public void widgetSelected(SelectionEvent e) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -186,21 +196,34 @@ public void widgetSelected(SelectionEvent e) { } }); + final ComboViewer childrenDropDown = new ComboViewer(buttonComp); + childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + childrenDropDown.setContentProvider(new ArrayContentProvider()); + childrenDropDown.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + EClass eclass = (EClass) element; + return eclass.getName(); + } + }); + childrenDropDown.setInput(new EClass[] { MenuPackageImpl.Literals.MENU, MenuPackageImpl.Literals.POPUP_MENU }); + childrenDropDown.setSelection(new StructuredSelection(MenuPackageImpl.Literals.MENU)); + b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - handleAdd(); + EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); + handleAdd(eClass); } }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -224,8 +247,8 @@ public IObservableList getChildList(Object element) { return null; } - protected void handleAdd() { - MMenu handler = MMenuFactory.INSTANCE.createMenu(); + protected void handleAdd(EClass eClass) { + EObject handler = EcoreUtil.create(eClass); setElementId(handler); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), feature, handler); From 622b23c2ed34d69c58be889d3d5e7a201eac3877 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Tue, 14 Feb 2012 17:43:50 -0500 Subject: [PATCH 0397/1286] Bug 371551 - [Model Editor] Adding Input Part via Window > Controls context menu instead adds a Part --- .../internal/common/component/virtual/VWindowControlEditor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index 1842987d61..7e910d6094 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -98,7 +98,7 @@ public void run() { actions.add(new Action(Messages.VWindowControlEditor_AddInputPart, createImageDescriptor(ResourceProvider.IMG_Part)) { @Override public void run() { - handleAdd(BasicPackageImpl.Literals.PART); + handleAdd(BasicPackageImpl.Literals.INPUT_PART); } }); From 6200249427056d25f98b32d4c660fce2aab7429a Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Tue, 14 Feb 2012 17:52:44 -0500 Subject: [PATCH 0398/1286] Bug 371553 - [Model Editor] NPE when finding a contribution class from Live Editor --- .../tools/emf/editor3x/PDEClassContributionProvider.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java index 7ae0019c62..4b3c3de337 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java @@ -18,6 +18,8 @@ import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider; import org.eclipse.jdt.core.JavaModelException; @@ -36,7 +38,10 @@ public PDEClassContributionProvider() { @SuppressWarnings("restriction") public void findContribution(final Filter filter, final ContributionResultHandler handler) { - IJavaSearchScope scope = PDEJavaHelper.getSearchScope(filter.project); + // filter.project may be null in the live editor + IJavaSearchScope scope = filter.project != null ? PDEJavaHelper + .getSearchScope(filter.project) : SearchEngine + .createWorkspaceScope(); char[] packageName = null; char[] typeName = null; @@ -85,7 +90,7 @@ public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, // System.err.println("Found: " + label + " => " + pName + " => " + path); - IResource resource = filter.project.getWorkspace().getRoot().findMember(path); + IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path); if( resource != null ) { IProject project = resource.getProject(); From 423b8751da303ab5cf29f9c3e9a74d2c40b32a31 Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Fri, 24 Feb 2012 00:40:12 +0100 Subject: [PATCH 0399/1286] Bug 371989 - Fail to open e4 workbench Editor --- .../org/eclipse/e4/tools/services/impl/ResourceService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java index f74b4af0fe..b4c9c83db6 100644 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java @@ -79,7 +79,7 @@ public void dispose() { } } - static class ResourcePool implements IDiposeableResourcePool { + public static class ResourcePool implements IDiposeableResourcePool { private ResourceService resourceService; private List> pooledImages = new ArrayList>(); @@ -88,9 +88,9 @@ static class ResourcePool implements IDiposeableResourcePool { private Display display; @Inject - public ResourcePool(ResourceService resourceService, Display display) { + public ResourcePool(IResourceService resourceService, Display display) { this.display = display; - this.resourceService = resourceService; + this.resourceService = (ResourceService) resourceService; } public Image getImage(String key) throws CoreException { From 2dea1d3291a20be553da903b4758fb850ef6d778 Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Fri, 24 Feb 2012 01:10:58 +0100 Subject: [PATCH 0400/1286] Bug 371989 - Fail to open e4 workbench Editor --- .../eclipse/e4/tools/services/impl/ResourceService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java index b4c9c83db6..7606412edd 100644 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java @@ -244,11 +244,11 @@ public ResourceService() { protected void removePooledResource(PooledResource resource) { if (resource.getResource() instanceof Image) { - displayPool.get(resource.display).getImagePool().remove(resource); + displayPool.get(resource.display).getImagePool().remove(resource.imageKey); } else if (resource.getResource() instanceof Color) { - displayPool.get(resource.display).getColorPool().remove(resource); + displayPool.get(resource.display).getColorPool().remove(resource.imageKey); } else if (resource.getResource() instanceof Font) { - displayPool.get(resource.display).getFontPool().remove(resource); + displayPool.get(resource.display).getFontPool().remove(resource.imageKey); } } @@ -268,7 +268,7 @@ private PooledResource loadResource( } } - if (resource != null) { + if (resource != null && resource.getResource() != null) { resource.count++; } else { resource = new PooledResource(display, this, key, From 0cf1d1f536a51613e69150a5e7123adc3e167942 Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Fri, 24 Feb 2012 01:22:49 +0100 Subject: [PATCH 0401/1286] Bug 371989 - Fail to open e4 workbench Editor --- .../e4/tools/services/IResourceService.java | 1 + .../tools/services/impl/ResourceService.java | 44 ++++++++++--------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceService.java index 93324df8f7..a52c0fbdae 100644 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceService.java +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceService.java @@ -19,6 +19,7 @@ public interface IResourceService { public interface IPooledResource { public T getResource(); + public String getId(); public void dispose(); } diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java index 7606412edd..468cfaf978 100644 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java @@ -49,17 +49,21 @@ static class PooledResource implements private Display display; private int count; private T resource; - private String imageKey; + private String id; private ResourceService resourceService; PooledResource(Display display, ResourceService resourceService, - String imageKey, T resource) { + String id, T resource) { this.display = display; - this.imageKey = imageKey; + this.id = id; this.count = 1; this.resourceService = resourceService; this.resource = resource; } + + public String getId() { + return id; + } public T getResource() { return resource; @@ -73,18 +77,18 @@ public void dispose() { resource.dispose(); } resource = null; - imageKey = null; + id = null; resourceService = null; } } } public static class ResourcePool implements IDiposeableResourcePool { - private ResourceService resourceService; + private IResourceService resourceService; - private List> pooledImages = new ArrayList>(); - private List> pooledFonts = new ArrayList>(); - private List> pooledColors = new ArrayList>(); + private List> pooledImages = new ArrayList>(); + private List> pooledFonts = new ArrayList>(); + private List> pooledColors = new ArrayList>(); private Display display; @Inject @@ -100,10 +104,10 @@ public Image getImage(String key) throws CoreException { "org.eclipse.e4.tools.services", "The pool is disposed")); } - PooledResource image = null; + IPooledResource image = null; - for (PooledResource img : pooledImages) { - if (img.imageKey.equals(key)) { + for (IPooledResource img : pooledImages) { + if (img.getId().equals(key)) { image = img; } } @@ -123,9 +127,9 @@ public Font getFont(String key) throws CoreException { "The pool is disposed")); } - PooledResource font = null; - for (PooledResource fon : pooledFonts) { - if (fon.imageKey.equals(key)) { + IPooledResource font = null; + for (IPooledResource fon : pooledFonts) { + if (fon.getId().equals(key)) { font = fon; } } @@ -143,10 +147,10 @@ public Color getColor(String key) throws CoreException { "org.eclipse.e4.tools.services", "The pool is disposed")); } - PooledResource color = null; + IPooledResource color = null; - for (PooledResource col : pooledColors) { - if (col.imageKey.equals(key)) { + for (IPooledResource col : pooledColors) { + if (col.getId().equals(key)) { color = col; } } @@ -244,11 +248,11 @@ public ResourceService() { protected void removePooledResource(PooledResource resource) { if (resource.getResource() instanceof Image) { - displayPool.get(resource.display).getImagePool().remove(resource.imageKey); + displayPool.get(resource.display).getImagePool().remove(resource.getId()); } else if (resource.getResource() instanceof Color) { - displayPool.get(resource.display).getColorPool().remove(resource.imageKey); + displayPool.get(resource.display).getColorPool().remove(resource.getId()); } else if (resource.getResource() instanceof Font) { - displayPool.get(resource.display).getFontPool().remove(resource.imageKey); + displayPool.get(resource.display).getFontPool().remove(resource.getId()); } } From ec55a29f4307e327a401bc33f3e1a2b21c14f979 Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Fri, 9 Mar 2012 16:14:06 +0100 Subject: [PATCH 0402/1286] [Bug 373476] [Bridge] No UISynchronizer installed into root context --- .../compat/internal/ContextServiceFactory.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java index 8cf22228ba..f487fdeff3 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java @@ -20,6 +20,7 @@ import org.eclipse.e4.tools.services.IClipboardService; import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; import org.eclipse.e4.ui.css.swt.theme.IThemeManager; +import org.eclipse.e4.ui.di.UISynchronize; import org.eclipse.e4.ui.services.IServiceConstants; import org.eclipse.e4.ui.services.IStylingEngine; import org.eclipse.jface.viewers.ISelection; @@ -63,11 +64,27 @@ public Object create(@SuppressWarnings("rawtypes") Class serviceInterface, IServ BundleContext bundleContext = bundle.getBundleContext(); IEclipseContext serviceContext = EclipseContextFactory.getServiceContext(bundleContext); + final IEclipseContext appContext = serviceContext.createChild("WorkbenchContext"); //$NON-NLS-1$ appContext.set(Display.class, Display.getCurrent()); appContext.set(Logger.class, new WorkbenchLogger()); appContext.set(IClipboardService.class, new ClipboardServiceImpl()); appContext.set(Realm.class, Realm.getDefault()); + + final Display d = Display.getCurrent(); + appContext.set(UISynchronize.class, new UISynchronize() { + + @Override + public void syncExec(Runnable runnable) { + d.syncExec(runnable); + } + + @Override + public void asyncExec(Runnable runnable) { + d.asyncExec(runnable); + } + }); + IContributionFactory contributionFactory = ContextInjectionFactory.make(ReflectionContributionFactory.class, appContext); appContext.set(IContributionFactory.class.getName(),contributionFactory); From 86a913abc14c6f2578b236610c03e284df20e1eb Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Fri, 9 Mar 2012 16:16:41 +0100 Subject: [PATCH 0403/1286] Bug 373805 - ISelectionProvider of compat layer can lead to a selection which can't be empty --- .../internal/SelectionProviderContextFunction.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/SelectionProviderContextFunction.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/SelectionProviderContextFunction.java index 901627cd04..b77ed466b2 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/SelectionProviderContextFunction.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/SelectionProviderContextFunction.java @@ -15,10 +15,10 @@ import org.eclipse.e4.core.contexts.ContextFunction; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.tools.services.ISelectionProviderService; +import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.StructuredSelection; - public class SelectionProviderContextFunction extends ContextFunction { @Override @@ -27,12 +27,18 @@ public Object compute(final IEclipseContext context) { public void setSelection(Object selection) { ISelectionProvider pv = context.get(ISelectionProvider.class); - if( selection instanceof List ) { - pv.setSelection(new StructuredSelection((List)selection)); + if( selection == null ) { + pv.setSelection(StructuredSelection.EMPTY); + } else if (selection instanceof ISelection) { + pv.setSelection((ISelection) selection); + } else if (selection instanceof List) { + pv.setSelection(new StructuredSelection((List) selection)); + } else if (selection instanceof Object[]) { + pv.setSelection(new StructuredSelection( + (Object[]) selection)); } else { pv.setSelection(new StructuredSelection(selection)); } - } }; } From 751a53f864e6d819031ba3888cb494353933c057 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Mon, 12 Mar 2012 08:21:32 -0400 Subject: [PATCH 0404/1286] Update to revised CSS specs for obtaining and changing properties From d48380477d879b6de77e22d15bd663c0a566c523 Mon Sep 17 00:00:00 2001 From: Bogdan Gheorghe Date: Mon, 12 Mar 2012 19:40:00 -0400 Subject: [PATCH 0405/1286] Bug 372327 - Editing CSS in Appearance pref page and restarting shows no change From 740d5a9a1cbdc0af119ce6185c2a7d467d8fac7d Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Sat, 24 Mar 2012 07:19:13 -0400 Subject: [PATCH 0406/1286] Bug 375233 - [CSS Spy] Cannot select CTabItems Needed to add getParent() support. Also added in support for SWT CTab{Folder,Items}. From ca28162127b2a456a5e331157546a243c34f5cac Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Sat, 24 Mar 2012 10:30:04 -0400 Subject: [PATCH 0407/1286] Bug 375253 - [CSS Spy] Add support for spying across multiple windows From 32783ccbb452da5cfda487fcf86c5ba477f3b9e2 Mon Sep 17 00:00:00 2001 From: Bogdan Gheorghe Date: Wed, 11 Apr 2012 11:48:34 -0400 Subject: [PATCH 0408/1286] Bug 376480 [CSSEditor] cannot install CSS editor into Juno M6 From 980a810fc3fbcd995b0d8ef716a977e6de7f199b Mon Sep 17 00:00:00 2001 From: Sopot Cela Date: Sun, 15 Apr 2012 16:48:55 +0200 Subject: [PATCH 0409/1286] Bug 376055 - [Tooling] Rename "Label" to "Perspective" under the Perspective Stack --- .../eclipse/e4/tools/emf/ui/internal/Messages.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 52deb0acdd..1c181eff5b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -208,9 +208,9 @@ PartStackEditor_AddPlaceholder=Placeholder PerspectiveEditor_Label=Perspective PerspectiveEditor_Description=Perspective Bla Bla Bla -PerspectiveEditor_LabelLabel=Label +PerspectiveEditor_LabelLabel=Label PerspectiveEditor_SelectedElement=Selected Element -PerspectiveEditor_Label=Label +PerspectiveEditor_Label=Perspective PerspectiveEditor_Tooltip=Tooltip PerspectiveEditor_IconURI=Icon URI PerspectiveEditor_Controls=Controls @@ -283,7 +283,7 @@ MenuContributionEditor_Position=Position MenuContributionEditor_TreeLabel=Menu Contribution MenuContributionEditor_TreeLabelDescription=Menu Contribution Bla Bla Bla Bla -ModelFragmentsEditor_ModelFragments=Model Fragements +ModelFragmentsEditor_ModelFragments=Model Fragments ModelFragmentsEditor_Label=Model Fragments ModelFragmentsEditor_Description=Description ModelFragmentsEditor_Imports=Imports From 8aa34900b3d36f5081546756a5930b444487f6ff Mon Sep 17 00:00:00 2001 From: Sopot Cela Date: Sun, 15 Apr 2012 16:52:56 +0200 Subject: [PATCH 0410/1286] Bug 375261 - [Tools] No check on Java type names when creating classes for handlers, parts and addons from Application.e4xmi editor. --- .../wizards/classes/AbstractNewClassPage.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java index a304714fa2..c137f6c6f7 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java @@ -23,11 +23,13 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.e4.internal.tools.ToolsPlugin; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaModel; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; +import org.eclipse.jdt.core.JavaConventions; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.internal.ui.JavaPlugin; @@ -205,7 +207,8 @@ public void widgetSelected(SelectionEvent e) { Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - dbc.bindValue(textProp.observe(t), BeanProperties.value("name", String.class).observe(clazz)); + dbc.bindValue(textProp.observe(t), BeanProperties.value("name", String.class).observe(clazz), + new UpdateValueStrategy().setBeforeSetValidator(new ClassnameValidator()),null); new Label(parent, SWT.NONE); } @@ -324,18 +327,12 @@ static class ClassnameValidator implements IValidator { public IStatus validate(Object value) { String name = value.toString(); - char[] ar = name.toCharArray(); - for (char c : ar) { - if (!Character.isJavaIdentifierPart(c)) { - return new Status(IStatus.ERROR, "", "'" + c + "' is not allowed in a Class-Name"); - } - } - - if (!Character.isJavaIdentifierStart(ar[0])) { - return new Status(IStatus.ERROR, "", "'" + ar[0] + "' is not allowed as the first character of a Class-Name"); - } + if (name.length()==0) + return new Status(IStatus.ERROR,ToolsPlugin.PLUGIN_ID,"Name must not be empty"); + if ((name.indexOf('.')!=-1)||(name.trim().indexOf(' ')!=-1)) + return new Status(IStatus.ERROR,ToolsPlugin.PLUGIN_ID,"Name must not be qualified or contain spaces"); - return Status.OK_STATUS; + return JavaConventions.validateJavaTypeName(name,JavaCore.VERSION_1_3,JavaCore.VERSION_1_3); } } From 8f72d84dce5b835a46bbcfc21e1c6aefa95d7151 Mon Sep 17 00:00:00 2001 From: Bogdan Gheorghe Date: Wed, 25 Apr 2012 17:44:40 -0400 Subject: [PATCH 0411/1286] Remove dependency on xtext.xtend2.lib From 2746eecc9dfd4387473a249dc31ed8d83a6367cd Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Thu, 26 Apr 2012 09:23:52 -0400 Subject: [PATCH 0412/1286] Bug 376475 - [CSSSpy] processor causes duplicate Copy keybinding Don't create a new binding table, but insert into the table corresponding to the requested context. From 6c79ff9f000267fafeacb6b816a6fcb4e877994f Mon Sep 17 00:00:00 2001 From: Elias Volanakis Date: Tue, 3 Apr 2012 15:59:07 -0700 Subject: [PATCH 0413/1286] Bug 376027 - e4 project template should use M1 instead of Ctrl in KeyBindings Changed key bindings for handlers to use M1 instead of Ctrl --- .../tools/wizards/project/E4NewProjectWizard.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java index 24c84c3da6..e7a1434e81 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java @@ -453,16 +453,16 @@ public void createApplicationResources(IProject project, // Create Quit command MCommand quitCommand = createCommand("quitCommand", "QuitHandler", - "Ctrl+Q", pluginName, fragment, application); + "M1+Q", pluginName, fragment, application); MCommand openCommand = createCommand("openCommand", "OpenHandler", - "Ctrl+O", pluginName, fragment, application); + "M1+O", pluginName, fragment, application); MCommand saveCommand = createCommand("saveCommand", "SaveHandler", - "Ctrl+S", pluginName, fragment, application); + "M1+S", pluginName, fragment, application); MCommand aboutCommand = createCommand("aboutCommand", - "AboutHandler", "Ctrl+A", pluginName, fragment, + "AboutHandler", "M1+A", pluginName, fragment, application); MTrimmedWindow mainWindow = MBasicFactory.INSTANCE From 49df658f9192939ea46ab68cc822cf51a7629ac2 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Thu, 26 Apr 2012 18:50:33 -0400 Subject: [PATCH 0414/1286] Soup up E4NewProjectWizard to use well-known Eclipse identifiers for commands --- .../wizards/project/E4NewProjectWizard.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java index e7a1434e81..1fce85eba9 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java @@ -68,7 +68,6 @@ import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.pde.core.build.IBuildEntry; -import org.eclipse.pde.core.build.IBuildModelFactory; import org.eclipse.pde.core.plugin.IPluginBase; import org.eclipse.pde.core.plugin.IPluginElement; import org.eclipse.pde.core.plugin.IPluginExtension; @@ -452,16 +451,20 @@ public void createApplicationResources(IProject project, resource.getContents().add((EObject) application); // Create Quit command - MCommand quitCommand = createCommand("quitCommand", "QuitHandler", + MCommand quitCommand = createCommand("org.eclipse.ui.file.exit", + "quitCommand", "QuitHandler", "M1+Q", pluginName, fragment, application); - MCommand openCommand = createCommand("openCommand", "OpenHandler", + MCommand openCommand = createCommand(pluginName + ".open", + "openCommand", "OpenHandler", "M1+O", pluginName, fragment, application); - MCommand saveCommand = createCommand("saveCommand", "SaveHandler", + MCommand saveCommand = createCommand("org.eclipse.ui.file.save", + "saveCommand", "SaveHandler", "M1+S", pluginName, fragment, application); - MCommand aboutCommand = createCommand("aboutCommand", + MCommand aboutCommand = createCommand( + "org.eclipse.ui.help.aboutAction", "aboutCommand", "AboutHandler", "M1+A", pluginName, fragment, application); @@ -640,12 +643,13 @@ public void createApplicationResources(IProject project, } } - private MCommand createCommand(String name, String className, + private MCommand createCommand(String commandId, String name, + String className, String keyBinding, String projectName, IPackageFragment fragment, MApplication application) { MCommand command = MCommandsFactory.INSTANCE.createCommand(); command.setCommandName(name); - command.setElementId(projectName + "." + name); + command.setElementId(commandId); application.getCommands().add(command); { // Create Quit handler for command From e9e349ee4c876312a7aa02ed41e63c6c1f78f140 Mon Sep 17 00:00:00 2001 From: Bogdan Gheorghe Date: Fri, 27 Apr 2012 21:29:10 -0400 Subject: [PATCH 0415/1286] Bug 377980 - Move org.eclipse.e4.ui.widgets.CTabFolder back to SWT --- .../common/uistructure/WidgetContentProvider.java | 11 ----------- .../common/uistructure/WidgetLabelProvider.java | 8 +------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetContentProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetContentProvider.java index 5e74fa251a..94fcb0c1e0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetContentProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetContentProvider.java @@ -71,11 +71,6 @@ public Object[] getChildren(Object parentElement) { if (item.getControl() != null) { return new Object[] { item.getControl() }; } - } else if (parentElement instanceof org.eclipse.e4.ui.widgets.CTabItem) { - org.eclipse.e4.ui.widgets.CTabItem item = (org.eclipse.e4.ui.widgets.CTabItem) parentElement; - if (item.getControl() != null) { - return new Object[] { item.getControl() }; - } } else if (parentElement instanceof Tree) { Tree tree = (Tree) parentElement; @@ -94,12 +89,6 @@ public Object[] getChildren(Object parentElement) { Object[] rv = new Object[items.length]; System.arraycopy(items, 0, rv, 0, rv.length); return rv; - } else if (parentElement instanceof org.eclipse.e4.ui.widgets.CTabFolder) { - org.eclipse.e4.ui.widgets.CTabFolder tabFolder = (org.eclipse.e4.ui.widgets.CTabFolder) parentElement; - org.eclipse.e4.ui.widgets.CTabItem[] items = tabFolder.getItems(); - Object[] rv = new Object[items.length]; - System.arraycopy(items, 0, rv, 0, rv.length); - return rv; } else if (parentElement instanceof TabFolder) { TabFolder tabFolder = (TabFolder) parentElement; TabItem[] items = tabFolder.getItems(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java index 0318e46cf6..b1811dca41 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java @@ -121,7 +121,7 @@ public void update(ViewerCell cell) { } else if (element instanceof TabFolder) { cell.setText("TabFolder"); //$NON-NLS-1$ cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_tabfolder_obj)); - } else if (element instanceof CTabFolder || element instanceof org.eclipse.e4.ui.widgets.CTabFolder) { + } else if (element instanceof CTabFolder) { cell.setText("CTabFolder"); //$NON-NLS-1$ cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_ctabfolder_obj)); } else if (element instanceof Combo) { @@ -169,12 +169,6 @@ public void update(ViewerCell cell) { cell.setStyleRanges(s.getStyleRanges()); cell.setText(s.getString()); // cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_clabel_obj)); - } else if (element instanceof org.eclipse.e4.ui.widgets.CTabItem) { - StyledString s = new StyledString("CTabItem"); //$NON-NLS-1$ - s.append(" - " + ((org.eclipse.e4.ui.widgets.CTabItem) element).getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - cell.setStyleRanges(s.getStyleRanges()); - cell.setText(s.getString()); - // cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_clabel_obj)); } else if (element instanceof Button) { Button b = (Button) element; if ((b.getStyle() & SWT.PUSH) == SWT.PUSH) { From bb429af4b7b6edbbc1ff4307e7773906db9ae721 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Mon, 30 Apr 2012 11:03:55 -0400 Subject: [PATCH 0416/1286] Bug 369443 - [CSS] Provide mechanism to listen for theme changes Remove unused references to CSS engine from ThemeEngine From b7f194cc7042064db5b8a66b955493e71797ba12 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Mon, 30 Apr 2012 11:05:36 -0400 Subject: [PATCH 0417/1286] CSS Spy: avoid creating "Cancel" button since there's no support for cancellation From 2b3007f58761ae61a7233b841c708b2ea0757202 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Mon, 30 Apr 2012 11:25:46 -0400 Subject: [PATCH 0418/1286] Commit CSS Scratchpad (from Brian's EclipseCon talk): open using M1+M2+M3+F4 or Ctrl-Alt-Shift-F4 From 9ea290aebbc5397c2ab59ddd2089892b8e0d8941 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Wed, 2 May 2012 12:41:23 -0400 Subject: [PATCH 0419/1286] Bug 376475 - [CSSSpy] processor causes duplicate Copy keybinding Add code to correct existig installations by checking for and removing the incorrect binding table. From 77cfe30456b537d27bb6b4b4724c3d036af762bc Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Mon, 7 May 2012 16:13:10 +0200 Subject: [PATCH 0420/1286] Bug 378602 - [Tooling] JavaProject not accepted as default container for new Application model file --- .../internal/tools/wizards/model/NewModelFilePage.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java index 634ea30ce8..23f4163208 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java @@ -14,6 +14,8 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.Path; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jface.dialogs.IDialogPage; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; @@ -122,6 +124,7 @@ private void initialize() { if (ssel.size() > 1) return; Object obj = ssel.getFirstElement(); + if (obj instanceof IResource) { IContainer container; if (obj instanceof IContainer) @@ -129,6 +132,13 @@ private void initialize() { else container = ((IResource) obj).getParent(); containerText.setText(container.getFullPath().toString()); + } else if( obj instanceof IJavaProject ) { + IJavaProject container = (IJavaProject) obj; + try { + containerText.setText(container.getCorrespondingResource().getFullPath().toString()); + } catch(JavaModelException e) { + e.printStackTrace(); + } } } fileText.setText(defaultFilename); From 537e9591b87b8e418cc6e14fea8082b4341d6387 Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Mon, 7 May 2012 16:27:01 +0200 Subject: [PATCH 0421/1286] Bug 378618 - [Liveeditor] NPE on Application-Element --- .../e4/tools/emf/ui/internal/common/ModelEditor.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 31e5bf0e2c..df35df625e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -135,6 +135,7 @@ import org.eclipse.e4.ui.model.application.MApplicationElement; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; +import org.eclipse.e4.ui.model.application.ui.MContext; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; @@ -635,7 +636,16 @@ public void run() { try { MApplicationElement o = (MApplicationElement) s.getFirstElement(); IScriptingSupport support = (IScriptingSupport) le.createExecutableExtension("class"); //$NON-NLS-1$ - support.openEditor(viewer.getControl().getShell(), s.getFirstElement(), project == null ? ModelUtils.getContainingContext(o) : null); + IEclipseContext ctx = null; + if (project == null) { + if (o instanceof MContext) { + ctx = ((MContext) o).getContext(); + } else { + ctx = ModelUtils.getContainingContext(o); + } + } + + support.openEditor(viewer.getControl().getShell(), s.getFirstElement(), ctx); } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); From ed9bc94509bbbec5632fd8feb5fdf96cecd10f39 Mon Sep 17 00:00:00 2001 From: Sopot Cela Date: Thu, 10 May 2012 13:23:09 +0200 Subject: [PATCH 0422/1286] Bug 376091 - [Tooling] Rename "String Model Fragment" to "Model Fragment" in fragment editor --- .../org/eclipse/e4/tools/emf/ui/internal/Messages.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 1c181eff5b..ee118fb261 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -288,8 +288,8 @@ ModelFragmentsEditor_Label=Model Fragments ModelFragmentsEditor_Description=Description ModelFragmentsEditor_Imports=Imports -StringModelFragment_Label=String Model Fragment -StringModelFragment_Description=String Model Fragment Bla Bla Bla +StringModelFragment_Label=Model Fragment +StringModelFragment_Description=Model Fragment Bla Bla Bla StringModelFragment_Featurename=Featurename StringModelFragment_ParentId=Element Id StringModelFragment_PositionInList=Position in list From 0067472f747b36d77d38238b1e500116bca8812d Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Fri, 11 May 2012 12:25:03 +0200 Subject: [PATCH 0423/1286] Bug 379215 - Allow typing in Element Id line for a Model Fragment --- .../emf/ui/internal/common/component/StringModelFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index 1852a4fad4..a34e25ed20 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -135,7 +135,7 @@ private Composite createForm(Composite parent) { Text t = new Text(comp, SWT.BORDER); TextPasteHandler.createFor(t); - t.setEditable(false); + // t.setEditable(false); gd = new GridData(GridData.FILL_HORIZONTAL); t.setLayoutData(gd); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__PARENT_ELEMENT_ID).observeDetail(getMaster())); From eb34ff34eae1001efe9ba2e49116d627134e734c Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Fri, 11 May 2012 13:00:15 +0200 Subject: [PATCH 0424/1286] Bug 378606 - [Tooling] Adding a Part menu does not add the required tag ViewMenu --- .../e4/tools/emf/ui/internal/Messages.java | 1 + .../tools/emf/ui/internal/Messages.properties | 1 + .../internal/common/component/MenuEditor.java | 5 ++ .../common/component/virtual/VMenuEditor.java | 49 ++++++++++++++++--- 4 files changed, 50 insertions(+), 6 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index d8e672f6b1..72f5591c5c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -121,6 +121,7 @@ public class Messages { public String KeyBindingEditor_AddParameter; public String MenuEditor_Label; + public String MenuEditor_Label_ViewMenu; public String MenuEditor_Description; public String MenuEditor_MenuItems; public String MenuEditor_MenuItemType; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index ee118fb261..203dd427e1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -118,6 +118,7 @@ KeyBindingEditor_SequenceEmpty=Keysequence must not be empty! KeyBindingEditor_AddParameter=Parameter MenuEditor_Label=Menu +MenuEditor_Label_ViewMenu=View Menu MenuEditor_Description=Menu bla bla bla MenuEditor_MenuItems=MenuItems MenuEditor_MenuItemType=Type diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 8aadbcad14..4dde73d666 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -36,6 +36,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor.EClass2EObject; import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor.EObject2EClass; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; +import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuEditor; import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; @@ -523,7 +524,11 @@ public String getLabel(Object element) { EObject o = (EObject) element; if (o.eContainer() instanceof MWindow) { return Messages.MenuEditor_MainMenu; + } else if (menu.getTags().contains(VMenuEditor.VIEW_MENU_TAG)) { + return Messages.MenuEditor_Label_ViewMenu; } + } else if (menu.getTags().contains(VMenuEditor.VIEW_MENU_TAG)) { + return Messages.MenuEditor_Label_ViewMenu; } return Messages.MenuEditor_Label; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java index 7fc2f058a5..0dcfffffc9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -21,6 +21,8 @@ import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; +import org.eclipse.e4.ui.model.application.ui.menu.MMenu; +import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuFactoryImpl; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.databinding.EMFDataBindingContext; @@ -59,6 +61,12 @@ public class VMenuEditor extends AbstractComponentEditor { private List actions = new ArrayList(); private EStructuralFeature feature; + public static final String VIEW_MENU_TAG = "ViewMenu"; //$NON-NLS-1$ + + enum Types { + MENU, POPUP_MENU, VIEW_MENU + } + protected VMenuEditor(EStructuralFeature feature) { super(); this.feature = feature; @@ -78,6 +86,12 @@ public void run() { handleAdd(MenuPackageImpl.Literals.POPUP_MENU); } }); + actions.add(new Action(Messages.MenuEditor_Label_ViewMenu, createImageDescriptor(ResourceProvider.IMG_Menu)) { + @Override + public void run() { + handleAddViewMenu(); + } + }); } @Override @@ -202,12 +216,16 @@ public void widgetSelected(SelectionEvent e) { childrenDropDown.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { - EClass eclass = (EClass) element; - return eclass.getName(); + if (element == Types.MENU) { + return Messages.MenuEditor_Label; + } else if (element == Types.POPUP_MENU) { + return Messages.PopupMenuEditor_TreeLabel; + } + return Messages.MenuEditor_Label_ViewMenu; } }); - childrenDropDown.setInput(new EClass[] { MenuPackageImpl.Literals.MENU, MenuPackageImpl.Literals.POPUP_MENU }); - childrenDropDown.setSelection(new StructuredSelection(MenuPackageImpl.Literals.MENU)); + childrenDropDown.setInput(Types.values()); + childrenDropDown.setSelection(new StructuredSelection(Types.MENU)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); @@ -215,8 +233,14 @@ public String getText(Object element) { b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - handleAdd(eClass); + Types t = (Types) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); + if (t == Types.MENU) { + handleAdd(MenuPackageImpl.Literals.MENU); + } else if (t == Types.POPUP_MENU) { + handleAdd(MenuPackageImpl.Literals.POPUP_MENU); + } else { + handleAddViewMenu(); + } } }); @@ -259,6 +283,19 @@ protected void handleAdd(EClass eClass) { } } + protected void handleAddViewMenu() { + MMenu menu = MenuFactoryImpl.eINSTANCE.createMenu(); + menu.getTags().add(VIEW_MENU_TAG); + setElementId(menu); + + Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), feature, menu); + + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + getEditor().setSelection(menu); + } + } + @Override public List getActions(Object element) { ArrayList l = new ArrayList(super.getActions(element)); From aae5c51587868da42291af737f6dd36f255fd156 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Mon, 14 May 2012 19:01:00 +0200 Subject: [PATCH 0425/1286] Bug 378597 - [Tooling] Rename e4 to Eclipse 4 in project creation wizard --- bundles/org.eclipse.e4.tools/OSGI-INF/l10n/bundle.properties | 4 ++-- .../e4/internal/tools/wizards/model/NewModelFilePage.java | 2 +- .../tools/wizards/project/NewApplicationWizardPage.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.e4.tools/OSGI-INF/l10n/bundle.properties b/bundles/org.eclipse.e4.tools/OSGI-INF/l10n/bundle.properties index af034d7e3f..fc83b8cd1b 100644 --- a/bundles/org.eclipse.e4.tools/OSGI-INF/l10n/bundle.properties +++ b/bundles/org.eclipse.e4.tools/OSGI-INF/l10n/bundle.properties @@ -1,8 +1,8 @@ #Properties file for org.eclipse.e4.tools -category.name = e4 +category.name = Eclipse 4 category.name.0 = Classes category.name.1 = Model -wizard.name = e4 Application Project +wizard.name = Eclipse 4 Application Project wizard.name.0 = New Application Model wizard.name.1 = New Model Fragment wizard.name.2 = New Handler Class diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java index 23f4163208..218e7d6a9d 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java @@ -56,7 +56,7 @@ public class NewModelFilePage extends WizardPage { public NewModelFilePage(ISelection selection, String defaultFilename) { super("wizardPage"); setTitle("New application model"); - setDescription("This wizard creates a new e4 application model"); + setDescription("This wizard creates a new Eclipse 4 application model"); this.selection = selection; this.defaultFilename = defaultFilename; } diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java index 8573dac15c..0fa47ba585 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java @@ -65,11 +65,11 @@ public class NewApplicationWizardPage extends WizardPage { private PropertyData[] PROPERTIES; protected NewApplicationWizardPage(IProjectProvider projectProvider, AbstractFieldData pluginData) { - super("New e4 Application Wizard Page"); + super("New Eclipse 4 Application Wizard Page"); this.projectProvider = projectProvider; this.pluginData = pluginData; data = new HashMap(); - setTitle("e4 Application"); + setTitle("Eclipse 4 Application"); setMessage("Configure application with special values."); } From 775ef0261b1d332100fc5a9db5e36dad928ea13c Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Mon, 14 May 2012 19:18:28 +0200 Subject: [PATCH 0426/1286] Bug 379281 - [Tooling] Adding the Add button to all model editor elements --- .../e4/tools/emf/ui/internal/common/component/MenuEditor.java | 1 + .../ui/internal/common/component/PartSashContainerEditor.java | 1 + .../tools/emf/ui/internal/common/component/PartStackEditor.java | 1 + .../common/component/virtual/VPerspectiveControlEditor.java | 1 + .../internal/common/component/virtual/VWindowControlEditor.java | 1 + .../emf/ui/internal/common/component/virtual/VWindowEditor.java | 1 + 6 files changed, 6 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 4dde73d666..b86ae279a6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -331,6 +331,7 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index 71ed478853..cbd7068a70 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -329,6 +329,7 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index ae737f26f0..d6860e06cd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -275,6 +275,7 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveControlEditor.java index 9aaba3ec59..4fa358dde5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveControlEditor.java @@ -226,6 +226,7 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index 7e910d6094..1346d55b3e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -233,6 +233,7 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index 500042f7f1..051f24131f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -207,6 +207,7 @@ public String getText(Object element) { childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.TRIMMED_WINDOW)); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { From a9da7e2cf867e61b4b47a352b26007c6e912ec7c Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Mon, 14 May 2012 19:39:47 +0200 Subject: [PATCH 0427/1286] Bug 378660 - Eclipse 4 wizard should not add dependency on o.e.core.resources --- .../e4/internal/tools/wizards/project/E4NewProjectWizard.java | 1 - 1 file changed, 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java index 1fce85eba9..f1288fc588 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java @@ -160,7 +160,6 @@ protected void adjustManifests( IPluginBase pluginBase = model.getPluginBase(); String[] dependencyId = new String[] { "javax.inject", - "org.eclipse.core.resources", "org.eclipse.core.runtime", "org.eclipse.swt", "org.eclipse.core.databinding", From e8cc65cd57d65f17b8c985bfb58931487b0129f5 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Mon, 14 May 2012 20:29:38 +0200 Subject: [PATCH 0428/1286] Bug 379459 - [Tooling] Changing default in the Preferences for Autogenerated ID's to true --- .../e4/tools/emf/ui/internal/PreferenceInitializer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PreferenceInitializer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PreferenceInitializer.java index bcfc2bbe2b..2068b5c289 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PreferenceInitializer.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PreferenceInitializer.java @@ -26,6 +26,10 @@ public void initializeDefaultPreferences() { String val = StringConverter.asString(new RGB(200, 200, 200)); pref.put("notVisibleAndRenderedColor", val); } + + if (pref.get("autoCreateElementId", null) == null) { + pref.putBoolean("autoCreateElementId", true); + } } } From 1cc06a7958ec3a221e1b1944a54ae34e74db9e7f Mon Sep 17 00:00:00 2001 From: Sopot Cela Date: Mon, 14 May 2012 20:55:43 +0200 Subject: [PATCH 0429/1286] Bug 379460 - [Tooling] Generated IDs by the Model Editor should be lowercase --- .../src/org/eclipse/e4/tools/emf/ui/common/Util.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java index caa8211363..271cade28e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java @@ -106,7 +106,7 @@ public static final String getDefaultElementId(Resource resource, MApplicationEl lastNumber = number; } - return prefix + "." + ++lastNumber; //$NON-NLS-1$ + return (prefix + "." + ++lastNumber).toLowerCase(); //$NON-NLS-1$ } catch (Exception e) { // TODO: handle exception e.printStackTrace(); From a0b4904ca9bc4372adf823031b53e13abb4f1ad1 Mon Sep 17 00:00:00 2001 From: Sopot Cela Date: Mon, 14 May 2012 20:55:43 +0200 Subject: [PATCH 0430/1286] Bug 379286 - [Tooling] Remove redundant information and space in model editor --- .../e4/tools/emf/ui/internal/common/ModelEditor.java | 2 +- .../common/component/virtual/VApplicationAddons.java | 5 ----- .../component/virtual/VApplicationCategoriesEditor.java | 5 ----- .../common/component/virtual/VBindingTableEditor.java | 6 +----- .../internal/common/component/virtual/VCommandEditor.java | 5 ----- .../internal/common/component/virtual/VHandlerEditor.java | 5 ----- .../common/component/virtual/VItemParametersEditor.java | 5 ----- .../common/component/virtual/VMenuContributionsEditor.java | 5 ----- .../ui/internal/common/component/virtual/VMenuEditor.java | 5 ----- .../common/component/virtual/VModelFragmentsEditor.java | 5 ----- .../common/component/virtual/VModelImportsEditor.java | 5 ----- .../internal/common/component/virtual/VPartDescriptor.java | 5 ----- .../common/component/virtual/VPerspectiveControlEditor.java | 5 ----- .../common/component/virtual/VRootBindingContexts.java | 5 ----- .../internal/common/component/virtual/VSnippetsEditor.java | 5 ----- .../component/virtual/VToolBarContributionsEditor.java | 5 ----- .../common/component/virtual/VTrimContributionsEditor.java | 5 ----- .../common/component/virtual/VWindowControlEditor.java | 5 ----- .../ui/internal/common/component/virtual/VWindowEditor.java | 5 ----- .../component/virtual/VWindowSharedElementsEditor.java | 5 ----- .../common/component/virtual/VWindowTrimEditor.java | 5 ----- .../src/org/eclipse/e4/internal/tools/ToolsPlugin.java | 2 +- 22 files changed, 3 insertions(+), 102 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index df35df625e..c44a07892e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -561,7 +561,7 @@ public void run() { } }); - form.setWeights(new int[] { 1, 2 }); + form.setWeights(new int[] { 3, 4 }); MenuManager mgr = new MenuManager(); mgr.setRemoveAllWhenShown(true); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java index e8c9bd44c6..dc6490be7a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java @@ -45,7 +45,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VApplicationAddons extends AbstractComponentEditor { private Composite composite; @@ -111,10 +110,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VApplicationAddons_Commands); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java index 2b1af264b3..ed8e27eec6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java @@ -45,7 +45,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VApplicationCategoriesEditor extends AbstractComponentEditor { private Composite composite; @@ -111,10 +110,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VApplicationCategoriesEditor_Categories); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java index 01a74ca6f3..d703c46427 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java @@ -45,7 +45,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VBindingTableEditor extends AbstractComponentEditor { private Composite composite; @@ -93,6 +92,7 @@ public Composite doGetEditor(Composite parent, Object object) { if (composite == null) { context = new EMFDataBindingContext(); composite = createForm(parent, context, getMaster()); + } VirtualEntry o = (VirtualEntry) object; bindingViewer.setInput(o.getList()); @@ -110,10 +110,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VBindingTableEditor_BindingTables); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - bindingViewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); bindingViewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java index 5661672ae9..64232bb699 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java @@ -46,7 +46,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VCommandEditor extends AbstractComponentEditor { private Composite composite; @@ -114,10 +113,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VCommandEditor_Commands); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java index ab57532a34..8899479634 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java @@ -45,7 +45,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VHandlerEditor extends AbstractComponentEditor { private Composite composite; @@ -110,10 +109,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VHandlerEditor_Handlers); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java index 637f240953..c12a38667b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java @@ -47,7 +47,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VItemParametersEditor extends AbstractComponentEditor { private Composite composite; @@ -114,10 +113,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VItemParametersEditor_Parameters); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java index 8870e43ac6..70c2d3a53f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java @@ -45,7 +45,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VMenuContributionsEditor extends AbstractComponentEditor { private Composite composite; @@ -111,10 +110,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VMenuContributionsEditor_MenuContributions); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java index 0dcfffffc9..f5de8e8da5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -52,7 +52,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VMenuEditor extends AbstractComponentEditor { private Composite composite; @@ -135,10 +134,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr parent = createScrollableContainer(folder); item.setControl(parent.getParent()); - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VMenuEditor_Menus); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java index 257c8e305a..723342daf2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java @@ -42,7 +42,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VModelFragmentsEditor extends AbstractComponentEditor { private Composite composite; @@ -96,10 +95,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VModelFragmentsEditor_Fragments); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java index 2e289aa0b2..80fb9be8b8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java @@ -53,7 +53,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VModelImportsEditor extends AbstractComponentEditor { private Composite composite; @@ -107,10 +106,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VModelImportsEditor_Imports); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java index 3175fe16df..be122480dc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java @@ -45,7 +45,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VPartDescriptor extends AbstractComponentEditor { private Composite composite; @@ -110,10 +109,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VPartDescriptor_Descriptors); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveControlEditor.java index 4fa358dde5..347d336347 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveControlEditor.java @@ -52,7 +52,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VPerspectiveControlEditor extends AbstractComponentEditor { private Composite composite; @@ -145,10 +144,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VWindowControlEditor_Controls); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java index e792c05ebc..cb58e9424e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java @@ -45,7 +45,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VRootBindingContexts extends AbstractComponentEditor { private Composite composite; @@ -111,10 +110,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VRootBindingContexts_Contexts); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VSnippetsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VSnippetsEditor.java index 1932fa060e..df4eac39ef 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VSnippetsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VSnippetsEditor.java @@ -42,7 +42,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VSnippetsEditor extends AbstractComponentEditor { private Composite composite; @@ -173,10 +172,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr parent = createScrollableContainer(folder); item.setControl(parent.getParent()); - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VSnippetsEditor_Snippets); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java index 9b5552c295..ab026ff2cd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java @@ -45,7 +45,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VToolBarContributionsEditor extends AbstractComponentEditor { private Composite composite; @@ -110,10 +109,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VToolBarContributionsEditor_Contributions); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java index 4a2c6b5d7a..196ed27447 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java @@ -45,7 +45,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VTrimContributionsEditor extends AbstractComponentEditor { private Composite composite; @@ -110,10 +109,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VTrimContributionsEditor_Contributions); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java index 1346d55b3e..cd6e97a230 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java @@ -52,7 +52,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VWindowControlEditor extends AbstractComponentEditor { private Composite composite; @@ -152,10 +151,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VWindowControlEditor_Controls); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java index 051f24131f..99eb3d8e45 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java @@ -50,7 +50,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public abstract class VWindowEditor extends AbstractComponentEditor { private Composite composite; @@ -121,10 +120,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr parent = createScrollableContainer(folder); item.setControl(parent.getParent()); - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VWindowEditor_Windows); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java index 64587f8ab6..32c985f9de 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java @@ -51,7 +51,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VWindowSharedElementsEditor extends AbstractComponentEditor { private Composite composite; @@ -130,10 +129,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VWindowSharedElementsEditor_Controls); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java index 70fe2b3cde..0ffae0236a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java @@ -42,7 +42,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; public class VWindowTrimEditor extends AbstractComponentEditor { private Composite composite; @@ -107,10 +106,6 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VWindowTrimEditor_Controls); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/ToolsPlugin.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/ToolsPlugin.java index 9f80ed6bfd..1a9fa29348 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/ToolsPlugin.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/ToolsPlugin.java @@ -11,7 +11,7 @@ public class ToolsPlugin extends AbstractUIPlugin { // The plug-in ID public static final String PLUGIN_ID = "org.eclipse.e4.tools"; //$NON-NLS-1$ - + private static ToolsPlugin plugin; private ResourceLocator resourceLocator; From 064236f3a046260d962c93d5501c9df92057aaa5 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Tue, 15 May 2012 18:47:44 +0200 Subject: [PATCH 0431/1286] Bug 379281 - [Tooling] Adding the Add button to all model editor elements - Menu Entry for Parts --- .../emf/ui/internal/common/component/virtual/VMenuEditor.java | 1 + 1 file changed, 1 insertion(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java index f5de8e8da5..77ee666c30 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java @@ -224,6 +224,7 @@ public String getText(Object element) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override From 9683c008afc294132110910fad6148247c824256 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Sun, 20 May 2012 21:43:12 +0200 Subject: [PATCH 0432/1286] Bug 380172 - Renamed e4 Workbench Editor to Eclipse 4 model editor --- .../OSGI-INF/l10n/bundle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/l10n/bundle.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/l10n/bundle.properties index 9042b1e4e4..482fea1f55 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/l10n/bundle.properties +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/l10n/bundle.properties @@ -1,5 +1,5 @@ #Properties file for org.eclipse.e4.tools.emf.editor3x -editor.name = e4 Workbenchmodel Editor +editor.name = Eclipse 4 model editor page.name = Model Editor Bundle-Name = Editor3x Bundle-Vendor = Eclipse.org \ No newline at end of file From 49f8a49d2544c5fb9388c861b29f419719740e52 Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Tue, 29 May 2012 22:33:59 +0200 Subject: [PATCH 0433/1286] Bug 380936 - Active features and plugins version should be increased to 0.12 --- bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF | 2 +- bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF | 2 +- bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF | 2 +- bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF | 2 +- bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF | 2 +- features/org.eclipse.e4.core.tools.feature/feature.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF index 0e792e7af8..6cedfefcc5 100644 --- a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.e4.tools.compat;singleton:=true -Bundle-Version: 0.11.0.qualifier +Bundle-Version: 0.12.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.core.runtime;bundle-version="3.6.0", diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF index a75d4ceb82..e11ae02f52 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.e4.tools.emf.editor3x;singleton:=true -Bundle-Version: 0.10.0.qualifier +Bundle-Version: 0.12.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.core.runtime;bundle-version="3.6.0", diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF index 7abd03fc96..7874eea14c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.e4.tools.emf.ui;singleton:=true -Bundle-Version: 0.10.0.qualifier +Bundle-Version: 0.12.0.qualifier Bundle-ClassPath: . Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF index 22da85cdd8..9374d6b9a4 100644 --- a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.e4.tools.services -Bundle-Version: 0.11.0.qualifier +Bundle-Version: 0.12.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 Export-Package: org.eclipse.e4.tools.services, org.eclipse.e4.tools.services.impl;x-friends:="org.eclipse.e4.tools.emf.ui" diff --git a/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF index 51cbe5ed5f..6165ceec1c 100644 --- a/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.e4.tools;singleton:=true -Bundle-Version: 0.10.0.qualifier +Bundle-Version: 0.12.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.pde.core;bundle-version="3.6.0", diff --git a/features/org.eclipse.e4.core.tools.feature/feature.xml b/features/org.eclipse.e4.core.tools.feature/feature.xml index c56823a4ff..a00b903e60 100644 --- a/features/org.eclipse.e4.core.tools.feature/feature.xml +++ b/features/org.eclipse.e4.core.tools.feature/feature.xml @@ -2,7 +2,7 @@ From 074f265dafc09f48822c45cca313aae95f2e49b5 Mon Sep 17 00:00:00 2001 From: Sopot Cela Date: Tue, 29 May 2012 22:36:17 +0200 Subject: [PATCH 0434/1286] Bug 379820 - Preference setting for autogenerated ID's not used for menus --- .../e4/tools/emf/ui/internal/common/component/MenuEditor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index b86ae279a6..5719a269b4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -546,7 +546,7 @@ public FeaturePath[] getLabelProperties() { protected void handleAdd(EClass eClass, boolean separator) { MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass); - + setElementId(eObject); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); if (cmd.canExecute()) { From 9d89e2aedcc487d60fea79de2e524d8e5002cca6 Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Fri, 8 Jun 2012 21:26:40 +0200 Subject: [PATCH 0435/1286] Bug 382118 - [Tools] Multiple keybindings for Show Live model From bea861c7a68f8c231502a1cae6d71ad021da69c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sopot=20=C3=87ela?= Date: Thu, 19 Jul 2012 18:49:14 +0200 Subject: [PATCH 0436/1286] Bug 379313 - Added API to show warning decoration in model editor --- .../common/component/ControlFactory.java | 52 ++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index 5d25804862..fd1788b11f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -15,12 +15,17 @@ import java.util.List; import java.util.Map.Entry; import org.eclipse.core.databinding.Binding; +import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.map.IObservableMap; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; +import org.eclipse.core.databinding.validation.IValidator; +import org.eclipse.core.databinding.validation.ValidationStatus; import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.e4.tools.emf.ui.common.Util; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; @@ -64,6 +69,9 @@ import org.eclipse.jface.databinding.viewers.ViewerProperties; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.fieldassist.ControlDecoration; +import org.eclipse.jface.fieldassist.FieldDecoration; +import org.eclipse.jface.fieldassist.FieldDecorationRegistry; import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.ColumnLabelProvider; import org.eclipse.jface.viewers.ComboViewer; @@ -318,6 +326,23 @@ public void widgetSelected(SelectionEvent e) { } public static void createTextField(Composite parent, String label, IObservableValue master, EMFDataBindingContext context, IWidgetValueProperty textProp, IEMFEditValueProperty modelProp) { + createTextField(parent, label, master, context, textProp, modelProp, null); + + } + + /** + * + * @param parent + * @param label + * @param master + * @param context + * @param textProp + * @param modelProp + * @param warningText + * Non null warningText means that a warning with this non-null + * text will be shown when the field is left empty + */ + public static void createTextField(Composite parent, String label, IObservableValue master, EMFDataBindingContext context, IWidgetValueProperty textProp, IEMFEditValueProperty modelProp, final String warningText) { Label l = new Label(parent, SWT.NONE); l.setText(label); l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); @@ -326,7 +351,32 @@ public static void createTextField(Composite parent, String label, IObservableVa GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); - + if (warningText != null) { + final ControlDecoration controlDecoration = new ControlDecoration(t, SWT.LEFT | SWT.TOP); + controlDecoration.setDescriptionText(warningText); + FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_WARNING); + controlDecoration.setImage(fieldDecoration.getImage()); + IValidator iv = new IValidator() { + + public IStatus validate(Object value) { + if (value == null) { + controlDecoration.show(); + return ValidationStatus.warning(warningText); + } + if (value instanceof String) { + String text = (String) value; + if (text.trim().length() == 0) { + controlDecoration.show(); + return ValidationStatus.warning(warningText); + } + } + controlDecoration.hide(); + return Status.OK_STATUS; + } + }; + UpdateValueStrategy acv = new UpdateValueStrategy().setAfterConvertValidator(iv); + context.bindValue(textProp.observeDelayed(200, t), modelProp.observeDetail(master), acv, acv); + } TextPasteHandler.createFor(t); context.bindValue(textProp.observeDelayed(200, t), modelProp.observeDetail(master)); } From a78ebe39c02c02cdbf58ff068c93fedb13135da0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sopot=20=C3=87ela?= Date: Thu, 19 Jul 2012 19:12:12 +0200 Subject: [PATCH 0437/1286] Bug 379304 - Show warning if ID not entered for commands --- .../src/org/eclipse/e4/tools/emf/ui/internal/Messages.java | 1 + .../org/eclipse/e4/tools/emf/ui/internal/Messages.properties | 2 ++ .../tools/emf/ui/internal/common/component/CommandEditor.java | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 72f5591c5c..708e717fe5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -12,6 +12,7 @@ public class Messages { + public String ModelTooling_Empty_Warning; public String ModelTooling_Common_Up; public String ModelTooling_Common_Down; public String ModelTooling_Common_AddEllipsis; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 203dd427e1..c0f8a18103 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -34,6 +34,8 @@ ModelTooling_ApplicationElement_Tags=Tags ModelTooling_Contribution_PersistedState=Persisted State +ModelTooling_Empty_Warning=Value must not be empty + AbstractCommandSelectionDialog_Label_CommandId=Command-Id ApplicationEditor_Label=Application diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index f913a326be..989672157f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -152,7 +152,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO return folder; } - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); + ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID), Messages.ModelTooling_Empty_Warning); ControlFactory.createTextField(parent, Messages.CommandEditor_Name, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME)); ControlFactory.createTextField(parent, Messages.CommandEditor_LabelDescription, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__DESCRIPTION)); From 78f853b9d926fca461234a31245f4d83f063af80 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Thu, 19 Jul 2012 19:21:50 +0200 Subject: [PATCH 0438/1286] Bug 384581 - [Tooling] Avoid double naming for Model Fragments Renamed label to "Model Fragment Definition". --- .../org/eclipse/e4/tools/emf/ui/internal/Messages.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index c0f8a18103..2ecc65615f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -287,7 +287,7 @@ MenuContributionEditor_TreeLabel=Menu Contribution MenuContributionEditor_TreeLabelDescription=Menu Contribution Bla Bla Bla Bla ModelFragmentsEditor_ModelFragments=Model Fragments -ModelFragmentsEditor_Label=Model Fragments +ModelFragmentsEditor_Label=Model Fragment Definition ModelFragmentsEditor_Description=Description ModelFragmentsEditor_Imports=Imports From 5bebf52744d8b079f0443eae5d7610d164734207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sopot=20=C3=87ela?= Date: Fri, 20 Jul 2012 00:13:08 +0200 Subject: [PATCH 0439/1286] Bug 385556 - Warn if Binding Context name is left empty --- .../src/org/eclipse/e4/tools/emf/ui/internal/Messages.java | 2 ++ .../org/eclipse/e4/tools/emf/ui/internal/Messages.properties | 1 + .../emf/ui/internal/common/component/BindingContextEditor.java | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index 708e717fe5..e0a2e6eb6f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -321,6 +321,7 @@ public class Messages { public String BindingContextEditor_Description; public String BindingContextEditor_Subcontexts; public String BindingContextEditor_AddContext; + public String BindingContextEditor_NameWarning; public String CommandParameterEditor_TreeLabel; public String CommandParameterEditor_TreeLabelDescritpion; @@ -611,4 +612,5 @@ public class Messages { public String ObjectViewer_Script; public String CommandWizard_ShellTitle; + } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 2ecc65615f..609bcdc4a4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -321,6 +321,7 @@ BindingContextEditor_Name=Name BindingContextEditor_Description=Description BindingContextEditor_Subcontexts=Subcontexts BindingContextEditor_AddContext=Binding Context +BindingContextEditor_NameWarning=Binding Context name should be left empty CommandParameterEditor_TreeLabel=Command Parameter CommandParameterEditor_TreeLabelDescritpion=Command Parameter Bla Bla Bla diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java index 0b4f7d1776..f6c2d51636 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java @@ -160,7 +160,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr } ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.BindingContextEditor_Name, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME)); + ControlFactory.createTextField(parent, Messages.BindingContextEditor_Name, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME), Messages.BindingContextEditor_NameWarning); ControlFactory.createTextField(parent, Messages.BindingContextEditor_Description, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_CONTEXT__DESCRIPTION)); Label l = new Label(parent, SWT.NONE); From b24753683bdc5afb57d79d4f8fb4a6d98b080b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sopot=20=C3=87ela?= Date: Tue, 24 Jul 2012 10:37:19 +0200 Subject: [PATCH 0440/1286] Bug 385257 - Adding class dialog to application model behaves now similar to the "Open Type" dialog. This patch will activate camelCase matching in the dialog, and allow the user to select with entry with tab or enter. --- .../PDEClassContributionProvider.java | 2 +- .../tools/emf/ui/internal/Messages.properties | 2 +- .../dialogs/ContributionClassDialog.java | 21 +++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java index 4b3c3de337..540d02b251 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java @@ -145,7 +145,7 @@ public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, packageName, SearchPattern.R_PATTERN_MATCH, typeName, - SearchPattern.R_PREFIX_MATCH, + SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CAMELCASE_MATCH, IJavaSearchConstants.CLASS, scope, req, diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 609bcdc4a4..8b813e4668 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -271,7 +271,7 @@ AddonsEditor_Tags=Tags ContributionClassDialog_DialogMessage=Enter the name of the contributing class ContributionClassDialog_DialogTitle=Find Contribution Class -ContributionClassDialog_Label_Classname=Classname +ContributionClassDialog_Label_Classname=Class Name ContributionClassDialog_ShellTitle=Find Contribution Class MenuContributionEditor_MenuItems=Menu Items diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java index 50b4056fb0..d4a02ef75e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -35,6 +35,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.graphics.Image; @@ -151,6 +153,25 @@ public void modifyText(ModifyEvent e) { currentResultHandler = new ContributionResultHandlerImpl(list); Filter filter = new Filter(project, t.getText()); collector.findContributions(filter, currentResultHandler); + t.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + if (e.keyCode == SWT.ARROW_DOWN) { + if (viewer.getTable().getItemCount() > 0) { + viewer.getTable().setFocus(); + viewer.getTable().select(0); + } + } + } + }); + viewer.getTable().addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + super.keyPressed(e); + if ((e.keyCode == SWT.ARROW_UP) && (viewer.getTable().getSelectionIndex() == 0)) { + t.setFocus(); + } + } + }); } }); From 8879d5abdf397f2b4d3f76f384d0b617b90ae218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sopot=20=C3=87ela?= Date: Tue, 24 Jul 2012 10:55:40 +0200 Subject: [PATCH 0441/1286] Bug 385685 - Model editor - Avoid repositioning the cursor and improved warning message --- .../eclipse/e4/tools/emf/ui/internal/Messages.properties | 2 +- .../emf/ui/internal/common/component/ControlFactory.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 8b813e4668..35ba6c60ae 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -321,7 +321,7 @@ BindingContextEditor_Name=Name BindingContextEditor_Description=Description BindingContextEditor_Subcontexts=Subcontexts BindingContextEditor_AddContext=Binding Context -BindingContextEditor_NameWarning=Binding Context name should be left empty +BindingContextEditor_NameWarning=Binding Context name should not be empty CommandParameterEditor_TreeLabel=Command Parameter CommandParameterEditor_TreeLabelDescritpion=Command Parameter Bla Bla Bla diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java index fd1788b11f..faaf89f4ab 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java @@ -351,6 +351,7 @@ public static void createTextField(Composite parent, String label, IObservableVa GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; t.setLayoutData(gd); + TextPasteHandler.createFor(t); if (warningText != null) { final ControlDecoration controlDecoration = new ControlDecoration(t, SWT.LEFT | SWT.TOP); controlDecoration.setDescriptionText(warningText); @@ -376,9 +377,8 @@ public IStatus validate(Object value) { }; UpdateValueStrategy acv = new UpdateValueStrategy().setAfterConvertValidator(iv); context.bindValue(textProp.observeDelayed(200, t), modelProp.observeDetail(master), acv, acv); - } - TextPasteHandler.createFor(t); - context.bindValue(textProp.observeDelayed(200, t), modelProp.observeDetail(master)); + } else + context.bindValue(textProp.observeDelayed(200, t), modelProp.observeDetail(master)); } public static void createTranslatedTextField(Composite parent, String label, IObservableValue master, EMFDataBindingContext context, IWidgetValueProperty textProp, IEMFEditValueProperty modelProp, IResourcePool resourcePool, IProject project) { From 96f3f49600caddf23cedf059931ba3a6077f8e27 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Wed, 8 Aug 2012 14:16:52 -0400 Subject: [PATCH 0442/1286] Bug 379236 - add maximize button in CSS Spy From 9cdc1dde00bca21e0edf6c19ad0e1f6629228053 Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Sun, 12 Aug 2012 11:12:49 +0200 Subject: [PATCH 0443/1286] Bug 387073 - [ModelEditor] ToolItem does not allow to define Menu --- .../e4/tools/emf/ui/internal/Messages.java | 2 +- .../tools/emf/ui/internal/Messages.properties | 1 + .../component/DirectToolItemEditor.java | 4 +- .../component/HandledToolItemEditor.java | 4 +- .../common/component/ToolItemEditor.java | 84 ++++++++++++++++++- 5 files changed, 88 insertions(+), 7 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index e0a2e6eb6f..a0883713df 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -354,6 +354,7 @@ public class Messages { public String ToolItemEditor_Enabled; public String ToolItemEditor_Selected; public String ToolItemEditor_NoExpression; + public String ToolItemEditor_Menu; public String TrimBarEditor_TreeLabel; public String TrimBarEditor_TreeLabelDescription; @@ -612,5 +613,4 @@ public class Messages { public String ObjectViewer_Script; public String CommandWizard_ShellTitle; - } \ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index 35ba6c60ae..f77325f0a2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -354,6 +354,7 @@ ToolItemEditor_IconURI=Icon URI ToolItemEditor_Enabled=Enabled ToolItemEditor_Selected=Selected ToolItemEditor_NoExpression= +ToolItemEditor_Menu=Menu TrimBarEditor_TreeLabel=Window Trim TrimBarEditor_TreeLabelDescription=Window Trim bla bla bla diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java index c22e08eb1b..b593827918 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java @@ -14,7 +14,6 @@ import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -148,9 +147,10 @@ public String getDescription(Object element) { return Messages.DirectToolItemEditor_Description; } + @SuppressWarnings("unchecked") @Override public IObservableList getChildList(Object element) { - final WritableList list = new WritableList(); + final IObservableList list = super.getChildList(element); if (((MDirectToolItem) element).getVisibleWhen() != null) { list.add(0, ((MDirectToolItem) element).getVisibleWhen()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java index e4895037f3..18febd9c5e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java @@ -13,7 +13,6 @@ import javax.inject.Inject; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IValueChangeListener; import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; @@ -114,9 +113,10 @@ public String getDescription(Object element) { return Messages.HandledToolItemEditor_Description; } + @SuppressWarnings("unchecked") @Override public IObservableList getChildList(Object element) { - final WritableList list = new WritableList(); + final IObservableList list = super.getChildList(element); if (((MHandledToolItem) element).getVisibleWhen() != null) { list.add(0, ((MHandledToolItem) element).getVisibleWhen()); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index db0ce04681..fd1be2be05 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -16,8 +16,12 @@ import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.conversion.Converter; import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; +import org.eclipse.core.databinding.observable.value.ValueChangeEvent; import org.eclipse.core.databinding.observable.value.WritableValue; +import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.core.resources.IProject; import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.tools.emf.ui.common.EStackLayout; @@ -33,15 +37,20 @@ import org.eclipse.e4.ui.model.application.ui.MUILabel; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.e4.ui.model.application.ui.menu.ItemType; +import org.eclipse.e4.ui.model.application.ui.menu.MMenu; +import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; import org.eclipse.e4.ui.model.application.ui.menu.MToolItem; import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; +import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.databinding.EMFDataBindingContext; +import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.databinding.edit.EMFEditProperties; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.jface.databinding.swt.IWidgetValueProperty; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.databinding.viewers.ViewerProperties; @@ -68,10 +77,14 @@ public abstract class ToolItemEditor extends AbstractComponentEditor { private EStackLayout stackLayout; + private IValueProperty TOOL_ITEM__MENU = EMFProperties.value(MenuPackageImpl.Literals.TOOL_ITEM__MENU); + @Inject @Optional protected IProject project; + private Button createRemoveMenu; + public ToolItemEditor() { super(); } @@ -105,6 +118,10 @@ public Composite doGetEditor(Composite parent, Object object) { } } + if (createRemoveMenu != null) { + createRemoveMenu.setSelection(((MToolItem) object).getMenu() != null); + } + getMaster().setValue(object); return composite; } @@ -216,6 +233,26 @@ public void widgetSelected(SelectionEvent e) { }); } + { + Label l = new Label(parent, SWT.NONE); + l.setText(Messages.ToolItemEditor_Menu); + l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + createRemoveMenu = new Button(parent, SWT.CHECK); + createRemoveMenu.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + MToolItem item = (MToolItem) getMaster().getValue(); + if (item.getMenu() == null) { + addMenu(); + } else { + removeMenu(); + } + } + }); + createRemoveMenu.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); + } + { Label l = new Label(parent, SWT.NONE); l.setText(Messages.ToolItemEditor_Enabled); @@ -300,9 +337,52 @@ protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext } + void removeMenu() { + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_ITEM__MENU, null); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + + void addMenu() { + MMenu menu = MMenuFactory.INSTANCE.createMenu(); + setElementId(menu); + + Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_ITEM__MENU, menu); + if (cmd.canExecute()) { + getEditingDomain().getCommandStack().execute(cmd); + } + } + @Override - public IObservableList getChildList(Object element) { - return null; + public IObservableList getChildList(final Object element) { + final WritableList list = new WritableList(); + + MToolItem item = (MToolItem) element; + if (item.getMenu() != null) { + list.add(0, item.getMenu()); + } + + TOOL_ITEM__MENU.observe(element).addValueChangeListener(new IValueChangeListener() { + + public void handleValueChange(ValueChangeEvent event) { + if (event.diff.getOldValue() != null) { + list.remove(event.diff.getOldValue()); + if (getMaster().getValue() == element && !createRemoveMenu.isDisposed()) { + createRemoveMenu.setSelection(false); + } + } + + if (event.diff.getNewValue() != null) { + list.add(0, event.diff.getNewValue()); + if (getMaster().getValue() == element && !createRemoveMenu.isDisposed()) { + createRemoveMenu.setSelection(true); + } + } + } + }); + + return list; } @Override From a3581f8886f2ca9d0699420d1ed8f197a49913de Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Tue, 14 Aug 2012 12:56:54 +0200 Subject: [PATCH 0444/1286] Bug 387017 - [Tooling] Eclipse 4 application wizard should not display the applicationXMI property Removes the applicationXMI property as we offer a good default behavior. --- .../wizards/project/E4NewProjectWizard.java | 147 ++++++++---------- .../project/NewApplicationWizardPage.java | 3 - 2 files changed, 69 insertions(+), 81 deletions(-) diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java index f1288fc588..d5df9c946f 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java @@ -93,6 +93,7 @@ */ public class E4NewProjectWizard extends NewPluginProjectWizard { + private static final String APPLICATION_MODEL = "Application.e4xmi"; private PluginFieldData fPluginData; private NewApplicationWizardPage fApplicationPage; private IProjectProvider fProjectProvider; @@ -238,12 +239,6 @@ private void adjustBuildPropertiesFile(IProject project) throws CoreException { e.addToken(cssEntry); } - String xmiPath = map - .get(NewApplicationWizardPage.APPLICATION_XMI_PROPERTY); - if( xmiPath != null ) { - e.addToken(xmiPath); - } - model.save(); } } @@ -269,13 +264,6 @@ public void createProductsExtension(IProject project) { String applicationName = map .get(NewApplicationWizardPage.APPLICATION); - String xmiPath = map - .get(NewApplicationWizardPage.APPLICATION_XMI_PROPERTY); - if (xmiPath != null) { - xmiPath = productName + "/" + xmiPath; - map.put(NewApplicationWizardPage.APPLICATION_XMI_PROPERTY, - xmiPath); - } String cssValue = map .get(NewApplicationWizardPage.APPLICATION_CSS_PROPERTY); if (cssValue != null) { @@ -348,8 +336,6 @@ public void createApplicationResources(IProject project, // If the project has invalid characters, the plug-in name would replace them with underscores, product name does the same String pluginName = map.get(NewApplicationWizardPage.PRODUCT_NAME); - String xmiPath = map - .get(NewApplicationWizardPage.APPLICATION_XMI_PROPERTY); // If there's no Activator created we create default package if (!fPluginData.doGenerateClass()) { @@ -379,7 +365,73 @@ public void createApplicationResources(IProject project, e1.printStackTrace(); } - if (xmiPath != null && xmiPath.trim().length() > 0) { + createApplicationModel(project, pluginName, fragment); + + String cssPath = map + .get(NewApplicationWizardPage.APPLICATION_CSS_PROPERTY); + if (cssPath != null && cssPath.trim().length() > 0) { + IFile file = project.getFile(cssPath); + + try { + prepareFolder(file.getParent(), monitor); + + URL corePath = ResourceLocator + .getProjectTemplateFiles("css/default.css"); + file.create(corePath.openStream(), true, monitor); + } catch (Exception e) { + PDEPlugin.logException(e); + } + } + + // IFolder folder = project.getFolder("icons"); + // try { + // folder.create(true, true, monitor); + // Bundle bundle = Platform + // .getBundle("org.eclipse.e4.tools.ui.designer"); + // + // for (String fileName : new String[] { "sample.gif", "save_edit.gif" + // }) { + // URL sampleUrl = bundle.getEntry("resources/icons/" + fileName); + // sampleUrl = FileLocator.resolve(sampleUrl); + // InputStream inputStream = sampleUrl.openStream(); + // IFile file = folder.getFile(fileName); + // file.create(inputStream, true, monitor); + // } + // } catch (Exception e) { + // PDEPlugin.logException(e); + // } + + String template_id = "common"; + Set binaryExtentions = new HashSet(); + binaryExtentions.add(".gif"); + binaryExtentions.add(".png"); + + Map keys = new HashMap(); + keys.put("projectName", pluginName); + keys.put("packageName", fragment.getElementName() + ".handlers"); + + try { + URL corePath = ResourceLocator.getProjectTemplateFiles(template_id); + IRunnableWithProgress op = new TemplateOperation(corePath, project, + keys, binaryExtentions); + getContainer().run(false, true, op); + } catch (Exception e) { + PDEPlugin.logException(e); + } + + try { + URL corePath = ResourceLocator.getProjectTemplateFiles("src"); + IRunnableWithProgress op = new TemplateOperation(corePath, + (IContainer) fragment.getResource(), keys, binaryExtentions); + getContainer().run(false, true, op); + } catch (Exception e) { + PDEPlugin.logException(e); + } + } + + private void createApplicationModel(IProject project, String pluginName, + IPackageFragment fragment) { + if (APPLICATION_MODEL != null && APPLICATION_MODEL.trim().length() > 0) { // Create a resource set // ResourceSet resourceSet = new ResourceSetImpl(); @@ -387,7 +439,7 @@ public void createApplicationResources(IProject project, // Get the URI of the model file. // URI fileURI = URI.createPlatformResourceURI(project.getName() + "/" - + xmiPath, true); + + APPLICATION_MODEL, true); // Create a resource for this file. // @@ -579,67 +631,6 @@ public void createApplicationResources(IProject project, PDEPlugin.logException(e); } } - - String cssPath = map - .get(NewApplicationWizardPage.APPLICATION_CSS_PROPERTY); - if (cssPath != null && cssPath.trim().length() > 0) { - IFile file = project.getFile(cssPath); - - try { - prepareFolder(file.getParent(), monitor); - - URL corePath = ResourceLocator - .getProjectTemplateFiles("css/default.css"); - file.create(corePath.openStream(), true, monitor); - } catch (Exception e) { - PDEPlugin.logException(e); - } - } - - // IFolder folder = project.getFolder("icons"); - // try { - // folder.create(true, true, monitor); - // Bundle bundle = Platform - // .getBundle("org.eclipse.e4.tools.ui.designer"); - // - // for (String fileName : new String[] { "sample.gif", "save_edit.gif" - // }) { - // URL sampleUrl = bundle.getEntry("resources/icons/" + fileName); - // sampleUrl = FileLocator.resolve(sampleUrl); - // InputStream inputStream = sampleUrl.openStream(); - // IFile file = folder.getFile(fileName); - // file.create(inputStream, true, monitor); - // } - // } catch (Exception e) { - // PDEPlugin.logException(e); - // } - - String template_id = "common"; - Set binaryExtentions = new HashSet(); - binaryExtentions.add(".gif"); - binaryExtentions.add(".png"); - - Map keys = new HashMap(); - keys.put("projectName", pluginName); - keys.put("packageName", fragment.getElementName() + ".handlers"); - - try { - URL corePath = ResourceLocator.getProjectTemplateFiles(template_id); - IRunnableWithProgress op = new TemplateOperation(corePath, project, - keys, binaryExtentions); - getContainer().run(false, true, op); - } catch (Exception e) { - PDEPlugin.logException(e); - } - - try { - URL corePath = ResourceLocator.getProjectTemplateFiles("src"); - IRunnableWithProgress op = new TemplateOperation(corePath, - (IContainer) fragment.getResource(), keys, binaryExtentions); - getContainer().run(false, true, op); - } catch (Exception e) { - PDEPlugin.logException(e); - } } private MCommand createCommand(String commandId, String name, diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java index 0fa47ba585..886986f745 100644 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java +++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java @@ -48,7 +48,6 @@ */ public class NewApplicationWizardPage extends WizardPage { public static final String E4_APPLICATION = "org.eclipse.e4.ui.workbench.swt.E4Application"; - public static final String APPLICATION_XMI_PROPERTY = "applicationXMI"; public static final String APPLICATION_CSS_PROPERTY = "applicationCSS"; public static final String PRODUCT_NAME = "productName"; public static final String APPLICATION = "application"; @@ -367,8 +366,6 @@ protected PropertyData[] getPropertyData() { new PropertyData(IProductConstants.APP_NAME, "Application Name:", projectProvider.getProjectName(), String.class, true), - new PropertyData(APPLICATION_XMI_PROPERTY, "Application UI:", - "Application.e4xmi", String.class, true), new PropertyData(APPLICATION_CSS_PROPERTY, "CSS Style:", "css/default.css", String.class, true), new PropertyData(IProductConstants.ABOUT_TEXT, "About Message:", "", From 2f382acf170c65280c3c7073dd4da3c93ac975c8 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Wed, 15 Aug 2012 16:23:49 +0200 Subject: [PATCH 0445/1286] Bug 387288 - [Tooling] Add message to filter text fields in ContributionClassDialog --- .../src/org/eclipse/e4/tools/emf/ui/internal/Messages.java | 1 + .../src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties | 1 + .../common/component/dialogs/ContributionClassDialog.java | 1 + 3 files changed, 3 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java index a0883713df..c3e7afbf2c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java @@ -271,6 +271,7 @@ public class Messages { public String ContributionClassDialog_DialogMessage; public String ContributionClassDialog_DialogTitle; public String ContributionClassDialog_Label_Classname; + public String ContributionClassDialog_FilterText_Message; public String ContributionClassDialog_ShellTitle; public String MenuContributionEditor_MenuItems; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties index f77325f0a2..575bd475d9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties @@ -272,6 +272,7 @@ AddonsEditor_Tags=Tags ContributionClassDialog_DialogMessage=Enter the name of the contributing class ContributionClassDialog_DialogTitle=Find Contribution Class ContributionClassDialog_Label_Classname=Class Name +ContributionClassDialog_FilterText_Message=Type to start search ContributionClassDialog_ShellTitle=Find Contribution Class MenuContributionEditor_MenuItems=Menu Items diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java index d4a02ef75e..8438f86ae2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java @@ -100,6 +100,7 @@ public void widgetDisposed(DisposeEvent e) { final Text t = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + t.setMessage(Messages.ContributionClassDialog_FilterText_Message); new Label(container, SWT.NONE); From aaea8f10fc341b8dbd91613d12ee28ecf27c43a2 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Wed, 15 Aug 2012 17:58:56 +0200 Subject: [PATCH 0446/1286] Bug 387295 - [Tooling] Fix org.eclipse.e4.tools.jdt.templates --- .../plugin.xml | 68 ++++++++++++++++++- .../E4TemplateCompletionProposalComputer.java | 4 +- .../templates/default-e4templates.xml | 25 ++++--- 3 files changed, 86 insertions(+), 11 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/plugin.xml b/bundles/org.eclipse.e4.tools.jdt.templates/plugin.xml index b3ed8606b1..2a4f15366e 100644 --- a/bundles/org.eclipse.e4.tools.jdt.templates/plugin.xml +++ b/bundles/org.eclipse.e4.tools.jdt.templates/plugin.xml @@ -15,7 +15,6 @@ activate="true" categoryId="org.eclipse.e4.tools.jdt.templates.e4ProposalCategory" class="org.eclipse.e4.internal.tools.jdt.templates.E4TemplateCompletionProposalComputer"> - + + + + + + + + + + + + diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java b/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java index cadf6bfc7c..fc49a7fb4d 100644 --- a/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java +++ b/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java @@ -34,10 +34,10 @@ public class E4TemplateCompletionProposalComputer extends AbstractTemplateCompletionProposalComputer { /** - * The name of org.eclipse.e4.core.services.IDisposable used to detect + * The name of javax.inject.Inject used to detect * if a project uses e4. */ - private static final String E4_TYPE_NAME= "org.eclipse.e4.core.services.IDisposable"; //$NON-NLS-1$ + private static final String E4_TYPE_NAME= "org.eclipse.e4.ui.di.Focus"; //$NON-NLS-1$ /** diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml b/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml index 33dd080869..61cd4d654a 100644 --- a/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml +++ b/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml @@ -10,6 +10,7 @@ * * Contributors: * Boris Bokowski, IBM Corporation - initial API and implementation + * Lars Vogel - Reworked templates *******************************************************************************/ --> @@ -46,14 +47,22 @@ void handleSomeEvent(Payload payloadObject) { ${cursor} } - + - + + + From db6469e99c3418f1a5820a2828cd68d1a4ccf2f6 Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Wed, 22 Aug 2012 00:09:28 +0200 Subject: [PATCH 0447/1286] Bug 387735 - [Tooling] All model element editors should allow to edit the persited state --- .../emf/ui/internal/common/component/ApplicationEditor.java | 1 + .../e4/tools/emf/ui/internal/common/component/AreaEditor.java | 1 + .../emf/ui/internal/common/component/BindingContextEditor.java | 1 + .../emf/ui/internal/common/component/BindingTableEditor.java | 1 + .../tools/emf/ui/internal/common/component/CategoryEditor.java | 1 + .../e4/tools/emf/ui/internal/common/component/CommandEditor.java | 1 + .../emf/ui/internal/common/component/CommandParameterEditor.java | 1 + .../emf/ui/internal/common/component/CoreExpressionEditor.java | 1 + .../e4/tools/emf/ui/internal/common/component/HandlerEditor.java | 1 + .../tools/emf/ui/internal/common/component/KeyBindingEditor.java | 1 + .../emf/ui/internal/common/component/MenuContributionEditor.java | 1 + .../e4/tools/emf/ui/internal/common/component/MenuEditor.java | 1 + .../tools/emf/ui/internal/common/component/MenuItemEditor.java | 1 + .../emf/ui/internal/common/component/MenuSeparatorEditor.java | 1 + .../tools/emf/ui/internal/common/component/ParameterEditor.java | 1 + .../emf/ui/internal/common/component/PartDescriptorEditor.java | 1 + .../ui/internal/common/component/PartSashContainerEditor.java | 1 + .../tools/emf/ui/internal/common/component/PartStackEditor.java | 1 + .../emf/ui/internal/common/component/PerspectiveEditor.java | 1 + .../emf/ui/internal/common/component/PerspectiveStackEditor.java | 1 + .../emf/ui/internal/common/component/PlaceholderEditor.java | 1 + .../ui/internal/common/component/ToolBarContributionEditor.java | 1 + .../e4/tools/emf/ui/internal/common/component/ToolBarEditor.java | 1 + .../emf/ui/internal/common/component/ToolBarSeparatorEditor.java | 1 + .../emf/ui/internal/common/component/ToolControlEditor.java | 1 + .../tools/emf/ui/internal/common/component/ToolItemEditor.java | 1 + .../e4/tools/emf/ui/internal/common/component/TrimBarEditor.java | 1 + .../emf/ui/internal/common/component/TrimContributionEditor.java | 1 + .../e4/tools/emf/ui/internal/common/component/WindowEditor.java | 1 + 29 files changed, 29 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java index b5675746f3..73c66bdeb1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java @@ -195,6 +195,7 @@ protected Composite createForm(Composite parent, EMFDataBindingContext context) ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, Messages, this, Messages.AddonsEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); if (project == null) { createUITreeInspection(folder); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java index 0e1f878fa1..ed5f975d84 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java @@ -417,6 +417,7 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); if (project == null) { createUITreeInspection(folder); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java index f6c2d51636..2c7693ff45 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java @@ -276,6 +276,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); folder.setSelection(0); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index 5d5dc408a3..d222f192bc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -308,6 +308,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); folder.setSelection(0); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java index 173cb52e9d..a873bb7315 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java @@ -128,6 +128,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, IO item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); folder.setSelection(0); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java index 989672157f..d3e2f478b7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java @@ -298,6 +298,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); folder.setSelection(0); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java index cf6a42150f..af385b064f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java @@ -152,6 +152,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); folder.setSelection(0); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java index 0f8129e152..ffcae4d697 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java @@ -130,6 +130,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); folder.setSelection(0); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java index f2b870a4e8..462394b998 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java @@ -214,6 +214,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); createInstanceInspection(folder); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java index 1c85beaeaf..484d0bf670 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java @@ -319,6 +319,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); folder.setSelection(0); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java index c6e5731efc..b5787d78e8 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java @@ -310,6 +310,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); folder.setSelection(0); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java index 5719a269b4..15a40d6b53 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java @@ -443,6 +443,7 @@ public String getText(Object element) { ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); if (project == null) { createUITreeInspection(folder); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java index 5b1542fff7..0ebae9700e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java @@ -309,6 +309,7 @@ public String getText(Object element) { ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); if (project == null) { createUITreeInspection(folder); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java index 1fa6af050e..7be3e9565a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java @@ -137,6 +137,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); if (project == null) { createUITreeInspection(folder); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java index 4569c8d79e..ca4dff692b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java @@ -134,6 +134,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); folder.setSelection(0); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index 65530756f1..c13a2a94c7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -314,6 +314,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); folder.setSelection(0); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java index cbd7068a70..079ce6384b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java @@ -371,6 +371,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); if (project == null) { createUITreeInspection(folder); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index d6860e06cd..01f534fc06 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -315,6 +315,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); if (project == null) { createUITreeInspection(folder); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java index 59361c49b4..05f98064bc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java @@ -265,6 +265,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); if (project == null) { createUITreeInspection(folder); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java index 0e6ba7cb6f..72c4cebe24 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java @@ -287,6 +287,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); if (project == null) { createUITreeInspection(folder); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java index 978294e729..c320bd4944 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java @@ -237,6 +237,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); if (project == null) { createUITreeInspection(folder); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java index 88110efa35..76e2100f95 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java @@ -320,6 +320,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); if (project == null) { createUITreeInspection(folder); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java index 683b7004c8..bcdbefba5f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java @@ -328,6 +328,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); folder.setSelection(0); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java index 4cc8b945db..6c3b174cc6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java @@ -148,6 +148,7 @@ private Composite createForm(Composite parent, EMFDataBindingContext context, Wr item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); if (project == null) { createUITreeInspection(folder); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java index ace2bd3a07..5db75c2f04 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java @@ -185,6 +185,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); if (project == null) { createInstanceInspection(folder); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java index fd1be2be05..a66f05b012 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java @@ -331,6 +331,7 @@ public String getText(Object element) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); } protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, WritableValue master) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java index 072ba2f1c5..f717944a6e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java @@ -327,6 +327,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); if (project == null) { createUITreeInspection(folder); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java index bd85be0f80..89381775aa 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java @@ -296,6 +296,7 @@ public void widgetSelected(SelectionEvent e) { item.setControl(parent.getParent()); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); if (project == null) { createUITreeInspection(folder); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java index 15f5739843..8e8c6987bc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java @@ -293,6 +293,7 @@ public void widgetSelected(SelectionEvent e) { ControlFactory.createTranslatedTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE), resourcePool, project); ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); + ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); if (project == null) { createUITreeInspection(folder); From e2b01816820d8141929f75962c3669cf5b0d5dd6 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Fri, 24 Aug 2012 18:13:18 -0400 Subject: [PATCH 0448/1286] CSS Spy: tweak output to add extra blank line From e2b1d26d98d2da29f942ea71599b5400ed20fe8b Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Fri, 24 Aug 2012 18:13:41 -0400 Subject: [PATCH 0449/1286] Bug 387676 - CSS editor in preferences > General > Appearance does not resize From f72d2f1f6c25facda50d8ba32bacc32984915c5f Mon Sep 17 00:00:00 2001 From: scela Date: Sun, 26 Aug 2012 15:11:44 +0200 Subject: [PATCH 0450/1286] ASSIGNED - bug 384675: [Tooling] Autogen id number not computed correctly. https://bugs.eclipse.org/bugs/show_bug.cgi?id=384675 --- .../src/org/eclipse/e4/tools/emf/ui/common/Util.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java index 271cade28e..3ea0cbf284 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java @@ -76,7 +76,7 @@ public static final String getDefaultElementId(Resource resource, MApplicationEl String className = o.eClass().getName(); String projectName = project.getName(); - String prefix = projectName + "." + className; //$NON-NLS-1$ + String prefix = (projectName + "." + className).toLowerCase(); //$NON-NLS-1$ TreeIterator it = resource.getAllContents(); SortedSet numbers = new TreeSet(); From b245890b88c952053e44b340c4835b2c9b7d8c04 Mon Sep 17 00:00:00 2001 From: Sopot Cela Date: Sun, 26 Aug 2012 15:43:30 +0200 Subject: [PATCH 0451/1286] NEW - bug 384508: [Model Editor] CTRL+C Does Not Copy https://bugs.eclipse.org/bugs/show_bug.cgi?id=384508 --- .../emf/ui/internal/common/component/PartDescriptorEditor.java | 1 + 1 file changed, 1 insertion(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java index c13a2a94c7..e4a519c7db 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java @@ -201,6 +201,7 @@ public void widgetSelected(SelectionEvent e) { Text t = new Text(parent, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CONTRIBUTION_URI).observeDetail(master)); + TextPasteHandler.createFor(t); final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); From c406a2b46a8bd72c594d786cda0fcda1648d881d Mon Sep 17 00:00:00 2001 From: Sopot Cela Date: Sun, 26 Aug 2012 15:58:45 +0200 Subject: [PATCH 0452/1286] NEW - bug 384450: [Tooling] Auto-Id for KeyBinding does not work https://bugs.eclipse.org/bugs/show_bug.cgi?id=384450 --- .../emf/ui/internal/common/component/BindingTableEditor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java index d222f192bc..14c724f16e 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java @@ -345,7 +345,7 @@ public List getActions(Object element) { protected void handleAddKeyBinding() { MKeyBinding handler = MCommandsFactory.INSTANCE.createKeyBinding(); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS, handler); - + setElementId(handler); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); getEditor().setSelection(handler); From 09252a352d03501de3b86810e03ddaa010900d1e Mon Sep 17 00:00:00 2001 From: Sopot Cela Date: Mon, 27 Aug 2012 22:29:49 +0200 Subject: [PATCH 0453/1286] ASSIGNED - bug 384579: [Tooling] Using the "Add" label for the Add button also for the Fragment editor https://bugs.eclipse.org/bugs/show_bug.cgi?id=384579 --- .../emf/ui/internal/common/component/ModelFragmentsEditor.java | 1 + .../emf/ui/internal/common/component/StringModelFragment.java | 1 + .../internal/common/component/virtual/VModelImportsEditor.java | 1 + 3 files changed, 3 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java index c6ac79e056..fe814a0fd0 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java @@ -215,6 +215,7 @@ public int compare(Viewer viewer, Object e1, Object e2) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index a34e25ed20..fe7bac2dd1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -293,6 +293,7 @@ public int compare(Viewer viewer, Object e1, Object e2) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java index 80fb9be8b8..38d0eeb91f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java @@ -203,6 +203,7 @@ public int compare(Viewer viewer, Object e1, Object e2) { b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); + b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override From 3d0d3fc2ec77939b9018e54c69bd414245475352 Mon Sep 17 00:00:00 2001 From: Sopot Cela Date: Tue, 28 Aug 2012 00:58:47 +0200 Subject: [PATCH 0454/1286] ASSIGNED - bug 384578: [Tooling] Fragment Editor, place text above the boxes https://bugs.eclipse.org/bugs/show_bug.cgi?id=384578 --- .../component/ModelFragmentsEditor.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java index fe814a0fd0..db4380bac4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java @@ -110,11 +110,16 @@ private Composite createForm(Composite parent) { } { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelFragmentsEditor_Imports); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); + GridLayout layout = (GridLayout) parent.getLayout(); + layout.numColumns = 2; - final TableViewer viewer = new TableViewer(parent); + Composite impCompo = new Composite(parent, SWT.NONE); + impCompo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + impCompo.setLayout(new GridLayout()); + Label l = new Label(impCompo, SWT.NONE); + l.setText(Messages.ModelFragmentsEditor_Imports); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); + final TableViewer viewer = new TableViewer(impCompo); viewer.setContentProvider(new ObservableListContentProvider()); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); @@ -252,11 +257,15 @@ public void widgetSelected(SelectionEvent e) { } { - Label l = new Label(parent, SWT.NONE); + + Composite fragCompo = new Composite(parent, SWT.NONE); + fragCompo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + fragCompo.setLayout(new GridLayout()); + Label l = new Label(fragCompo, SWT.NONE); l.setText(Messages.ModelFragmentsEditor_ModelFragments); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); + l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); - final TableViewer viewer = new TableViewer(parent); + final TableViewer viewer = new TableViewer(fragCompo); viewer.setContentProvider(new ObservableListContentProvider()); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); From 010f306b1ffdce207aeb121925cb687519b62526 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Tue, 28 Aug 2012 16:01:16 +0200 Subject: [PATCH 0455/1286] First versioni of a Tycho build for the org.eclipse.e4.core.tools feature. Currently the build of the update site is failing. This might be a Tycho bug. --- bundles/org.eclipse.e4.tools.compat/pom.xml | 16 ++++++++++++++++ .../org.eclipse.e4.tools.emf.editor3x/pom.xml | 16 ++++++++++++++++ bundles/org.eclipse.e4.tools.emf.ui/pom.xml | 16 ++++++++++++++++ bundles/org.eclipse.e4.tools.services/pom.xml | 16 ++++++++++++++++ bundles/org.eclipse.e4.tools/pom.xml | 16 ++++++++++++++++ .../org.eclipse.e4.core.tools.feature/pom.xml | 17 +++++++++++++++++ 6 files changed, 97 insertions(+) create mode 100644 bundles/org.eclipse.e4.tools.compat/pom.xml create mode 100644 bundles/org.eclipse.e4.tools.emf.editor3x/pom.xml create mode 100644 bundles/org.eclipse.e4.tools.emf.ui/pom.xml create mode 100644 bundles/org.eclipse.e4.tools.services/pom.xml create mode 100644 bundles/org.eclipse.e4.tools/pom.xml create mode 100644 features/org.eclipse.e4.core.tools.feature/pom.xml diff --git a/bundles/org.eclipse.e4.tools.compat/pom.xml b/bundles/org.eclipse.e4.tools.compat/pom.xml new file mode 100644 index 0000000000..d7ecc19323 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.compat/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + + ../../build/parent/pom.xml + org.eclipse.e4.tools + parent + 1.0.0-SNAPSHOT + + + org.eclipse.e4.tools.compat + 0.12.0.qualifier + eclipse-plugin + + org.eclipse.e4.tools.compat Build + diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/pom.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/pom.xml new file mode 100644 index 0000000000..eba3805c9c --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + + ../../build/parent/pom.xml + org.eclipse.e4.tools + parent + 1.0.0-SNAPSHOT + + + org.eclipse.e4.tools.emf.editor3x + 0.12.0.qualifier + eclipse-plugin + + org.eclipse.e4.tools.emf.editor3x Build + diff --git a/bundles/org.eclipse.e4.tools.emf.ui/pom.xml b/bundles/org.eclipse.e4.tools.emf.ui/pom.xml new file mode 100644 index 0000000000..cfa0fc5283 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.ui/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + + ../../build/parent/pom.xml + org.eclipse.e4.tools + parent + 1.0.0-SNAPSHOT + + + org.eclipse.e4.tools.emf.ui + 0.12.0.qualifier + eclipse-plugin + + org.eclipse.e4.tools.emf.uiBuild + diff --git a/bundles/org.eclipse.e4.tools.services/pom.xml b/bundles/org.eclipse.e4.tools.services/pom.xml new file mode 100644 index 0000000000..644f0083a7 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.services/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + + ../../build/parent/pom.xml + org.eclipse.e4.tools + parent + 1.0.0-SNAPSHOT + + + org.eclipse.e4.tools.services + 0.12.0.qualifier + eclipse-plugin + + org.eclipse.e4.tools.services Build + diff --git a/bundles/org.eclipse.e4.tools/pom.xml b/bundles/org.eclipse.e4.tools/pom.xml new file mode 100644 index 0000000000..dc537d5f56 --- /dev/null +++ b/bundles/org.eclipse.e4.tools/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + + ../../build/parent/pom.xml + org.eclipse.e4.tools + parent + 1.0.0-SNAPSHOT + + + org.eclipse.e4.tools + 0.12.0.qualifier + eclipse-plugin + + org.eclipse.e4.tools Build + diff --git a/features/org.eclipse.e4.core.tools.feature/pom.xml b/features/org.eclipse.e4.core.tools.feature/pom.xml new file mode 100644 index 0000000000..e4cc8bf596 --- /dev/null +++ b/features/org.eclipse.e4.core.tools.feature/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + + ../../build/parent/pom.xml + org.eclipse.e4.tools + parent + 1.0.0-SNAPSHOT + + + org.eclipse.e4.core.tools.feature + 0.12.0.qualifier + eclipse-feature + + org.eclipse.e4.core.tools.feature Build + From dedbc20dc538c6038a409745fa4220a72f881b3b Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Tue, 28 Aug 2012 18:08:48 +0200 Subject: [PATCH 0456/1286] Tycho build setup changed based on feedback from Paul Webster From 124f85832928c51722915096f55e6813206806b3 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Fri, 31 Aug 2012 14:47:26 +0200 Subject: [PATCH 0457/1286] Tycho build now includes all o.e.e4.tools components Also increased version number for o.e.e4.tools.jdt.templates --- .../META-INF/MANIFEST.MF | 2 +- .../org.eclipse.e4.tools.jdt.templates/pom.xml | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 bundles/org.eclipse.e4.tools.jdt.templates/pom.xml diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF index a38d2608f1..4da685d645 100644 --- a/bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: e4 Templates Bundle-SymbolicName: org.eclipse.e4.tools.jdt.templates;singleton:=true -Bundle-Version: 0.10.0.qualifier +Bundle-Version: 0.12.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.jdt.ui;bundle-version="3.6.0", org.eclipse.ui.editors;bundle-version="3.6.0", diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/pom.xml b/bundles/org.eclipse.e4.tools.jdt.templates/pom.xml new file mode 100644 index 0000000000..e4d546ea1b --- /dev/null +++ b/bundles/org.eclipse.e4.tools.jdt.templates/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + + ../../build/parent/pom.xml + org.eclipse.e4.tools + parent + 1.0.0-SNAPSHOT + + + org.eclipse.e4.tools.jdt.templates + 0.12.0.qualifier + eclipse-plugin + + org.eclipse.e4.tools.jdt.templates Build + From 9cef7ef19ab8c373f9da4557d3e7037416903679 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Fri, 31 Aug 2012 15:27:06 +0200 Subject: [PATCH 0458/1286] Added features to category.xml for Tycho build From 85bd664389d25e6a910e1782cd72c8af698033ef Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Fri, 31 Aug 2012 15:31:19 +0200 Subject: [PATCH 0459/1286] Split CSS spy and CSS editor feature in different p2 categories to allow to install them separately From fa88a2be65960ca6dc972faa7647826bec936c0e Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Sun, 2 Sep 2012 21:54:35 +0200 Subject: [PATCH 0460/1286] Bug 365195 - [Tooling] Double-click on editor tree element should open the tree --- .../e4/tools/emf/ui/internal/common/ModelEditor.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index c44a07892e..02f1430c58 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -181,6 +181,8 @@ import org.eclipse.jface.text.source.AnnotationModel; import org.eclipse.jface.text.source.SourceViewer; import org.eclipse.jface.text.source.VerticalRuler; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; @@ -830,6 +832,15 @@ public void handleMapChange(MapChangeEvent event) { viewer.setInput(modelProvider.getRoot()); viewer.expandToLevel(2); + viewer.addDoubleClickListener(new IDoubleClickListener() { + + public void doubleClick(DoubleClickEvent event) { + TreeViewer viewer = (TreeViewer) event.getViewer(); + IStructuredSelection thisSelection = (IStructuredSelection) event.getSelection(); + Object selectedNode = thisSelection.getFirstElement(); + viewer.setExpandedState(selectedNode, !viewer.getExpandedState(selectedNode)); + } + }); // ViewerDropAdapter adapter = new ViewerDropAdapter(viewer) { // // @Override From c08ac6bf9212d0bdbea81ddbc4ed627e71275a81 Mon Sep 17 00:00:00 2001 From: Sopot Cela Date: Sun, 2 Sep 2012 22:14:24 +0200 Subject: [PATCH 0461/1286] bug 384584: [Tooling] No auto-id for model elements in fragments https://bugs.eclipse.org/bugs/show_bug.cgi?id=384584 --- .../emf/ui/internal/common/component/StringModelFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java index fe7bac2dd1..7215a536e2 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java @@ -300,7 +300,7 @@ public int compare(Viewer viewer, Object e1, Object e2) { public void widgetSelected(SelectionEvent e) { EClass eClass = ((FeatureClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement()).eClass; EObject eObject = EcoreUtil.create(eClass); - + setElementId(eObject); Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS, eObject); if (cmd.canExecute()) { From 808b65e55770bad1ab6e8d2410df0f0626935374 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Mon, 3 Sep 2012 00:01:43 +0200 Subject: [PATCH 0462/1286] Updated e4 JDT templates --- .../templates/default-e4templates.xml | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml b/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml index 61cd4d654a..f8cf7dc5ad 100644 --- a/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml +++ b/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml @@ -16,33 +16,27 @@ -