From 6767cfd76b21155a1c1fde314fb0108eb6f193ba Mon Sep 17 00:00:00 2001 From: Fabian Brosig <fabian.brosig@uni-wuerzburg.de> Date: Wed, 6 Mar 2013 17:51:48 +0000 Subject: [PATCH] git-svn-id: https://se1.informatik.uni-wuerzburg.de/usvn/svn/code/code/DMM/trunk@10650 9e42b895-fcda-4063-8a3b-11be15eb1bbd --- .../.classpath | 7 - .../.project | 28 - .../META-INF/MANIFEST.MF | 25 - .../build.properties | 10 - .../icons/full/obj16/FunctionsModelFile.gif | Bin 346 -> 0 bytes .../obj16/ParameterdependenciesModelFile.gif | Bin 346 -> 0 bytes .../icons/full/obj16/RepositoryModelFile.gif | Bin 346 -> 0 bytes .../full/obj16/ServicebehaviorModelFile.gif | Bin 346 -> 0 bytes .../icons/full/obj16/SystemModelFile.gif | Bin 346 -> 0 bytes .../icons/full/wizban/NewFunctions.gif | Bin 2462 -> 0 bytes .../full/wizban/NewParameterdependencies.gif | Bin 2462 -> 0 bytes .../icons/full/wizban/NewRepository.gif | Bin 2462 -> 0 bytes .../icons/full/wizban/NewServicebehavior.gif | Bin 2462 -> 0 bytes .../icons/full/wizban/NewSystem.gif | Bin 2462 -> 0 bytes .../plugin.properties | 89 - .../plugin.xml | 140 -- .../FunctionsActionBarContributor.java | 426 ---- .../presentation/FunctionsEditor.java | 1833 ----------------- .../presentation/FunctionsModelWizard.java | 630 ------ ...meterdependenciesActionBarContributor.java | 426 ---- .../ParameterdependenciesEditor.java | 1833 ----------------- .../ParameterdependenciesModelWizard.java | 630 ------ .../ApplicationlevelEditorPlugin.java | 98 - .../RepositoryActionBarContributor.java | 426 ---- .../presentation/RepositoryEditor.java | 1833 ----------------- .../presentation/RepositoryModelWizard.java | 630 ------ .../ServicebehaviorActionBarContributor.java | 426 ---- .../presentation/ServicebehaviorEditor.java | 1833 ----------------- .../ServicebehaviorModelWizard.java | 630 ------ .../SystemActionBarContributor.java | 426 ---- .../system/presentation/SystemEditor.java | 1833 ----------------- .../presentation/SystemModelWizard.java | 630 ------ 32 files changed, 14842 deletions(-) delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/.classpath delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/.project delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/META-INF/MANIFEST.MF delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/build.properties delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/obj16/FunctionsModelFile.gif delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/obj16/ParameterdependenciesModelFile.gif delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/obj16/RepositoryModelFile.gif delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/obj16/ServicebehaviorModelFile.gif delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/obj16/SystemModelFile.gif delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/wizban/NewFunctions.gif delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/wizban/NewParameterdependencies.gif delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/wizban/NewRepository.gif delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/wizban/NewServicebehavior.gif delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/wizban/NewSystem.gif delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/plugin.properties delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/plugin.xml delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/presentation/FunctionsActionBarContributor.java delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/presentation/FunctionsEditor.java delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/presentation/FunctionsModelWizard.java delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/parameterdependencies/presentation/ParameterdependenciesActionBarContributor.java delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/parameterdependencies/presentation/ParameterdependenciesEditor.java delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/parameterdependencies/presentation/ParameterdependenciesModelWizard.java delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/presentation/ApplicationlevelEditorPlugin.java delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/repository/presentation/RepositoryActionBarContributor.java delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/repository/presentation/RepositoryEditor.java delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/repository/presentation/RepositoryModelWizard.java delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/servicebehavior/presentation/ServicebehaviorActionBarContributor.java delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/servicebehavior/presentation/ServicebehaviorEditor.java delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/servicebehavior/presentation/ServicebehaviorModelWizard.java delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/system/presentation/SystemActionBarContributor.java delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/system/presentation/SystemEditor.java delete mode 100644 edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/system/presentation/SystemModelWizard.java diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/.classpath b/edu.kit.ipd.descartes.mm.applicationlevel.editor/.classpath deleted file mode 100644 index 121e527a..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/.project b/edu.kit.ipd.descartes.mm.applicationlevel.editor/.project deleted file mode 100644 index e2b0898e..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>edu.kit.ipd.descartes.mm.applicationlevel.editor</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>org.eclipse.pde.PluginNature</nature> - </natures> -</projectDescription> diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/META-INF/MANIFEST.MF b/edu.kit.ipd.descartes.mm.applicationlevel.editor/META-INF/MANIFEST.MF deleted file mode 100644 index f5dea54b..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/META-INF/MANIFEST.MF +++ /dev/null @@ -1,25 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: edu.kit.ipd.descartes.mm.applicationlevel.editor;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-ClassPath: . -Bundle-Activator: edu.kit.ipd.descartes.mm.applicationlevel.presentation.ApplicationlevelEditorPlugin$Implementation -Bundle-Vendor: %providerName -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Export-Package: edu.kit.ipd.descartes.mm.applicationlevel.functions.presentation, - edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.presentation, - edu.kit.ipd.descartes.mm.applicationlevel.presentation, - edu.kit.ipd.descartes.mm.applicationlevel.repository.presentation, - edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.presentation, - edu.kit.ipd.descartes.mm.applicationlevel.system.presentation -Require-Bundle: org.eclipse.core.runtime, - org.eclipse.core.resources;visibility:=reexport, - edu.kit.ipd.descartes.mm.applicationlevel.edit;visibility:=reexport, - org.eclipse.emf.ecore.xmi;visibility:=reexport, - org.eclipse.emf.edit.ui;visibility:=reexport, - org.eclipse.ui.ide;visibility:=reexport, - edu.kit.ipd.descartes.core.edit;visibility:=reexport, - edu.kit.ipd.descartes.identifier.edit;visibility:=reexport -Bundle-ActivationPolicy: lazy diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/build.properties b/edu.kit.ipd.descartes.mm.applicationlevel.editor/build.properties deleted file mode 100644 index 13bc1763..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/build.properties +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - -bin.includes = .,\ - icons/,\ - META-INF/,\ - plugin.xml,\ - plugin.properties -jars.compile.order = . -source.. = src/ -output.. = bin diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/obj16/FunctionsModelFile.gif b/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/obj16/FunctionsModelFile.gif deleted file mode 100644 index bf17865c125686a053bb4dd3731ec74938954169..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 346 zcmZ?wbhEHb6krfwxXQrL(9jScAHRS9{{Q#qA2@IT$YuD?z`*by$o~Hy%=!;v&%Zw( zDCOYbuw{ZR5N+tUThrsPyxVC}hx6Q4*Xd1e&E>vzrGC}L0arF<-r8I9;6(q=Uw^*; z{QdRE?@wQUfB5?Q?WbR_KK#7@^2eR$-+>lT3n>0%VPs%nW6%K^2=WsHTe(AXfrpNe z;t7>Y8Z8y`F7UQ!{)|{Jv$BxsRh9Kk&xt}>?Q+iqmPQEf<m7LP4$+Kq`{DkuQ9iOu zTt$VKwS~7y+?A=Im8GSS$(6r~mt|T%e^<}cewK+Y5~`|gt&1dFCDm3{@vl;obd}m9 SRlu@Y%EyU`f4++&gEas&i+HI3 diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/obj16/ParameterdependenciesModelFile.gif b/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/obj16/ParameterdependenciesModelFile.gif deleted file mode 100644 index a2cd622f6f9e0012dec944a5ac4650e4d419db41..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 346 zcmZ?wbhEHb6krfwxXQrL(9jScAHRS9{{Q#qA2@IT$YuD?z`*by$o~Hy%=!;v&zUm^ zD0M8jXUhazAllGxx2DHodAHM|4(GY8uG5>`n#+CbO8u&f1Fme!ytTLH!HNE#zy5sx z`TOgS-=Dtz{_yqp+fTn<efW9*<&QhhzXL6x7Et`j!pOkD#-IZ-5acHYwsME&0uLP_ z#S<!*G+HX=UEpoe{28%cW@RDMt19c8o)d+%+U1@JER7J{$;sao9ikcK_QU;QqkLqS zxQYrdYYT6axGPgZD@#iulPiA}FUz!k{;r;>{VWq*Bve(~S{F&UN~*1@;$NjE=_<8J Ss(@v)l#de=|9lrm25SJ}^La%8 diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/obj16/RepositoryModelFile.gif b/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/obj16/RepositoryModelFile.gif deleted file mode 100644 index fa21681600f5a716d10a3287a8961d762f0bb73a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 346 zcmZ?wbhEHb6krfwxXQrL(9jScAHRS9{{Q#qA2@IT$YuD?z`*by$o~Hy%=!;v&zUm^ zC^geKZOa5(AllGxx2DHodAHM|4(GY8uG5>`n#+CbO8u&f1Fme!ytTLH!HNE#zy5sx z`TOgS-=Dtz{_yqp+fTn<efW9*<&QhhzXL6x7Et`j!pOkD#-IZ-5acHYwsME&0uLP_ z#S<!*G+HX=UEpoe{28%cW@RDMt19c8o)d+%+U1@JER7J{$;sao9ikcK_QU;QqkLqS zxQYrdYYT6axGPgZD@#iulPiA}FUz!k{;r;>{VWq*Bve(~S{F&UN~*1@;$NjE=_<8J Ss(@v)l#de=|9lrm25SId|9H{> diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/obj16/ServicebehaviorModelFile.gif b/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/obj16/ServicebehaviorModelFile.gif deleted file mode 100644 index 5d3db6b0059d777b73ac5f5f94c86c442b813ed4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 346 zcmZ?wbhEHb6krfwxXQrL(9jScAHRS9{{Q#qA2@IT$YuD?z`*by$o~Hy%=!;v&zUo) za@i#Z2Zt>aY=LM)zulT1hvnT)i#nX=wz^Jla%(R4tt<7bE)KY|Df8Ceng=KPfByRO z{patmKYoAu`uoGz-)}$tdiCMw{g*%PJpT@~fLcKDCkrD30~>=5$Uu;v7}&}knhQL1 zgcMJxT+(Q%n0JA<Me}FGdYP4lOs}e}Z+cD?(rTA`Ca^R@a3?2!Q*?-Cl-m#YhmG=) zUE(S#ysRy}P2#Rh1+6SCg-oveRlF?I`uV$hruMT;bdgY1ZEIa5;VP-Ns)~P=nxw1L TCaD6J%~C#2O#Jg*92u+uV5fM| diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/obj16/SystemModelFile.gif b/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/obj16/SystemModelFile.gif deleted file mode 100644 index c872719135ef87cc335328be9076187c3fdf7cfb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 346 zcmZ?wbhEHb6krfwxXQrL(9jScAHRS9{{Q#qA2@IT$YuD?z`*by$o~Hy%=-WT$JgIC zj=tGH|NgSdOIs$`0?~$kyEQ!y%e$QxbvVy$b)DYi)?DseSL#<?9B^e*=B>Ro4^H&| z{PpMi&);8v{QmUy_lK{)-+ub_>ch|bFMr&5{vBumwSeMJ7DfgJHU=G#fgnFIu$4PB z7kKChDV|Wdq|s6_?*ea&=Ff=rGAj$2UR7D&^qeT9)h_o;U}=QlPEP)&=n%~)w;%2g z8|5Rr#8p&ySzCCU#9f&RT3K2OnOym+cv+_P^LO=3?Pr<jBB83<*1AZ-RZ?wL75^$V XNmr>&QUxrVrF@*2_~*MgGFSruo;rK0 diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/wizban/NewFunctions.gif b/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/wizban/NewFunctions.gif deleted file mode 100644 index 03168bdd288f44ea10e64d5c7672216a29d702f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2462 zcmd6m`8OMg8ivzyXM`x-QPZJfTAHHK&QR5AsWql$w2Ic!U~ILkTE>kEI<Z7zO%t&s z)=KP>*qVxxL>L++Dp4Xu1dXMO(HS%DUvb~_ocG7?Jl{FrXXjvRX71+%xDNOX*vszj z?%Mj7we`<**2EBBJj9=qNH<p3zgT!?S$bt#dSx-0%(8c72n52)%F5a=?*<%e<CkX( z$J)X%_5u0M!9_PiOKyf1yFA3XKE%02JadmCxJThVV~L)zrT62@eG)2t_o#p;kpfey zf>Ue4(&{2Io=0ZX$NWxtl--z!ZvGA1`WvPtt(b-^rlCr^vP!!#Bqnx`7lqY*xVnB^ z9gEN~P}ayU-(!&6!mX!|P`gHHtO<JmWFJq+9-HM)FO5$xPKcy}cgr)9HKBNALAEK8 zu3x^FedT_R<-M${-nm!3bFTTKZ65r)1;#EQ-_{@F_-g?yxX>jW=NgW4i+tuDO>mFK zd&Ckw_T<Za6DxfZDtr?w;K`(bl&UafT`00P21SX>ZcIQoBMRHoN@&OuS|*->B6g#Q zT{-1FxfQ*+6+IX-6H8`dNG~wt7g+L(!kU-3`u_4Jc3I<KdD9@Nm0R7;tD}!lx<;wp zqs_gq+g^@$4GMZWZ(s6+gJZKp<Kp27$>`L=$fSfnz4%5X6-m~n#VfN5A7&)0EAmez z^(+GARoTA-n+B^pc$Dr@TK_~Z_ig_lGwj#1-0?ZSaA|bv{mA6}#Eew3ydhqaFMs&7 zw7NC;dUkkno-bT{Gb0tuF27s&Ad;+3i)AwTr{xbHmsU4FY<^kW_`I;PDOp}$TH9LP z_`F5+*_v+IoEw<zuWD~CEhZIb;ER$Av2mC@cxpPaxuurY*4@YWmw~~KZbm~T9^1nj zd^bD88~9^{JvPRhm=etY@7DhB3bJRk_X_}}U4Vj;wtZ9i%QU6KhWCO@j_r2^={XY2 z#&qkl)D1#}XU-QPGBu2&wH>g&kW3xxKnSO0-l4$od<UUU?him4z^P=;W+0?YDSCNj ziod`qzYafC8oU*B%hkc!=-ku=fGhb{9E#AnUNebzudppdnG{d82J!2ick<`l8{JtU zqC|CfXdq`}Su{k8pn7#io=e_=uCZ!j4vRx3Xi;Q;w4FYwUC|YMp9auNPBKLx&>3o{ zZEKwhgZUI!8tMoT8){Dq;t<c_JpzYSEt38MX`L01#pTzzQl7<ydQ$GAJ%2uNY?jvv zi%!`#-@1z<-#&e|_u0pl_szeucD2xFBLiQS#_e48u%rqY7Ani9!Y||A+qc0pkE_Wd zw!OL}P*LK^j|($#z+svQ-oQA<NoljPA9~!xJEiPfvM;b8-1z9@*|=EE3uRH@D`t3w zVP|_?2ub+JD;60iAo|H)+2tAOw+s-%KxRw;<g3dW2dGitBbbr)qouh_xxR)&yqc}K zmx9`baxrRN)dL*sZNMR>`sr684}EJ^NBYfzyTDX9^8i-`)(kgC6pyEF&)o1o8ObzE zDss^J{a`f*fLHrUuLM8sdxA6S1RaJc^l0aUN_{eH9f?WQN@+Ea+Myk$PBo}UJuSKf zFk(P3JSa#>FPmIow7Y$z8W&zKB?2`~mBIPapQg(XD0(fO#WG#%Ap-{xEB8SftwZF3 z4m<9?wvFJ`_LP%km6+gqPM|_%ufgvS$w&eg60f@%)}VtiK%Ge(2$gjMEmclFY`dii zp@;scGenng#qaZY4YGhPcrLJ!I5E)~-0_X39v;cOG|GI{2URy=IL;_KK?kh7G>DG8 zN_p4%Cv)Q(rPU|K=rGUZ^8=wFyr^HUa-fcEJ-FLO)#;j*CW`uT3AFd<A3P>cQ$?to ziIsnyt|Iduw48A)=QVK!R9EBPKe<AHg1@P#kuQ_pfth-2-)nyZ4DI>IO->mm)jr6l z(5AwmyK-z|a|4ABi8xDW@3x-)GY+lR-_SOb#23=h4-dM5On*7--NL!1HxnoN_FPXO zFTwf%V~XU(L%a_gv@sKU3=PY<bS*GMT7^%!w484->T$ljEoX7seQ+&7d_xVK_<<oC z*`YmGQ~Wxc9)IO05m41yWj@!ZVdpjWv+832%a@qH&~%~<Dk}e;{Fg|C?y-0wcK><Q z<YkxlUtKEC3DR9}YxYj{kr(W-#(h%UhzST$a^A%$NETC~cj4kS=YR<KuH&=MUphJ) z!Sd7Z6|@v5Y07pbO~@k`DwI!`sCySEyJ%*YNiMM~wuJr~Lw7a62bx&7b^Ow;Kw`aJ zgrM(uu8NBm`FmB%GwLLewI=o2lOr|uHw-SF0-_)HAMBvNvJF~Ca!x!|@%hpimA;BN z5mI?`+zjMza|#%lJ%12uVrLXRrW7v`1J6Cp^Y)E|H>)3|3&x9#>dvS3S$(68Z)WRV zU}5sYY)!LGI1XBKSi4)gLkGlm#s=uvbWf6&rJ%^haigFXrf-<#%YogI-vLT*4E}u# z;L^;=I02R1gw=7qiP%E4ki>d`b7CIkMv%0X4##r<K9z@#3?r(+IdUcNJ=vXA)2GHu z<dZH2tr_!K=_VS?>_8I|VG*`yKAgaXZ2%D{Yxa*(=8lFJb#fdWtDjHcc7KkkY$fnv zeHIMcHe^^#k&o163xu=!sHmeMajUVx={lz>=Y+Rgu#Lk6w^G04R-{XK&QEl+17K}s zXzki=>UI<I>-A!~cAovd#rgojR<$e{e5m#|Ws1V9D%1m626(bZ^4v7-Z)Z3RB_K<G z06h^9+%^8QAC&py_z!nf4QHPm%qCM~a`Wu(690_1OgsuchP`|JcDmMUe^g7!e)D<< zeH`*TSLX(m(7SFsZh8C27d3kT8NS~-3Hr1?HDw(A#>$<9bOoq3`s)W>#%pBl0|AZ| za)#hKq~hTPePE&=3~GZ{94PrzP?duu3X85xHMdo18yJoV^z@w4(rtjpQ@`6a;`Zhu zOpEVt94fIPVTWH){+n1Bay{_vo&B$rPy3;O;c>FJ{p;%u40Fl52jF|tox}8r&ARBH zV%Y2YQpTfao^O;hFEaFxBht33!&nYAbIJjo6n$B!pR~w-d4sW1f%!W&iQe*eLHE1y WHLWx+A6adG$ac=`;sJGafW<%GFUB?i diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/wizban/NewParameterdependencies.gif b/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/wizban/NewParameterdependencies.gif deleted file mode 100644 index 61ca32410390f9da40cb0a7541cce4fc4cec83d7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2462 zcmd6m`8OMg8ivzyXM`x-QPZJfTAHHK&QR5jT4P$ORkW4{W2;@&GHz7Ri6s(inusN_ zR$`aL)>M=vLTQw!M2Qp;G?p$#XUw>N#eL6n-XFj7eCK?ht-XzzxvwMO8sH0HH#<8! zt7~6Z*S^qM<AZ$hAb(aOU0+%IYT=P->6vBenaN}_2?PQHf#|=LW#yZD9gem3&9#AJ zZQvL?|2(Il!W$vQH$sY>AL3jd;#|X@xkVD(BJmzEM30z~`*CI7@fAM1l*1EA0m+p? zDb=B=wc+W{Bhu@l|DZg|YDhpg{f=$<9n+jzL_-$QP$iw2C0!U26T8ccf~sCzZ6B_d zMX2vDZD5z}GC*$T*3pNlog*~XIK6M8mnUS8&hV!e$EFs>MN+~0rD@5kP`o@Z+mJ}t zF5b(!bU)kjUgl-5oXcL>SAEdd5B}W(W9y%1<A-thEgu$C;2ef?3B$QYJada8xJBXJ zV~Fm%@})ir72fgXJ_+UUB$9t}Whk;X1X&Y}qQqu3#G{)K1#PLtG-NR?1J6JayHLc= z?6U5h@}8XXZVZ`;B{MOk7Z~yjEcr!2^-Ek`Us)r&v|*sEae&mqt!m@d(uXOXBh;>u zrk*#gFUL9u1U;O0FL}a&(V4+9@zA(rWO9CZLc*U~cq@{MB&$>6<(c`9(~^~C`RC#~ z7J>4r^xuJv16A!jO4kUjZ@h>5uJ83U`^^k@Y?d!v9GUzuJTW&uEtM>-ix=ffA3ray zY!1Ac8Jd{m3m4u_O9eAa@8>^?Br8*5nN0q9>Eoxxm5q-ZUsu<^%r9?9mev+mH&@ob zY*M{9r<ylr`zQJ;+geJBNJZ)R!lVLhEG8G8l16N5uA#Md^)mjYf1tgKQD1?_cC!ZF z&rI|BUk|fKM|tCug1P_Q+W%cac8zv_0id)4P*BpgYb<-2s&vrsUZBa5y)Ga<2ZGtC zZf&NzL9p=D*+N8yhH;d(J=O=3p<@*Q;WW?L=Nq1FC)CRQ0B8d^mCV@)fRrjlEiF&- z=Q(B9;0H>AHUn?E*jpK$nLGz@A>WKe5jxhYC-83NHU%h?qREy(ex1{H-mF`L8!K3p zpza0@;H)o+25I3`&yI*QN!!p>R(142aqu`TlI(}J)hD$nx`6M~0D4J@rU(Q&UG1bz zjblL&pW;G89RgxQ>_~we;u*Yqz>um%;$I-G)8f(CyjmB^v)B+1%6+uQug8we@H${o z$y?@|cX8y~Cr|f0`?UO_={MGn7W#BVz{`@@?ThY~Q~|?6W$8rNMcfCwR(QryHCgzU zXQu=zN;v*$emWL7L=(a58AmwDtyk;@A2;$&DEk!e3CIsKKKytlHb(PYX(afP8D3$? z$xatS5<c>bLB<M*zVcVLxkmcU{e)1E8502c=6uQ?Y83DYW~BXSaW+G)uVEjjW@GND zpmwfIjG9w*2gi6BaEK|s`jyB7-<#Evez)MxGZjufz*T}Z!^{yyV<}tH*Zq!1Fbxw6 z?X~{cU&R67)xOayz)yRh;EXyz2Vn}`+IgT7?{pgnVj{IdS_P!GYlo^+4eC%&3oihS z7!V8(3R2R`BIg_JY#pk?h1E%kKuuF+aGvy+sj_{Fo{OikOqV)H|31X>eUL`WAUVI? zmb<5QJ!qvZ`8Zi6I;f5lpit3c@CQUP9FK*>>28G9>tGB}rxN-@WL-c@mE#XvZ)!s5 zAwTO3(j{E+hg@F0%)b+!18g9Uk9P#Mf2XO3M=~#rFkkgT)lC=<(~6GJ{wtmuL<e4l zymRfdxpB49$`fOBs7KP-{*Yi^<gLpbr~_LM?z&!ivU<6ZqJC5Y?K%9K$K+|M2z4{C z@^4d>WZr}3Qx0XkMy`PBV%+m5R|rt>GZi)PWzst^Q}?ZVZEt}g-JiHg$wQ=?2YD3Q zWGHk;j!kH)r|==+rwMIcR#Sh*qSgB9Tc;EGLOS~4epis`t%F|8oU3}%v7+zKbO-R_ zt@be{NuE5!htL6QGokz7keo}`0z;&g_~Z*qc@`t?XUkf%7pB|>R^!Fj)xZfK8M5JR z+H*C<Z!>9emwpieRjpL!a=h!e-(bI}J_fLSh<Wpk$4a51vLDHRiA3mbix*<IUq?({ zc6$BQsq&m4-SM(wZ&w|9!5(ecBgGAyfDpxJogD*Z(Zzb_&R=!%4~OqKJp1ysy`upv zKlwpHOL2mxY+KxjJan#H`DC%WSH7~dW>%@>0=s-u=%+DwR|CASk#$?gH|+{Ytha*@ z^d8Moan>ULsA_piodmMdq+We;sM_wj!G#k*^y9w$?eteRfon+4v8O8DUmGIRRuIR6 zD{hRLf&8pb03)*I_G3+KjiN@C;v{0=nWwp4J`wOH^}}?*SfNqv*_7TZ-)ZBU*m~z! znA}hs(<~E?z1A$&_NMOOKC!K_0XinlgQR6CD71E1&#!^$8)o`&V0YwqfYR#&e;)xj zH*wOBK_xd}wOlVEwg4?8u^!+YnftlnByFXGaU6hm#eqXZh$?WlTnT(nc4x)(sqrHD zxU)e^`dnt3i3T$(z=T9tfGwC0#dBfnKm^K){d1(bgW-9dY<q{Q=i|7YU!yBp2z*$t z1;eHl85&*aEp^@m;jVmA)X|W*R$JqAol=yu!`dv^#-W0nDPMES(<D5nC%Rewu+~zv zc1;&`s}cF_S`l44*KW^3oxfnSN|ppZP;;9yN#Ru%=z%Q#J=nv!u9|kY)9nZ2ktIKY zo(KqT8voe~%J_Ngr#q^KGf(zsk*U!+xpsGnf5urR90ni3-o17^P3w&xs=0Wtd7ZsJ z4*7$NQ@u*aUDs{b+&$#;n%#hOpYI(7y;`3e(+_`l#f^k?0jM_k=?7lKYh>;L0ge=K z2H`rSqM><xV1h3UYK>RyFaDfgnT;e03olJJwN`2y7!C{c^c+*utbs>Ue%LYM_T(T; zi|(%<D7GeHhh9<sn@|vZE#Tdqy|0u{`l5hgv9fo4YisokbIJP$;CoXYL-g^D+NfWm z*=zbz#-nE*Z<RC7GxU!lQn#u?S@zYl%KjY`eOZXFw9s#9ov~bw`8y_&-u!od*ZZ+m VtyE8MSxsN?R`$%oK6Q0~#Xpu|#?k-) diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/wizban/NewRepository.gif b/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/wizban/NewRepository.gif deleted file mode 100644 index 0e69a72e1265b1957c0bc7fc77ad4007a56ac983..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2462 zcmd6m`8OMg8ivzyXM`x-QMW_Iv@}JdouR7JmRe(4MyqHo4H;YQs+Mu1f=(=vSkpu- ziM0~DB(|oaBoT&2iAt165kX_=VsyqG_pi9`dCvRecb@N@@3VKbv#|7c23!Yx2JB^b zcXw_5%i8*9276*iAQ=+ONo5<W>tC$AvaG$ct-Z5YEEbVSL?V%RbA*k5-VHd;)<4e< zj<bVf9Rl-Rf{Sj3mfQ?2c72F<dx&?Bc;*pB^oSyO#ge>YOYg^*`zBQS?NI?wA|q0& zf>Ue4(&{2Io=0ZX$NWxxl--z!Y5on@`Wv<-t(cA~rlU){vP!$LWEO6Z7lqY*__}_4 z9h=xNP}ayP-(!%{!mDSD(7HzH><LEyWFKF|8JiVMFO5$xPKaf~cgr)<HIZaxLB1)K ztzW*EedT_R^}Vd0d~$#C$+_l-v3>B*7Fhehe7gXw)2{`v;6m4MyjwWlJ@T1HG|?lP z;2BHu+><Z!ORV%wsPIdyfG3j!Q>wyHb)l%*7&J95yD<UNj4W(VE1{!G=$Qm2n$(RZ zb>)=z<W}_NR`g&gEF6V}CBMK@Uf?J%3Ts~C>-)=_IAx84<xPX+R$g^Gzm73N?HZ+Z zk2d$dZhJZ2H7M-mzJ19T4UWwYjZ20nq@z;{Ba>3W^x_+_Oe|fSmaNP!e3+50t|&g0 z)U%1yS7rYUY#OZY;8VLt>HQPEytn;-%y3@M^2X-`qNUNP_al?@6EiaD@`hwdvHaoF z((2aW>)GMSd4Xv0&5TSqyZmn9gIKycEs@I=pO!y-Tw2}yu=!<e<MYDGrgV9IX>DtD z<MS5HcWb(3b8cX=zpA~pw3u9+K`2Tt#KmFr;Hl}P=9XG|TX!Gx9|i_Hx|t1?1Y8e$ z@ZIbTf8dW1&e#}#VoEswzgzpiE6ASF-Y)=Db^%H%x(-d{FVj>G8{Z2uJGS2qWZ*=! z7}KxI(liPYojG5G%+xZC)^)`BK{EAh5D;$5ykmj!`3_>8A^?Cfg3~D6O$4M&C3<;f zO0d8!zYafC8oU*B%gxco<lNK+fE(pj9Gcj<UNcGXsIV(Un-x#B1_|n2cJk*u8a>z{ z;zUgkD1y7OEFPjq(7Zb%&n53b*Vr{Nhb18s^e9RI#@>+JuIvWBPX`zzCz&IWm<)~6 zcD2rh!2+rq9eo6d3w0m|aY^S0o`_*}tE9g`I%g$gart#_)Ms&_Uex;-ub)pGo8@=H zqEoglx9;L8w@;t#efDwXee<vET^-EXNW{z1xSh+M)-)m0N^SX6_+|Wihc<ZTaSeII zws)5lDo#B4abYG7I7}DA8<@wqDQ#CBh8{QZPpSHq>_ZfUn;v~U8yBm6p)3k~#e$$T z?BbvgA&VY)$D-ndB!9&#`#clFmH}cI$btoce04qJ2sJ@Gf|=+(TAIsL7-~7jYuH(O zD`{LPm!Rj>J;AX)MqE;=zhM>X(6<(K<ln4#3oNBG5AaoB?QlzE@p$U?%#DDPku2k+ zB1fIy4_0#l1dXqZO7PRZCwP-i&|#QTk8VDw)HlP<iIhaElvM+19lBwfG^2X-)1pfN z6D9=9hk{fLvMB{7yW2;q@!|C{5>VS*6`U{oak~6~viH(i9Lud9GH?L7av!ACIz%bx zu;=Y-+X!B5PdQ0ZiwUmhB9tn7jedtnM-p(5c>T?=20g41`b^?LsJt6!t#<NZ+bwMf zBlHKoA%>JEd7sB`kOy|bbAgSdiHXkOj&HOL2q@O2QP!(IsHPdyX-3%@I&jrni{!+w zRCKL>vNWwxS$$%P3G+%mKM)$ikNV{&F4T!*0C(T0I$g8UMAbYlh4vo(gU{k?tBLe8 zaf+|gRTTb%mNQP}{3f1|=4RUaCr<=W3NRNp3gogoFmuoCd+l$4p*<gY$tlC++6Vbm z`cxQnSAk1xZlDSv5od|*-8R#I#$h!28`@@)1R@6J;X!wh`7eikTDaE?X5z%(p6fyI z6KoDJr^w!X<omEeTMLor(6EBX&;dhaRfLpF%lTHLp6AQkau%mO2G<fKH#ESBADHry z9r|+(<*&2p@mGEn1J!NR=5u`;c3$H?t3L*?{Yd!>O()8r;_~k(e~HDI9;+7;kDo`) zUUvEX)ur~FDBJb1;p|i&dBGWL+$Y12n1PTb=UttH<S``%7cO3N35<a6Iz9XRrK7VE ztT_E%Nk@5-u4-S>ggSDeLiKcsrcZ&Yt9Evo^b)6HOBA3rbXN;}pox83&p-VtNMf*y z6!sm@Rddy$e5Y=GMw1M((WYH{a-_!LhS8-{K+NO*gB^@lc0ubX?un;rzF!)n(pQlu zLMm^LTYv&=PXQyd=MUn{>`kJ_RN|!);JK%HK7Nt#X3e7v;dqfr-TBnMtKaAnnmGm+ z*x0-<JM(NauA|Nz&i<DE&;g0PsSzeN-HWVaEiAHi+9;@n85(E#abb59cYv}RgMS|b zxHfY$PC%tMVRbwo60Q&<BC{XhommHY5oBGJ!|_~zZ{?vQ!^moIjzR@|Pkv|B{Hf^@ z<)o`oYsP$5x|tR$8(~H!F2WWqhZA_P4ImP2!}%e~(#iOuUXG(v_45h*?$0rmtwaH= z&x&c+h6;-*@|C%6f$	D(h)U-D_;|`Yx%eIpOVA9Mdr2t<*2M73osG%M<<VKv-KD zMz^+`w%vsKdcByTo9D1^u|80^RV_~jAF91goucxq3JpNkfnJ=EJa=t}+Zm2S38>QV zK~IE453PUg2W9>+{{0<w<Jl(%vnjNg+&qW7q(9@W6OV$A;qG3)ov!mb0Nqlu-?HA( z5Rdw|n@fXQ=w0_6_q=_Si`qSa48L!kg?&1onlg@lbJc^4as#M01{eliCTL~t0|AZ| za);o0<l^B4Ltvsm3~EbI9w_-#P?dusiHfdFHMdpi8X1oW4Gf&q(rtmqQ~$kd!t2dN znit>SI8<Uw#tpxs{wJ|8<T~Q*o&B#=Py3^R;c@b}{p;%uOiSsz2jF|tox_ZY&AR9x zV>s)EGUlUaUT;)0FER~}Bh$94!`O~BbE<)zR6}{FzpN-=d4su9f&Du+iP7?RLHE1y XHJvnXUwLhR$ac=`;sH%ffYpBiUZuug diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/wizban/NewServicebehavior.gif b/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/wizban/NewServicebehavior.gif deleted file mode 100644 index 54a4d3bfcee04f68a4c9f191918b9df0dc0f669e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2462 zcmd6m`8OMg8ivzyXM`x-QPZJfTAHHK&QR5AsWql$w2Ic!U~ILkTE>kEI<Z7zO%t&s z)=KP>*qVxxL>L++Dp4Xu1dXMO(HS%DUvb~_ocG7?Jl{FrXXjvRX71+%xDNOX*vszj z?%Mj7we`<**2EBBJj9=qNH<p3zgT!?S$bt#dSx-0Oag(BQ2pA<%F5a=?*<%e<CkX( z$J)X%_5u0M!9_PiOKyf1yFA3XKE%02JadmCxJThVV~L)zrT62@eG)2t_o#p;kpfey zf>Ue4(&{2Io=0ZX$NWxtl--z!ZvGA1`WvPtt(b-^rlCr^vP!!#Bqnx`7lqY*xVnB^ z9gEN~P}ayU-(!&6!mX!|P`gHHtO<JmWFJq+9-HM)FO5$xPKcy}cgr)9HKBNALAEK8 zu3x^FedT_R<-M${-nm!3bFTTKZ65r)1;#EQ-_{@F_-g?yxX>jW=NgW4i+tuDO>mFK zd&Ckw_T<Za6DxfZDtr?w;K`(bl&UafT`00P21SX>ZcIQoBMRHoN@&OuS|*->B6g#Q zT{-1FxfQ*+6+IX-6H8`dNG~wt7g+L(!kU-3`u_4Jc3I<KdD9@Nm0R7;tD}!lx<;wp zqs_gq+g^@$4GMZWZ(s6+gJZKp<Kp27$>`L=$fSfnz4%5X6-m~n#VfN5A7&)0EAmez z^(+GARoTA-n+B^pc$Dr@TK_~Z_ig_lGwj#1-0?ZSaA|bv{mA6}#Eew3ydhqaFMs&7 zw7NC;dUkkno-bT{Gb0tuF27s&Ad;+3i)AwTr{xbHmsU4FY<^kW_`I;PDOp}$TH9LP z_`F5+*_v+IoEw<zuWD~CEhZIb;ER$Av2mC@cxpPaxuurY*4@YWmw~~KZbm~T9^1nj zd^bD88~9^{JvPRhm=etY@7DhB3bJRk_X_}}U4Vj;wtZ9i%QU6KhWCO@j_r2^={XY2 z#&qkl)D1#}XU-QPGBu2&wH>g&kW3xxKnSO0-l4$od<UUU?him4z^P=;W+0?YDSCNj ziod`qzYafC8oU*B%hkc!=-ku=fGhb{9E#AnUNebzudppdnG{d82J!2ick<`l8{JtU zqC|CfXdq`}Su{k8pn7#io=e_=uCZ!j4vRx3Xi;Q;w4FYwUC|YMp9auNPBKLx&>3o{ zZEKwhgZUI!8tMoT8){Dq;t<c_JpzYSEt38MX`L01#pTzzQl7<ydQ$GAJ%2uNY?jvv zi%!`#-@1z<-#&e|_u0pl_szeucD2xFBLiQS#_e48u%rqY7Ani9!Y||A+qc0pkE_Wd zw!OL}P*LK^j|($#z+svQ-oQA<NoljPA9~!xJEiPfvM;b8-1z9@*|=EE3uRH@D`t3w zVP|_?2ub+JD;60iAo|H)+2tAOw+s-%KxRw;<g3dW2dGitBbbr)qouh_xxR)&yqc}K zmx9`baxrRN)dL*sZNMR>`sr684}EJ^NBYfzyTDX9^8i-`)(kgC6pyEF&)o1o8ObzE zDss^J{a`f*fLHrUuLM8sdxA6S1RaJc^l0aUN_{eH9f?WQN@+Ea+Myk$PBo}UJuSKf zFk(P3JSa#>FPmIow7Y$z8W&zKB?2`~mBIPapQg(XD0(fO#WG#%Ap-{xEB8SftwZF3 z4m<9?wvFJ`_LP%km6+gqPM|_%ufgvS$w&eg60f@%)}VtiK%Ge(2$gjMEmclFY`dii zp@;scGenng#qaZY4YGhPcrLJ!I5E)~-0_X39v;cOG|GI{2URy=IL;_KK?kh7G>DG8 zN_p4%Cv)Q(rPU|K=rGUZ^8=wFyr^HUa-fcEJ-FLO)#;j*CW`uT3AFd<A3P>cQ$?to ziIsnyt|Iduw48A)=QVK!R9EBPKe<AHg1@P#kuQ_pfth-2-)nyZ4DI>IO->mm)jr6l z(5AwmyK-z|a|4ABi8xDW@3x-)GY+lR-_SOb#23=h4-dM5On*7--NL!1HxnoN_FPXO zFTwf%V~XU(L%a_gv@sKU3=PY<bS*GMT7^%!w484->T$ljEoX7seQ+&7d_xVK_<<oC z*`YmGQ~Wxc9)IO05m41yWj@!ZVdpjWv+832%a@qH&~%~<Dk}e;{Fg|C?y-0wcK><Q z<YkxlUtKEC3DR9}YxYj{kr(W-#(h%UhzST$a^A%$NETC~cj4kS=YR<KuH&=MUphJ) z!Sd7Z6|@v5Y07pbO~@k`DwI!`sCySEyJ%*YNiMM~wuJr~Lw7a62bx&7b^Ow;Kw`aJ zgrM(uu8NBm`FmB%GwLLewI=o2lOr|uHw-SF0-_)HAMBvNvJF~Ca!x!|@%hpimA;BN z5mI?`+zjMza|#%lJ%12uVrLXRrW7v`1J6Cp^Y)E|H>)3|3&x9#>dvS3S$(68Z)WRV zU}5sYY)!LGI1XBKSi4)gLkGlm#s=uvbWf6&rJ%^haigFXrf-<#%YogI-vLT*4E}u# z;L^;=I02R1gw=7qiP%E4ki>d`b7CIkMv%0X4##r<K9z@#3?r(+IdUcNJ=vXA)2GHu z<dZH2tr_!K=_VS?>_8I|VG*`yKAgaXZ2%D{Yxa*(=8lFJb#fdWtDjHcc7KkkY$fnv zeHIMcHe^^#k&o163xu=!sHmeMajUVx={lz>=Y+Rgu#Lk6w^G04R-{XK&QEl+17K}s zXzki=>UI<I>-A!~cAovd#rgojR<$e{e5m#|Ws1V9D%1m626(bZ^4v7-Z)Z3RB_K<G z06h^9+%^8QAC&py_z!nf4QHPm%qCM~a`Wu(690_1OgsuchP`|JcDmMUe^g7!e)D<< zeH`*TSLX(m(7SFsZh8C27d3kT8NS~-3Hr1?HDw(A#>$<9bOoq3`s)W>#%pBl0|AZ| za)#hKq~hTPePE&=3~GZ{94PrzP?duu3X85xHMdo18yJoV^z@w4(rtjpQ@`6a;`Zhu zOpEVt94fIPVTWH){+n1Bay{_vo&B$rPy3;O;c>FJ{p;%u40Fl52jF|tox}8r&ARBH zV%Y2YQpTfao^O;hFEaFxBht33!&nYAbIJjo6n$B!pR~w-d4sW1f%!W&iQe*eLHE1y WHLWx+A6adG$ac=`;sJGafW<#n3C3Ok diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/wizban/NewSystem.gif b/edu.kit.ipd.descartes.mm.applicationlevel.editor/icons/full/wizban/NewSystem.gif deleted file mode 100644 index 040a8eddef0054854e41fad3626fea58f87a3036..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2462 zcmd6m`8OMg8ivzyXM`x-QPZJfTAHHK&QR5jT4P#9t7t6^##XzkW!$Ks6H6r4G!aW; zt;8;gy<$ls42=?%D3Kz9#?qG288hx*ao_Wt_s8!%-#OoBZEIy>>TM6W1^5Ek&)(kN z+WPj|`WHHLVuΞ?0RA8>{QvW^U=`?iuFp>D!-n`TZ;1#qTR(-&lBO--cr?y|b<0 zSSvWj#y7_yApcHK;hmrY$0s<aCphQOmoDK1mvFpW6wxiJ=uu3GXKb0*KBe$@l3!wZ zKvHFJa&>6xtFY9X$lobXGwR~d4ZmTVe#0~-7toLeG*nT0dQk_4)PvopJFlV_SKWuJ zW)f-#itAV<`wWsBIW_bVYWpaSIYIB6?BxnrW3#;JrSa*-3894letAZ`CJ?PGNH@ij z^{Wpvu06^$f0%yVBkQ_H=1niO<>P<1z*zg{SovV=e$9mi<T-}moI-HUVJ}@G2rdzL z*C?XvzI?G)T$yKVsaISnJb~n!SRRb54nkH%qA1ZBb+PCML|#jBAq`nbOT#lz#10g( zJ+q`UtF$Ytv=c+_!IFD0q;3qk8%yrat9*^C=_{#c71s@x)DM!HI2A42YWfJJeU#cU z+R*i;`Sp1FAis<K?lo61I5s;pE*hQ?k4`O&Op1Bai*JPzp?Gatv@*N!aYnqlBKure z!z57pi~k*1KUmSqrF4wa`X;(K@B03jVZE8<jL-1|OQTaCMkePcW+dX}4bhTp`QzuM z)vdudv%{0~Ji+4I83})O`TfF2p?Gy#B$diOFMs^Bw7U6mb9-&$%fia0czJzkZEJPo z%NEshYr1iBZeX&nyrrqAfK-r*&rit1Mq{$!Nh!pJ#wuEKM=#@F1_oO@7`0`1Y$tQ@ z{p<{P;Exg3*cf+Wia-CqTl>E&$iC73F8~zw0CEbNHuWX1lNFBYKlC>`anK2*V@EI< z)2>ce)e97yyO@tiQ!|Xvw8eTs(zGo6Ane9@+g$yNt%Pcs4*;zPr;^#5evo2?h~<?j z-U7Si7W_z2z?T1ACtC}H3saW>PUO4MC_>wM<s{yv)G7~UR4~=#&#Q6R&6#tlb72Mw z<5XRse(a59;Sep9>fRQ1Az>G~#;lAyDhiySg_C{I*1Dt?c_;8A8bBu@-WY*Er>dN_ zs<O`u;8C1tsAE8EkPXS7O}v12^&3_;i~kFxab7eQom1^Zc^Mt#MtOvG`}x#~S#BFF zB5}ub>j92@@9g=mm!DQXH2lik(?FjO^Lt$sy?fQwoXTgIDJ`D~xr+N>(+p2LsUi*C zac>txg>k1pEzCp%hiO81E#m|`vH6D0(6f5(8AY$c1Ae(7hR2`HMn|b%Dh>x<Gr`LZ zJJ@JLNP?&CQOIaM(OcGUoo%4oI6w#nne+f4UmefcLJj<$!VEN@F3qLMbk%HQRIE(h z<y0<}h*0y&uHYySJvK4PTelo}<Xe+!(r;#*g&w(ck8$N-^$=4;!FbZn%x$03VLkfs z`L-IrAFf~n@G4*FW#AXR&v6EAprbIkPR$%pk!Pxv9WkC-CaC~YTQ!4Ksd_c27x`BJ z1`G&>3k50YWRP<W_I8d{;6iF7M4-B{A~;9#({#xpdH1FB*dC`E$iN}Q$|I0k(-1kg z)tYmlc_U!8CGj*_DKemj?I%~(rT05TJQ9nA#At5@*J@$(Q0L+Xf}|ZlbEVTyn(wMZ z=s`bf4bjCM(T8kqt<<+2o&~HUPE51~w0@(mgGcsU8SUxsg{m4c>}KTcp#wME)rfZ7 zGFkijXH&yUh1KVV=wP>mivvM{-0)wnv!Qk@9k}yG`Ps^qdWz~vF|_OWAKV_Ux{^RU z4J-RPT~6jcZaimK!ma1<sZNGne{uu>IUi$T9ZxE`4>NY%dD!w67}WWRlaM$}s(PG5 zp-lxt_hi_(hFS^_5_+D{(qS?EXEa)+ueNz6o+qHApB#1u8UJ$Bqmg}6XC_+s?S)Q1 zZmh*2#uUk&i}(;cXlWvF9U7K#=o(;%q#U1kWjV)e)b(OXbLQf-%ivn9=(Y+t?ju7w zvP*lVBL8(ZCFa^sLZGsR(tMU@?d}`w7v*OFrWY}1q5f1cR9Nyo`7fam-D%b>a`}1G z=ykitU+qe-2$DSy3)XJMv2NB_-2n-1#0Z2ayy$4}FO4kJxpeuagKsE&&+g@y?bfzB zu<YyyISu(qnxb`KJ@VM4QpK}{svfzDj_Mi3;w!AuErE~P&;vE_p?c;$E$@^YAd$`< zg5P^GOUY4#{JpaIIaLzKLY;c^`LRly+j>{d0MXC-4!6?#t^C)K>{Bn4Jh$t@Q&thD z0?Y1<n}B>Q&j7<R<_}|ytPLW@6k^08;Ds029$sPa2G!$q{&>DY^~I##8{cT+8(2D* zn3(KfE8`3!wynk-*7~mY&>@kvp&mLa#f_w4&d;~B+sLhg>FTF@v0?XR_kohzgMXg@ zI5x0TPeH|ZVAUKCA~p{#ATb}~?0XJ#LP?qmM`PFk&$1)Oh7lFuOql}sq4fT$@e9Kx z@@YrCrqucL6eG2s3_l|hVG*`yIvmS^Z2%D{3)YX}rgr+5wK8q(Dqc<C_I{2mYa;Mq zy=DxnW@K<=zNf@-3xvDzNnT4$>|AMy({@Nw%nWHUV;KhX?<Q?$m8OWf4$rkSd|}PS zXw9k)>P|iK>#YL1X12|N#TsA!R)sVHe5C3gWs1Tr&(i^!`?|44vYpj!?xore#UhJ- z06pguT-5$^5R~@g_z(A$^=F?S&LC4Gv$Aa-5dVxZk2?-Nfqii6UW&#WA5>%ELDL#r zT^#Z|Cx=?4pa;&o&e;dZm(@D~sb1gO^LsTu*QXx;=7tLi=>$-&^U?LcidRcN00NxI zV-LZ#NCm?Sy1+PZ7}OFkKT!BNw>%R`6y#r<YG^Lk)YBi~>*&}gr&t0{CVjVO!0F0D z7#BR+I8tay!VdRS{u`GUc+2nI{e%6AXT4FtkZ9?<zV-E5hN<}dWAMZ2wqg3jW_83* zk*sxH3FGNYx3`LEml?Vz5y?9h!A#rAIYr+#imo)sTaxdyyuny0#rz!=PjCD?x8wcz Wnntp_r?jdsa3^zi@sO%2!0aC;?8!I) diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/plugin.properties b/edu.kit.ipd.descartes.mm.applicationlevel.editor/plugin.properties deleted file mode 100644 index fea39203..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/plugin.properties +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - -pluginName = Applicationlevel Editor -providerName = www.example.org - -_UI_FunctionsEditor_menu = &Functions Editor -_UI_ParameterdependenciesEditor_menu = &Parameterdependencies Editor -_UI_RepositoryEditor_menu = &Repository Editor -_UI_ServicebehaviorEditor_menu = &Servicebehavior Editor -_UI_SystemEditor_menu = &System Editor - -_UI_CreateChild_menu_item = &New Child -_UI_CreateSibling_menu_item = N&ew Sibling - -_UI_ShowPropertiesView_menu_item = Show &Properties View -_UI_RefreshViewer_menu_item = &Refresh - -_UI_SelectionPage_label = Selection -_UI_ParentPage_label = Parent -_UI_ListPage_label = List -_UI_TreePage_label = Tree -_UI_TablePage_label = Table -_UI_TreeWithColumnsPage_label = Tree with Columns -_UI_ObjectColumn_label = Object -_UI_SelfColumn_label = Self - -_UI_NoObjectSelected = Selected Nothing -_UI_SingleObjectSelected = Selected Object: {0} -_UI_MultiObjectSelected = Selected {0} Objects - -_UI_OpenEditorError_label = Open Editor - -_UI_Wizard_category = Example EMF Model Creation Wizards - -_UI_CreateModelError_message = Problems encountered in file "{0}" - -_UI_FunctionsModelWizard_label = Functions Model -_UI_FunctionsModelWizard_description = Create a new Functions model - -_UI_FunctionsEditor_label = Functions Model Editor - -_UI_FunctionsEditorFilenameDefaultBase = My -_UI_FunctionsEditorFilenameExtensions = functions - -_UI_ParameterdependenciesModelWizard_label = Parameterdependencies Model -_UI_ParameterdependenciesModelWizard_description = Create a new Parameterdependencies model - -_UI_ParameterdependenciesEditor_label = Parameterdependencies Model Editor - -_UI_ParameterdependenciesEditorFilenameDefaultBase = My -_UI_ParameterdependenciesEditorFilenameExtensions = parameterdependencies - -_UI_RepositoryModelWizard_label = Repository Model -_UI_RepositoryModelWizard_description = Create a new Repository model - -_UI_RepositoryEditor_label = Repository Model Editor - -_UI_RepositoryEditorFilenameDefaultBase = My -_UI_RepositoryEditorFilenameExtensions = repository - -_UI_ServicebehaviorModelWizard_label = Servicebehavior Model -_UI_ServicebehaviorModelWizard_description = Create a new Servicebehavior model - -_UI_ServicebehaviorEditor_label = Servicebehavior Model Editor - -_UI_ServicebehaviorEditorFilenameDefaultBase = My -_UI_ServicebehaviorEditorFilenameExtensions = servicebehavior - -_UI_SystemModelWizard_label = System Model -_UI_SystemModelWizard_description = Create a new System model - -_UI_SystemEditor_label = System Model Editor - -_UI_SystemEditorFilenameDefaultBase = My -_UI_SystemEditorFilenameExtensions = system - -_UI_Wizard_label = New - -_WARN_FilenameExtension = The file name must end in ''.{0}'' -_WARN_FilenameExtensions = The file name must have one of the following extensions: {0} - -_UI_ModelObject = &Model Object -_UI_XMLEncoding = &XML Encoding -_UI_XMLEncodingChoices = UTF-8 ASCII UTF-16 UTF-16BE UTF-16LE ISO-8859-1 -_UI_Wizard_initial_object_description = Select a model object to create - -_UI_FileConflict_label = File Conflict -_WARN_FileConflict = There are unsaved changes that conflict with changes made outside the editor. Do you wish to discard this editor's changes? - diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/plugin.xml b/edu.kit.ipd.descartes.mm.applicationlevel.editor/plugin.xml deleted file mode 100644 index 09fc7870..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/plugin.xml +++ /dev/null @@ -1,140 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?> - -<!-- - Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT ---> - -<plugin> - - <extension point="org.eclipse.ui.newWizards"> - <category - id="org.eclipse.emf.ecore.Wizard.category.ID" - name="%_UI_Wizard_category"/> - <wizard - id="edu.kit.ipd.descartes.mm.applicationlevel.functions.presentation.FunctionsModelWizardID" - name="%_UI_FunctionsModelWizard_label" - class="edu.kit.ipd.descartes.mm.applicationlevel.functions.presentation.FunctionsModelWizard" - category="org.eclipse.emf.ecore.Wizard.category.ID" - icon="icons/full/obj16/FunctionsModelFile.gif"> - <description>%_UI_FunctionsModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - - <extension point="org.eclipse.ui.editors"> - <editor - id="edu.kit.ipd.descartes.mm.applicationlevel.functions.presentation.FunctionsEditorID" - name="%_UI_FunctionsEditor_label" - icon="icons/full/obj16/FunctionsModelFile.gif" - extensions="functions" - class="edu.kit.ipd.descartes.mm.applicationlevel.functions.presentation.FunctionsEditor" - contributorClass="edu.kit.ipd.descartes.mm.applicationlevel.functions.presentation.FunctionsActionBarContributor"> - </editor> - </extension> - - <extension point="org.eclipse.ui.newWizards"> - <category - id="org.eclipse.emf.ecore.Wizard.category.ID" - name="%_UI_Wizard_category"/> - <wizard - id="edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.presentation.ParameterdependenciesModelWizardID" - name="%_UI_ParameterdependenciesModelWizard_label" - class="edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.presentation.ParameterdependenciesModelWizard" - category="org.eclipse.emf.ecore.Wizard.category.ID" - icon="icons/full/obj16/ParameterdependenciesModelFile.gif"> - <description>%_UI_ParameterdependenciesModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - - <extension point="org.eclipse.ui.editors"> - <editor - id="edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.presentation.ParameterdependenciesEditorID" - name="%_UI_ParameterdependenciesEditor_label" - icon="icons/full/obj16/ParameterdependenciesModelFile.gif" - extensions="parameterdependencies" - class="edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.presentation.ParameterdependenciesEditor" - contributorClass="edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.presentation.ParameterdependenciesActionBarContributor"> - </editor> - </extension> - - <extension point="org.eclipse.ui.newWizards"> - <category - id="org.eclipse.emf.ecore.Wizard.category.ID" - name="%_UI_Wizard_category"/> - <wizard - id="edu.kit.ipd.descartes.mm.applicationlevel.repository.presentation.RepositoryModelWizardID" - name="%_UI_RepositoryModelWizard_label" - class="edu.kit.ipd.descartes.mm.applicationlevel.repository.presentation.RepositoryModelWizard" - category="org.eclipse.emf.ecore.Wizard.category.ID" - icon="icons/full/obj16/RepositoryModelFile.gif"> - <description>%_UI_RepositoryModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - - <extension point="org.eclipse.ui.editors"> - <editor - id="edu.kit.ipd.descartes.mm.applicationlevel.repository.presentation.RepositoryEditorID" - name="%_UI_RepositoryEditor_label" - icon="icons/full/obj16/RepositoryModelFile.gif" - extensions="repository" - class="edu.kit.ipd.descartes.mm.applicationlevel.repository.presentation.RepositoryEditor" - contributorClass="edu.kit.ipd.descartes.mm.applicationlevel.repository.presentation.RepositoryActionBarContributor"> - </editor> - </extension> - - <extension point="org.eclipse.ui.newWizards"> - <category - id="org.eclipse.emf.ecore.Wizard.category.ID" - name="%_UI_Wizard_category"/> - <wizard - id="edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.presentation.ServicebehaviorModelWizardID" - name="%_UI_ServicebehaviorModelWizard_label" - class="edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.presentation.ServicebehaviorModelWizard" - category="org.eclipse.emf.ecore.Wizard.category.ID" - icon="icons/full/obj16/ServicebehaviorModelFile.gif"> - <description>%_UI_ServicebehaviorModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - - <extension point="org.eclipse.ui.editors"> - <editor - id="edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.presentation.ServicebehaviorEditorID" - name="%_UI_ServicebehaviorEditor_label" - icon="icons/full/obj16/ServicebehaviorModelFile.gif" - extensions="servicebehavior" - class="edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.presentation.ServicebehaviorEditor" - contributorClass="edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.presentation.ServicebehaviorActionBarContributor"> - </editor> - </extension> - - <extension point="org.eclipse.ui.newWizards"> - <category - id="org.eclipse.emf.ecore.Wizard.category.ID" - name="%_UI_Wizard_category"/> - <wizard - id="edu.kit.ipd.descartes.mm.applicationlevel.system.presentation.SystemModelWizardID" - name="%_UI_SystemModelWizard_label" - class="edu.kit.ipd.descartes.mm.applicationlevel.system.presentation.SystemModelWizard" - category="org.eclipse.emf.ecore.Wizard.category.ID" - icon="icons/full/obj16/SystemModelFile.gif"> - <description>%_UI_SystemModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - - <extension point="org.eclipse.ui.editors"> - <editor - id="edu.kit.ipd.descartes.mm.applicationlevel.system.presentation.SystemEditorID" - name="%_UI_SystemEditor_label" - icon="icons/full/obj16/SystemModelFile.gif" - extensions="system" - class="edu.kit.ipd.descartes.mm.applicationlevel.system.presentation.SystemEditor" - contributorClass="edu.kit.ipd.descartes.mm.applicationlevel.system.presentation.SystemActionBarContributor"> - </editor> - </extension> - -</plugin> diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/presentation/FunctionsActionBarContributor.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/presentation/FunctionsActionBarContributor.java deleted file mode 100644 index 52048405..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/presentation/FunctionsActionBarContributor.java +++ /dev/null @@ -1,426 +0,0 @@ -/** - * Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - */ -package edu.kit.ipd.descartes.mm.applicationlevel.functions.presentation; - -import edu.kit.ipd.descartes.mm.applicationlevel.presentation.ApplicationlevelEditorPlugin; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.emf.common.ui.viewer.IViewerProvider; - -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.domain.IEditingDomainProvider; - -import org.eclipse.emf.edit.ui.action.ControlAction; -import org.eclipse.emf.edit.ui.action.CreateChildAction; -import org.eclipse.emf.edit.ui.action.CreateSiblingAction; -import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; -import org.eclipse.emf.edit.ui.action.LoadResourceAction; -import org.eclipse.emf.edit.ui.action.ValidateAction; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IContributionItem; -import org.eclipse.jface.action.IContributionManager; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.action.SubContributionItem; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.Viewer; - -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.PartInitException; - -/** - * This is the action bar contributor for the Functions model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class FunctionsActionBarContributor - extends EditingDomainActionBarContributor - implements ISelectionChangedListener { - /** - * This keeps track of the active editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IEditorPart activeEditorPart; - - /** - * This keeps track of the current selection provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ISelectionProvider selectionProvider; - - /** - * This action opens the Properties view. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IAction showPropertiesViewAction = - new Action(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) { - @Override - public void run() { - try { - getPage().showView("org.eclipse.ui.views.PropertySheet"); - } - catch (PartInitException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - }; - - /** - * This action refreshes the viewer of the current editor if the editor - * implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IAction refreshViewerAction = - new Action(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) { - @Override - public boolean isEnabled() { - return activeEditorPart instanceof IViewerProvider; - } - - @Override - public void run() { - if (activeEditorPart instanceof IViewerProvider) { - Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer(); - if (viewer != null) { - viewer.refresh(); - } - } - } - }; - - /** - * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor - * generated for the current selection by the item provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> createChildActions; - - /** - * This is the menu manager into which menu contribution items should be added for CreateChild actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IMenuManager createChildMenuManager; - - /** - * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor - * generated for the current selection by the item provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> createSiblingActions; - - /** - * This is the menu manager into which menu contribution items should be added for CreateSibling actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IMenuManager createSiblingMenuManager; - - /** - * This creates an instance of the contributor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public FunctionsActionBarContributor() { - super(ADDITIONS_LAST_STYLE); - loadResourceAction = new LoadResourceAction(); - validateAction = new ValidateAction(); - controlAction = new ControlAction(); - } - - /** - * This adds Separators for editor additions to the tool bar. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void contributeToToolBar(IToolBarManager toolBarManager) { - toolBarManager.add(new Separator("functions-settings")); - toolBarManager.add(new Separator("functions-additions")); - } - - /** - * This adds to the menu bar a menu and some separators for editor additions, - * as well as the sub-menus for object creation items. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void contributeToMenu(IMenuManager menuManager) { - super.contributeToMenu(menuManager); - - IMenuManager submenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_FunctionsEditor_menu"), "edu.kit.ipd.descartes.mm.applicationlevel.functionsMenuID"); - menuManager.insertAfter("additions", submenuManager); - submenuManager.add(new Separator("settings")); - submenuManager.add(new Separator("actions")); - submenuManager.add(new Separator("additions")); - submenuManager.add(new Separator("additions-end")); - - // Prepare for CreateChild item addition or removal. - // - createChildMenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); - submenuManager.insertBefore("additions", createChildMenuManager); - - // Prepare for CreateSibling item addition or removal. - // - createSiblingMenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); - submenuManager.insertBefore("additions", createSiblingMenuManager); - - // Force an update because Eclipse hides empty menus now. - // - submenuManager.addMenuListener - (new IMenuListener() { - public void menuAboutToShow(IMenuManager menuManager) { - menuManager.updateAll(true); - } - }); - - addGlobalActions(submenuManager); - } - - /** - * When the active editor changes, this remembers the change and registers with it as a selection provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setActiveEditor(IEditorPart part) { - super.setActiveEditor(part); - activeEditorPart = part; - - // Switch to the new selection provider. - // - if (selectionProvider != null) { - selectionProvider.removeSelectionChangedListener(this); - } - if (part == null) { - selectionProvider = null; - } - else { - selectionProvider = part.getSite().getSelectionProvider(); - selectionProvider.addSelectionChangedListener(this); - - // Fake a selection changed event to update the menus. - // - if (selectionProvider.getSelection() != null) { - selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection())); - } - } - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, - * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings - * that can be added to the selected object and updating the menus accordingly. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void selectionChanged(SelectionChangedEvent event) { - // Remove any menu items for old selection. - // - if (createChildMenuManager != null) { - depopulateManager(createChildMenuManager, createChildActions); - } - if (createSiblingMenuManager != null) { - depopulateManager(createSiblingMenuManager, createSiblingActions); - } - - // Query the new selection for appropriate new child/sibling descriptors - // - Collection<?> newChildDescriptors = null; - Collection<?> newSiblingDescriptors = null; - - ISelection selection = event.getSelection(); - if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) { - Object object = ((IStructuredSelection)selection).getFirstElement(); - - EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain(); - - newChildDescriptors = domain.getNewChildDescriptors(object, null); - newSiblingDescriptors = domain.getNewChildDescriptors(null, object); - } - - // Generate actions for selection; populate and redraw the menus. - // - createChildActions = generateCreateChildActions(newChildDescriptors, selection); - createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); - - if (createChildMenuManager != null) { - populateManager(createChildMenuManager, createChildActions, null); - createChildMenuManager.update(true); - } - if (createSiblingMenuManager != null) { - populateManager(createSiblingMenuManager, createSiblingActions, null); - createSiblingMenuManager.update(true); - } - } - - /** - * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in <code>descriptors</code>, - * and returns the collection of these actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) { - Collection<IAction> actions = new ArrayList<IAction>(); - if (descriptors != null) { - for (Object descriptor : descriptors) { - actions.add(new CreateChildAction(activeEditorPart, selection, descriptor)); - } - } - return actions; - } - - /** - * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in <code>descriptors</code>, - * and returns the collection of these actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection) { - Collection<IAction> actions = new ArrayList<IAction>(); - if (descriptors != null) { - for (Object descriptor : descriptors) { - actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor)); - } - } - return actions; - } - - /** - * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s - * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection, - * by inserting them before the specified contribution item <code>contributionID</code>. - * If <code>contributionID</code> is <code>null</code>, they are simply added. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) { - if (actions != null) { - for (IAction action : actions) { - if (contributionID != null) { - manager.insertBefore(contributionID, action); - } - else { - manager.add(action); - } - } - } - } - - /** - * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s - * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) { - if (actions != null) { - IContributionItem[] items = manager.getItems(); - for (int i = 0; i < items.length; i++) { - // Look into SubContributionItems - // - IContributionItem contributionItem = items[i]; - while (contributionItem instanceof SubContributionItem) { - contributionItem = ((SubContributionItem)contributionItem).getInnerItem(); - } - - // Delete the ActionContributionItems with matching action. - // - if (contributionItem instanceof ActionContributionItem) { - IAction action = ((ActionContributionItem)contributionItem).getAction(); - if (actions.contains(action)) { - manager.remove(contributionItem); - } - } - } - } - } - - /** - * This populates the pop-up menu before it appears. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void menuAboutToShow(IMenuManager menuManager) { - super.menuAboutToShow(menuManager); - MenuManager submenuManager = null; - - submenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); - populateManager(submenuManager, createChildActions, null); - menuManager.insertBefore("edit", submenuManager); - - submenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); - populateManager(submenuManager, createSiblingActions, null); - menuManager.insertBefore("edit", submenuManager); - } - - /** - * This inserts global actions before the "additions-end" separator. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected void addGlobalActions(IMenuManager menuManager) { - menuManager.insertAfter("additions-end", new Separator("ui-actions")); - menuManager.insertAfter("ui-actions", showPropertiesViewAction); - - refreshViewerAction.setEnabled(refreshViewerAction.isEnabled()); - menuManager.insertAfter("ui-actions", refreshViewerAction); - - super.addGlobalActions(menuManager); - } - - /** - * This ensures that a delete action will clean up all references to deleted objects. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean removeAllReferencesOnDelete() { - return true; - } - -} diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/presentation/FunctionsEditor.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/presentation/FunctionsEditor.java deleted file mode 100644 index 23385b8a..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/presentation/FunctionsEditor.java +++ /dev/null @@ -1,1833 +0,0 @@ -/** - * Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - */ -package edu.kit.ipd.descartes.mm.applicationlevel.functions.presentation; - - -import java.io.IOException; -import java.io.InputStream; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.EventObject; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -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.ResourcesPlugin; - -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.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; - -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; - -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; - -import org.eclipse.swt.SWT; - -import org.eclipse.swt.custom.CTabFolder; - -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.Transfer; - -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; - -import org.eclipse.swt.graphics.Point; - -import org.eclipse.swt.layout.FillLayout; - -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; - -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; - -import org.eclipse.ui.dialogs.SaveAsDialog; - -import org.eclipse.ui.ide.IGotoMarker; - -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.MultiPageEditorPart; - -import org.eclipse.ui.views.contentoutline.ContentOutline; -import org.eclipse.ui.views.contentoutline.ContentOutlinePage; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; - -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.PropertySheet; -import org.eclipse.ui.views.properties.PropertySheetPage; - -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CommandStack; -import org.eclipse.emf.common.command.CommandStackListener; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.common.ui.MarkerHelper; -import org.eclipse.emf.common.ui.ViewerPane; - -import org.eclipse.emf.common.ui.editor.ProblemEditorPart; - -import org.eclipse.emf.common.ui.viewer.IViewerProvider; - -import org.eclipse.emf.common.util.BasicDiagnostic; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EValidator; - -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; - -import org.eclipse.emf.ecore.util.EContentAdapter; -import org.eclipse.emf.ecore.util.EcoreUtil; - -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.domain.IEditingDomainProvider; - -import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; - -import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; - -import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; - -import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; - -import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; -import org.eclipse.emf.edit.ui.dnd.LocalTransfer; -import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; - -import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; -import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; - -import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; -import org.eclipse.emf.edit.ui.util.EditUIUtil; - -import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; - -import edu.kit.ipd.descartes.mm.applicationlevel.functions.provider.FunctionsItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.core.provider.CoreItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.identifier.provider.IdentifierItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.provider.ParameterdependenciesItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.presentation.ApplicationlevelEditorPlugin; - -import edu.kit.ipd.descartes.mm.applicationlevel.repository.provider.RepositoryItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.provider.ServicebehaviorItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.system.provider.SystemItemProviderAdapterFactory; - -import org.eclipse.ui.actions.WorkspaceModifyOperation; - - -/** - * This is an example of a Functions model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class FunctionsEditor - extends MultiPageEditorPart - implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { - /** - * This keeps track of the editing domain that is used to track all changes to the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected AdapterFactoryEditingDomain editingDomain; - - /** - * This is the one adapter factory used for providing views of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ComposedAdapterFactory adapterFactory; - - /** - * This is the content outline page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IContentOutlinePage contentOutlinePage; - - /** - * This is a kludge... - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStatusLineManager contentOutlineStatusLineManager; - - /** - * This is the content outline page's viewer. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer contentOutlineViewer; - - /** - * This is the property sheet page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected PropertySheetPage propertySheetPage; - - /** - * This is the viewer that shadows the selection in the content outline. - * The parent relation must be correctly defined for this to work. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer selectionViewer; - - /** - * This inverts the roll of parent and child in the content provider and show parents as a tree. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer parentViewer; - - /** - * This shows how a tree view works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewer; - - /** - * This shows how a list view works. - * A list viewer doesn't support icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListViewer listViewer; - - /** - * This shows how a table view works. - * A table can be used as a list with icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TableViewer tableViewer; - - /** - * This shows how a tree view with columns works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewerWithColumns; - - /** - * This keeps track of the active viewer pane, in the book. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ViewerPane currentViewerPane; - - /** - * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Viewer currentViewer; - - /** - * This listens to which ever viewer is active. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ISelectionChangedListener selectionChangedListener; - - /** - * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>(); - - /** - * This keeps track of the selection of the editor as a whole. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ISelection editorSelection = StructuredSelection.EMPTY; - - /** - * The MarkerHelper is responsible for creating workspace resource markers presented - * in Eclipse's Problems View. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected MarkerHelper markerHelper = new EditUIMarkerHelper(); - - /** - * This listens for when the outline becomes active - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IPartListener partListener = - new IPartListener() { - public void partActivated(IWorkbenchPart p) { - if (p instanceof ContentOutline) { - if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { - getActionBarContributor().setActiveEditor(FunctionsEditor.this); - - setCurrentViewer(contentOutlineViewer); - } - } - else if (p instanceof PropertySheet) { - if (((PropertySheet)p).getCurrentPage() == propertySheetPage) { - getActionBarContributor().setActiveEditor(FunctionsEditor.this); - handleActivate(); - } - } - else if (p == FunctionsEditor.this) { - handleActivate(); - } - } - public void partBroughtToTop(IWorkbenchPart p) { - // Ignore. - } - public void partClosed(IWorkbenchPart p) { - // Ignore. - } - public void partDeactivated(IWorkbenchPart p) { - // Ignore. - } - public void partOpened(IWorkbenchPart p) { - // Ignore. - } - }; - - /** - * Resources that have been removed since last activation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<Resource> removedResources = new ArrayList<Resource>(); - - /** - * Resources that have been changed since last activation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<Resource> changedResources = new ArrayList<Resource>(); - - /** - * Resources that have been saved. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<Resource> savedResources = new ArrayList<Resource>(); - - /** - * Map to store the diagnostic associated with a resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>(); - - /** - * Controls whether the problem indication should be updated. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean updateProblemIndication = true; - - /** - * Adapter used to update the problem indication when resources are demanded loaded. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EContentAdapter problemIndicationAdapter = - new EContentAdapter() { - @Override - public void notifyChanged(Notification notification) { - if (notification.getNotifier() instanceof Resource) { - switch (notification.getFeatureID(Resource.class)) { - case Resource.RESOURCE__IS_LOADED: - case Resource.RESOURCE__ERRORS: - case Resource.RESOURCE__WARNINGS: { - Resource resource = (Resource)notification.getNotifier(); - Diagnostic diagnostic = analyzeResourceProblems(resource, null); - if (diagnostic.getSeverity() != Diagnostic.OK) { - resourceToDiagnosticMap.put(resource, diagnostic); - } - else { - resourceToDiagnosticMap.remove(resource); - } - - if (updateProblemIndication) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - updateProblemIndication(); - } - }); - } - break; - } - } - } - else { - super.notifyChanged(notification); - } - } - - @Override - protected void setTarget(Resource target) { - basicSetTarget(target); - } - - @Override - protected void unsetTarget(Resource target) { - basicUnsetTarget(target); - } - }; - - /** - * This listens for workspace changes. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IResourceChangeListener resourceChangeListener = - new IResourceChangeListener() { - public void resourceChanged(IResourceChangeEvent event) { - IResourceDelta delta = event.getDelta(); - try { - class ResourceDeltaVisitor implements IResourceDeltaVisitor { - protected ResourceSet resourceSet = editingDomain.getResourceSet(); - protected Collection<Resource> changedResources = new ArrayList<Resource>(); - protected Collection<Resource> removedResources = new ArrayList<Resource>(); - - public boolean visit(IResourceDelta delta) { - if (delta.getResource().getType() == IResource.FILE) { - if (delta.getKind() == IResourceDelta.REMOVED || - delta.getKind() == IResourceDelta.CHANGED && delta.getFlags() != IResourceDelta.MARKERS) { - Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false); - if (resource != null) { - if (delta.getKind() == IResourceDelta.REMOVED) { - removedResources.add(resource); - } - else if (!savedResources.remove(resource)) { - changedResources.add(resource); - } - } - } - } - - return true; - } - - public Collection<Resource> getChangedResources() { - return changedResources; - } - - public Collection<Resource> getRemovedResources() { - return removedResources; - } - } - - final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(); - delta.accept(visitor); - - if (!visitor.getRemovedResources().isEmpty()) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - removedResources.addAll(visitor.getRemovedResources()); - if (!isDirty()) { - getSite().getPage().closeEditor(FunctionsEditor.this, false); - } - } - }); - } - - if (!visitor.getChangedResources().isEmpty()) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - changedResources.addAll(visitor.getChangedResources()); - if (getSite().getPage().getActiveEditor() == FunctionsEditor.this) { - handleActivate(); - } - } - }); - } - } - catch (CoreException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - }; - - /** - * Handles activation of the editor or it's associated views. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void handleActivate() { - // Recompute the read only state. - // - if (editingDomain.getResourceToReadOnlyMap() != null) { - editingDomain.getResourceToReadOnlyMap().clear(); - - // Refresh any actions that may become enabled or disabled. - // - setSelection(getSelection()); - } - - if (!removedResources.isEmpty()) { - if (handleDirtyConflict()) { - getSite().getPage().closeEditor(FunctionsEditor.this, false); - } - else { - removedResources.clear(); - changedResources.clear(); - savedResources.clear(); - } - } - else if (!changedResources.isEmpty()) { - changedResources.removeAll(savedResources); - handleChangedResources(); - changedResources.clear(); - savedResources.clear(); - } - } - - /** - * Handles what to do with changed resources on activation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void handleChangedResources() { - if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) { - if (isDirty()) { - changedResources.addAll(editingDomain.getResourceSet().getResources()); - } - editingDomain.getCommandStack().flush(); - - updateProblemIndication = false; - for (Resource resource : changedResources) { - if (resource.isLoaded()) { - resource.unload(); - try { - resource.load(Collections.EMPTY_MAP); - } - catch (IOException exception) { - if (!resourceToDiagnosticMap.containsKey(resource)) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - } - } - } - - if (AdapterFactoryEditingDomain.isStale(editorSelection)) { - setSelection(StructuredSelection.EMPTY); - } - - updateProblemIndication = true; - updateProblemIndication(); - } - } - - /** - * Updates the problems indication with the information described in the specified diagnostic. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void updateProblemIndication() { - if (updateProblemIndication) { - BasicDiagnostic diagnostic = - new BasicDiagnostic - (Diagnostic.OK, - "edu.kit.ipd.descartes.mm.applicationlevel.editor", - 0, - null, - new Object [] { editingDomain.getResourceSet() }); - for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) { - if (childDiagnostic.getSeverity() != Diagnostic.OK) { - diagnostic.add(childDiagnostic); - } - } - - int lastEditorPage = getPageCount() - 1; - if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) { - ((ProblemEditorPart)getEditor(lastEditorPage)).setDiagnostic(diagnostic); - if (diagnostic.getSeverity() != Diagnostic.OK) { - setActivePage(lastEditorPage); - } - } - else if (diagnostic.getSeverity() != Diagnostic.OK) { - ProblemEditorPart problemEditorPart = new ProblemEditorPart(); - problemEditorPart.setDiagnostic(diagnostic); - problemEditorPart.setMarkerHelper(markerHelper); - try { - addPage(++lastEditorPage, problemEditorPart, getEditorInput()); - setPageText(lastEditorPage, problemEditorPart.getPartName()); - setActivePage(lastEditorPage); - showTabs(); - } - catch (PartInitException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - - if (markerHelper.hasMarkers(editingDomain.getResourceSet())) { - markerHelper.deleteMarkers(editingDomain.getResourceSet()); - if (diagnostic.getSeverity() != Diagnostic.OK) { - try { - markerHelper.createMarkers(diagnostic); - } - catch (CoreException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - } - } - } - - /** - * Shows a dialog that asks if conflicting changes should be discarded. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean handleDirtyConflict() { - return - MessageDialog.openQuestion - (getSite().getShell(), - getString("_UI_FileConflict_label"), - getString("_WARN_FileConflict")); - } - - /** - * This creates a model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public FunctionsEditor() { - super(); - initializeEditingDomain(); - } - - /** - * This sets up the editing domain for the model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void initializeEditingDomain() { - // Create an adapter factory that yields item providers. - // - adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - - adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new FunctionsItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new ParameterdependenciesItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new RepositoryItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new ServicebehaviorItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new SystemItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new CoreItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new IdentifierItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); - - // Create the command stack that will notify this editor as commands are executed. - // - BasicCommandStack commandStack = new BasicCommandStack(); - - // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus. - // - commandStack.addCommandStackListener - (new CommandStackListener() { - public void commandStackChanged(final EventObject event) { - getContainer().getDisplay().asyncExec - (new Runnable() { - public void run() { - firePropertyChange(IEditorPart.PROP_DIRTY); - - // Try to select the affected objects. - // - Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand(); - if (mostRecentCommand != null) { - setSelectionToViewer(mostRecentCommand.getAffectedObjects()); - } - if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) { - propertySheetPage.refresh(); - } - } - }); - } - }); - - // Create the editing domain with a special command stack. - // - editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>()); - } - - /** - * This is here for the listener to be able to call it. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected void firePropertyChange(int action) { - super.firePropertyChange(action); - } - - /** - * This sets the selection into whichever viewer is active. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSelectionToViewer(Collection<?> collection) { - final Collection<?> theSelection = collection; - // Make sure it's okay. - // - if (theSelection != null && !theSelection.isEmpty()) { - Runnable runnable = - new Runnable() { - public void run() { - // Try to select the items in the current content viewer of the editor. - // - if (currentViewer != null) { - currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true); - } - } - }; - getSite().getShell().getDisplay().asyncExec(runnable); - } - } - - /** - * This returns the editing domain as required by the {@link IEditingDomainProvider} interface. - * This is important for implementing the static methods of {@link AdapterFactoryEditingDomain} - * and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EditingDomain getEditingDomain() { - return editingDomain; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object [] getElements(Object object) { - Object parent = super.getParent(object); - return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object [] getChildren(Object object) { - Object parent = super.getParent(object); - return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean hasChildren(Object object) { - Object parent = super.getParent(object); - return parent != null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object getParent(Object object) { - return null; - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewerPane(ViewerPane viewerPane) { - if (currentViewerPane != viewerPane) { - if (currentViewerPane != null) { - currentViewerPane.showFocus(false); - } - currentViewerPane = viewerPane; - } - setCurrentViewer(currentViewerPane.getViewer()); - } - - /** - * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, - * is the current one. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewer(Viewer viewer) { - // If it is changing... - // - if (currentViewer != viewer) { - if (selectionChangedListener == null) { - // Create the listener on demand. - // - selectionChangedListener = - new ISelectionChangedListener() { - // This just notifies those things that are affected by the section. - // - public void selectionChanged(SelectionChangedEvent selectionChangedEvent) { - setSelection(selectionChangedEvent.getSelection()); - } - }; - } - - // Stop listening to the old one. - // - if (currentViewer != null) { - currentViewer.removeSelectionChangedListener(selectionChangedListener); - } - - // Start listening to the new one. - // - if (viewer != null) { - viewer.addSelectionChangedListener(selectionChangedListener); - } - - // Remember it. - // - currentViewer = viewer; - - // Set the editors selection based on the current viewer's selection. - // - setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection()); - } - } - - /** - * This returns the viewer as required by the {@link IViewerProvider} interface. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Viewer getViewer() { - return currentViewer; - } - - /** - * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createContextMenuFor(StructuredViewer viewer) { - MenuManager contextMenu = new MenuManager("#PopUp"); - contextMenu.add(new Separator("additions")); - contextMenu.setRemoveAllWhenShown(true); - contextMenu.addMenuListener(this); - Menu menu= contextMenu.createContextMenu(viewer.getControl()); - viewer.getControl().setMenu(menu); - getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); - - int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; - Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() }; - viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); - viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); - } - - /** - * This is the method called to load a resource into the editing domain's resource set based on the editor's input. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createModel() { - URI resourceURI = EditUIUtil.getURI(getEditorInput()); - Exception exception = null; - Resource resource = null; - try { - // Load the resource through the editing domain. - // - resource = editingDomain.getResourceSet().getResource(resourceURI, true); - } - catch (Exception e) { - exception = e; - resource = editingDomain.getResourceSet().getResource(resourceURI, false); - } - - Diagnostic diagnostic = analyzeResourceProblems(resource, exception); - if (diagnostic.getSeverity() != Diagnostic.OK) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter); - } - - /** - * Returns a diagnostic describing the errors and warnings listed in the resource - * and the specified exception (if any). - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) { - if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) { - BasicDiagnostic basicDiagnostic = - new BasicDiagnostic - (Diagnostic.ERROR, - "edu.kit.ipd.descartes.mm.applicationlevel.editor", - 0, - getString("_UI_CreateModelError_message", resource.getURI()), - new Object [] { exception == null ? (Object)resource : exception }); - basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); - return basicDiagnostic; - } - else if (exception != null) { - return - new BasicDiagnostic - (Diagnostic.ERROR, - "edu.kit.ipd.descartes.mm.applicationlevel.editor", - 0, - getString("_UI_CreateModelError_message", resource.getURI()), - new Object[] { exception }); - } - else { - return Diagnostic.OK_INSTANCE; - } - } - - /** - * This is the method used by the framework to install your own controls. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void createPages() { - // Creates the model from the editor input - // - createModel(); - - // Only creates the other pages if there is something that can be edited - // - if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { - // Create a page for the selection tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), FunctionsEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - selectionViewer = (TreeViewer)viewerPane.getViewer(); - selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - - selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - selectionViewer.setInput(editingDomain.getResourceSet()); - selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - viewerPane.setTitle(editingDomain.getResourceSet()); - - new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - - createContextMenuFor(selectionViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_SelectionPage_label")); - } - - // Create a page for the parent tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), FunctionsEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - parentViewer = (TreeViewer)viewerPane.getViewer(); - parentViewer.setAutoExpandLevel(30); - parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); - parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(parentViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ParentPage_label")); - } - - // This is the page for the list viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), FunctionsEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new ListViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - listViewer = (ListViewer)viewerPane.getViewer(); - listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(listViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ListPage_label")); - } - - // This is the page for the tree viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), FunctionsEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - treeViewer = (TreeViewer)viewerPane.getViewer(); - treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); - - createContextMenuFor(treeViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreePage_label")); - } - - // This is the page for the table viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), FunctionsEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TableViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - tableViewer = (TableViewer)viewerPane.getViewer(); - - Table table = tableViewer.getTable(); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableColumn objectColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(3, 100, true)); - objectColumn.setText(getString("_UI_ObjectColumn_label")); - objectColumn.setResizable(true); - - TableColumn selfColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(2, 100, true)); - selfColumn.setText(getString("_UI_SelfColumn_label")); - selfColumn.setResizable(true); - - tableViewer.setColumnProperties(new String [] {"a", "b"}); - tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(tableViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TablePage_label")); - } - - // This is the page for the table tree viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), FunctionsEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); - - Tree tree = treeViewerWithColumns.getTree(); - tree.setLayoutData(new FillLayout()); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); - - TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); - objectColumn.setText(getString("_UI_ObjectColumn_label")); - objectColumn.setResizable(true); - objectColumn.setWidth(250); - - TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); - selfColumn.setText(getString("_UI_SelfColumn_label")); - selfColumn.setResizable(true); - selfColumn.setWidth(200); - - treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); - treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(treeViewerWithColumns); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); - } - - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - setActivePage(0); - } - }); - } - - // Ensures that this editor will only display the page's tab - // area if there are more than one page - // - getContainer().addControlListener - (new ControlAdapter() { - boolean guard = false; - @Override - public void controlResized(ControlEvent event) { - if (!guard) { - guard = true; - hideTabs(); - guard = false; - } - } - }); - - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - updateProblemIndication(); - } - }); - } - - /** - * If there is just one page in the multi-page editor part, - * this hides the single tab at the bottom. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void hideTabs() { - if (getPageCount() <= 1) { - setPageText(0, ""); - if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(1); - Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y + 6); - } - } - } - - /** - * If there is more than one page in the multi-page editor part, - * this shows the tabs at the bottom. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void showTabs() { - if (getPageCount() > 1) { - setPageText(0, getString("_UI_SelectionPage_label")); - if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); - Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y - 6); - } - } - } - - /** - * This is used to track the active viewer. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected void pageChange(int pageIndex) { - super.pageChange(pageIndex); - - if (contentOutlinePage != null) { - handleContentOutlineSelection(contentOutlinePage.getSelection()); - } - } - - /** - * This is how the framework determines which interfaces we implement. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("rawtypes") - @Override - public Object getAdapter(Class key) { - if (key.equals(IContentOutlinePage.class)) { - return showOutlineView() ? getContentOutlinePage() : null; - } - else if (key.equals(IPropertySheetPage.class)) { - return getPropertySheetPage(); - } - else if (key.equals(IGotoMarker.class)) { - return this; - } - else { - return super.getAdapter(key); - } - } - - /** - * This accesses a cached version of the content outliner. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IContentOutlinePage getContentOutlinePage() { - if (contentOutlinePage == null) { - // The content outline is just a tree. - // - class MyContentOutlinePage extends ContentOutlinePage { - @Override - public void createControl(Composite parent) { - super.createControl(parent); - contentOutlineViewer = getTreeViewer(); - contentOutlineViewer.addSelectionChangedListener(this); - - // Set up the tree viewer. - // - contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - contentOutlineViewer.setInput(editingDomain.getResourceSet()); - - // Make sure our popups work. - // - createContextMenuFor(contentOutlineViewer); - - if (!editingDomain.getResourceSet().getResources().isEmpty()) { - // Select the root object in the view. - // - contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - } - } - - @Override - public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) { - super.makeContributions(menuManager, toolBarManager, statusLineManager); - contentOutlineStatusLineManager = statusLineManager; - } - - @Override - public void setActionBars(IActionBars actionBars) { - super.setActionBars(actionBars); - getActionBarContributor().shareGlobalActions(this, actionBars); - } - } - - contentOutlinePage = new MyContentOutlinePage(); - - // Listen to selection so that we can handle it is a special way. - // - contentOutlinePage.addSelectionChangedListener - (new ISelectionChangedListener() { - // This ensures that we handle selections correctly. - // - public void selectionChanged(SelectionChangedEvent event) { - handleContentOutlineSelection(event.getSelection()); - } - }); - } - - return contentOutlinePage; - } - - /** - * This accesses a cached version of the property sheet. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IPropertySheetPage getPropertySheetPage() { - if (propertySheetPage == null) { - propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { - @Override - public void setSelectionToViewer(List<?> selection) { - FunctionsEditor.this.setSelectionToViewer(selection); - FunctionsEditor.this.setFocus(); - } - - @Override - public void setActionBars(IActionBars actionBars) { - super.setActionBars(actionBars); - getActionBarContributor().shareGlobalActions(this, actionBars); - } - }; - propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); - } - - return propertySheetPage; - } - - /** - * This deals with how we want selection in the outliner to affect the other views. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void handleContentOutlineSelection(ISelection selection) { - if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { - Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); - if (selectedElements.hasNext()) { - // Get the first selected element. - // - Object selectedElement = selectedElements.next(); - - // If it's the selection viewer, then we want it to select the same selection as this selection. - // - if (currentViewerPane.getViewer() == selectionViewer) { - ArrayList<Object> selectionList = new ArrayList<Object>(); - selectionList.add(selectedElement); - while (selectedElements.hasNext()) { - selectionList.add(selectedElements.next()); - } - - // Set the selection to the widget. - // - selectionViewer.setSelection(new StructuredSelection(selectionList)); - } - else { - // Set the input to the widget. - // - if (currentViewerPane.getViewer().getInput() != selectedElement) { - currentViewerPane.getViewer().setInput(selectedElement); - currentViewerPane.setTitle(selectedElement); - } - } - } - } - } - - /** - * This is for implementing {@link IEditorPart} and simply tests the command stack. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean isDirty() { - return ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded(); - } - - /** - * This is for implementing {@link IEditorPart} and simply saves the model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void doSave(IProgressMonitor progressMonitor) { - // Save only resources that have actually changed. - // - final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); - saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - - // Do the work within an operation because this is a long running activity that modifies the workbench. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - // This is the method that gets invoked when the operation runs. - // - @Override - public void execute(IProgressMonitor monitor) { - // Save the resources to the file system. - // - boolean first = true; - for (Resource resource : editingDomain.getResourceSet().getResources()) { - if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) { - try { - long timeStamp = resource.getTimeStamp(); - resource.save(saveOptions); - if (resource.getTimeStamp() != timeStamp) { - savedResources.add(resource); - } - } - catch (Exception exception) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - first = false; - } - } - } - }; - - updateProblemIndication = false; - try { - // This runs the options, and shows progress. - // - new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); - - // Refresh the necessary state. - // - ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone(); - firePropertyChange(IEditorPart.PROP_DIRTY); - } - catch (Exception exception) { - // Something went wrong that shouldn't. - // - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - updateProblemIndication = true; - updateProblemIndication(); - } - - /** - * This returns whether something has been persisted to the URI of the specified resource. - * The implementation uses the URI converter from the editor's resource set to try to open an input stream. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean isPersisted(Resource resource) { - boolean result = false; - try { - InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI()); - if (stream != null) { - result = true; - stream.close(); - } - } - catch (IOException e) { - // Ignore - } - return result; - } - - /** - * This always returns true because it is not currently supported. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean isSaveAsAllowed() { - return true; - } - - /** - * This also changes the editor's input. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void doSaveAs() { - SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell()); - saveAsDialog.open(); - IPath path = saveAsDialog.getResult(); - if (path != null) { - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); - if (file != null) { - doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file)); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void doSaveAs(URI uri, IEditorInput editorInput) { - (editingDomain.getResourceSet().getResources().get(0)).setURI(uri); - setInputWithNotify(editorInput); - setPartName(editorInput.getName()); - IProgressMonitor progressMonitor = - getActionBars().getStatusLineManager() != null ? - getActionBars().getStatusLineManager().getProgressMonitor() : - new NullProgressMonitor(); - doSave(progressMonitor); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void gotoMarker(IMarker marker) { - try { - if (marker.getType().equals(EValidator.MARKER)) { - String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null); - if (uriAttribute != null) { - URI uri = URI.createURI(uriAttribute); - EObject eObject = editingDomain.getResourceSet().getEObject(uri, true); - if (eObject != null) { - setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject))); - } - } - } - } - catch (CoreException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - - /** - * This is called during startup. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void init(IEditorSite site, IEditorInput editorInput) { - setSite(site); - setInputWithNotify(editorInput); - setPartName(editorInput.getName()); - site.setSelectionProvider(this); - site.getPage().addPartListener(partListener); - ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setFocus() { - if (currentViewerPane != null) { - currentViewerPane.setFocus(); - } - else { - getControl(getActivePage()).setFocus(); - } - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void addSelectionChangedListener(ISelectionChangedListener listener) { - selectionChangedListeners.add(listener); - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void removeSelectionChangedListener(ISelectionChangedListener listener) { - selectionChangedListeners.remove(listener); - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ISelection getSelection() { - return editorSelection; - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection. - * Calling this result will notify the listeners. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSelection(ISelection selection) { - editorSelection = selection; - - for (ISelectionChangedListener listener : selectionChangedListeners) { - listener.selectionChanged(new SelectionChangedEvent(this, selection)); - } - setStatusLineManager(selection); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setStatusLineManager(ISelection selection) { - IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? - contentOutlineStatusLineManager : getActionBars().getStatusLineManager(); - - if (statusLineManager != null) { - if (selection instanceof IStructuredSelection) { - Collection<?> collection = ((IStructuredSelection)selection).toList(); - switch (collection.size()) { - case 0: { - statusLineManager.setMessage(getString("_UI_NoObjectSelected")); - break; - } - case 1: { - String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next()); - statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text)); - break; - } - default: { - statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size()))); - break; - } - } - } - else { - statusLineManager.setMessage(""); - } - } - } - - /** - * This looks up a string in the plugin's plugin.properties file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static String getString(String key) { - return ApplicationlevelEditorPlugin.INSTANCE.getString(key); - } - - /** - * This looks up a string in plugin.properties, making a substitution. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static String getString(String key, Object s1) { - return ApplicationlevelEditorPlugin.INSTANCE.getString(key, new Object [] { s1 }); - } - - /** - * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void menuAboutToShow(IMenuManager menuManager) { - ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EditingDomainActionBarContributor getActionBarContributor() { - return (EditingDomainActionBarContributor)getEditorSite().getActionBarContributor(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IActionBars getActionBars() { - return getActionBarContributor().getActionBars(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public AdapterFactory getAdapterFactory() { - return adapterFactory; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void dispose() { - updateProblemIndication = false; - - ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener); - - getSite().getPage().removePartListener(partListener); - - adapterFactory.dispose(); - - if (getActionBarContributor().getActiveEditor() == this) { - getActionBarContributor().setActiveEditor(null); - } - - if (propertySheetPage != null) { - propertySheetPage.dispose(); - } - - if (contentOutlinePage != null) { - contentOutlinePage.dispose(); - } - - super.dispose(); - } - - /** - * Returns whether the outline view should be presented to the user. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean showOutlineView() { - return true; - } -} diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/presentation/FunctionsModelWizard.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/presentation/FunctionsModelWizard.java deleted file mode 100644 index 40395c27..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/presentation/FunctionsModelWizard.java +++ /dev/null @@ -1,630 +0,0 @@ -/** - * Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - */ -package edu.kit.ipd.descartes.mm.applicationlevel.functions.presentation; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.StringTokenizer; - -import org.eclipse.emf.common.CommonPlugin; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; - -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.EObject; - -import org.eclipse.emf.ecore.xmi.XMLResource; - -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; - -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.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; - -import org.eclipse.core.runtime.IProgressMonitor; - -import org.eclipse.jface.dialogs.MessageDialog; - -import org.eclipse.jface.viewers.IStructuredSelection; - -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; - -import org.eclipse.swt.SWT; - -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.ModifyEvent; - -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; - -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; - -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; - -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - -import edu.kit.ipd.descartes.mm.applicationlevel.functions.FunctionsFactory; -import edu.kit.ipd.descartes.mm.applicationlevel.functions.FunctionsPackage; -import edu.kit.ipd.descartes.mm.applicationlevel.provider.ApplicationlevelEditPlugin; - - -import edu.kit.ipd.descartes.mm.applicationlevel.presentation.ApplicationlevelEditorPlugin; - -import org.eclipse.core.runtime.Path; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; - -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; - - -/** - * This is a simple wizard for creating a new model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class FunctionsModelWizard extends Wizard implements INewWizard { - /** - * The supported extensions for created files. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<String> FILE_EXTENSIONS = - Collections.unmodifiableList(Arrays.asList(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_FunctionsEditorFilenameExtensions").split("\\s*,\\s*"))); - - /** - * A formatted list of supported file extensions, suitable for display. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String FORMATTED_FILE_EXTENSIONS = - ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_FunctionsEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); - - /** - * This caches an instance of the model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected FunctionsPackage functionsPackage = FunctionsPackage.eINSTANCE; - - /** - * This caches an instance of the model factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected FunctionsFactory functionsFactory = functionsPackage.getFunctionsFactory(); - - /** - * This is the file creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected FunctionsModelWizardNewFileCreationPage newFileCreationPage; - - /** - * This is the initial object creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected FunctionsModelWizardInitialObjectCreationPage initialObjectCreationPage; - - /** - * Remember the selection during initialization for populating the default container. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStructuredSelection selection; - - /** - * Remember the workbench during initialization. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IWorkbench workbench; - - /** - * Caches the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected List<String> initialObjectNames; - - /** - * This just records the information. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); - setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(ApplicationlevelEditorPlugin.INSTANCE.getImage("full/wizban/NewFunctions"))); - } - - /** - * Returns the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getInitialObjectNames() { - if (initialObjectNames == null) { - initialObjectNames = new ArrayList<String>(); - for (EClassifier eClassifier : functionsPackage.getEClassifiers()) { - if (eClassifier instanceof EClass) { - EClass eClass = (EClass)eClassifier; - if (!eClass.isAbstract()) { - initialObjectNames.add(eClass.getName()); - } - } - } - Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); - } - return initialObjectNames; - } - - /** - * Create a new model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObject createInitialModel() { - EClass eClass = (EClass)functionsPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); - EObject rootObject = functionsFactory.create(eClass); - return rootObject; - } - - /** - * Do the work after everything is specified. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @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<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); - resource.save(options); - } - catch (Exception exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(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(), ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); - return false; - } - - return true; - } - catch (Exception exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - return false; - } - } - - /** - * This is the one page of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class FunctionsModelWizardNewFileCreationPage extends WizardNewFileCreationPage { - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public FunctionsModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { - super(pageId, selection); - } - - /** - * The framework calls this to see if the file is correct. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean validatePage() { - if (super.validatePage()) { - String extension = new Path(getFileName()).getFileExtension(); - if (extension == null || !FILE_EXTENSIONS.contains(extension)) { - String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; - setErrorMessage(ApplicationlevelEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); - return false; - } - return true; - } - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); - } - } - - /** - * This is the page where the type of object to create is selected. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class FunctionsModelWizardInitialObjectCreationPage extends WizardPage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo initialObjectField; - - /** - * @generated - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - */ - protected List<String> encodings; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo encodingField; - - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public FunctionsModelWizardInitialObjectCreationPage(String pageId) { - super(pageId); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 12; - composite.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - } - - Label containerLabel = new Label(composite, SWT.LEFT); - { - containerLabel.setText(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ModelObject")); - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - containerLabel.setLayoutData(data); - } - - initialObjectField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - initialObjectField.setLayoutData(data); - } - - for (String objectName : getInitialObjectNames()) { - initialObjectField.add(getLabel(objectName)); - } - - if (initialObjectField.getItemCount() == 1) { - initialObjectField.select(0); - } - initialObjectField.addModifyListener(validator); - - Label encodingLabel = new Label(composite, SWT.LEFT); - { - encodingLabel.setText(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - encodingLabel.setLayoutData(data); - } - encodingField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - encodingField.setLayoutData(data); - } - - for (String encoding : getEncodings()) { - encodingField.add(encoding); - } - - encodingField.select(0); - encodingField.addModifyListener(validator); - - setPageComplete(validatePage()); - setControl(composite); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModifyListener validator = - new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(validatePage()); - } - }; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean validatePage() { - return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - if (initialObjectField.getItemCount() == 1) { - initialObjectField.clearSelection(); - encodingField.setFocus(); - } - else { - encodingField.clearSelection(); - initialObjectField.setFocus(); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getInitialObjectName() { - String label = initialObjectField.getText(); - - for (String name : getInitialObjectNames()) { - if (getLabel(name).equals(label)) { - return name; - } - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getEncoding() { - return encodingField.getText(); - } - - /** - * Returns the label for the specified type name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected String getLabel(String typeName) { - try { - return ApplicationlevelEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); - } - catch(MissingResourceException mre) { - ApplicationlevelEditorPlugin.INSTANCE.log(mre); - } - return typeName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getEncodings() { - if (encodings == null) { - encodings = new ArrayList<String>(); - for (StringTokenizer stringTokenizer = new StringTokenizer(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) { - encodings.add(stringTokenizer.nextToken()); - } - } - return encodings; - } - } - - /** - * The framework calls this to create the contents of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void addPages() { - // Create a page, set the title, and the initial model file name. - // - newFileCreationPage = new FunctionsModelWizardNewFileCreationPage("Whatever", selection); - newFileCreationPage.setTitle(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_FunctionsModelWizard_label")); - newFileCreationPage.setDescription(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_FunctionsModelWizard_description")); - newFileCreationPage.setFileName(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_FunctionsEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); - addPage(newFileCreationPage); - - // Try and get the resource selection to determine a current directory for the file dialog. - // - if (selection != null && !selection.isEmpty()) { - // Get the resource... - // - Object selectedElement = selection.iterator().next(); - if (selectedElement instanceof IResource) { - // Get the resource parent, if its a file. - // - IResource selectedResource = (IResource)selectedElement; - if (selectedResource.getType() == IResource.FILE) { - selectedResource = selectedResource.getParent(); - } - - // This gives us a directory... - // - if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { - // Set this for the container. - // - newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); - - // Make up a unique new name here. - // - String defaultModelBaseFilename = ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_FunctionsEditorFilenameDefaultBase"); - String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); - String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; - for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { - modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; - } - newFileCreationPage.setFileName(modelFilename); - } - } - } - initialObjectCreationPage = new FunctionsModelWizardInitialObjectCreationPage("Whatever2"); - initialObjectCreationPage.setTitle(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_FunctionsModelWizard_label")); - initialObjectCreationPage.setDescription(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); - addPage(initialObjectCreationPage); - } - - /** - * Get the file from the page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return newFileCreationPage.getModelFile(); - } - -} diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/parameterdependencies/presentation/ParameterdependenciesActionBarContributor.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/parameterdependencies/presentation/ParameterdependenciesActionBarContributor.java deleted file mode 100644 index aefadfed..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/parameterdependencies/presentation/ParameterdependenciesActionBarContributor.java +++ /dev/null @@ -1,426 +0,0 @@ -/** - * Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - */ -package edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.presentation; - -import edu.kit.ipd.descartes.mm.applicationlevel.presentation.ApplicationlevelEditorPlugin; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.emf.common.ui.viewer.IViewerProvider; - -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.domain.IEditingDomainProvider; - -import org.eclipse.emf.edit.ui.action.ControlAction; -import org.eclipse.emf.edit.ui.action.CreateChildAction; -import org.eclipse.emf.edit.ui.action.CreateSiblingAction; -import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; -import org.eclipse.emf.edit.ui.action.LoadResourceAction; -import org.eclipse.emf.edit.ui.action.ValidateAction; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IContributionItem; -import org.eclipse.jface.action.IContributionManager; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.action.SubContributionItem; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.Viewer; - -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.PartInitException; - -/** - * This is the action bar contributor for the Parameterdependencies model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class ParameterdependenciesActionBarContributor - extends EditingDomainActionBarContributor - implements ISelectionChangedListener { - /** - * This keeps track of the active editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IEditorPart activeEditorPart; - - /** - * This keeps track of the current selection provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ISelectionProvider selectionProvider; - - /** - * This action opens the Properties view. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IAction showPropertiesViewAction = - new Action(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) { - @Override - public void run() { - try { - getPage().showView("org.eclipse.ui.views.PropertySheet"); - } - catch (PartInitException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - }; - - /** - * This action refreshes the viewer of the current editor if the editor - * implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IAction refreshViewerAction = - new Action(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) { - @Override - public boolean isEnabled() { - return activeEditorPart instanceof IViewerProvider; - } - - @Override - public void run() { - if (activeEditorPart instanceof IViewerProvider) { - Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer(); - if (viewer != null) { - viewer.refresh(); - } - } - } - }; - - /** - * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor - * generated for the current selection by the item provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> createChildActions; - - /** - * This is the menu manager into which menu contribution items should be added for CreateChild actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IMenuManager createChildMenuManager; - - /** - * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor - * generated for the current selection by the item provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> createSiblingActions; - - /** - * This is the menu manager into which menu contribution items should be added for CreateSibling actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IMenuManager createSiblingMenuManager; - - /** - * This creates an instance of the contributor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ParameterdependenciesActionBarContributor() { - super(ADDITIONS_LAST_STYLE); - loadResourceAction = new LoadResourceAction(); - validateAction = new ValidateAction(); - controlAction = new ControlAction(); - } - - /** - * This adds Separators for editor additions to the tool bar. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void contributeToToolBar(IToolBarManager toolBarManager) { - toolBarManager.add(new Separator("parameterdependencies-settings")); - toolBarManager.add(new Separator("parameterdependencies-additions")); - } - - /** - * This adds to the menu bar a menu and some separators for editor additions, - * as well as the sub-menus for object creation items. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void contributeToMenu(IMenuManager menuManager) { - super.contributeToMenu(menuManager); - - IMenuManager submenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ParameterdependenciesEditor_menu"), "edu.kit.ipd.descartes.mm.applicationlevel.parameterdependenciesMenuID"); - menuManager.insertAfter("additions", submenuManager); - submenuManager.add(new Separator("settings")); - submenuManager.add(new Separator("actions")); - submenuManager.add(new Separator("additions")); - submenuManager.add(new Separator("additions-end")); - - // Prepare for CreateChild item addition or removal. - // - createChildMenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); - submenuManager.insertBefore("additions", createChildMenuManager); - - // Prepare for CreateSibling item addition or removal. - // - createSiblingMenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); - submenuManager.insertBefore("additions", createSiblingMenuManager); - - // Force an update because Eclipse hides empty menus now. - // - submenuManager.addMenuListener - (new IMenuListener() { - public void menuAboutToShow(IMenuManager menuManager) { - menuManager.updateAll(true); - } - }); - - addGlobalActions(submenuManager); - } - - /** - * When the active editor changes, this remembers the change and registers with it as a selection provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setActiveEditor(IEditorPart part) { - super.setActiveEditor(part); - activeEditorPart = part; - - // Switch to the new selection provider. - // - if (selectionProvider != null) { - selectionProvider.removeSelectionChangedListener(this); - } - if (part == null) { - selectionProvider = null; - } - else { - selectionProvider = part.getSite().getSelectionProvider(); - selectionProvider.addSelectionChangedListener(this); - - // Fake a selection changed event to update the menus. - // - if (selectionProvider.getSelection() != null) { - selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection())); - } - } - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, - * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings - * that can be added to the selected object and updating the menus accordingly. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void selectionChanged(SelectionChangedEvent event) { - // Remove any menu items for old selection. - // - if (createChildMenuManager != null) { - depopulateManager(createChildMenuManager, createChildActions); - } - if (createSiblingMenuManager != null) { - depopulateManager(createSiblingMenuManager, createSiblingActions); - } - - // Query the new selection for appropriate new child/sibling descriptors - // - Collection<?> newChildDescriptors = null; - Collection<?> newSiblingDescriptors = null; - - ISelection selection = event.getSelection(); - if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) { - Object object = ((IStructuredSelection)selection).getFirstElement(); - - EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain(); - - newChildDescriptors = domain.getNewChildDescriptors(object, null); - newSiblingDescriptors = domain.getNewChildDescriptors(null, object); - } - - // Generate actions for selection; populate and redraw the menus. - // - createChildActions = generateCreateChildActions(newChildDescriptors, selection); - createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); - - if (createChildMenuManager != null) { - populateManager(createChildMenuManager, createChildActions, null); - createChildMenuManager.update(true); - } - if (createSiblingMenuManager != null) { - populateManager(createSiblingMenuManager, createSiblingActions, null); - createSiblingMenuManager.update(true); - } - } - - /** - * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in <code>descriptors</code>, - * and returns the collection of these actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) { - Collection<IAction> actions = new ArrayList<IAction>(); - if (descriptors != null) { - for (Object descriptor : descriptors) { - actions.add(new CreateChildAction(activeEditorPart, selection, descriptor)); - } - } - return actions; - } - - /** - * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in <code>descriptors</code>, - * and returns the collection of these actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection) { - Collection<IAction> actions = new ArrayList<IAction>(); - if (descriptors != null) { - for (Object descriptor : descriptors) { - actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor)); - } - } - return actions; - } - - /** - * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s - * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection, - * by inserting them before the specified contribution item <code>contributionID</code>. - * If <code>contributionID</code> is <code>null</code>, they are simply added. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) { - if (actions != null) { - for (IAction action : actions) { - if (contributionID != null) { - manager.insertBefore(contributionID, action); - } - else { - manager.add(action); - } - } - } - } - - /** - * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s - * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) { - if (actions != null) { - IContributionItem[] items = manager.getItems(); - for (int i = 0; i < items.length; i++) { - // Look into SubContributionItems - // - IContributionItem contributionItem = items[i]; - while (contributionItem instanceof SubContributionItem) { - contributionItem = ((SubContributionItem)contributionItem).getInnerItem(); - } - - // Delete the ActionContributionItems with matching action. - // - if (contributionItem instanceof ActionContributionItem) { - IAction action = ((ActionContributionItem)contributionItem).getAction(); - if (actions.contains(action)) { - manager.remove(contributionItem); - } - } - } - } - } - - /** - * This populates the pop-up menu before it appears. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void menuAboutToShow(IMenuManager menuManager) { - super.menuAboutToShow(menuManager); - MenuManager submenuManager = null; - - submenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); - populateManager(submenuManager, createChildActions, null); - menuManager.insertBefore("edit", submenuManager); - - submenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); - populateManager(submenuManager, createSiblingActions, null); - menuManager.insertBefore("edit", submenuManager); - } - - /** - * This inserts global actions before the "additions-end" separator. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected void addGlobalActions(IMenuManager menuManager) { - menuManager.insertAfter("additions-end", new Separator("ui-actions")); - menuManager.insertAfter("ui-actions", showPropertiesViewAction); - - refreshViewerAction.setEnabled(refreshViewerAction.isEnabled()); - menuManager.insertAfter("ui-actions", refreshViewerAction); - - super.addGlobalActions(menuManager); - } - - /** - * This ensures that a delete action will clean up all references to deleted objects. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean removeAllReferencesOnDelete() { - return true; - } - -} diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/parameterdependencies/presentation/ParameterdependenciesEditor.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/parameterdependencies/presentation/ParameterdependenciesEditor.java deleted file mode 100644 index 8824a099..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/parameterdependencies/presentation/ParameterdependenciesEditor.java +++ /dev/null @@ -1,1833 +0,0 @@ -/** - * Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - */ -package edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.presentation; - - -import java.io.IOException; -import java.io.InputStream; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.EventObject; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -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.ResourcesPlugin; - -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.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; - -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; - -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; - -import org.eclipse.swt.SWT; - -import org.eclipse.swt.custom.CTabFolder; - -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.Transfer; - -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; - -import org.eclipse.swt.graphics.Point; - -import org.eclipse.swt.layout.FillLayout; - -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; - -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; - -import org.eclipse.ui.dialogs.SaveAsDialog; - -import org.eclipse.ui.ide.IGotoMarker; - -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.MultiPageEditorPart; - -import org.eclipse.ui.views.contentoutline.ContentOutline; -import org.eclipse.ui.views.contentoutline.ContentOutlinePage; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; - -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.PropertySheet; -import org.eclipse.ui.views.properties.PropertySheetPage; - -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CommandStack; -import org.eclipse.emf.common.command.CommandStackListener; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.common.ui.MarkerHelper; -import org.eclipse.emf.common.ui.ViewerPane; - -import org.eclipse.emf.common.ui.editor.ProblemEditorPart; - -import org.eclipse.emf.common.ui.viewer.IViewerProvider; - -import org.eclipse.emf.common.util.BasicDiagnostic; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EValidator; - -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; - -import org.eclipse.emf.ecore.util.EContentAdapter; -import org.eclipse.emf.ecore.util.EcoreUtil; - -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.domain.IEditingDomainProvider; - -import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; - -import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; - -import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; - -import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; - -import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; -import org.eclipse.emf.edit.ui.dnd.LocalTransfer; -import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; - -import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; -import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; - -import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; -import org.eclipse.emf.edit.ui.util.EditUIUtil; - -import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; - -import edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.provider.ParameterdependenciesItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.core.provider.CoreItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.identifier.provider.IdentifierItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.functions.provider.FunctionsItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.presentation.ApplicationlevelEditorPlugin; - -import edu.kit.ipd.descartes.mm.applicationlevel.repository.provider.RepositoryItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.provider.ServicebehaviorItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.system.provider.SystemItemProviderAdapterFactory; - -import org.eclipse.ui.actions.WorkspaceModifyOperation; - - -/** - * This is an example of a Parameterdependencies model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class ParameterdependenciesEditor - extends MultiPageEditorPart - implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { - /** - * This keeps track of the editing domain that is used to track all changes to the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected AdapterFactoryEditingDomain editingDomain; - - /** - * This is the one adapter factory used for providing views of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ComposedAdapterFactory adapterFactory; - - /** - * This is the content outline page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IContentOutlinePage contentOutlinePage; - - /** - * This is a kludge... - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStatusLineManager contentOutlineStatusLineManager; - - /** - * This is the content outline page's viewer. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer contentOutlineViewer; - - /** - * This is the property sheet page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected PropertySheetPage propertySheetPage; - - /** - * This is the viewer that shadows the selection in the content outline. - * The parent relation must be correctly defined for this to work. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer selectionViewer; - - /** - * This inverts the roll of parent and child in the content provider and show parents as a tree. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer parentViewer; - - /** - * This shows how a tree view works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewer; - - /** - * This shows how a list view works. - * A list viewer doesn't support icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListViewer listViewer; - - /** - * This shows how a table view works. - * A table can be used as a list with icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TableViewer tableViewer; - - /** - * This shows how a tree view with columns works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewerWithColumns; - - /** - * This keeps track of the active viewer pane, in the book. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ViewerPane currentViewerPane; - - /** - * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Viewer currentViewer; - - /** - * This listens to which ever viewer is active. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ISelectionChangedListener selectionChangedListener; - - /** - * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>(); - - /** - * This keeps track of the selection of the editor as a whole. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ISelection editorSelection = StructuredSelection.EMPTY; - - /** - * The MarkerHelper is responsible for creating workspace resource markers presented - * in Eclipse's Problems View. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected MarkerHelper markerHelper = new EditUIMarkerHelper(); - - /** - * This listens for when the outline becomes active - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IPartListener partListener = - new IPartListener() { - public void partActivated(IWorkbenchPart p) { - if (p instanceof ContentOutline) { - if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { - getActionBarContributor().setActiveEditor(ParameterdependenciesEditor.this); - - setCurrentViewer(contentOutlineViewer); - } - } - else if (p instanceof PropertySheet) { - if (((PropertySheet)p).getCurrentPage() == propertySheetPage) { - getActionBarContributor().setActiveEditor(ParameterdependenciesEditor.this); - handleActivate(); - } - } - else if (p == ParameterdependenciesEditor.this) { - handleActivate(); - } - } - public void partBroughtToTop(IWorkbenchPart p) { - // Ignore. - } - public void partClosed(IWorkbenchPart p) { - // Ignore. - } - public void partDeactivated(IWorkbenchPart p) { - // Ignore. - } - public void partOpened(IWorkbenchPart p) { - // Ignore. - } - }; - - /** - * Resources that have been removed since last activation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<Resource> removedResources = new ArrayList<Resource>(); - - /** - * Resources that have been changed since last activation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<Resource> changedResources = new ArrayList<Resource>(); - - /** - * Resources that have been saved. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<Resource> savedResources = new ArrayList<Resource>(); - - /** - * Map to store the diagnostic associated with a resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>(); - - /** - * Controls whether the problem indication should be updated. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean updateProblemIndication = true; - - /** - * Adapter used to update the problem indication when resources are demanded loaded. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EContentAdapter problemIndicationAdapter = - new EContentAdapter() { - @Override - public void notifyChanged(Notification notification) { - if (notification.getNotifier() instanceof Resource) { - switch (notification.getFeatureID(Resource.class)) { - case Resource.RESOURCE__IS_LOADED: - case Resource.RESOURCE__ERRORS: - case Resource.RESOURCE__WARNINGS: { - Resource resource = (Resource)notification.getNotifier(); - Diagnostic diagnostic = analyzeResourceProblems(resource, null); - if (diagnostic.getSeverity() != Diagnostic.OK) { - resourceToDiagnosticMap.put(resource, diagnostic); - } - else { - resourceToDiagnosticMap.remove(resource); - } - - if (updateProblemIndication) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - updateProblemIndication(); - } - }); - } - break; - } - } - } - else { - super.notifyChanged(notification); - } - } - - @Override - protected void setTarget(Resource target) { - basicSetTarget(target); - } - - @Override - protected void unsetTarget(Resource target) { - basicUnsetTarget(target); - } - }; - - /** - * This listens for workspace changes. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IResourceChangeListener resourceChangeListener = - new IResourceChangeListener() { - public void resourceChanged(IResourceChangeEvent event) { - IResourceDelta delta = event.getDelta(); - try { - class ResourceDeltaVisitor implements IResourceDeltaVisitor { - protected ResourceSet resourceSet = editingDomain.getResourceSet(); - protected Collection<Resource> changedResources = new ArrayList<Resource>(); - protected Collection<Resource> removedResources = new ArrayList<Resource>(); - - public boolean visit(IResourceDelta delta) { - if (delta.getResource().getType() == IResource.FILE) { - if (delta.getKind() == IResourceDelta.REMOVED || - delta.getKind() == IResourceDelta.CHANGED && delta.getFlags() != IResourceDelta.MARKERS) { - Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false); - if (resource != null) { - if (delta.getKind() == IResourceDelta.REMOVED) { - removedResources.add(resource); - } - else if (!savedResources.remove(resource)) { - changedResources.add(resource); - } - } - } - } - - return true; - } - - public Collection<Resource> getChangedResources() { - return changedResources; - } - - public Collection<Resource> getRemovedResources() { - return removedResources; - } - } - - final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(); - delta.accept(visitor); - - if (!visitor.getRemovedResources().isEmpty()) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - removedResources.addAll(visitor.getRemovedResources()); - if (!isDirty()) { - getSite().getPage().closeEditor(ParameterdependenciesEditor.this, false); - } - } - }); - } - - if (!visitor.getChangedResources().isEmpty()) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - changedResources.addAll(visitor.getChangedResources()); - if (getSite().getPage().getActiveEditor() == ParameterdependenciesEditor.this) { - handleActivate(); - } - } - }); - } - } - catch (CoreException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - }; - - /** - * Handles activation of the editor or it's associated views. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void handleActivate() { - // Recompute the read only state. - // - if (editingDomain.getResourceToReadOnlyMap() != null) { - editingDomain.getResourceToReadOnlyMap().clear(); - - // Refresh any actions that may become enabled or disabled. - // - setSelection(getSelection()); - } - - if (!removedResources.isEmpty()) { - if (handleDirtyConflict()) { - getSite().getPage().closeEditor(ParameterdependenciesEditor.this, false); - } - else { - removedResources.clear(); - changedResources.clear(); - savedResources.clear(); - } - } - else if (!changedResources.isEmpty()) { - changedResources.removeAll(savedResources); - handleChangedResources(); - changedResources.clear(); - savedResources.clear(); - } - } - - /** - * Handles what to do with changed resources on activation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void handleChangedResources() { - if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) { - if (isDirty()) { - changedResources.addAll(editingDomain.getResourceSet().getResources()); - } - editingDomain.getCommandStack().flush(); - - updateProblemIndication = false; - for (Resource resource : changedResources) { - if (resource.isLoaded()) { - resource.unload(); - try { - resource.load(Collections.EMPTY_MAP); - } - catch (IOException exception) { - if (!resourceToDiagnosticMap.containsKey(resource)) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - } - } - } - - if (AdapterFactoryEditingDomain.isStale(editorSelection)) { - setSelection(StructuredSelection.EMPTY); - } - - updateProblemIndication = true; - updateProblemIndication(); - } - } - - /** - * Updates the problems indication with the information described in the specified diagnostic. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void updateProblemIndication() { - if (updateProblemIndication) { - BasicDiagnostic diagnostic = - new BasicDiagnostic - (Diagnostic.OK, - "edu.kit.ipd.descartes.mm.applicationlevel.editor", - 0, - null, - new Object [] { editingDomain.getResourceSet() }); - for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) { - if (childDiagnostic.getSeverity() != Diagnostic.OK) { - diagnostic.add(childDiagnostic); - } - } - - int lastEditorPage = getPageCount() - 1; - if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) { - ((ProblemEditorPart)getEditor(lastEditorPage)).setDiagnostic(diagnostic); - if (diagnostic.getSeverity() != Diagnostic.OK) { - setActivePage(lastEditorPage); - } - } - else if (diagnostic.getSeverity() != Diagnostic.OK) { - ProblemEditorPart problemEditorPart = new ProblemEditorPart(); - problemEditorPart.setDiagnostic(diagnostic); - problemEditorPart.setMarkerHelper(markerHelper); - try { - addPage(++lastEditorPage, problemEditorPart, getEditorInput()); - setPageText(lastEditorPage, problemEditorPart.getPartName()); - setActivePage(lastEditorPage); - showTabs(); - } - catch (PartInitException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - - if (markerHelper.hasMarkers(editingDomain.getResourceSet())) { - markerHelper.deleteMarkers(editingDomain.getResourceSet()); - if (diagnostic.getSeverity() != Diagnostic.OK) { - try { - markerHelper.createMarkers(diagnostic); - } - catch (CoreException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - } - } - } - - /** - * Shows a dialog that asks if conflicting changes should be discarded. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean handleDirtyConflict() { - return - MessageDialog.openQuestion - (getSite().getShell(), - getString("_UI_FileConflict_label"), - getString("_WARN_FileConflict")); - } - - /** - * This creates a model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ParameterdependenciesEditor() { - super(); - initializeEditingDomain(); - } - - /** - * This sets up the editing domain for the model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void initializeEditingDomain() { - // Create an adapter factory that yields item providers. - // - adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - - adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new FunctionsItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new ParameterdependenciesItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new RepositoryItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new ServicebehaviorItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new SystemItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new CoreItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new IdentifierItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); - - // Create the command stack that will notify this editor as commands are executed. - // - BasicCommandStack commandStack = new BasicCommandStack(); - - // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus. - // - commandStack.addCommandStackListener - (new CommandStackListener() { - public void commandStackChanged(final EventObject event) { - getContainer().getDisplay().asyncExec - (new Runnable() { - public void run() { - firePropertyChange(IEditorPart.PROP_DIRTY); - - // Try to select the affected objects. - // - Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand(); - if (mostRecentCommand != null) { - setSelectionToViewer(mostRecentCommand.getAffectedObjects()); - } - if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) { - propertySheetPage.refresh(); - } - } - }); - } - }); - - // Create the editing domain with a special command stack. - // - editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>()); - } - - /** - * This is here for the listener to be able to call it. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected void firePropertyChange(int action) { - super.firePropertyChange(action); - } - - /** - * This sets the selection into whichever viewer is active. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSelectionToViewer(Collection<?> collection) { - final Collection<?> theSelection = collection; - // Make sure it's okay. - // - if (theSelection != null && !theSelection.isEmpty()) { - Runnable runnable = - new Runnable() { - public void run() { - // Try to select the items in the current content viewer of the editor. - // - if (currentViewer != null) { - currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true); - } - } - }; - getSite().getShell().getDisplay().asyncExec(runnable); - } - } - - /** - * This returns the editing domain as required by the {@link IEditingDomainProvider} interface. - * This is important for implementing the static methods of {@link AdapterFactoryEditingDomain} - * and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EditingDomain getEditingDomain() { - return editingDomain; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object [] getElements(Object object) { - Object parent = super.getParent(object); - return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object [] getChildren(Object object) { - Object parent = super.getParent(object); - return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean hasChildren(Object object) { - Object parent = super.getParent(object); - return parent != null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object getParent(Object object) { - return null; - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewerPane(ViewerPane viewerPane) { - if (currentViewerPane != viewerPane) { - if (currentViewerPane != null) { - currentViewerPane.showFocus(false); - } - currentViewerPane = viewerPane; - } - setCurrentViewer(currentViewerPane.getViewer()); - } - - /** - * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, - * is the current one. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewer(Viewer viewer) { - // If it is changing... - // - if (currentViewer != viewer) { - if (selectionChangedListener == null) { - // Create the listener on demand. - // - selectionChangedListener = - new ISelectionChangedListener() { - // This just notifies those things that are affected by the section. - // - public void selectionChanged(SelectionChangedEvent selectionChangedEvent) { - setSelection(selectionChangedEvent.getSelection()); - } - }; - } - - // Stop listening to the old one. - // - if (currentViewer != null) { - currentViewer.removeSelectionChangedListener(selectionChangedListener); - } - - // Start listening to the new one. - // - if (viewer != null) { - viewer.addSelectionChangedListener(selectionChangedListener); - } - - // Remember it. - // - currentViewer = viewer; - - // Set the editors selection based on the current viewer's selection. - // - setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection()); - } - } - - /** - * This returns the viewer as required by the {@link IViewerProvider} interface. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Viewer getViewer() { - return currentViewer; - } - - /** - * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createContextMenuFor(StructuredViewer viewer) { - MenuManager contextMenu = new MenuManager("#PopUp"); - contextMenu.add(new Separator("additions")); - contextMenu.setRemoveAllWhenShown(true); - contextMenu.addMenuListener(this); - Menu menu= contextMenu.createContextMenu(viewer.getControl()); - viewer.getControl().setMenu(menu); - getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); - - int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; - Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() }; - viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); - viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); - } - - /** - * This is the method called to load a resource into the editing domain's resource set based on the editor's input. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createModel() { - URI resourceURI = EditUIUtil.getURI(getEditorInput()); - Exception exception = null; - Resource resource = null; - try { - // Load the resource through the editing domain. - // - resource = editingDomain.getResourceSet().getResource(resourceURI, true); - } - catch (Exception e) { - exception = e; - resource = editingDomain.getResourceSet().getResource(resourceURI, false); - } - - Diagnostic diagnostic = analyzeResourceProblems(resource, exception); - if (diagnostic.getSeverity() != Diagnostic.OK) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter); - } - - /** - * Returns a diagnostic describing the errors and warnings listed in the resource - * and the specified exception (if any). - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) { - if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) { - BasicDiagnostic basicDiagnostic = - new BasicDiagnostic - (Diagnostic.ERROR, - "edu.kit.ipd.descartes.mm.applicationlevel.editor", - 0, - getString("_UI_CreateModelError_message", resource.getURI()), - new Object [] { exception == null ? (Object)resource : exception }); - basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); - return basicDiagnostic; - } - else if (exception != null) { - return - new BasicDiagnostic - (Diagnostic.ERROR, - "edu.kit.ipd.descartes.mm.applicationlevel.editor", - 0, - getString("_UI_CreateModelError_message", resource.getURI()), - new Object[] { exception }); - } - else { - return Diagnostic.OK_INSTANCE; - } - } - - /** - * This is the method used by the framework to install your own controls. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void createPages() { - // Creates the model from the editor input - // - createModel(); - - // Only creates the other pages if there is something that can be edited - // - if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { - // Create a page for the selection tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), ParameterdependenciesEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - selectionViewer = (TreeViewer)viewerPane.getViewer(); - selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - - selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - selectionViewer.setInput(editingDomain.getResourceSet()); - selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - viewerPane.setTitle(editingDomain.getResourceSet()); - - new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - - createContextMenuFor(selectionViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_SelectionPage_label")); - } - - // Create a page for the parent tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), ParameterdependenciesEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - parentViewer = (TreeViewer)viewerPane.getViewer(); - parentViewer.setAutoExpandLevel(30); - parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); - parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(parentViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ParentPage_label")); - } - - // This is the page for the list viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), ParameterdependenciesEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new ListViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - listViewer = (ListViewer)viewerPane.getViewer(); - listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(listViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ListPage_label")); - } - - // This is the page for the tree viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), ParameterdependenciesEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - treeViewer = (TreeViewer)viewerPane.getViewer(); - treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); - - createContextMenuFor(treeViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreePage_label")); - } - - // This is the page for the table viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), ParameterdependenciesEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TableViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - tableViewer = (TableViewer)viewerPane.getViewer(); - - Table table = tableViewer.getTable(); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableColumn objectColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(3, 100, true)); - objectColumn.setText(getString("_UI_ObjectColumn_label")); - objectColumn.setResizable(true); - - TableColumn selfColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(2, 100, true)); - selfColumn.setText(getString("_UI_SelfColumn_label")); - selfColumn.setResizable(true); - - tableViewer.setColumnProperties(new String [] {"a", "b"}); - tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(tableViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TablePage_label")); - } - - // This is the page for the table tree viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), ParameterdependenciesEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); - - Tree tree = treeViewerWithColumns.getTree(); - tree.setLayoutData(new FillLayout()); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); - - TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); - objectColumn.setText(getString("_UI_ObjectColumn_label")); - objectColumn.setResizable(true); - objectColumn.setWidth(250); - - TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); - selfColumn.setText(getString("_UI_SelfColumn_label")); - selfColumn.setResizable(true); - selfColumn.setWidth(200); - - treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); - treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(treeViewerWithColumns); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); - } - - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - setActivePage(0); - } - }); - } - - // Ensures that this editor will only display the page's tab - // area if there are more than one page - // - getContainer().addControlListener - (new ControlAdapter() { - boolean guard = false; - @Override - public void controlResized(ControlEvent event) { - if (!guard) { - guard = true; - hideTabs(); - guard = false; - } - } - }); - - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - updateProblemIndication(); - } - }); - } - - /** - * If there is just one page in the multi-page editor part, - * this hides the single tab at the bottom. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void hideTabs() { - if (getPageCount() <= 1) { - setPageText(0, ""); - if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(1); - Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y + 6); - } - } - } - - /** - * If there is more than one page in the multi-page editor part, - * this shows the tabs at the bottom. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void showTabs() { - if (getPageCount() > 1) { - setPageText(0, getString("_UI_SelectionPage_label")); - if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); - Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y - 6); - } - } - } - - /** - * This is used to track the active viewer. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected void pageChange(int pageIndex) { - super.pageChange(pageIndex); - - if (contentOutlinePage != null) { - handleContentOutlineSelection(contentOutlinePage.getSelection()); - } - } - - /** - * This is how the framework determines which interfaces we implement. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("rawtypes") - @Override - public Object getAdapter(Class key) { - if (key.equals(IContentOutlinePage.class)) { - return showOutlineView() ? getContentOutlinePage() : null; - } - else if (key.equals(IPropertySheetPage.class)) { - return getPropertySheetPage(); - } - else if (key.equals(IGotoMarker.class)) { - return this; - } - else { - return super.getAdapter(key); - } - } - - /** - * This accesses a cached version of the content outliner. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IContentOutlinePage getContentOutlinePage() { - if (contentOutlinePage == null) { - // The content outline is just a tree. - // - class MyContentOutlinePage extends ContentOutlinePage { - @Override - public void createControl(Composite parent) { - super.createControl(parent); - contentOutlineViewer = getTreeViewer(); - contentOutlineViewer.addSelectionChangedListener(this); - - // Set up the tree viewer. - // - contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - contentOutlineViewer.setInput(editingDomain.getResourceSet()); - - // Make sure our popups work. - // - createContextMenuFor(contentOutlineViewer); - - if (!editingDomain.getResourceSet().getResources().isEmpty()) { - // Select the root object in the view. - // - contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - } - } - - @Override - public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) { - super.makeContributions(menuManager, toolBarManager, statusLineManager); - contentOutlineStatusLineManager = statusLineManager; - } - - @Override - public void setActionBars(IActionBars actionBars) { - super.setActionBars(actionBars); - getActionBarContributor().shareGlobalActions(this, actionBars); - } - } - - contentOutlinePage = new MyContentOutlinePage(); - - // Listen to selection so that we can handle it is a special way. - // - contentOutlinePage.addSelectionChangedListener - (new ISelectionChangedListener() { - // This ensures that we handle selections correctly. - // - public void selectionChanged(SelectionChangedEvent event) { - handleContentOutlineSelection(event.getSelection()); - } - }); - } - - return contentOutlinePage; - } - - /** - * This accesses a cached version of the property sheet. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IPropertySheetPage getPropertySheetPage() { - if (propertySheetPage == null) { - propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { - @Override - public void setSelectionToViewer(List<?> selection) { - ParameterdependenciesEditor.this.setSelectionToViewer(selection); - ParameterdependenciesEditor.this.setFocus(); - } - - @Override - public void setActionBars(IActionBars actionBars) { - super.setActionBars(actionBars); - getActionBarContributor().shareGlobalActions(this, actionBars); - } - }; - propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); - } - - return propertySheetPage; - } - - /** - * This deals with how we want selection in the outliner to affect the other views. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void handleContentOutlineSelection(ISelection selection) { - if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { - Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); - if (selectedElements.hasNext()) { - // Get the first selected element. - // - Object selectedElement = selectedElements.next(); - - // If it's the selection viewer, then we want it to select the same selection as this selection. - // - if (currentViewerPane.getViewer() == selectionViewer) { - ArrayList<Object> selectionList = new ArrayList<Object>(); - selectionList.add(selectedElement); - while (selectedElements.hasNext()) { - selectionList.add(selectedElements.next()); - } - - // Set the selection to the widget. - // - selectionViewer.setSelection(new StructuredSelection(selectionList)); - } - else { - // Set the input to the widget. - // - if (currentViewerPane.getViewer().getInput() != selectedElement) { - currentViewerPane.getViewer().setInput(selectedElement); - currentViewerPane.setTitle(selectedElement); - } - } - } - } - } - - /** - * This is for implementing {@link IEditorPart} and simply tests the command stack. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean isDirty() { - return ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded(); - } - - /** - * This is for implementing {@link IEditorPart} and simply saves the model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void doSave(IProgressMonitor progressMonitor) { - // Save only resources that have actually changed. - // - final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); - saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - - // Do the work within an operation because this is a long running activity that modifies the workbench. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - // This is the method that gets invoked when the operation runs. - // - @Override - public void execute(IProgressMonitor monitor) { - // Save the resources to the file system. - // - boolean first = true; - for (Resource resource : editingDomain.getResourceSet().getResources()) { - if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) { - try { - long timeStamp = resource.getTimeStamp(); - resource.save(saveOptions); - if (resource.getTimeStamp() != timeStamp) { - savedResources.add(resource); - } - } - catch (Exception exception) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - first = false; - } - } - } - }; - - updateProblemIndication = false; - try { - // This runs the options, and shows progress. - // - new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); - - // Refresh the necessary state. - // - ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone(); - firePropertyChange(IEditorPart.PROP_DIRTY); - } - catch (Exception exception) { - // Something went wrong that shouldn't. - // - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - updateProblemIndication = true; - updateProblemIndication(); - } - - /** - * This returns whether something has been persisted to the URI of the specified resource. - * The implementation uses the URI converter from the editor's resource set to try to open an input stream. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean isPersisted(Resource resource) { - boolean result = false; - try { - InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI()); - if (stream != null) { - result = true; - stream.close(); - } - } - catch (IOException e) { - // Ignore - } - return result; - } - - /** - * This always returns true because it is not currently supported. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean isSaveAsAllowed() { - return true; - } - - /** - * This also changes the editor's input. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void doSaveAs() { - SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell()); - saveAsDialog.open(); - IPath path = saveAsDialog.getResult(); - if (path != null) { - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); - if (file != null) { - doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file)); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void doSaveAs(URI uri, IEditorInput editorInput) { - (editingDomain.getResourceSet().getResources().get(0)).setURI(uri); - setInputWithNotify(editorInput); - setPartName(editorInput.getName()); - IProgressMonitor progressMonitor = - getActionBars().getStatusLineManager() != null ? - getActionBars().getStatusLineManager().getProgressMonitor() : - new NullProgressMonitor(); - doSave(progressMonitor); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void gotoMarker(IMarker marker) { - try { - if (marker.getType().equals(EValidator.MARKER)) { - String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null); - if (uriAttribute != null) { - URI uri = URI.createURI(uriAttribute); - EObject eObject = editingDomain.getResourceSet().getEObject(uri, true); - if (eObject != null) { - setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject))); - } - } - } - } - catch (CoreException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - - /** - * This is called during startup. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void init(IEditorSite site, IEditorInput editorInput) { - setSite(site); - setInputWithNotify(editorInput); - setPartName(editorInput.getName()); - site.setSelectionProvider(this); - site.getPage().addPartListener(partListener); - ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setFocus() { - if (currentViewerPane != null) { - currentViewerPane.setFocus(); - } - else { - getControl(getActivePage()).setFocus(); - } - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void addSelectionChangedListener(ISelectionChangedListener listener) { - selectionChangedListeners.add(listener); - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void removeSelectionChangedListener(ISelectionChangedListener listener) { - selectionChangedListeners.remove(listener); - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ISelection getSelection() { - return editorSelection; - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection. - * Calling this result will notify the listeners. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSelection(ISelection selection) { - editorSelection = selection; - - for (ISelectionChangedListener listener : selectionChangedListeners) { - listener.selectionChanged(new SelectionChangedEvent(this, selection)); - } - setStatusLineManager(selection); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setStatusLineManager(ISelection selection) { - IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? - contentOutlineStatusLineManager : getActionBars().getStatusLineManager(); - - if (statusLineManager != null) { - if (selection instanceof IStructuredSelection) { - Collection<?> collection = ((IStructuredSelection)selection).toList(); - switch (collection.size()) { - case 0: { - statusLineManager.setMessage(getString("_UI_NoObjectSelected")); - break; - } - case 1: { - String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next()); - statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text)); - break; - } - default: { - statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size()))); - break; - } - } - } - else { - statusLineManager.setMessage(""); - } - } - } - - /** - * This looks up a string in the plugin's plugin.properties file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static String getString(String key) { - return ApplicationlevelEditorPlugin.INSTANCE.getString(key); - } - - /** - * This looks up a string in plugin.properties, making a substitution. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static String getString(String key, Object s1) { - return ApplicationlevelEditorPlugin.INSTANCE.getString(key, new Object [] { s1 }); - } - - /** - * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void menuAboutToShow(IMenuManager menuManager) { - ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EditingDomainActionBarContributor getActionBarContributor() { - return (EditingDomainActionBarContributor)getEditorSite().getActionBarContributor(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IActionBars getActionBars() { - return getActionBarContributor().getActionBars(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public AdapterFactory getAdapterFactory() { - return adapterFactory; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void dispose() { - updateProblemIndication = false; - - ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener); - - getSite().getPage().removePartListener(partListener); - - adapterFactory.dispose(); - - if (getActionBarContributor().getActiveEditor() == this) { - getActionBarContributor().setActiveEditor(null); - } - - if (propertySheetPage != null) { - propertySheetPage.dispose(); - } - - if (contentOutlinePage != null) { - contentOutlinePage.dispose(); - } - - super.dispose(); - } - - /** - * Returns whether the outline view should be presented to the user. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean showOutlineView() { - return true; - } -} diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/parameterdependencies/presentation/ParameterdependenciesModelWizard.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/parameterdependencies/presentation/ParameterdependenciesModelWizard.java deleted file mode 100644 index 67a5ec0a..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/parameterdependencies/presentation/ParameterdependenciesModelWizard.java +++ /dev/null @@ -1,630 +0,0 @@ -/** - * Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - */ -package edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.presentation; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.StringTokenizer; - -import org.eclipse.emf.common.CommonPlugin; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; - -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.EObject; - -import org.eclipse.emf.ecore.xmi.XMLResource; - -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; - -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.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; - -import org.eclipse.core.runtime.IProgressMonitor; - -import org.eclipse.jface.dialogs.MessageDialog; - -import org.eclipse.jface.viewers.IStructuredSelection; - -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; - -import org.eclipse.swt.SWT; - -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.ModifyEvent; - -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; - -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; - -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; - -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - -import edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.ParameterdependenciesFactory; -import edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.ParameterdependenciesPackage; -import edu.kit.ipd.descartes.mm.applicationlevel.provider.ApplicationlevelEditPlugin; - - -import edu.kit.ipd.descartes.mm.applicationlevel.presentation.ApplicationlevelEditorPlugin; - -import org.eclipse.core.runtime.Path; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; - -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; - - -/** - * This is a simple wizard for creating a new model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class ParameterdependenciesModelWizard extends Wizard implements INewWizard { - /** - * The supported extensions for created files. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<String> FILE_EXTENSIONS = - Collections.unmodifiableList(Arrays.asList(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ParameterdependenciesEditorFilenameExtensions").split("\\s*,\\s*"))); - - /** - * A formatted list of supported file extensions, suitable for display. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String FORMATTED_FILE_EXTENSIONS = - ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ParameterdependenciesEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); - - /** - * This caches an instance of the model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ParameterdependenciesPackage parameterdependenciesPackage = ParameterdependenciesPackage.eINSTANCE; - - /** - * This caches an instance of the model factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ParameterdependenciesFactory parameterdependenciesFactory = parameterdependenciesPackage.getParameterdependenciesFactory(); - - /** - * This is the file creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ParameterdependenciesModelWizardNewFileCreationPage newFileCreationPage; - - /** - * This is the initial object creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ParameterdependenciesModelWizardInitialObjectCreationPage initialObjectCreationPage; - - /** - * Remember the selection during initialization for populating the default container. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStructuredSelection selection; - - /** - * Remember the workbench during initialization. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IWorkbench workbench; - - /** - * Caches the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected List<String> initialObjectNames; - - /** - * This just records the information. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); - setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(ApplicationlevelEditorPlugin.INSTANCE.getImage("full/wizban/NewParameterdependencies"))); - } - - /** - * Returns the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getInitialObjectNames() { - if (initialObjectNames == null) { - initialObjectNames = new ArrayList<String>(); - for (EClassifier eClassifier : parameterdependenciesPackage.getEClassifiers()) { - if (eClassifier instanceof EClass) { - EClass eClass = (EClass)eClassifier; - if (!eClass.isAbstract()) { - initialObjectNames.add(eClass.getName()); - } - } - } - Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); - } - return initialObjectNames; - } - - /** - * Create a new model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObject createInitialModel() { - EClass eClass = (EClass)parameterdependenciesPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); - EObject rootObject = parameterdependenciesFactory.create(eClass); - return rootObject; - } - - /** - * Do the work after everything is specified. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @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<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); - resource.save(options); - } - catch (Exception exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(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(), ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); - return false; - } - - return true; - } - catch (Exception exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - return false; - } - } - - /** - * This is the one page of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class ParameterdependenciesModelWizardNewFileCreationPage extends WizardNewFileCreationPage { - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ParameterdependenciesModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { - super(pageId, selection); - } - - /** - * The framework calls this to see if the file is correct. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean validatePage() { - if (super.validatePage()) { - String extension = new Path(getFileName()).getFileExtension(); - if (extension == null || !FILE_EXTENSIONS.contains(extension)) { - String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; - setErrorMessage(ApplicationlevelEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); - return false; - } - return true; - } - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); - } - } - - /** - * This is the page where the type of object to create is selected. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class ParameterdependenciesModelWizardInitialObjectCreationPage extends WizardPage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo initialObjectField; - - /** - * @generated - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - */ - protected List<String> encodings; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo encodingField; - - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ParameterdependenciesModelWizardInitialObjectCreationPage(String pageId) { - super(pageId); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 12; - composite.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - } - - Label containerLabel = new Label(composite, SWT.LEFT); - { - containerLabel.setText(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ModelObject")); - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - containerLabel.setLayoutData(data); - } - - initialObjectField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - initialObjectField.setLayoutData(data); - } - - for (String objectName : getInitialObjectNames()) { - initialObjectField.add(getLabel(objectName)); - } - - if (initialObjectField.getItemCount() == 1) { - initialObjectField.select(0); - } - initialObjectField.addModifyListener(validator); - - Label encodingLabel = new Label(composite, SWT.LEFT); - { - encodingLabel.setText(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - encodingLabel.setLayoutData(data); - } - encodingField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - encodingField.setLayoutData(data); - } - - for (String encoding : getEncodings()) { - encodingField.add(encoding); - } - - encodingField.select(0); - encodingField.addModifyListener(validator); - - setPageComplete(validatePage()); - setControl(composite); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModifyListener validator = - new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(validatePage()); - } - }; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean validatePage() { - return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - if (initialObjectField.getItemCount() == 1) { - initialObjectField.clearSelection(); - encodingField.setFocus(); - } - else { - encodingField.clearSelection(); - initialObjectField.setFocus(); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getInitialObjectName() { - String label = initialObjectField.getText(); - - for (String name : getInitialObjectNames()) { - if (getLabel(name).equals(label)) { - return name; - } - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getEncoding() { - return encodingField.getText(); - } - - /** - * Returns the label for the specified type name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected String getLabel(String typeName) { - try { - return ApplicationlevelEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); - } - catch(MissingResourceException mre) { - ApplicationlevelEditorPlugin.INSTANCE.log(mre); - } - return typeName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getEncodings() { - if (encodings == null) { - encodings = new ArrayList<String>(); - for (StringTokenizer stringTokenizer = new StringTokenizer(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) { - encodings.add(stringTokenizer.nextToken()); - } - } - return encodings; - } - } - - /** - * The framework calls this to create the contents of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void addPages() { - // Create a page, set the title, and the initial model file name. - // - newFileCreationPage = new ParameterdependenciesModelWizardNewFileCreationPage("Whatever", selection); - newFileCreationPage.setTitle(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ParameterdependenciesModelWizard_label")); - newFileCreationPage.setDescription(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ParameterdependenciesModelWizard_description")); - newFileCreationPage.setFileName(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ParameterdependenciesEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); - addPage(newFileCreationPage); - - // Try and get the resource selection to determine a current directory for the file dialog. - // - if (selection != null && !selection.isEmpty()) { - // Get the resource... - // - Object selectedElement = selection.iterator().next(); - if (selectedElement instanceof IResource) { - // Get the resource parent, if its a file. - // - IResource selectedResource = (IResource)selectedElement; - if (selectedResource.getType() == IResource.FILE) { - selectedResource = selectedResource.getParent(); - } - - // This gives us a directory... - // - if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { - // Set this for the container. - // - newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); - - // Make up a unique new name here. - // - String defaultModelBaseFilename = ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ParameterdependenciesEditorFilenameDefaultBase"); - String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); - String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; - for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { - modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; - } - newFileCreationPage.setFileName(modelFilename); - } - } - } - initialObjectCreationPage = new ParameterdependenciesModelWizardInitialObjectCreationPage("Whatever2"); - initialObjectCreationPage.setTitle(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ParameterdependenciesModelWizard_label")); - initialObjectCreationPage.setDescription(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); - addPage(initialObjectCreationPage); - } - - /** - * Get the file from the page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return newFileCreationPage.getModelFile(); - } - -} diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/presentation/ApplicationlevelEditorPlugin.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/presentation/ApplicationlevelEditorPlugin.java deleted file mode 100644 index 598b4fe3..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/presentation/ApplicationlevelEditorPlugin.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - */ -package edu.kit.ipd.descartes.mm.applicationlevel.presentation; - -import edu.kit.ipd.descartes.core.provider.CoreEditPlugin; - -import edu.kit.ipd.descartes.identifier.provider.IdentifierEditPlugin; - -import org.eclipse.emf.common.EMFPlugin; - -import org.eclipse.emf.common.ui.EclipseUIPlugin; - -import org.eclipse.emf.common.util.ResourceLocator; - -/** - * This is the central singleton for the Applicationlevel editor plugin. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public final class ApplicationlevelEditorPlugin extends EMFPlugin { - /** - * Keep track of the singleton. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final ApplicationlevelEditorPlugin INSTANCE = new ApplicationlevelEditorPlugin(); - - /** - * Keep track of the singleton. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static Implementation plugin; - - /** - * Create the instance. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ApplicationlevelEditorPlugin() { - super - (new ResourceLocator [] { - CoreEditPlugin.INSTANCE, - IdentifierEditPlugin.INSTANCE, - }); - } - - /** - * Returns the singleton instance of the Eclipse plugin. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the singleton instance. - * @generated - */ - @Override - public ResourceLocator getPluginResourceLocator() { - return plugin; - } - - /** - * Returns the singleton instance of the Eclipse plugin. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the singleton instance. - * @generated - */ - public static Implementation getPlugin() { - return plugin; - } - - /** - * The actual implementation of the Eclipse <b>Plugin</b>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static class Implementation extends EclipseUIPlugin { - /** - * Creates an instance. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Implementation() { - super(); - - // Remember the static instance. - // - plugin = this; - } - } - -} diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/repository/presentation/RepositoryActionBarContributor.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/repository/presentation/RepositoryActionBarContributor.java deleted file mode 100644 index da4a6374..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/repository/presentation/RepositoryActionBarContributor.java +++ /dev/null @@ -1,426 +0,0 @@ -/** - * Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - */ -package edu.kit.ipd.descartes.mm.applicationlevel.repository.presentation; - -import edu.kit.ipd.descartes.mm.applicationlevel.presentation.ApplicationlevelEditorPlugin; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.emf.common.ui.viewer.IViewerProvider; - -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.domain.IEditingDomainProvider; - -import org.eclipse.emf.edit.ui.action.ControlAction; -import org.eclipse.emf.edit.ui.action.CreateChildAction; -import org.eclipse.emf.edit.ui.action.CreateSiblingAction; -import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; -import org.eclipse.emf.edit.ui.action.LoadResourceAction; -import org.eclipse.emf.edit.ui.action.ValidateAction; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IContributionItem; -import org.eclipse.jface.action.IContributionManager; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.action.SubContributionItem; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.Viewer; - -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.PartInitException; - -/** - * This is the action bar contributor for the Repository model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class RepositoryActionBarContributor - extends EditingDomainActionBarContributor - implements ISelectionChangedListener { - /** - * This keeps track of the active editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IEditorPart activeEditorPart; - - /** - * This keeps track of the current selection provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ISelectionProvider selectionProvider; - - /** - * This action opens the Properties view. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IAction showPropertiesViewAction = - new Action(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) { - @Override - public void run() { - try { - getPage().showView("org.eclipse.ui.views.PropertySheet"); - } - catch (PartInitException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - }; - - /** - * This action refreshes the viewer of the current editor if the editor - * implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IAction refreshViewerAction = - new Action(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) { - @Override - public boolean isEnabled() { - return activeEditorPart instanceof IViewerProvider; - } - - @Override - public void run() { - if (activeEditorPart instanceof IViewerProvider) { - Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer(); - if (viewer != null) { - viewer.refresh(); - } - } - } - }; - - /** - * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor - * generated for the current selection by the item provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> createChildActions; - - /** - * This is the menu manager into which menu contribution items should be added for CreateChild actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IMenuManager createChildMenuManager; - - /** - * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor - * generated for the current selection by the item provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> createSiblingActions; - - /** - * This is the menu manager into which menu contribution items should be added for CreateSibling actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IMenuManager createSiblingMenuManager; - - /** - * This creates an instance of the contributor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public RepositoryActionBarContributor() { - super(ADDITIONS_LAST_STYLE); - loadResourceAction = new LoadResourceAction(); - validateAction = new ValidateAction(); - controlAction = new ControlAction(); - } - - /** - * This adds Separators for editor additions to the tool bar. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void contributeToToolBar(IToolBarManager toolBarManager) { - toolBarManager.add(new Separator("repository-settings")); - toolBarManager.add(new Separator("repository-additions")); - } - - /** - * This adds to the menu bar a menu and some separators for editor additions, - * as well as the sub-menus for object creation items. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void contributeToMenu(IMenuManager menuManager) { - super.contributeToMenu(menuManager); - - IMenuManager submenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_RepositoryEditor_menu"), "edu.kit.ipd.descartes.mm.applicationlevel.repositoryMenuID"); - menuManager.insertAfter("additions", submenuManager); - submenuManager.add(new Separator("settings")); - submenuManager.add(new Separator("actions")); - submenuManager.add(new Separator("additions")); - submenuManager.add(new Separator("additions-end")); - - // Prepare for CreateChild item addition or removal. - // - createChildMenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); - submenuManager.insertBefore("additions", createChildMenuManager); - - // Prepare for CreateSibling item addition or removal. - // - createSiblingMenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); - submenuManager.insertBefore("additions", createSiblingMenuManager); - - // Force an update because Eclipse hides empty menus now. - // - submenuManager.addMenuListener - (new IMenuListener() { - public void menuAboutToShow(IMenuManager menuManager) { - menuManager.updateAll(true); - } - }); - - addGlobalActions(submenuManager); - } - - /** - * When the active editor changes, this remembers the change and registers with it as a selection provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setActiveEditor(IEditorPart part) { - super.setActiveEditor(part); - activeEditorPart = part; - - // Switch to the new selection provider. - // - if (selectionProvider != null) { - selectionProvider.removeSelectionChangedListener(this); - } - if (part == null) { - selectionProvider = null; - } - else { - selectionProvider = part.getSite().getSelectionProvider(); - selectionProvider.addSelectionChangedListener(this); - - // Fake a selection changed event to update the menus. - // - if (selectionProvider.getSelection() != null) { - selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection())); - } - } - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, - * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings - * that can be added to the selected object and updating the menus accordingly. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void selectionChanged(SelectionChangedEvent event) { - // Remove any menu items for old selection. - // - if (createChildMenuManager != null) { - depopulateManager(createChildMenuManager, createChildActions); - } - if (createSiblingMenuManager != null) { - depopulateManager(createSiblingMenuManager, createSiblingActions); - } - - // Query the new selection for appropriate new child/sibling descriptors - // - Collection<?> newChildDescriptors = null; - Collection<?> newSiblingDescriptors = null; - - ISelection selection = event.getSelection(); - if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) { - Object object = ((IStructuredSelection)selection).getFirstElement(); - - EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain(); - - newChildDescriptors = domain.getNewChildDescriptors(object, null); - newSiblingDescriptors = domain.getNewChildDescriptors(null, object); - } - - // Generate actions for selection; populate and redraw the menus. - // - createChildActions = generateCreateChildActions(newChildDescriptors, selection); - createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); - - if (createChildMenuManager != null) { - populateManager(createChildMenuManager, createChildActions, null); - createChildMenuManager.update(true); - } - if (createSiblingMenuManager != null) { - populateManager(createSiblingMenuManager, createSiblingActions, null); - createSiblingMenuManager.update(true); - } - } - - /** - * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in <code>descriptors</code>, - * and returns the collection of these actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) { - Collection<IAction> actions = new ArrayList<IAction>(); - if (descriptors != null) { - for (Object descriptor : descriptors) { - actions.add(new CreateChildAction(activeEditorPart, selection, descriptor)); - } - } - return actions; - } - - /** - * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in <code>descriptors</code>, - * and returns the collection of these actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection) { - Collection<IAction> actions = new ArrayList<IAction>(); - if (descriptors != null) { - for (Object descriptor : descriptors) { - actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor)); - } - } - return actions; - } - - /** - * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s - * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection, - * by inserting them before the specified contribution item <code>contributionID</code>. - * If <code>contributionID</code> is <code>null</code>, they are simply added. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) { - if (actions != null) { - for (IAction action : actions) { - if (contributionID != null) { - manager.insertBefore(contributionID, action); - } - else { - manager.add(action); - } - } - } - } - - /** - * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s - * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) { - if (actions != null) { - IContributionItem[] items = manager.getItems(); - for (int i = 0; i < items.length; i++) { - // Look into SubContributionItems - // - IContributionItem contributionItem = items[i]; - while (contributionItem instanceof SubContributionItem) { - contributionItem = ((SubContributionItem)contributionItem).getInnerItem(); - } - - // Delete the ActionContributionItems with matching action. - // - if (contributionItem instanceof ActionContributionItem) { - IAction action = ((ActionContributionItem)contributionItem).getAction(); - if (actions.contains(action)) { - manager.remove(contributionItem); - } - } - } - } - } - - /** - * This populates the pop-up menu before it appears. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void menuAboutToShow(IMenuManager menuManager) { - super.menuAboutToShow(menuManager); - MenuManager submenuManager = null; - - submenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); - populateManager(submenuManager, createChildActions, null); - menuManager.insertBefore("edit", submenuManager); - - submenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); - populateManager(submenuManager, createSiblingActions, null); - menuManager.insertBefore("edit", submenuManager); - } - - /** - * This inserts global actions before the "additions-end" separator. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected void addGlobalActions(IMenuManager menuManager) { - menuManager.insertAfter("additions-end", new Separator("ui-actions")); - menuManager.insertAfter("ui-actions", showPropertiesViewAction); - - refreshViewerAction.setEnabled(refreshViewerAction.isEnabled()); - menuManager.insertAfter("ui-actions", refreshViewerAction); - - super.addGlobalActions(menuManager); - } - - /** - * This ensures that a delete action will clean up all references to deleted objects. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean removeAllReferencesOnDelete() { - return true; - } - -} diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/repository/presentation/RepositoryEditor.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/repository/presentation/RepositoryEditor.java deleted file mode 100644 index d17aa093..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/repository/presentation/RepositoryEditor.java +++ /dev/null @@ -1,1833 +0,0 @@ -/** - * Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - */ -package edu.kit.ipd.descartes.mm.applicationlevel.repository.presentation; - - -import java.io.IOException; -import java.io.InputStream; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.EventObject; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -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.ResourcesPlugin; - -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.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; - -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; - -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; - -import org.eclipse.swt.SWT; - -import org.eclipse.swt.custom.CTabFolder; - -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.Transfer; - -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; - -import org.eclipse.swt.graphics.Point; - -import org.eclipse.swt.layout.FillLayout; - -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; - -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; - -import org.eclipse.ui.dialogs.SaveAsDialog; - -import org.eclipse.ui.ide.IGotoMarker; - -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.MultiPageEditorPart; - -import org.eclipse.ui.views.contentoutline.ContentOutline; -import org.eclipse.ui.views.contentoutline.ContentOutlinePage; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; - -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.PropertySheet; -import org.eclipse.ui.views.properties.PropertySheetPage; - -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CommandStack; -import org.eclipse.emf.common.command.CommandStackListener; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.common.ui.MarkerHelper; -import org.eclipse.emf.common.ui.ViewerPane; - -import org.eclipse.emf.common.ui.editor.ProblemEditorPart; - -import org.eclipse.emf.common.ui.viewer.IViewerProvider; - -import org.eclipse.emf.common.util.BasicDiagnostic; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EValidator; - -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; - -import org.eclipse.emf.ecore.util.EContentAdapter; -import org.eclipse.emf.ecore.util.EcoreUtil; - -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.domain.IEditingDomainProvider; - -import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; - -import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; - -import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; - -import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; - -import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; -import org.eclipse.emf.edit.ui.dnd.LocalTransfer; -import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; - -import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; -import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; - -import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; -import org.eclipse.emf.edit.ui.util.EditUIUtil; - -import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; - -import edu.kit.ipd.descartes.mm.applicationlevel.repository.provider.RepositoryItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.core.provider.CoreItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.identifier.provider.IdentifierItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.functions.provider.FunctionsItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.provider.ParameterdependenciesItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.presentation.ApplicationlevelEditorPlugin; - -import edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.provider.ServicebehaviorItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.system.provider.SystemItemProviderAdapterFactory; - -import org.eclipse.ui.actions.WorkspaceModifyOperation; - - -/** - * This is an example of a Repository model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class RepositoryEditor - extends MultiPageEditorPart - implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { - /** - * This keeps track of the editing domain that is used to track all changes to the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected AdapterFactoryEditingDomain editingDomain; - - /** - * This is the one adapter factory used for providing views of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ComposedAdapterFactory adapterFactory; - - /** - * This is the content outline page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IContentOutlinePage contentOutlinePage; - - /** - * This is a kludge... - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStatusLineManager contentOutlineStatusLineManager; - - /** - * This is the content outline page's viewer. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer contentOutlineViewer; - - /** - * This is the property sheet page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected PropertySheetPage propertySheetPage; - - /** - * This is the viewer that shadows the selection in the content outline. - * The parent relation must be correctly defined for this to work. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer selectionViewer; - - /** - * This inverts the roll of parent and child in the content provider and show parents as a tree. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer parentViewer; - - /** - * This shows how a tree view works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewer; - - /** - * This shows how a list view works. - * A list viewer doesn't support icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListViewer listViewer; - - /** - * This shows how a table view works. - * A table can be used as a list with icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TableViewer tableViewer; - - /** - * This shows how a tree view with columns works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewerWithColumns; - - /** - * This keeps track of the active viewer pane, in the book. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ViewerPane currentViewerPane; - - /** - * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Viewer currentViewer; - - /** - * This listens to which ever viewer is active. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ISelectionChangedListener selectionChangedListener; - - /** - * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>(); - - /** - * This keeps track of the selection of the editor as a whole. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ISelection editorSelection = StructuredSelection.EMPTY; - - /** - * The MarkerHelper is responsible for creating workspace resource markers presented - * in Eclipse's Problems View. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected MarkerHelper markerHelper = new EditUIMarkerHelper(); - - /** - * This listens for when the outline becomes active - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IPartListener partListener = - new IPartListener() { - public void partActivated(IWorkbenchPart p) { - if (p instanceof ContentOutline) { - if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { - getActionBarContributor().setActiveEditor(RepositoryEditor.this); - - setCurrentViewer(contentOutlineViewer); - } - } - else if (p instanceof PropertySheet) { - if (((PropertySheet)p).getCurrentPage() == propertySheetPage) { - getActionBarContributor().setActiveEditor(RepositoryEditor.this); - handleActivate(); - } - } - else if (p == RepositoryEditor.this) { - handleActivate(); - } - } - public void partBroughtToTop(IWorkbenchPart p) { - // Ignore. - } - public void partClosed(IWorkbenchPart p) { - // Ignore. - } - public void partDeactivated(IWorkbenchPart p) { - // Ignore. - } - public void partOpened(IWorkbenchPart p) { - // Ignore. - } - }; - - /** - * Resources that have been removed since last activation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<Resource> removedResources = new ArrayList<Resource>(); - - /** - * Resources that have been changed since last activation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<Resource> changedResources = new ArrayList<Resource>(); - - /** - * Resources that have been saved. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<Resource> savedResources = new ArrayList<Resource>(); - - /** - * Map to store the diagnostic associated with a resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>(); - - /** - * Controls whether the problem indication should be updated. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean updateProblemIndication = true; - - /** - * Adapter used to update the problem indication when resources are demanded loaded. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EContentAdapter problemIndicationAdapter = - new EContentAdapter() { - @Override - public void notifyChanged(Notification notification) { - if (notification.getNotifier() instanceof Resource) { - switch (notification.getFeatureID(Resource.class)) { - case Resource.RESOURCE__IS_LOADED: - case Resource.RESOURCE__ERRORS: - case Resource.RESOURCE__WARNINGS: { - Resource resource = (Resource)notification.getNotifier(); - Diagnostic diagnostic = analyzeResourceProblems(resource, null); - if (diagnostic.getSeverity() != Diagnostic.OK) { - resourceToDiagnosticMap.put(resource, diagnostic); - } - else { - resourceToDiagnosticMap.remove(resource); - } - - if (updateProblemIndication) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - updateProblemIndication(); - } - }); - } - break; - } - } - } - else { - super.notifyChanged(notification); - } - } - - @Override - protected void setTarget(Resource target) { - basicSetTarget(target); - } - - @Override - protected void unsetTarget(Resource target) { - basicUnsetTarget(target); - } - }; - - /** - * This listens for workspace changes. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IResourceChangeListener resourceChangeListener = - new IResourceChangeListener() { - public void resourceChanged(IResourceChangeEvent event) { - IResourceDelta delta = event.getDelta(); - try { - class ResourceDeltaVisitor implements IResourceDeltaVisitor { - protected ResourceSet resourceSet = editingDomain.getResourceSet(); - protected Collection<Resource> changedResources = new ArrayList<Resource>(); - protected Collection<Resource> removedResources = new ArrayList<Resource>(); - - public boolean visit(IResourceDelta delta) { - if (delta.getResource().getType() == IResource.FILE) { - if (delta.getKind() == IResourceDelta.REMOVED || - delta.getKind() == IResourceDelta.CHANGED && delta.getFlags() != IResourceDelta.MARKERS) { - Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false); - if (resource != null) { - if (delta.getKind() == IResourceDelta.REMOVED) { - removedResources.add(resource); - } - else if (!savedResources.remove(resource)) { - changedResources.add(resource); - } - } - } - } - - return true; - } - - public Collection<Resource> getChangedResources() { - return changedResources; - } - - public Collection<Resource> getRemovedResources() { - return removedResources; - } - } - - final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(); - delta.accept(visitor); - - if (!visitor.getRemovedResources().isEmpty()) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - removedResources.addAll(visitor.getRemovedResources()); - if (!isDirty()) { - getSite().getPage().closeEditor(RepositoryEditor.this, false); - } - } - }); - } - - if (!visitor.getChangedResources().isEmpty()) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - changedResources.addAll(visitor.getChangedResources()); - if (getSite().getPage().getActiveEditor() == RepositoryEditor.this) { - handleActivate(); - } - } - }); - } - } - catch (CoreException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - }; - - /** - * Handles activation of the editor or it's associated views. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void handleActivate() { - // Recompute the read only state. - // - if (editingDomain.getResourceToReadOnlyMap() != null) { - editingDomain.getResourceToReadOnlyMap().clear(); - - // Refresh any actions that may become enabled or disabled. - // - setSelection(getSelection()); - } - - if (!removedResources.isEmpty()) { - if (handleDirtyConflict()) { - getSite().getPage().closeEditor(RepositoryEditor.this, false); - } - else { - removedResources.clear(); - changedResources.clear(); - savedResources.clear(); - } - } - else if (!changedResources.isEmpty()) { - changedResources.removeAll(savedResources); - handleChangedResources(); - changedResources.clear(); - savedResources.clear(); - } - } - - /** - * Handles what to do with changed resources on activation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void handleChangedResources() { - if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) { - if (isDirty()) { - changedResources.addAll(editingDomain.getResourceSet().getResources()); - } - editingDomain.getCommandStack().flush(); - - updateProblemIndication = false; - for (Resource resource : changedResources) { - if (resource.isLoaded()) { - resource.unload(); - try { - resource.load(Collections.EMPTY_MAP); - } - catch (IOException exception) { - if (!resourceToDiagnosticMap.containsKey(resource)) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - } - } - } - - if (AdapterFactoryEditingDomain.isStale(editorSelection)) { - setSelection(StructuredSelection.EMPTY); - } - - updateProblemIndication = true; - updateProblemIndication(); - } - } - - /** - * Updates the problems indication with the information described in the specified diagnostic. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void updateProblemIndication() { - if (updateProblemIndication) { - BasicDiagnostic diagnostic = - new BasicDiagnostic - (Diagnostic.OK, - "edu.kit.ipd.descartes.mm.applicationlevel.editor", - 0, - null, - new Object [] { editingDomain.getResourceSet() }); - for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) { - if (childDiagnostic.getSeverity() != Diagnostic.OK) { - diagnostic.add(childDiagnostic); - } - } - - int lastEditorPage = getPageCount() - 1; - if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) { - ((ProblemEditorPart)getEditor(lastEditorPage)).setDiagnostic(diagnostic); - if (diagnostic.getSeverity() != Diagnostic.OK) { - setActivePage(lastEditorPage); - } - } - else if (diagnostic.getSeverity() != Diagnostic.OK) { - ProblemEditorPart problemEditorPart = new ProblemEditorPart(); - problemEditorPart.setDiagnostic(diagnostic); - problemEditorPart.setMarkerHelper(markerHelper); - try { - addPage(++lastEditorPage, problemEditorPart, getEditorInput()); - setPageText(lastEditorPage, problemEditorPart.getPartName()); - setActivePage(lastEditorPage); - showTabs(); - } - catch (PartInitException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - - if (markerHelper.hasMarkers(editingDomain.getResourceSet())) { - markerHelper.deleteMarkers(editingDomain.getResourceSet()); - if (diagnostic.getSeverity() != Diagnostic.OK) { - try { - markerHelper.createMarkers(diagnostic); - } - catch (CoreException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - } - } - } - - /** - * Shows a dialog that asks if conflicting changes should be discarded. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean handleDirtyConflict() { - return - MessageDialog.openQuestion - (getSite().getShell(), - getString("_UI_FileConflict_label"), - getString("_WARN_FileConflict")); - } - - /** - * This creates a model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public RepositoryEditor() { - super(); - initializeEditingDomain(); - } - - /** - * This sets up the editing domain for the model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void initializeEditingDomain() { - // Create an adapter factory that yields item providers. - // - adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - - adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new FunctionsItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new ParameterdependenciesItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new RepositoryItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new ServicebehaviorItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new SystemItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new CoreItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new IdentifierItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); - - // Create the command stack that will notify this editor as commands are executed. - // - BasicCommandStack commandStack = new BasicCommandStack(); - - // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus. - // - commandStack.addCommandStackListener - (new CommandStackListener() { - public void commandStackChanged(final EventObject event) { - getContainer().getDisplay().asyncExec - (new Runnable() { - public void run() { - firePropertyChange(IEditorPart.PROP_DIRTY); - - // Try to select the affected objects. - // - Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand(); - if (mostRecentCommand != null) { - setSelectionToViewer(mostRecentCommand.getAffectedObjects()); - } - if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) { - propertySheetPage.refresh(); - } - } - }); - } - }); - - // Create the editing domain with a special command stack. - // - editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>()); - } - - /** - * This is here for the listener to be able to call it. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected void firePropertyChange(int action) { - super.firePropertyChange(action); - } - - /** - * This sets the selection into whichever viewer is active. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSelectionToViewer(Collection<?> collection) { - final Collection<?> theSelection = collection; - // Make sure it's okay. - // - if (theSelection != null && !theSelection.isEmpty()) { - Runnable runnable = - new Runnable() { - public void run() { - // Try to select the items in the current content viewer of the editor. - // - if (currentViewer != null) { - currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true); - } - } - }; - getSite().getShell().getDisplay().asyncExec(runnable); - } - } - - /** - * This returns the editing domain as required by the {@link IEditingDomainProvider} interface. - * This is important for implementing the static methods of {@link AdapterFactoryEditingDomain} - * and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EditingDomain getEditingDomain() { - return editingDomain; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object [] getElements(Object object) { - Object parent = super.getParent(object); - return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object [] getChildren(Object object) { - Object parent = super.getParent(object); - return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean hasChildren(Object object) { - Object parent = super.getParent(object); - return parent != null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object getParent(Object object) { - return null; - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewerPane(ViewerPane viewerPane) { - if (currentViewerPane != viewerPane) { - if (currentViewerPane != null) { - currentViewerPane.showFocus(false); - } - currentViewerPane = viewerPane; - } - setCurrentViewer(currentViewerPane.getViewer()); - } - - /** - * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, - * is the current one. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewer(Viewer viewer) { - // If it is changing... - // - if (currentViewer != viewer) { - if (selectionChangedListener == null) { - // Create the listener on demand. - // - selectionChangedListener = - new ISelectionChangedListener() { - // This just notifies those things that are affected by the section. - // - public void selectionChanged(SelectionChangedEvent selectionChangedEvent) { - setSelection(selectionChangedEvent.getSelection()); - } - }; - } - - // Stop listening to the old one. - // - if (currentViewer != null) { - currentViewer.removeSelectionChangedListener(selectionChangedListener); - } - - // Start listening to the new one. - // - if (viewer != null) { - viewer.addSelectionChangedListener(selectionChangedListener); - } - - // Remember it. - // - currentViewer = viewer; - - // Set the editors selection based on the current viewer's selection. - // - setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection()); - } - } - - /** - * This returns the viewer as required by the {@link IViewerProvider} interface. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Viewer getViewer() { - return currentViewer; - } - - /** - * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createContextMenuFor(StructuredViewer viewer) { - MenuManager contextMenu = new MenuManager("#PopUp"); - contextMenu.add(new Separator("additions")); - contextMenu.setRemoveAllWhenShown(true); - contextMenu.addMenuListener(this); - Menu menu= contextMenu.createContextMenu(viewer.getControl()); - viewer.getControl().setMenu(menu); - getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); - - int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; - Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() }; - viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); - viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); - } - - /** - * This is the method called to load a resource into the editing domain's resource set based on the editor's input. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createModel() { - URI resourceURI = EditUIUtil.getURI(getEditorInput()); - Exception exception = null; - Resource resource = null; - try { - // Load the resource through the editing domain. - // - resource = editingDomain.getResourceSet().getResource(resourceURI, true); - } - catch (Exception e) { - exception = e; - resource = editingDomain.getResourceSet().getResource(resourceURI, false); - } - - Diagnostic diagnostic = analyzeResourceProblems(resource, exception); - if (diagnostic.getSeverity() != Diagnostic.OK) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter); - } - - /** - * Returns a diagnostic describing the errors and warnings listed in the resource - * and the specified exception (if any). - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) { - if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) { - BasicDiagnostic basicDiagnostic = - new BasicDiagnostic - (Diagnostic.ERROR, - "edu.kit.ipd.descartes.mm.applicationlevel.editor", - 0, - getString("_UI_CreateModelError_message", resource.getURI()), - new Object [] { exception == null ? (Object)resource : exception }); - basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); - return basicDiagnostic; - } - else if (exception != null) { - return - new BasicDiagnostic - (Diagnostic.ERROR, - "edu.kit.ipd.descartes.mm.applicationlevel.editor", - 0, - getString("_UI_CreateModelError_message", resource.getURI()), - new Object[] { exception }); - } - else { - return Diagnostic.OK_INSTANCE; - } - } - - /** - * This is the method used by the framework to install your own controls. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void createPages() { - // Creates the model from the editor input - // - createModel(); - - // Only creates the other pages if there is something that can be edited - // - if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { - // Create a page for the selection tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), RepositoryEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - selectionViewer = (TreeViewer)viewerPane.getViewer(); - selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - - selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - selectionViewer.setInput(editingDomain.getResourceSet()); - selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - viewerPane.setTitle(editingDomain.getResourceSet()); - - new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - - createContextMenuFor(selectionViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_SelectionPage_label")); - } - - // Create a page for the parent tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), RepositoryEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - parentViewer = (TreeViewer)viewerPane.getViewer(); - parentViewer.setAutoExpandLevel(30); - parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); - parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(parentViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ParentPage_label")); - } - - // This is the page for the list viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), RepositoryEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new ListViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - listViewer = (ListViewer)viewerPane.getViewer(); - listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(listViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ListPage_label")); - } - - // This is the page for the tree viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), RepositoryEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - treeViewer = (TreeViewer)viewerPane.getViewer(); - treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); - - createContextMenuFor(treeViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreePage_label")); - } - - // This is the page for the table viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), RepositoryEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TableViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - tableViewer = (TableViewer)viewerPane.getViewer(); - - Table table = tableViewer.getTable(); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableColumn objectColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(3, 100, true)); - objectColumn.setText(getString("_UI_ObjectColumn_label")); - objectColumn.setResizable(true); - - TableColumn selfColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(2, 100, true)); - selfColumn.setText(getString("_UI_SelfColumn_label")); - selfColumn.setResizable(true); - - tableViewer.setColumnProperties(new String [] {"a", "b"}); - tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(tableViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TablePage_label")); - } - - // This is the page for the table tree viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), RepositoryEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); - - Tree tree = treeViewerWithColumns.getTree(); - tree.setLayoutData(new FillLayout()); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); - - TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); - objectColumn.setText(getString("_UI_ObjectColumn_label")); - objectColumn.setResizable(true); - objectColumn.setWidth(250); - - TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); - selfColumn.setText(getString("_UI_SelfColumn_label")); - selfColumn.setResizable(true); - selfColumn.setWidth(200); - - treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); - treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(treeViewerWithColumns); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); - } - - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - setActivePage(0); - } - }); - } - - // Ensures that this editor will only display the page's tab - // area if there are more than one page - // - getContainer().addControlListener - (new ControlAdapter() { - boolean guard = false; - @Override - public void controlResized(ControlEvent event) { - if (!guard) { - guard = true; - hideTabs(); - guard = false; - } - } - }); - - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - updateProblemIndication(); - } - }); - } - - /** - * If there is just one page in the multi-page editor part, - * this hides the single tab at the bottom. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void hideTabs() { - if (getPageCount() <= 1) { - setPageText(0, ""); - if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(1); - Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y + 6); - } - } - } - - /** - * If there is more than one page in the multi-page editor part, - * this shows the tabs at the bottom. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void showTabs() { - if (getPageCount() > 1) { - setPageText(0, getString("_UI_SelectionPage_label")); - if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); - Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y - 6); - } - } - } - - /** - * This is used to track the active viewer. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected void pageChange(int pageIndex) { - super.pageChange(pageIndex); - - if (contentOutlinePage != null) { - handleContentOutlineSelection(contentOutlinePage.getSelection()); - } - } - - /** - * This is how the framework determines which interfaces we implement. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("rawtypes") - @Override - public Object getAdapter(Class key) { - if (key.equals(IContentOutlinePage.class)) { - return showOutlineView() ? getContentOutlinePage() : null; - } - else if (key.equals(IPropertySheetPage.class)) { - return getPropertySheetPage(); - } - else if (key.equals(IGotoMarker.class)) { - return this; - } - else { - return super.getAdapter(key); - } - } - - /** - * This accesses a cached version of the content outliner. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IContentOutlinePage getContentOutlinePage() { - if (contentOutlinePage == null) { - // The content outline is just a tree. - // - class MyContentOutlinePage extends ContentOutlinePage { - @Override - public void createControl(Composite parent) { - super.createControl(parent); - contentOutlineViewer = getTreeViewer(); - contentOutlineViewer.addSelectionChangedListener(this); - - // Set up the tree viewer. - // - contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - contentOutlineViewer.setInput(editingDomain.getResourceSet()); - - // Make sure our popups work. - // - createContextMenuFor(contentOutlineViewer); - - if (!editingDomain.getResourceSet().getResources().isEmpty()) { - // Select the root object in the view. - // - contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - } - } - - @Override - public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) { - super.makeContributions(menuManager, toolBarManager, statusLineManager); - contentOutlineStatusLineManager = statusLineManager; - } - - @Override - public void setActionBars(IActionBars actionBars) { - super.setActionBars(actionBars); - getActionBarContributor().shareGlobalActions(this, actionBars); - } - } - - contentOutlinePage = new MyContentOutlinePage(); - - // Listen to selection so that we can handle it is a special way. - // - contentOutlinePage.addSelectionChangedListener - (new ISelectionChangedListener() { - // This ensures that we handle selections correctly. - // - public void selectionChanged(SelectionChangedEvent event) { - handleContentOutlineSelection(event.getSelection()); - } - }); - } - - return contentOutlinePage; - } - - /** - * This accesses a cached version of the property sheet. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IPropertySheetPage getPropertySheetPage() { - if (propertySheetPage == null) { - propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { - @Override - public void setSelectionToViewer(List<?> selection) { - RepositoryEditor.this.setSelectionToViewer(selection); - RepositoryEditor.this.setFocus(); - } - - @Override - public void setActionBars(IActionBars actionBars) { - super.setActionBars(actionBars); - getActionBarContributor().shareGlobalActions(this, actionBars); - } - }; - propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); - } - - return propertySheetPage; - } - - /** - * This deals with how we want selection in the outliner to affect the other views. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void handleContentOutlineSelection(ISelection selection) { - if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { - Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); - if (selectedElements.hasNext()) { - // Get the first selected element. - // - Object selectedElement = selectedElements.next(); - - // If it's the selection viewer, then we want it to select the same selection as this selection. - // - if (currentViewerPane.getViewer() == selectionViewer) { - ArrayList<Object> selectionList = new ArrayList<Object>(); - selectionList.add(selectedElement); - while (selectedElements.hasNext()) { - selectionList.add(selectedElements.next()); - } - - // Set the selection to the widget. - // - selectionViewer.setSelection(new StructuredSelection(selectionList)); - } - else { - // Set the input to the widget. - // - if (currentViewerPane.getViewer().getInput() != selectedElement) { - currentViewerPane.getViewer().setInput(selectedElement); - currentViewerPane.setTitle(selectedElement); - } - } - } - } - } - - /** - * This is for implementing {@link IEditorPart} and simply tests the command stack. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean isDirty() { - return ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded(); - } - - /** - * This is for implementing {@link IEditorPart} and simply saves the model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void doSave(IProgressMonitor progressMonitor) { - // Save only resources that have actually changed. - // - final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); - saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - - // Do the work within an operation because this is a long running activity that modifies the workbench. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - // This is the method that gets invoked when the operation runs. - // - @Override - public void execute(IProgressMonitor monitor) { - // Save the resources to the file system. - // - boolean first = true; - for (Resource resource : editingDomain.getResourceSet().getResources()) { - if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) { - try { - long timeStamp = resource.getTimeStamp(); - resource.save(saveOptions); - if (resource.getTimeStamp() != timeStamp) { - savedResources.add(resource); - } - } - catch (Exception exception) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - first = false; - } - } - } - }; - - updateProblemIndication = false; - try { - // This runs the options, and shows progress. - // - new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); - - // Refresh the necessary state. - // - ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone(); - firePropertyChange(IEditorPart.PROP_DIRTY); - } - catch (Exception exception) { - // Something went wrong that shouldn't. - // - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - updateProblemIndication = true; - updateProblemIndication(); - } - - /** - * This returns whether something has been persisted to the URI of the specified resource. - * The implementation uses the URI converter from the editor's resource set to try to open an input stream. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean isPersisted(Resource resource) { - boolean result = false; - try { - InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI()); - if (stream != null) { - result = true; - stream.close(); - } - } - catch (IOException e) { - // Ignore - } - return result; - } - - /** - * This always returns true because it is not currently supported. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean isSaveAsAllowed() { - return true; - } - - /** - * This also changes the editor's input. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void doSaveAs() { - SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell()); - saveAsDialog.open(); - IPath path = saveAsDialog.getResult(); - if (path != null) { - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); - if (file != null) { - doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file)); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void doSaveAs(URI uri, IEditorInput editorInput) { - (editingDomain.getResourceSet().getResources().get(0)).setURI(uri); - setInputWithNotify(editorInput); - setPartName(editorInput.getName()); - IProgressMonitor progressMonitor = - getActionBars().getStatusLineManager() != null ? - getActionBars().getStatusLineManager().getProgressMonitor() : - new NullProgressMonitor(); - doSave(progressMonitor); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void gotoMarker(IMarker marker) { - try { - if (marker.getType().equals(EValidator.MARKER)) { - String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null); - if (uriAttribute != null) { - URI uri = URI.createURI(uriAttribute); - EObject eObject = editingDomain.getResourceSet().getEObject(uri, true); - if (eObject != null) { - setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject))); - } - } - } - } - catch (CoreException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - - /** - * This is called during startup. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void init(IEditorSite site, IEditorInput editorInput) { - setSite(site); - setInputWithNotify(editorInput); - setPartName(editorInput.getName()); - site.setSelectionProvider(this); - site.getPage().addPartListener(partListener); - ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setFocus() { - if (currentViewerPane != null) { - currentViewerPane.setFocus(); - } - else { - getControl(getActivePage()).setFocus(); - } - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void addSelectionChangedListener(ISelectionChangedListener listener) { - selectionChangedListeners.add(listener); - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void removeSelectionChangedListener(ISelectionChangedListener listener) { - selectionChangedListeners.remove(listener); - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ISelection getSelection() { - return editorSelection; - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection. - * Calling this result will notify the listeners. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSelection(ISelection selection) { - editorSelection = selection; - - for (ISelectionChangedListener listener : selectionChangedListeners) { - listener.selectionChanged(new SelectionChangedEvent(this, selection)); - } - setStatusLineManager(selection); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setStatusLineManager(ISelection selection) { - IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? - contentOutlineStatusLineManager : getActionBars().getStatusLineManager(); - - if (statusLineManager != null) { - if (selection instanceof IStructuredSelection) { - Collection<?> collection = ((IStructuredSelection)selection).toList(); - switch (collection.size()) { - case 0: { - statusLineManager.setMessage(getString("_UI_NoObjectSelected")); - break; - } - case 1: { - String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next()); - statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text)); - break; - } - default: { - statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size()))); - break; - } - } - } - else { - statusLineManager.setMessage(""); - } - } - } - - /** - * This looks up a string in the plugin's plugin.properties file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static String getString(String key) { - return ApplicationlevelEditorPlugin.INSTANCE.getString(key); - } - - /** - * This looks up a string in plugin.properties, making a substitution. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static String getString(String key, Object s1) { - return ApplicationlevelEditorPlugin.INSTANCE.getString(key, new Object [] { s1 }); - } - - /** - * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void menuAboutToShow(IMenuManager menuManager) { - ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EditingDomainActionBarContributor getActionBarContributor() { - return (EditingDomainActionBarContributor)getEditorSite().getActionBarContributor(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IActionBars getActionBars() { - return getActionBarContributor().getActionBars(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public AdapterFactory getAdapterFactory() { - return adapterFactory; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void dispose() { - updateProblemIndication = false; - - ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener); - - getSite().getPage().removePartListener(partListener); - - adapterFactory.dispose(); - - if (getActionBarContributor().getActiveEditor() == this) { - getActionBarContributor().setActiveEditor(null); - } - - if (propertySheetPage != null) { - propertySheetPage.dispose(); - } - - if (contentOutlinePage != null) { - contentOutlinePage.dispose(); - } - - super.dispose(); - } - - /** - * Returns whether the outline view should be presented to the user. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean showOutlineView() { - return true; - } -} diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/repository/presentation/RepositoryModelWizard.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/repository/presentation/RepositoryModelWizard.java deleted file mode 100644 index e74f8aa4..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/repository/presentation/RepositoryModelWizard.java +++ /dev/null @@ -1,630 +0,0 @@ -/** - * Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - */ -package edu.kit.ipd.descartes.mm.applicationlevel.repository.presentation; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.StringTokenizer; - -import org.eclipse.emf.common.CommonPlugin; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; - -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.EObject; - -import org.eclipse.emf.ecore.xmi.XMLResource; - -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; - -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.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; - -import org.eclipse.core.runtime.IProgressMonitor; - -import org.eclipse.jface.dialogs.MessageDialog; - -import org.eclipse.jface.viewers.IStructuredSelection; - -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; - -import org.eclipse.swt.SWT; - -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.ModifyEvent; - -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; - -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; - -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; - -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - -import edu.kit.ipd.descartes.mm.applicationlevel.repository.RepositoryFactory; -import edu.kit.ipd.descartes.mm.applicationlevel.repository.RepositoryPackage; -import edu.kit.ipd.descartes.mm.applicationlevel.provider.ApplicationlevelEditPlugin; - - -import edu.kit.ipd.descartes.mm.applicationlevel.presentation.ApplicationlevelEditorPlugin; - -import org.eclipse.core.runtime.Path; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; - -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; - - -/** - * This is a simple wizard for creating a new model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class RepositoryModelWizard extends Wizard implements INewWizard { - /** - * The supported extensions for created files. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<String> FILE_EXTENSIONS = - Collections.unmodifiableList(Arrays.asList(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_RepositoryEditorFilenameExtensions").split("\\s*,\\s*"))); - - /** - * A formatted list of supported file extensions, suitable for display. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String FORMATTED_FILE_EXTENSIONS = - ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_RepositoryEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); - - /** - * This caches an instance of the model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected RepositoryPackage repositoryPackage = RepositoryPackage.eINSTANCE; - - /** - * This caches an instance of the model factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected RepositoryFactory repositoryFactory = repositoryPackage.getRepositoryFactory(); - - /** - * This is the file creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected RepositoryModelWizardNewFileCreationPage newFileCreationPage; - - /** - * This is the initial object creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected RepositoryModelWizardInitialObjectCreationPage initialObjectCreationPage; - - /** - * Remember the selection during initialization for populating the default container. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStructuredSelection selection; - - /** - * Remember the workbench during initialization. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IWorkbench workbench; - - /** - * Caches the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected List<String> initialObjectNames; - - /** - * This just records the information. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); - setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(ApplicationlevelEditorPlugin.INSTANCE.getImage("full/wizban/NewRepository"))); - } - - /** - * Returns the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getInitialObjectNames() { - if (initialObjectNames == null) { - initialObjectNames = new ArrayList<String>(); - for (EClassifier eClassifier : repositoryPackage.getEClassifiers()) { - if (eClassifier instanceof EClass) { - EClass eClass = (EClass)eClassifier; - if (!eClass.isAbstract()) { - initialObjectNames.add(eClass.getName()); - } - } - } - Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); - } - return initialObjectNames; - } - - /** - * Create a new model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObject createInitialModel() { - EClass eClass = (EClass)repositoryPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); - EObject rootObject = repositoryFactory.create(eClass); - return rootObject; - } - - /** - * Do the work after everything is specified. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @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<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); - resource.save(options); - } - catch (Exception exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(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(), ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); - return false; - } - - return true; - } - catch (Exception exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - return false; - } - } - - /** - * This is the one page of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class RepositoryModelWizardNewFileCreationPage extends WizardNewFileCreationPage { - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public RepositoryModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { - super(pageId, selection); - } - - /** - * The framework calls this to see if the file is correct. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean validatePage() { - if (super.validatePage()) { - String extension = new Path(getFileName()).getFileExtension(); - if (extension == null || !FILE_EXTENSIONS.contains(extension)) { - String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; - setErrorMessage(ApplicationlevelEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); - return false; - } - return true; - } - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); - } - } - - /** - * This is the page where the type of object to create is selected. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class RepositoryModelWizardInitialObjectCreationPage extends WizardPage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo initialObjectField; - - /** - * @generated - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - */ - protected List<String> encodings; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo encodingField; - - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public RepositoryModelWizardInitialObjectCreationPage(String pageId) { - super(pageId); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 12; - composite.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - } - - Label containerLabel = new Label(composite, SWT.LEFT); - { - containerLabel.setText(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ModelObject")); - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - containerLabel.setLayoutData(data); - } - - initialObjectField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - initialObjectField.setLayoutData(data); - } - - for (String objectName : getInitialObjectNames()) { - initialObjectField.add(getLabel(objectName)); - } - - if (initialObjectField.getItemCount() == 1) { - initialObjectField.select(0); - } - initialObjectField.addModifyListener(validator); - - Label encodingLabel = new Label(composite, SWT.LEFT); - { - encodingLabel.setText(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - encodingLabel.setLayoutData(data); - } - encodingField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - encodingField.setLayoutData(data); - } - - for (String encoding : getEncodings()) { - encodingField.add(encoding); - } - - encodingField.select(0); - encodingField.addModifyListener(validator); - - setPageComplete(validatePage()); - setControl(composite); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModifyListener validator = - new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(validatePage()); - } - }; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean validatePage() { - return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - if (initialObjectField.getItemCount() == 1) { - initialObjectField.clearSelection(); - encodingField.setFocus(); - } - else { - encodingField.clearSelection(); - initialObjectField.setFocus(); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getInitialObjectName() { - String label = initialObjectField.getText(); - - for (String name : getInitialObjectNames()) { - if (getLabel(name).equals(label)) { - return name; - } - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getEncoding() { - return encodingField.getText(); - } - - /** - * Returns the label for the specified type name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected String getLabel(String typeName) { - try { - return ApplicationlevelEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); - } - catch(MissingResourceException mre) { - ApplicationlevelEditorPlugin.INSTANCE.log(mre); - } - return typeName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getEncodings() { - if (encodings == null) { - encodings = new ArrayList<String>(); - for (StringTokenizer stringTokenizer = new StringTokenizer(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) { - encodings.add(stringTokenizer.nextToken()); - } - } - return encodings; - } - } - - /** - * The framework calls this to create the contents of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void addPages() { - // Create a page, set the title, and the initial model file name. - // - newFileCreationPage = new RepositoryModelWizardNewFileCreationPage("Whatever", selection); - newFileCreationPage.setTitle(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_RepositoryModelWizard_label")); - newFileCreationPage.setDescription(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_RepositoryModelWizard_description")); - newFileCreationPage.setFileName(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_RepositoryEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); - addPage(newFileCreationPage); - - // Try and get the resource selection to determine a current directory for the file dialog. - // - if (selection != null && !selection.isEmpty()) { - // Get the resource... - // - Object selectedElement = selection.iterator().next(); - if (selectedElement instanceof IResource) { - // Get the resource parent, if its a file. - // - IResource selectedResource = (IResource)selectedElement; - if (selectedResource.getType() == IResource.FILE) { - selectedResource = selectedResource.getParent(); - } - - // This gives us a directory... - // - if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { - // Set this for the container. - // - newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); - - // Make up a unique new name here. - // - String defaultModelBaseFilename = ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_RepositoryEditorFilenameDefaultBase"); - String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); - String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; - for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { - modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; - } - newFileCreationPage.setFileName(modelFilename); - } - } - } - initialObjectCreationPage = new RepositoryModelWizardInitialObjectCreationPage("Whatever2"); - initialObjectCreationPage.setTitle(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_RepositoryModelWizard_label")); - initialObjectCreationPage.setDescription(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); - addPage(initialObjectCreationPage); - } - - /** - * Get the file from the page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return newFileCreationPage.getModelFile(); - } - -} diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/servicebehavior/presentation/ServicebehaviorActionBarContributor.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/servicebehavior/presentation/ServicebehaviorActionBarContributor.java deleted file mode 100644 index 12918d77..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/servicebehavior/presentation/ServicebehaviorActionBarContributor.java +++ /dev/null @@ -1,426 +0,0 @@ -/** - * Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - */ -package edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.presentation; - -import edu.kit.ipd.descartes.mm.applicationlevel.presentation.ApplicationlevelEditorPlugin; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.emf.common.ui.viewer.IViewerProvider; - -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.domain.IEditingDomainProvider; - -import org.eclipse.emf.edit.ui.action.ControlAction; -import org.eclipse.emf.edit.ui.action.CreateChildAction; -import org.eclipse.emf.edit.ui.action.CreateSiblingAction; -import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; -import org.eclipse.emf.edit.ui.action.LoadResourceAction; -import org.eclipse.emf.edit.ui.action.ValidateAction; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IContributionItem; -import org.eclipse.jface.action.IContributionManager; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.action.SubContributionItem; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.Viewer; - -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.PartInitException; - -/** - * This is the action bar contributor for the Servicebehavior model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class ServicebehaviorActionBarContributor - extends EditingDomainActionBarContributor - implements ISelectionChangedListener { - /** - * This keeps track of the active editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IEditorPart activeEditorPart; - - /** - * This keeps track of the current selection provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ISelectionProvider selectionProvider; - - /** - * This action opens the Properties view. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IAction showPropertiesViewAction = - new Action(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) { - @Override - public void run() { - try { - getPage().showView("org.eclipse.ui.views.PropertySheet"); - } - catch (PartInitException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - }; - - /** - * This action refreshes the viewer of the current editor if the editor - * implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IAction refreshViewerAction = - new Action(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) { - @Override - public boolean isEnabled() { - return activeEditorPart instanceof IViewerProvider; - } - - @Override - public void run() { - if (activeEditorPart instanceof IViewerProvider) { - Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer(); - if (viewer != null) { - viewer.refresh(); - } - } - } - }; - - /** - * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor - * generated for the current selection by the item provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> createChildActions; - - /** - * This is the menu manager into which menu contribution items should be added for CreateChild actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IMenuManager createChildMenuManager; - - /** - * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor - * generated for the current selection by the item provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> createSiblingActions; - - /** - * This is the menu manager into which menu contribution items should be added for CreateSibling actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IMenuManager createSiblingMenuManager; - - /** - * This creates an instance of the contributor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ServicebehaviorActionBarContributor() { - super(ADDITIONS_LAST_STYLE); - loadResourceAction = new LoadResourceAction(); - validateAction = new ValidateAction(); - controlAction = new ControlAction(); - } - - /** - * This adds Separators for editor additions to the tool bar. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void contributeToToolBar(IToolBarManager toolBarManager) { - toolBarManager.add(new Separator("servicebehavior-settings")); - toolBarManager.add(new Separator("servicebehavior-additions")); - } - - /** - * This adds to the menu bar a menu and some separators for editor additions, - * as well as the sub-menus for object creation items. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void contributeToMenu(IMenuManager menuManager) { - super.contributeToMenu(menuManager); - - IMenuManager submenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ServicebehaviorEditor_menu"), "edu.kit.ipd.descartes.mm.applicationlevel.servicebehaviorMenuID"); - menuManager.insertAfter("additions", submenuManager); - submenuManager.add(new Separator("settings")); - submenuManager.add(new Separator("actions")); - submenuManager.add(new Separator("additions")); - submenuManager.add(new Separator("additions-end")); - - // Prepare for CreateChild item addition or removal. - // - createChildMenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); - submenuManager.insertBefore("additions", createChildMenuManager); - - // Prepare for CreateSibling item addition or removal. - // - createSiblingMenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); - submenuManager.insertBefore("additions", createSiblingMenuManager); - - // Force an update because Eclipse hides empty menus now. - // - submenuManager.addMenuListener - (new IMenuListener() { - public void menuAboutToShow(IMenuManager menuManager) { - menuManager.updateAll(true); - } - }); - - addGlobalActions(submenuManager); - } - - /** - * When the active editor changes, this remembers the change and registers with it as a selection provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setActiveEditor(IEditorPart part) { - super.setActiveEditor(part); - activeEditorPart = part; - - // Switch to the new selection provider. - // - if (selectionProvider != null) { - selectionProvider.removeSelectionChangedListener(this); - } - if (part == null) { - selectionProvider = null; - } - else { - selectionProvider = part.getSite().getSelectionProvider(); - selectionProvider.addSelectionChangedListener(this); - - // Fake a selection changed event to update the menus. - // - if (selectionProvider.getSelection() != null) { - selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection())); - } - } - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, - * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings - * that can be added to the selected object and updating the menus accordingly. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void selectionChanged(SelectionChangedEvent event) { - // Remove any menu items for old selection. - // - if (createChildMenuManager != null) { - depopulateManager(createChildMenuManager, createChildActions); - } - if (createSiblingMenuManager != null) { - depopulateManager(createSiblingMenuManager, createSiblingActions); - } - - // Query the new selection for appropriate new child/sibling descriptors - // - Collection<?> newChildDescriptors = null; - Collection<?> newSiblingDescriptors = null; - - ISelection selection = event.getSelection(); - if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) { - Object object = ((IStructuredSelection)selection).getFirstElement(); - - EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain(); - - newChildDescriptors = domain.getNewChildDescriptors(object, null); - newSiblingDescriptors = domain.getNewChildDescriptors(null, object); - } - - // Generate actions for selection; populate and redraw the menus. - // - createChildActions = generateCreateChildActions(newChildDescriptors, selection); - createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); - - if (createChildMenuManager != null) { - populateManager(createChildMenuManager, createChildActions, null); - createChildMenuManager.update(true); - } - if (createSiblingMenuManager != null) { - populateManager(createSiblingMenuManager, createSiblingActions, null); - createSiblingMenuManager.update(true); - } - } - - /** - * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in <code>descriptors</code>, - * and returns the collection of these actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) { - Collection<IAction> actions = new ArrayList<IAction>(); - if (descriptors != null) { - for (Object descriptor : descriptors) { - actions.add(new CreateChildAction(activeEditorPart, selection, descriptor)); - } - } - return actions; - } - - /** - * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in <code>descriptors</code>, - * and returns the collection of these actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection) { - Collection<IAction> actions = new ArrayList<IAction>(); - if (descriptors != null) { - for (Object descriptor : descriptors) { - actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor)); - } - } - return actions; - } - - /** - * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s - * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection, - * by inserting them before the specified contribution item <code>contributionID</code>. - * If <code>contributionID</code> is <code>null</code>, they are simply added. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) { - if (actions != null) { - for (IAction action : actions) { - if (contributionID != null) { - manager.insertBefore(contributionID, action); - } - else { - manager.add(action); - } - } - } - } - - /** - * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s - * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) { - if (actions != null) { - IContributionItem[] items = manager.getItems(); - for (int i = 0; i < items.length; i++) { - // Look into SubContributionItems - // - IContributionItem contributionItem = items[i]; - while (contributionItem instanceof SubContributionItem) { - contributionItem = ((SubContributionItem)contributionItem).getInnerItem(); - } - - // Delete the ActionContributionItems with matching action. - // - if (contributionItem instanceof ActionContributionItem) { - IAction action = ((ActionContributionItem)contributionItem).getAction(); - if (actions.contains(action)) { - manager.remove(contributionItem); - } - } - } - } - } - - /** - * This populates the pop-up menu before it appears. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void menuAboutToShow(IMenuManager menuManager) { - super.menuAboutToShow(menuManager); - MenuManager submenuManager = null; - - submenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); - populateManager(submenuManager, createChildActions, null); - menuManager.insertBefore("edit", submenuManager); - - submenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); - populateManager(submenuManager, createSiblingActions, null); - menuManager.insertBefore("edit", submenuManager); - } - - /** - * This inserts global actions before the "additions-end" separator. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected void addGlobalActions(IMenuManager menuManager) { - menuManager.insertAfter("additions-end", new Separator("ui-actions")); - menuManager.insertAfter("ui-actions", showPropertiesViewAction); - - refreshViewerAction.setEnabled(refreshViewerAction.isEnabled()); - menuManager.insertAfter("ui-actions", refreshViewerAction); - - super.addGlobalActions(menuManager); - } - - /** - * This ensures that a delete action will clean up all references to deleted objects. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean removeAllReferencesOnDelete() { - return true; - } - -} diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/servicebehavior/presentation/ServicebehaviorEditor.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/servicebehavior/presentation/ServicebehaviorEditor.java deleted file mode 100644 index 8da3980a..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/servicebehavior/presentation/ServicebehaviorEditor.java +++ /dev/null @@ -1,1833 +0,0 @@ -/** - * Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - */ -package edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.presentation; - - -import java.io.IOException; -import java.io.InputStream; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.EventObject; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -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.ResourcesPlugin; - -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.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; - -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; - -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; - -import org.eclipse.swt.SWT; - -import org.eclipse.swt.custom.CTabFolder; - -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.Transfer; - -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; - -import org.eclipse.swt.graphics.Point; - -import org.eclipse.swt.layout.FillLayout; - -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; - -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; - -import org.eclipse.ui.dialogs.SaveAsDialog; - -import org.eclipse.ui.ide.IGotoMarker; - -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.MultiPageEditorPart; - -import org.eclipse.ui.views.contentoutline.ContentOutline; -import org.eclipse.ui.views.contentoutline.ContentOutlinePage; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; - -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.PropertySheet; -import org.eclipse.ui.views.properties.PropertySheetPage; - -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CommandStack; -import org.eclipse.emf.common.command.CommandStackListener; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.common.ui.MarkerHelper; -import org.eclipse.emf.common.ui.ViewerPane; - -import org.eclipse.emf.common.ui.editor.ProblemEditorPart; - -import org.eclipse.emf.common.ui.viewer.IViewerProvider; - -import org.eclipse.emf.common.util.BasicDiagnostic; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EValidator; - -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; - -import org.eclipse.emf.ecore.util.EContentAdapter; -import org.eclipse.emf.ecore.util.EcoreUtil; - -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.domain.IEditingDomainProvider; - -import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; - -import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; - -import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; - -import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; - -import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; -import org.eclipse.emf.edit.ui.dnd.LocalTransfer; -import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; - -import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; -import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; - -import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; -import org.eclipse.emf.edit.ui.util.EditUIUtil; - -import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; - -import edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.provider.ServicebehaviorItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.core.provider.CoreItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.identifier.provider.IdentifierItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.functions.provider.FunctionsItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.provider.ParameterdependenciesItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.presentation.ApplicationlevelEditorPlugin; - -import edu.kit.ipd.descartes.mm.applicationlevel.repository.provider.RepositoryItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.system.provider.SystemItemProviderAdapterFactory; - -import org.eclipse.ui.actions.WorkspaceModifyOperation; - - -/** - * This is an example of a Servicebehavior model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class ServicebehaviorEditor - extends MultiPageEditorPart - implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { - /** - * This keeps track of the editing domain that is used to track all changes to the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected AdapterFactoryEditingDomain editingDomain; - - /** - * This is the one adapter factory used for providing views of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ComposedAdapterFactory adapterFactory; - - /** - * This is the content outline page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IContentOutlinePage contentOutlinePage; - - /** - * This is a kludge... - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStatusLineManager contentOutlineStatusLineManager; - - /** - * This is the content outline page's viewer. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer contentOutlineViewer; - - /** - * This is the property sheet page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected PropertySheetPage propertySheetPage; - - /** - * This is the viewer that shadows the selection in the content outline. - * The parent relation must be correctly defined for this to work. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer selectionViewer; - - /** - * This inverts the roll of parent and child in the content provider and show parents as a tree. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer parentViewer; - - /** - * This shows how a tree view works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewer; - - /** - * This shows how a list view works. - * A list viewer doesn't support icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListViewer listViewer; - - /** - * This shows how a table view works. - * A table can be used as a list with icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TableViewer tableViewer; - - /** - * This shows how a tree view with columns works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewerWithColumns; - - /** - * This keeps track of the active viewer pane, in the book. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ViewerPane currentViewerPane; - - /** - * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Viewer currentViewer; - - /** - * This listens to which ever viewer is active. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ISelectionChangedListener selectionChangedListener; - - /** - * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>(); - - /** - * This keeps track of the selection of the editor as a whole. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ISelection editorSelection = StructuredSelection.EMPTY; - - /** - * The MarkerHelper is responsible for creating workspace resource markers presented - * in Eclipse's Problems View. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected MarkerHelper markerHelper = new EditUIMarkerHelper(); - - /** - * This listens for when the outline becomes active - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IPartListener partListener = - new IPartListener() { - public void partActivated(IWorkbenchPart p) { - if (p instanceof ContentOutline) { - if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { - getActionBarContributor().setActiveEditor(ServicebehaviorEditor.this); - - setCurrentViewer(contentOutlineViewer); - } - } - else if (p instanceof PropertySheet) { - if (((PropertySheet)p).getCurrentPage() == propertySheetPage) { - getActionBarContributor().setActiveEditor(ServicebehaviorEditor.this); - handleActivate(); - } - } - else if (p == ServicebehaviorEditor.this) { - handleActivate(); - } - } - public void partBroughtToTop(IWorkbenchPart p) { - // Ignore. - } - public void partClosed(IWorkbenchPart p) { - // Ignore. - } - public void partDeactivated(IWorkbenchPart p) { - // Ignore. - } - public void partOpened(IWorkbenchPart p) { - // Ignore. - } - }; - - /** - * Resources that have been removed since last activation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<Resource> removedResources = new ArrayList<Resource>(); - - /** - * Resources that have been changed since last activation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<Resource> changedResources = new ArrayList<Resource>(); - - /** - * Resources that have been saved. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<Resource> savedResources = new ArrayList<Resource>(); - - /** - * Map to store the diagnostic associated with a resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>(); - - /** - * Controls whether the problem indication should be updated. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean updateProblemIndication = true; - - /** - * Adapter used to update the problem indication when resources are demanded loaded. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EContentAdapter problemIndicationAdapter = - new EContentAdapter() { - @Override - public void notifyChanged(Notification notification) { - if (notification.getNotifier() instanceof Resource) { - switch (notification.getFeatureID(Resource.class)) { - case Resource.RESOURCE__IS_LOADED: - case Resource.RESOURCE__ERRORS: - case Resource.RESOURCE__WARNINGS: { - Resource resource = (Resource)notification.getNotifier(); - Diagnostic diagnostic = analyzeResourceProblems(resource, null); - if (diagnostic.getSeverity() != Diagnostic.OK) { - resourceToDiagnosticMap.put(resource, diagnostic); - } - else { - resourceToDiagnosticMap.remove(resource); - } - - if (updateProblemIndication) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - updateProblemIndication(); - } - }); - } - break; - } - } - } - else { - super.notifyChanged(notification); - } - } - - @Override - protected void setTarget(Resource target) { - basicSetTarget(target); - } - - @Override - protected void unsetTarget(Resource target) { - basicUnsetTarget(target); - } - }; - - /** - * This listens for workspace changes. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IResourceChangeListener resourceChangeListener = - new IResourceChangeListener() { - public void resourceChanged(IResourceChangeEvent event) { - IResourceDelta delta = event.getDelta(); - try { - class ResourceDeltaVisitor implements IResourceDeltaVisitor { - protected ResourceSet resourceSet = editingDomain.getResourceSet(); - protected Collection<Resource> changedResources = new ArrayList<Resource>(); - protected Collection<Resource> removedResources = new ArrayList<Resource>(); - - public boolean visit(IResourceDelta delta) { - if (delta.getResource().getType() == IResource.FILE) { - if (delta.getKind() == IResourceDelta.REMOVED || - delta.getKind() == IResourceDelta.CHANGED && delta.getFlags() != IResourceDelta.MARKERS) { - Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false); - if (resource != null) { - if (delta.getKind() == IResourceDelta.REMOVED) { - removedResources.add(resource); - } - else if (!savedResources.remove(resource)) { - changedResources.add(resource); - } - } - } - } - - return true; - } - - public Collection<Resource> getChangedResources() { - return changedResources; - } - - public Collection<Resource> getRemovedResources() { - return removedResources; - } - } - - final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(); - delta.accept(visitor); - - if (!visitor.getRemovedResources().isEmpty()) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - removedResources.addAll(visitor.getRemovedResources()); - if (!isDirty()) { - getSite().getPage().closeEditor(ServicebehaviorEditor.this, false); - } - } - }); - } - - if (!visitor.getChangedResources().isEmpty()) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - changedResources.addAll(visitor.getChangedResources()); - if (getSite().getPage().getActiveEditor() == ServicebehaviorEditor.this) { - handleActivate(); - } - } - }); - } - } - catch (CoreException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - }; - - /** - * Handles activation of the editor or it's associated views. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void handleActivate() { - // Recompute the read only state. - // - if (editingDomain.getResourceToReadOnlyMap() != null) { - editingDomain.getResourceToReadOnlyMap().clear(); - - // Refresh any actions that may become enabled or disabled. - // - setSelection(getSelection()); - } - - if (!removedResources.isEmpty()) { - if (handleDirtyConflict()) { - getSite().getPage().closeEditor(ServicebehaviorEditor.this, false); - } - else { - removedResources.clear(); - changedResources.clear(); - savedResources.clear(); - } - } - else if (!changedResources.isEmpty()) { - changedResources.removeAll(savedResources); - handleChangedResources(); - changedResources.clear(); - savedResources.clear(); - } - } - - /** - * Handles what to do with changed resources on activation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void handleChangedResources() { - if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) { - if (isDirty()) { - changedResources.addAll(editingDomain.getResourceSet().getResources()); - } - editingDomain.getCommandStack().flush(); - - updateProblemIndication = false; - for (Resource resource : changedResources) { - if (resource.isLoaded()) { - resource.unload(); - try { - resource.load(Collections.EMPTY_MAP); - } - catch (IOException exception) { - if (!resourceToDiagnosticMap.containsKey(resource)) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - } - } - } - - if (AdapterFactoryEditingDomain.isStale(editorSelection)) { - setSelection(StructuredSelection.EMPTY); - } - - updateProblemIndication = true; - updateProblemIndication(); - } - } - - /** - * Updates the problems indication with the information described in the specified diagnostic. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void updateProblemIndication() { - if (updateProblemIndication) { - BasicDiagnostic diagnostic = - new BasicDiagnostic - (Diagnostic.OK, - "edu.kit.ipd.descartes.mm.applicationlevel.editor", - 0, - null, - new Object [] { editingDomain.getResourceSet() }); - for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) { - if (childDiagnostic.getSeverity() != Diagnostic.OK) { - diagnostic.add(childDiagnostic); - } - } - - int lastEditorPage = getPageCount() - 1; - if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) { - ((ProblemEditorPart)getEditor(lastEditorPage)).setDiagnostic(diagnostic); - if (diagnostic.getSeverity() != Diagnostic.OK) { - setActivePage(lastEditorPage); - } - } - else if (diagnostic.getSeverity() != Diagnostic.OK) { - ProblemEditorPart problemEditorPart = new ProblemEditorPart(); - problemEditorPart.setDiagnostic(diagnostic); - problemEditorPart.setMarkerHelper(markerHelper); - try { - addPage(++lastEditorPage, problemEditorPart, getEditorInput()); - setPageText(lastEditorPage, problemEditorPart.getPartName()); - setActivePage(lastEditorPage); - showTabs(); - } - catch (PartInitException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - - if (markerHelper.hasMarkers(editingDomain.getResourceSet())) { - markerHelper.deleteMarkers(editingDomain.getResourceSet()); - if (diagnostic.getSeverity() != Diagnostic.OK) { - try { - markerHelper.createMarkers(diagnostic); - } - catch (CoreException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - } - } - } - - /** - * Shows a dialog that asks if conflicting changes should be discarded. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean handleDirtyConflict() { - return - MessageDialog.openQuestion - (getSite().getShell(), - getString("_UI_FileConflict_label"), - getString("_WARN_FileConflict")); - } - - /** - * This creates a model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ServicebehaviorEditor() { - super(); - initializeEditingDomain(); - } - - /** - * This sets up the editing domain for the model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void initializeEditingDomain() { - // Create an adapter factory that yields item providers. - // - adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - - adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new FunctionsItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new ParameterdependenciesItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new RepositoryItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new ServicebehaviorItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new SystemItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new CoreItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new IdentifierItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); - - // Create the command stack that will notify this editor as commands are executed. - // - BasicCommandStack commandStack = new BasicCommandStack(); - - // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus. - // - commandStack.addCommandStackListener - (new CommandStackListener() { - public void commandStackChanged(final EventObject event) { - getContainer().getDisplay().asyncExec - (new Runnable() { - public void run() { - firePropertyChange(IEditorPart.PROP_DIRTY); - - // Try to select the affected objects. - // - Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand(); - if (mostRecentCommand != null) { - setSelectionToViewer(mostRecentCommand.getAffectedObjects()); - } - if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) { - propertySheetPage.refresh(); - } - } - }); - } - }); - - // Create the editing domain with a special command stack. - // - editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>()); - } - - /** - * This is here for the listener to be able to call it. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected void firePropertyChange(int action) { - super.firePropertyChange(action); - } - - /** - * This sets the selection into whichever viewer is active. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSelectionToViewer(Collection<?> collection) { - final Collection<?> theSelection = collection; - // Make sure it's okay. - // - if (theSelection != null && !theSelection.isEmpty()) { - Runnable runnable = - new Runnable() { - public void run() { - // Try to select the items in the current content viewer of the editor. - // - if (currentViewer != null) { - currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true); - } - } - }; - getSite().getShell().getDisplay().asyncExec(runnable); - } - } - - /** - * This returns the editing domain as required by the {@link IEditingDomainProvider} interface. - * This is important for implementing the static methods of {@link AdapterFactoryEditingDomain} - * and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EditingDomain getEditingDomain() { - return editingDomain; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object [] getElements(Object object) { - Object parent = super.getParent(object); - return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object [] getChildren(Object object) { - Object parent = super.getParent(object); - return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean hasChildren(Object object) { - Object parent = super.getParent(object); - return parent != null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object getParent(Object object) { - return null; - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewerPane(ViewerPane viewerPane) { - if (currentViewerPane != viewerPane) { - if (currentViewerPane != null) { - currentViewerPane.showFocus(false); - } - currentViewerPane = viewerPane; - } - setCurrentViewer(currentViewerPane.getViewer()); - } - - /** - * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, - * is the current one. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewer(Viewer viewer) { - // If it is changing... - // - if (currentViewer != viewer) { - if (selectionChangedListener == null) { - // Create the listener on demand. - // - selectionChangedListener = - new ISelectionChangedListener() { - // This just notifies those things that are affected by the section. - // - public void selectionChanged(SelectionChangedEvent selectionChangedEvent) { - setSelection(selectionChangedEvent.getSelection()); - } - }; - } - - // Stop listening to the old one. - // - if (currentViewer != null) { - currentViewer.removeSelectionChangedListener(selectionChangedListener); - } - - // Start listening to the new one. - // - if (viewer != null) { - viewer.addSelectionChangedListener(selectionChangedListener); - } - - // Remember it. - // - currentViewer = viewer; - - // Set the editors selection based on the current viewer's selection. - // - setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection()); - } - } - - /** - * This returns the viewer as required by the {@link IViewerProvider} interface. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Viewer getViewer() { - return currentViewer; - } - - /** - * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createContextMenuFor(StructuredViewer viewer) { - MenuManager contextMenu = new MenuManager("#PopUp"); - contextMenu.add(new Separator("additions")); - contextMenu.setRemoveAllWhenShown(true); - contextMenu.addMenuListener(this); - Menu menu= contextMenu.createContextMenu(viewer.getControl()); - viewer.getControl().setMenu(menu); - getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); - - int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; - Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() }; - viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); - viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); - } - - /** - * This is the method called to load a resource into the editing domain's resource set based on the editor's input. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createModel() { - URI resourceURI = EditUIUtil.getURI(getEditorInput()); - Exception exception = null; - Resource resource = null; - try { - // Load the resource through the editing domain. - // - resource = editingDomain.getResourceSet().getResource(resourceURI, true); - } - catch (Exception e) { - exception = e; - resource = editingDomain.getResourceSet().getResource(resourceURI, false); - } - - Diagnostic diagnostic = analyzeResourceProblems(resource, exception); - if (diagnostic.getSeverity() != Diagnostic.OK) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter); - } - - /** - * Returns a diagnostic describing the errors and warnings listed in the resource - * and the specified exception (if any). - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) { - if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) { - BasicDiagnostic basicDiagnostic = - new BasicDiagnostic - (Diagnostic.ERROR, - "edu.kit.ipd.descartes.mm.applicationlevel.editor", - 0, - getString("_UI_CreateModelError_message", resource.getURI()), - new Object [] { exception == null ? (Object)resource : exception }); - basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); - return basicDiagnostic; - } - else if (exception != null) { - return - new BasicDiagnostic - (Diagnostic.ERROR, - "edu.kit.ipd.descartes.mm.applicationlevel.editor", - 0, - getString("_UI_CreateModelError_message", resource.getURI()), - new Object[] { exception }); - } - else { - return Diagnostic.OK_INSTANCE; - } - } - - /** - * This is the method used by the framework to install your own controls. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void createPages() { - // Creates the model from the editor input - // - createModel(); - - // Only creates the other pages if there is something that can be edited - // - if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { - // Create a page for the selection tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), ServicebehaviorEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - selectionViewer = (TreeViewer)viewerPane.getViewer(); - selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - - selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - selectionViewer.setInput(editingDomain.getResourceSet()); - selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - viewerPane.setTitle(editingDomain.getResourceSet()); - - new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - - createContextMenuFor(selectionViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_SelectionPage_label")); - } - - // Create a page for the parent tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), ServicebehaviorEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - parentViewer = (TreeViewer)viewerPane.getViewer(); - parentViewer.setAutoExpandLevel(30); - parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); - parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(parentViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ParentPage_label")); - } - - // This is the page for the list viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), ServicebehaviorEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new ListViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - listViewer = (ListViewer)viewerPane.getViewer(); - listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(listViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ListPage_label")); - } - - // This is the page for the tree viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), ServicebehaviorEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - treeViewer = (TreeViewer)viewerPane.getViewer(); - treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); - - createContextMenuFor(treeViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreePage_label")); - } - - // This is the page for the table viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), ServicebehaviorEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TableViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - tableViewer = (TableViewer)viewerPane.getViewer(); - - Table table = tableViewer.getTable(); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableColumn objectColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(3, 100, true)); - objectColumn.setText(getString("_UI_ObjectColumn_label")); - objectColumn.setResizable(true); - - TableColumn selfColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(2, 100, true)); - selfColumn.setText(getString("_UI_SelfColumn_label")); - selfColumn.setResizable(true); - - tableViewer.setColumnProperties(new String [] {"a", "b"}); - tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(tableViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TablePage_label")); - } - - // This is the page for the table tree viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), ServicebehaviorEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); - - Tree tree = treeViewerWithColumns.getTree(); - tree.setLayoutData(new FillLayout()); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); - - TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); - objectColumn.setText(getString("_UI_ObjectColumn_label")); - objectColumn.setResizable(true); - objectColumn.setWidth(250); - - TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); - selfColumn.setText(getString("_UI_SelfColumn_label")); - selfColumn.setResizable(true); - selfColumn.setWidth(200); - - treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); - treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(treeViewerWithColumns); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); - } - - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - setActivePage(0); - } - }); - } - - // Ensures that this editor will only display the page's tab - // area if there are more than one page - // - getContainer().addControlListener - (new ControlAdapter() { - boolean guard = false; - @Override - public void controlResized(ControlEvent event) { - if (!guard) { - guard = true; - hideTabs(); - guard = false; - } - } - }); - - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - updateProblemIndication(); - } - }); - } - - /** - * If there is just one page in the multi-page editor part, - * this hides the single tab at the bottom. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void hideTabs() { - if (getPageCount() <= 1) { - setPageText(0, ""); - if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(1); - Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y + 6); - } - } - } - - /** - * If there is more than one page in the multi-page editor part, - * this shows the tabs at the bottom. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void showTabs() { - if (getPageCount() > 1) { - setPageText(0, getString("_UI_SelectionPage_label")); - if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); - Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y - 6); - } - } - } - - /** - * This is used to track the active viewer. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected void pageChange(int pageIndex) { - super.pageChange(pageIndex); - - if (contentOutlinePage != null) { - handleContentOutlineSelection(contentOutlinePage.getSelection()); - } - } - - /** - * This is how the framework determines which interfaces we implement. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("rawtypes") - @Override - public Object getAdapter(Class key) { - if (key.equals(IContentOutlinePage.class)) { - return showOutlineView() ? getContentOutlinePage() : null; - } - else if (key.equals(IPropertySheetPage.class)) { - return getPropertySheetPage(); - } - else if (key.equals(IGotoMarker.class)) { - return this; - } - else { - return super.getAdapter(key); - } - } - - /** - * This accesses a cached version of the content outliner. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IContentOutlinePage getContentOutlinePage() { - if (contentOutlinePage == null) { - // The content outline is just a tree. - // - class MyContentOutlinePage extends ContentOutlinePage { - @Override - public void createControl(Composite parent) { - super.createControl(parent); - contentOutlineViewer = getTreeViewer(); - contentOutlineViewer.addSelectionChangedListener(this); - - // Set up the tree viewer. - // - contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - contentOutlineViewer.setInput(editingDomain.getResourceSet()); - - // Make sure our popups work. - // - createContextMenuFor(contentOutlineViewer); - - if (!editingDomain.getResourceSet().getResources().isEmpty()) { - // Select the root object in the view. - // - contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - } - } - - @Override - public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) { - super.makeContributions(menuManager, toolBarManager, statusLineManager); - contentOutlineStatusLineManager = statusLineManager; - } - - @Override - public void setActionBars(IActionBars actionBars) { - super.setActionBars(actionBars); - getActionBarContributor().shareGlobalActions(this, actionBars); - } - } - - contentOutlinePage = new MyContentOutlinePage(); - - // Listen to selection so that we can handle it is a special way. - // - contentOutlinePage.addSelectionChangedListener - (new ISelectionChangedListener() { - // This ensures that we handle selections correctly. - // - public void selectionChanged(SelectionChangedEvent event) { - handleContentOutlineSelection(event.getSelection()); - } - }); - } - - return contentOutlinePage; - } - - /** - * This accesses a cached version of the property sheet. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IPropertySheetPage getPropertySheetPage() { - if (propertySheetPage == null) { - propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { - @Override - public void setSelectionToViewer(List<?> selection) { - ServicebehaviorEditor.this.setSelectionToViewer(selection); - ServicebehaviorEditor.this.setFocus(); - } - - @Override - public void setActionBars(IActionBars actionBars) { - super.setActionBars(actionBars); - getActionBarContributor().shareGlobalActions(this, actionBars); - } - }; - propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); - } - - return propertySheetPage; - } - - /** - * This deals with how we want selection in the outliner to affect the other views. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void handleContentOutlineSelection(ISelection selection) { - if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { - Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); - if (selectedElements.hasNext()) { - // Get the first selected element. - // - Object selectedElement = selectedElements.next(); - - // If it's the selection viewer, then we want it to select the same selection as this selection. - // - if (currentViewerPane.getViewer() == selectionViewer) { - ArrayList<Object> selectionList = new ArrayList<Object>(); - selectionList.add(selectedElement); - while (selectedElements.hasNext()) { - selectionList.add(selectedElements.next()); - } - - // Set the selection to the widget. - // - selectionViewer.setSelection(new StructuredSelection(selectionList)); - } - else { - // Set the input to the widget. - // - if (currentViewerPane.getViewer().getInput() != selectedElement) { - currentViewerPane.getViewer().setInput(selectedElement); - currentViewerPane.setTitle(selectedElement); - } - } - } - } - } - - /** - * This is for implementing {@link IEditorPart} and simply tests the command stack. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean isDirty() { - return ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded(); - } - - /** - * This is for implementing {@link IEditorPart} and simply saves the model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void doSave(IProgressMonitor progressMonitor) { - // Save only resources that have actually changed. - // - final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); - saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - - // Do the work within an operation because this is a long running activity that modifies the workbench. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - // This is the method that gets invoked when the operation runs. - // - @Override - public void execute(IProgressMonitor monitor) { - // Save the resources to the file system. - // - boolean first = true; - for (Resource resource : editingDomain.getResourceSet().getResources()) { - if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) { - try { - long timeStamp = resource.getTimeStamp(); - resource.save(saveOptions); - if (resource.getTimeStamp() != timeStamp) { - savedResources.add(resource); - } - } - catch (Exception exception) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - first = false; - } - } - } - }; - - updateProblemIndication = false; - try { - // This runs the options, and shows progress. - // - new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); - - // Refresh the necessary state. - // - ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone(); - firePropertyChange(IEditorPart.PROP_DIRTY); - } - catch (Exception exception) { - // Something went wrong that shouldn't. - // - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - updateProblemIndication = true; - updateProblemIndication(); - } - - /** - * This returns whether something has been persisted to the URI of the specified resource. - * The implementation uses the URI converter from the editor's resource set to try to open an input stream. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean isPersisted(Resource resource) { - boolean result = false; - try { - InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI()); - if (stream != null) { - result = true; - stream.close(); - } - } - catch (IOException e) { - // Ignore - } - return result; - } - - /** - * This always returns true because it is not currently supported. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean isSaveAsAllowed() { - return true; - } - - /** - * This also changes the editor's input. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void doSaveAs() { - SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell()); - saveAsDialog.open(); - IPath path = saveAsDialog.getResult(); - if (path != null) { - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); - if (file != null) { - doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file)); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void doSaveAs(URI uri, IEditorInput editorInput) { - (editingDomain.getResourceSet().getResources().get(0)).setURI(uri); - setInputWithNotify(editorInput); - setPartName(editorInput.getName()); - IProgressMonitor progressMonitor = - getActionBars().getStatusLineManager() != null ? - getActionBars().getStatusLineManager().getProgressMonitor() : - new NullProgressMonitor(); - doSave(progressMonitor); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void gotoMarker(IMarker marker) { - try { - if (marker.getType().equals(EValidator.MARKER)) { - String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null); - if (uriAttribute != null) { - URI uri = URI.createURI(uriAttribute); - EObject eObject = editingDomain.getResourceSet().getEObject(uri, true); - if (eObject != null) { - setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject))); - } - } - } - } - catch (CoreException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - - /** - * This is called during startup. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void init(IEditorSite site, IEditorInput editorInput) { - setSite(site); - setInputWithNotify(editorInput); - setPartName(editorInput.getName()); - site.setSelectionProvider(this); - site.getPage().addPartListener(partListener); - ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setFocus() { - if (currentViewerPane != null) { - currentViewerPane.setFocus(); - } - else { - getControl(getActivePage()).setFocus(); - } - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void addSelectionChangedListener(ISelectionChangedListener listener) { - selectionChangedListeners.add(listener); - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void removeSelectionChangedListener(ISelectionChangedListener listener) { - selectionChangedListeners.remove(listener); - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ISelection getSelection() { - return editorSelection; - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection. - * Calling this result will notify the listeners. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSelection(ISelection selection) { - editorSelection = selection; - - for (ISelectionChangedListener listener : selectionChangedListeners) { - listener.selectionChanged(new SelectionChangedEvent(this, selection)); - } - setStatusLineManager(selection); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setStatusLineManager(ISelection selection) { - IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? - contentOutlineStatusLineManager : getActionBars().getStatusLineManager(); - - if (statusLineManager != null) { - if (selection instanceof IStructuredSelection) { - Collection<?> collection = ((IStructuredSelection)selection).toList(); - switch (collection.size()) { - case 0: { - statusLineManager.setMessage(getString("_UI_NoObjectSelected")); - break; - } - case 1: { - String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next()); - statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text)); - break; - } - default: { - statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size()))); - break; - } - } - } - else { - statusLineManager.setMessage(""); - } - } - } - - /** - * This looks up a string in the plugin's plugin.properties file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static String getString(String key) { - return ApplicationlevelEditorPlugin.INSTANCE.getString(key); - } - - /** - * This looks up a string in plugin.properties, making a substitution. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static String getString(String key, Object s1) { - return ApplicationlevelEditorPlugin.INSTANCE.getString(key, new Object [] { s1 }); - } - - /** - * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void menuAboutToShow(IMenuManager menuManager) { - ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EditingDomainActionBarContributor getActionBarContributor() { - return (EditingDomainActionBarContributor)getEditorSite().getActionBarContributor(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IActionBars getActionBars() { - return getActionBarContributor().getActionBars(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public AdapterFactory getAdapterFactory() { - return adapterFactory; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void dispose() { - updateProblemIndication = false; - - ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener); - - getSite().getPage().removePartListener(partListener); - - adapterFactory.dispose(); - - if (getActionBarContributor().getActiveEditor() == this) { - getActionBarContributor().setActiveEditor(null); - } - - if (propertySheetPage != null) { - propertySheetPage.dispose(); - } - - if (contentOutlinePage != null) { - contentOutlinePage.dispose(); - } - - super.dispose(); - } - - /** - * Returns whether the outline view should be presented to the user. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean showOutlineView() { - return true; - } -} diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/servicebehavior/presentation/ServicebehaviorModelWizard.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/servicebehavior/presentation/ServicebehaviorModelWizard.java deleted file mode 100644 index e68f5b8f..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/servicebehavior/presentation/ServicebehaviorModelWizard.java +++ /dev/null @@ -1,630 +0,0 @@ -/** - * Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - */ -package edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.presentation; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.StringTokenizer; - -import org.eclipse.emf.common.CommonPlugin; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; - -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.EObject; - -import org.eclipse.emf.ecore.xmi.XMLResource; - -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; - -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.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; - -import org.eclipse.core.runtime.IProgressMonitor; - -import org.eclipse.jface.dialogs.MessageDialog; - -import org.eclipse.jface.viewers.IStructuredSelection; - -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; - -import org.eclipse.swt.SWT; - -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.ModifyEvent; - -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; - -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; - -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; - -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - -import edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.ServicebehaviorFactory; -import edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.ServicebehaviorPackage; -import edu.kit.ipd.descartes.mm.applicationlevel.provider.ApplicationlevelEditPlugin; - - -import edu.kit.ipd.descartes.mm.applicationlevel.presentation.ApplicationlevelEditorPlugin; - -import org.eclipse.core.runtime.Path; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; - -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; - - -/** - * This is a simple wizard for creating a new model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class ServicebehaviorModelWizard extends Wizard implements INewWizard { - /** - * The supported extensions for created files. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<String> FILE_EXTENSIONS = - Collections.unmodifiableList(Arrays.asList(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ServicebehaviorEditorFilenameExtensions").split("\\s*,\\s*"))); - - /** - * A formatted list of supported file extensions, suitable for display. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String FORMATTED_FILE_EXTENSIONS = - ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ServicebehaviorEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); - - /** - * This caches an instance of the model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ServicebehaviorPackage servicebehaviorPackage = ServicebehaviorPackage.eINSTANCE; - - /** - * This caches an instance of the model factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ServicebehaviorFactory servicebehaviorFactory = servicebehaviorPackage.getServicebehaviorFactory(); - - /** - * This is the file creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ServicebehaviorModelWizardNewFileCreationPage newFileCreationPage; - - /** - * This is the initial object creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ServicebehaviorModelWizardInitialObjectCreationPage initialObjectCreationPage; - - /** - * Remember the selection during initialization for populating the default container. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStructuredSelection selection; - - /** - * Remember the workbench during initialization. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IWorkbench workbench; - - /** - * Caches the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected List<String> initialObjectNames; - - /** - * This just records the information. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); - setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(ApplicationlevelEditorPlugin.INSTANCE.getImage("full/wizban/NewServicebehavior"))); - } - - /** - * Returns the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getInitialObjectNames() { - if (initialObjectNames == null) { - initialObjectNames = new ArrayList<String>(); - for (EClassifier eClassifier : servicebehaviorPackage.getEClassifiers()) { - if (eClassifier instanceof EClass) { - EClass eClass = (EClass)eClassifier; - if (!eClass.isAbstract()) { - initialObjectNames.add(eClass.getName()); - } - } - } - Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); - } - return initialObjectNames; - } - - /** - * Create a new model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObject createInitialModel() { - EClass eClass = (EClass)servicebehaviorPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); - EObject rootObject = servicebehaviorFactory.create(eClass); - return rootObject; - } - - /** - * Do the work after everything is specified. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @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<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); - resource.save(options); - } - catch (Exception exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(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(), ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); - return false; - } - - return true; - } - catch (Exception exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - return false; - } - } - - /** - * This is the one page of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class ServicebehaviorModelWizardNewFileCreationPage extends WizardNewFileCreationPage { - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ServicebehaviorModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { - super(pageId, selection); - } - - /** - * The framework calls this to see if the file is correct. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean validatePage() { - if (super.validatePage()) { - String extension = new Path(getFileName()).getFileExtension(); - if (extension == null || !FILE_EXTENSIONS.contains(extension)) { - String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; - setErrorMessage(ApplicationlevelEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); - return false; - } - return true; - } - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); - } - } - - /** - * This is the page where the type of object to create is selected. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class ServicebehaviorModelWizardInitialObjectCreationPage extends WizardPage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo initialObjectField; - - /** - * @generated - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - */ - protected List<String> encodings; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo encodingField; - - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ServicebehaviorModelWizardInitialObjectCreationPage(String pageId) { - super(pageId); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 12; - composite.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - } - - Label containerLabel = new Label(composite, SWT.LEFT); - { - containerLabel.setText(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ModelObject")); - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - containerLabel.setLayoutData(data); - } - - initialObjectField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - initialObjectField.setLayoutData(data); - } - - for (String objectName : getInitialObjectNames()) { - initialObjectField.add(getLabel(objectName)); - } - - if (initialObjectField.getItemCount() == 1) { - initialObjectField.select(0); - } - initialObjectField.addModifyListener(validator); - - Label encodingLabel = new Label(composite, SWT.LEFT); - { - encodingLabel.setText(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - encodingLabel.setLayoutData(data); - } - encodingField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - encodingField.setLayoutData(data); - } - - for (String encoding : getEncodings()) { - encodingField.add(encoding); - } - - encodingField.select(0); - encodingField.addModifyListener(validator); - - setPageComplete(validatePage()); - setControl(composite); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModifyListener validator = - new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(validatePage()); - } - }; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean validatePage() { - return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - if (initialObjectField.getItemCount() == 1) { - initialObjectField.clearSelection(); - encodingField.setFocus(); - } - else { - encodingField.clearSelection(); - initialObjectField.setFocus(); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getInitialObjectName() { - String label = initialObjectField.getText(); - - for (String name : getInitialObjectNames()) { - if (getLabel(name).equals(label)) { - return name; - } - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getEncoding() { - return encodingField.getText(); - } - - /** - * Returns the label for the specified type name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected String getLabel(String typeName) { - try { - return ApplicationlevelEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); - } - catch(MissingResourceException mre) { - ApplicationlevelEditorPlugin.INSTANCE.log(mre); - } - return typeName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getEncodings() { - if (encodings == null) { - encodings = new ArrayList<String>(); - for (StringTokenizer stringTokenizer = new StringTokenizer(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) { - encodings.add(stringTokenizer.nextToken()); - } - } - return encodings; - } - } - - /** - * The framework calls this to create the contents of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void addPages() { - // Create a page, set the title, and the initial model file name. - // - newFileCreationPage = new ServicebehaviorModelWizardNewFileCreationPage("Whatever", selection); - newFileCreationPage.setTitle(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ServicebehaviorModelWizard_label")); - newFileCreationPage.setDescription(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ServicebehaviorModelWizard_description")); - newFileCreationPage.setFileName(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ServicebehaviorEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); - addPage(newFileCreationPage); - - // Try and get the resource selection to determine a current directory for the file dialog. - // - if (selection != null && !selection.isEmpty()) { - // Get the resource... - // - Object selectedElement = selection.iterator().next(); - if (selectedElement instanceof IResource) { - // Get the resource parent, if its a file. - // - IResource selectedResource = (IResource)selectedElement; - if (selectedResource.getType() == IResource.FILE) { - selectedResource = selectedResource.getParent(); - } - - // This gives us a directory... - // - if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { - // Set this for the container. - // - newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); - - // Make up a unique new name here. - // - String defaultModelBaseFilename = ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ServicebehaviorEditorFilenameDefaultBase"); - String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); - String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; - for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { - modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; - } - newFileCreationPage.setFileName(modelFilename); - } - } - } - initialObjectCreationPage = new ServicebehaviorModelWizardInitialObjectCreationPage("Whatever2"); - initialObjectCreationPage.setTitle(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ServicebehaviorModelWizard_label")); - initialObjectCreationPage.setDescription(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); - addPage(initialObjectCreationPage); - } - - /** - * Get the file from the page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return newFileCreationPage.getModelFile(); - } - -} diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/system/presentation/SystemActionBarContributor.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/system/presentation/SystemActionBarContributor.java deleted file mode 100644 index 78ed4812..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/system/presentation/SystemActionBarContributor.java +++ /dev/null @@ -1,426 +0,0 @@ -/** - * Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - */ -package edu.kit.ipd.descartes.mm.applicationlevel.system.presentation; - -import edu.kit.ipd.descartes.mm.applicationlevel.presentation.ApplicationlevelEditorPlugin; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.emf.common.ui.viewer.IViewerProvider; - -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.domain.IEditingDomainProvider; - -import org.eclipse.emf.edit.ui.action.ControlAction; -import org.eclipse.emf.edit.ui.action.CreateChildAction; -import org.eclipse.emf.edit.ui.action.CreateSiblingAction; -import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; -import org.eclipse.emf.edit.ui.action.LoadResourceAction; -import org.eclipse.emf.edit.ui.action.ValidateAction; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IContributionItem; -import org.eclipse.jface.action.IContributionManager; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.action.SubContributionItem; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.Viewer; - -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.PartInitException; - -/** - * This is the action bar contributor for the System model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class SystemActionBarContributor - extends EditingDomainActionBarContributor - implements ISelectionChangedListener { - /** - * This keeps track of the active editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IEditorPart activeEditorPart; - - /** - * This keeps track of the current selection provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ISelectionProvider selectionProvider; - - /** - * This action opens the Properties view. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IAction showPropertiesViewAction = - new Action(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) { - @Override - public void run() { - try { - getPage().showView("org.eclipse.ui.views.PropertySheet"); - } - catch (PartInitException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - }; - - /** - * This action refreshes the viewer of the current editor if the editor - * implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IAction refreshViewerAction = - new Action(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) { - @Override - public boolean isEnabled() { - return activeEditorPart instanceof IViewerProvider; - } - - @Override - public void run() { - if (activeEditorPart instanceof IViewerProvider) { - Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer(); - if (viewer != null) { - viewer.refresh(); - } - } - } - }; - - /** - * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor - * generated for the current selection by the item provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> createChildActions; - - /** - * This is the menu manager into which menu contribution items should be added for CreateChild actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IMenuManager createChildMenuManager; - - /** - * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor - * generated for the current selection by the item provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> createSiblingActions; - - /** - * This is the menu manager into which menu contribution items should be added for CreateSibling actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IMenuManager createSiblingMenuManager; - - /** - * This creates an instance of the contributor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SystemActionBarContributor() { - super(ADDITIONS_LAST_STYLE); - loadResourceAction = new LoadResourceAction(); - validateAction = new ValidateAction(); - controlAction = new ControlAction(); - } - - /** - * This adds Separators for editor additions to the tool bar. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void contributeToToolBar(IToolBarManager toolBarManager) { - toolBarManager.add(new Separator("system-settings")); - toolBarManager.add(new Separator("system-additions")); - } - - /** - * This adds to the menu bar a menu and some separators for editor additions, - * as well as the sub-menus for object creation items. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void contributeToMenu(IMenuManager menuManager) { - super.contributeToMenu(menuManager); - - IMenuManager submenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_SystemEditor_menu"), "edu.kit.ipd.descartes.mm.applicationlevel.systemMenuID"); - menuManager.insertAfter("additions", submenuManager); - submenuManager.add(new Separator("settings")); - submenuManager.add(new Separator("actions")); - submenuManager.add(new Separator("additions")); - submenuManager.add(new Separator("additions-end")); - - // Prepare for CreateChild item addition or removal. - // - createChildMenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); - submenuManager.insertBefore("additions", createChildMenuManager); - - // Prepare for CreateSibling item addition or removal. - // - createSiblingMenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); - submenuManager.insertBefore("additions", createSiblingMenuManager); - - // Force an update because Eclipse hides empty menus now. - // - submenuManager.addMenuListener - (new IMenuListener() { - public void menuAboutToShow(IMenuManager menuManager) { - menuManager.updateAll(true); - } - }); - - addGlobalActions(submenuManager); - } - - /** - * When the active editor changes, this remembers the change and registers with it as a selection provider. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setActiveEditor(IEditorPart part) { - super.setActiveEditor(part); - activeEditorPart = part; - - // Switch to the new selection provider. - // - if (selectionProvider != null) { - selectionProvider.removeSelectionChangedListener(this); - } - if (part == null) { - selectionProvider = null; - } - else { - selectionProvider = part.getSite().getSelectionProvider(); - selectionProvider.addSelectionChangedListener(this); - - // Fake a selection changed event to update the menus. - // - if (selectionProvider.getSelection() != null) { - selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection())); - } - } - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, - * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings - * that can be added to the selected object and updating the menus accordingly. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void selectionChanged(SelectionChangedEvent event) { - // Remove any menu items for old selection. - // - if (createChildMenuManager != null) { - depopulateManager(createChildMenuManager, createChildActions); - } - if (createSiblingMenuManager != null) { - depopulateManager(createSiblingMenuManager, createSiblingActions); - } - - // Query the new selection for appropriate new child/sibling descriptors - // - Collection<?> newChildDescriptors = null; - Collection<?> newSiblingDescriptors = null; - - ISelection selection = event.getSelection(); - if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) { - Object object = ((IStructuredSelection)selection).getFirstElement(); - - EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain(); - - newChildDescriptors = domain.getNewChildDescriptors(object, null); - newSiblingDescriptors = domain.getNewChildDescriptors(null, object); - } - - // Generate actions for selection; populate and redraw the menus. - // - createChildActions = generateCreateChildActions(newChildDescriptors, selection); - createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); - - if (createChildMenuManager != null) { - populateManager(createChildMenuManager, createChildActions, null); - createChildMenuManager.update(true); - } - if (createSiblingMenuManager != null) { - populateManager(createSiblingMenuManager, createSiblingActions, null); - createSiblingMenuManager.update(true); - } - } - - /** - * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in <code>descriptors</code>, - * and returns the collection of these actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) { - Collection<IAction> actions = new ArrayList<IAction>(); - if (descriptors != null) { - for (Object descriptor : descriptors) { - actions.add(new CreateChildAction(activeEditorPart, selection, descriptor)); - } - } - return actions; - } - - /** - * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in <code>descriptors</code>, - * and returns the collection of these actions. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection) { - Collection<IAction> actions = new ArrayList<IAction>(); - if (descriptors != null) { - for (Object descriptor : descriptors) { - actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor)); - } - } - return actions; - } - - /** - * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s - * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection, - * by inserting them before the specified contribution item <code>contributionID</code>. - * If <code>contributionID</code> is <code>null</code>, they are simply added. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) { - if (actions != null) { - for (IAction action : actions) { - if (contributionID != null) { - manager.insertBefore(contributionID, action); - } - else { - manager.add(action); - } - } - } - } - - /** - * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s - * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) { - if (actions != null) { - IContributionItem[] items = manager.getItems(); - for (int i = 0; i < items.length; i++) { - // Look into SubContributionItems - // - IContributionItem contributionItem = items[i]; - while (contributionItem instanceof SubContributionItem) { - contributionItem = ((SubContributionItem)contributionItem).getInnerItem(); - } - - // Delete the ActionContributionItems with matching action. - // - if (contributionItem instanceof ActionContributionItem) { - IAction action = ((ActionContributionItem)contributionItem).getAction(); - if (actions.contains(action)) { - manager.remove(contributionItem); - } - } - } - } - } - - /** - * This populates the pop-up menu before it appears. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void menuAboutToShow(IMenuManager menuManager) { - super.menuAboutToShow(menuManager); - MenuManager submenuManager = null; - - submenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); - populateManager(submenuManager, createChildActions, null); - menuManager.insertBefore("edit", submenuManager); - - submenuManager = new MenuManager(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); - populateManager(submenuManager, createSiblingActions, null); - menuManager.insertBefore("edit", submenuManager); - } - - /** - * This inserts global actions before the "additions-end" separator. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected void addGlobalActions(IMenuManager menuManager) { - menuManager.insertAfter("additions-end", new Separator("ui-actions")); - menuManager.insertAfter("ui-actions", showPropertiesViewAction); - - refreshViewerAction.setEnabled(refreshViewerAction.isEnabled()); - menuManager.insertAfter("ui-actions", refreshViewerAction); - - super.addGlobalActions(menuManager); - } - - /** - * This ensures that a delete action will clean up all references to deleted objects. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean removeAllReferencesOnDelete() { - return true; - } - -} diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/system/presentation/SystemEditor.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/system/presentation/SystemEditor.java deleted file mode 100644 index 1c919e7f..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/system/presentation/SystemEditor.java +++ /dev/null @@ -1,1833 +0,0 @@ -/** - * Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - */ -package edu.kit.ipd.descartes.mm.applicationlevel.system.presentation; - - -import java.io.IOException; -import java.io.InputStream; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.EventObject; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -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.ResourcesPlugin; - -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.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; - -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; - -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; - -import org.eclipse.swt.SWT; - -import org.eclipse.swt.custom.CTabFolder; - -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.Transfer; - -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; - -import org.eclipse.swt.graphics.Point; - -import org.eclipse.swt.layout.FillLayout; - -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; - -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; - -import org.eclipse.ui.dialogs.SaveAsDialog; - -import org.eclipse.ui.ide.IGotoMarker; - -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.MultiPageEditorPart; - -import org.eclipse.ui.views.contentoutline.ContentOutline; -import org.eclipse.ui.views.contentoutline.ContentOutlinePage; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; - -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.PropertySheet; -import org.eclipse.ui.views.properties.PropertySheetPage; - -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CommandStack; -import org.eclipse.emf.common.command.CommandStackListener; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.common.ui.MarkerHelper; -import org.eclipse.emf.common.ui.ViewerPane; - -import org.eclipse.emf.common.ui.editor.ProblemEditorPart; - -import org.eclipse.emf.common.ui.viewer.IViewerProvider; - -import org.eclipse.emf.common.util.BasicDiagnostic; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EValidator; - -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; - -import org.eclipse.emf.ecore.util.EContentAdapter; -import org.eclipse.emf.ecore.util.EcoreUtil; - -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.domain.IEditingDomainProvider; - -import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; - -import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; - -import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; - -import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; - -import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; -import org.eclipse.emf.edit.ui.dnd.LocalTransfer; -import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; - -import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; -import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; - -import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; -import org.eclipse.emf.edit.ui.util.EditUIUtil; - -import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; - -import edu.kit.ipd.descartes.mm.applicationlevel.system.provider.SystemItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.core.provider.CoreItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.identifier.provider.IdentifierItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.functions.provider.FunctionsItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.provider.ParameterdependenciesItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.presentation.ApplicationlevelEditorPlugin; - -import edu.kit.ipd.descartes.mm.applicationlevel.repository.provider.RepositoryItemProviderAdapterFactory; - -import edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.provider.ServicebehaviorItemProviderAdapterFactory; - -import org.eclipse.ui.actions.WorkspaceModifyOperation; - - -/** - * This is an example of a System model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class SystemEditor - extends MultiPageEditorPart - implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { - /** - * This keeps track of the editing domain that is used to track all changes to the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected AdapterFactoryEditingDomain editingDomain; - - /** - * This is the one adapter factory used for providing views of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ComposedAdapterFactory adapterFactory; - - /** - * This is the content outline page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IContentOutlinePage contentOutlinePage; - - /** - * This is a kludge... - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStatusLineManager contentOutlineStatusLineManager; - - /** - * This is the content outline page's viewer. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer contentOutlineViewer; - - /** - * This is the property sheet page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected PropertySheetPage propertySheetPage; - - /** - * This is the viewer that shadows the selection in the content outline. - * The parent relation must be correctly defined for this to work. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer selectionViewer; - - /** - * This inverts the roll of parent and child in the content provider and show parents as a tree. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer parentViewer; - - /** - * This shows how a tree view works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewer; - - /** - * This shows how a list view works. - * A list viewer doesn't support icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListViewer listViewer; - - /** - * This shows how a table view works. - * A table can be used as a list with icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TableViewer tableViewer; - - /** - * This shows how a tree view with columns works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewerWithColumns; - - /** - * This keeps track of the active viewer pane, in the book. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ViewerPane currentViewerPane; - - /** - * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Viewer currentViewer; - - /** - * This listens to which ever viewer is active. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ISelectionChangedListener selectionChangedListener; - - /** - * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>(); - - /** - * This keeps track of the selection of the editor as a whole. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ISelection editorSelection = StructuredSelection.EMPTY; - - /** - * The MarkerHelper is responsible for creating workspace resource markers presented - * in Eclipse's Problems View. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected MarkerHelper markerHelper = new EditUIMarkerHelper(); - - /** - * This listens for when the outline becomes active - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IPartListener partListener = - new IPartListener() { - public void partActivated(IWorkbenchPart p) { - if (p instanceof ContentOutline) { - if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { - getActionBarContributor().setActiveEditor(SystemEditor.this); - - setCurrentViewer(contentOutlineViewer); - } - } - else if (p instanceof PropertySheet) { - if (((PropertySheet)p).getCurrentPage() == propertySheetPage) { - getActionBarContributor().setActiveEditor(SystemEditor.this); - handleActivate(); - } - } - else if (p == SystemEditor.this) { - handleActivate(); - } - } - public void partBroughtToTop(IWorkbenchPart p) { - // Ignore. - } - public void partClosed(IWorkbenchPart p) { - // Ignore. - } - public void partDeactivated(IWorkbenchPart p) { - // Ignore. - } - public void partOpened(IWorkbenchPart p) { - // Ignore. - } - }; - - /** - * Resources that have been removed since last activation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<Resource> removedResources = new ArrayList<Resource>(); - - /** - * Resources that have been changed since last activation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<Resource> changedResources = new ArrayList<Resource>(); - - /** - * Resources that have been saved. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<Resource> savedResources = new ArrayList<Resource>(); - - /** - * Map to store the diagnostic associated with a resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>(); - - /** - * Controls whether the problem indication should be updated. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean updateProblemIndication = true; - - /** - * Adapter used to update the problem indication when resources are demanded loaded. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EContentAdapter problemIndicationAdapter = - new EContentAdapter() { - @Override - public void notifyChanged(Notification notification) { - if (notification.getNotifier() instanceof Resource) { - switch (notification.getFeatureID(Resource.class)) { - case Resource.RESOURCE__IS_LOADED: - case Resource.RESOURCE__ERRORS: - case Resource.RESOURCE__WARNINGS: { - Resource resource = (Resource)notification.getNotifier(); - Diagnostic diagnostic = analyzeResourceProblems(resource, null); - if (diagnostic.getSeverity() != Diagnostic.OK) { - resourceToDiagnosticMap.put(resource, diagnostic); - } - else { - resourceToDiagnosticMap.remove(resource); - } - - if (updateProblemIndication) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - updateProblemIndication(); - } - }); - } - break; - } - } - } - else { - super.notifyChanged(notification); - } - } - - @Override - protected void setTarget(Resource target) { - basicSetTarget(target); - } - - @Override - protected void unsetTarget(Resource target) { - basicUnsetTarget(target); - } - }; - - /** - * This listens for workspace changes. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IResourceChangeListener resourceChangeListener = - new IResourceChangeListener() { - public void resourceChanged(IResourceChangeEvent event) { - IResourceDelta delta = event.getDelta(); - try { - class ResourceDeltaVisitor implements IResourceDeltaVisitor { - protected ResourceSet resourceSet = editingDomain.getResourceSet(); - protected Collection<Resource> changedResources = new ArrayList<Resource>(); - protected Collection<Resource> removedResources = new ArrayList<Resource>(); - - public boolean visit(IResourceDelta delta) { - if (delta.getResource().getType() == IResource.FILE) { - if (delta.getKind() == IResourceDelta.REMOVED || - delta.getKind() == IResourceDelta.CHANGED && delta.getFlags() != IResourceDelta.MARKERS) { - Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false); - if (resource != null) { - if (delta.getKind() == IResourceDelta.REMOVED) { - removedResources.add(resource); - } - else if (!savedResources.remove(resource)) { - changedResources.add(resource); - } - } - } - } - - return true; - } - - public Collection<Resource> getChangedResources() { - return changedResources; - } - - public Collection<Resource> getRemovedResources() { - return removedResources; - } - } - - final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(); - delta.accept(visitor); - - if (!visitor.getRemovedResources().isEmpty()) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - removedResources.addAll(visitor.getRemovedResources()); - if (!isDirty()) { - getSite().getPage().closeEditor(SystemEditor.this, false); - } - } - }); - } - - if (!visitor.getChangedResources().isEmpty()) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - changedResources.addAll(visitor.getChangedResources()); - if (getSite().getPage().getActiveEditor() == SystemEditor.this) { - handleActivate(); - } - } - }); - } - } - catch (CoreException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - }; - - /** - * Handles activation of the editor or it's associated views. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void handleActivate() { - // Recompute the read only state. - // - if (editingDomain.getResourceToReadOnlyMap() != null) { - editingDomain.getResourceToReadOnlyMap().clear(); - - // Refresh any actions that may become enabled or disabled. - // - setSelection(getSelection()); - } - - if (!removedResources.isEmpty()) { - if (handleDirtyConflict()) { - getSite().getPage().closeEditor(SystemEditor.this, false); - } - else { - removedResources.clear(); - changedResources.clear(); - savedResources.clear(); - } - } - else if (!changedResources.isEmpty()) { - changedResources.removeAll(savedResources); - handleChangedResources(); - changedResources.clear(); - savedResources.clear(); - } - } - - /** - * Handles what to do with changed resources on activation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void handleChangedResources() { - if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) { - if (isDirty()) { - changedResources.addAll(editingDomain.getResourceSet().getResources()); - } - editingDomain.getCommandStack().flush(); - - updateProblemIndication = false; - for (Resource resource : changedResources) { - if (resource.isLoaded()) { - resource.unload(); - try { - resource.load(Collections.EMPTY_MAP); - } - catch (IOException exception) { - if (!resourceToDiagnosticMap.containsKey(resource)) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - } - } - } - - if (AdapterFactoryEditingDomain.isStale(editorSelection)) { - setSelection(StructuredSelection.EMPTY); - } - - updateProblemIndication = true; - updateProblemIndication(); - } - } - - /** - * Updates the problems indication with the information described in the specified diagnostic. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void updateProblemIndication() { - if (updateProblemIndication) { - BasicDiagnostic diagnostic = - new BasicDiagnostic - (Diagnostic.OK, - "edu.kit.ipd.descartes.mm.applicationlevel.editor", - 0, - null, - new Object [] { editingDomain.getResourceSet() }); - for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) { - if (childDiagnostic.getSeverity() != Diagnostic.OK) { - diagnostic.add(childDiagnostic); - } - } - - int lastEditorPage = getPageCount() - 1; - if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) { - ((ProblemEditorPart)getEditor(lastEditorPage)).setDiagnostic(diagnostic); - if (diagnostic.getSeverity() != Diagnostic.OK) { - setActivePage(lastEditorPage); - } - } - else if (diagnostic.getSeverity() != Diagnostic.OK) { - ProblemEditorPart problemEditorPart = new ProblemEditorPart(); - problemEditorPart.setDiagnostic(diagnostic); - problemEditorPart.setMarkerHelper(markerHelper); - try { - addPage(++lastEditorPage, problemEditorPart, getEditorInput()); - setPageText(lastEditorPage, problemEditorPart.getPartName()); - setActivePage(lastEditorPage); - showTabs(); - } - catch (PartInitException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - - if (markerHelper.hasMarkers(editingDomain.getResourceSet())) { - markerHelper.deleteMarkers(editingDomain.getResourceSet()); - if (diagnostic.getSeverity() != Diagnostic.OK) { - try { - markerHelper.createMarkers(diagnostic); - } - catch (CoreException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - } - } - } - - /** - * Shows a dialog that asks if conflicting changes should be discarded. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean handleDirtyConflict() { - return - MessageDialog.openQuestion - (getSite().getShell(), - getString("_UI_FileConflict_label"), - getString("_WARN_FileConflict")); - } - - /** - * This creates a model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SystemEditor() { - super(); - initializeEditingDomain(); - } - - /** - * This sets up the editing domain for the model editor. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void initializeEditingDomain() { - // Create an adapter factory that yields item providers. - // - adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - - adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new FunctionsItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new ParameterdependenciesItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new RepositoryItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new ServicebehaviorItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new SystemItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new CoreItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new IdentifierItemProviderAdapterFactory()); - adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); - - // Create the command stack that will notify this editor as commands are executed. - // - BasicCommandStack commandStack = new BasicCommandStack(); - - // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus. - // - commandStack.addCommandStackListener - (new CommandStackListener() { - public void commandStackChanged(final EventObject event) { - getContainer().getDisplay().asyncExec - (new Runnable() { - public void run() { - firePropertyChange(IEditorPart.PROP_DIRTY); - - // Try to select the affected objects. - // - Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand(); - if (mostRecentCommand != null) { - setSelectionToViewer(mostRecentCommand.getAffectedObjects()); - } - if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) { - propertySheetPage.refresh(); - } - } - }); - } - }); - - // Create the editing domain with a special command stack. - // - editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>()); - } - - /** - * This is here for the listener to be able to call it. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected void firePropertyChange(int action) { - super.firePropertyChange(action); - } - - /** - * This sets the selection into whichever viewer is active. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSelectionToViewer(Collection<?> collection) { - final Collection<?> theSelection = collection; - // Make sure it's okay. - // - if (theSelection != null && !theSelection.isEmpty()) { - Runnable runnable = - new Runnable() { - public void run() { - // Try to select the items in the current content viewer of the editor. - // - if (currentViewer != null) { - currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true); - } - } - }; - getSite().getShell().getDisplay().asyncExec(runnable); - } - } - - /** - * This returns the editing domain as required by the {@link IEditingDomainProvider} interface. - * This is important for implementing the static methods of {@link AdapterFactoryEditingDomain} - * and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EditingDomain getEditingDomain() { - return editingDomain; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object [] getElements(Object object) { - Object parent = super.getParent(object); - return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object [] getChildren(Object object) { - Object parent = super.getParent(object); - return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean hasChildren(Object object) { - Object parent = super.getParent(object); - return parent != null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object getParent(Object object) { - return null; - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewerPane(ViewerPane viewerPane) { - if (currentViewerPane != viewerPane) { - if (currentViewerPane != null) { - currentViewerPane.showFocus(false); - } - currentViewerPane = viewerPane; - } - setCurrentViewer(currentViewerPane.getViewer()); - } - - /** - * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, - * is the current one. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewer(Viewer viewer) { - // If it is changing... - // - if (currentViewer != viewer) { - if (selectionChangedListener == null) { - // Create the listener on demand. - // - selectionChangedListener = - new ISelectionChangedListener() { - // This just notifies those things that are affected by the section. - // - public void selectionChanged(SelectionChangedEvent selectionChangedEvent) { - setSelection(selectionChangedEvent.getSelection()); - } - }; - } - - // Stop listening to the old one. - // - if (currentViewer != null) { - currentViewer.removeSelectionChangedListener(selectionChangedListener); - } - - // Start listening to the new one. - // - if (viewer != null) { - viewer.addSelectionChangedListener(selectionChangedListener); - } - - // Remember it. - // - currentViewer = viewer; - - // Set the editors selection based on the current viewer's selection. - // - setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection()); - } - } - - /** - * This returns the viewer as required by the {@link IViewerProvider} interface. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Viewer getViewer() { - return currentViewer; - } - - /** - * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createContextMenuFor(StructuredViewer viewer) { - MenuManager contextMenu = new MenuManager("#PopUp"); - contextMenu.add(new Separator("additions")); - contextMenu.setRemoveAllWhenShown(true); - contextMenu.addMenuListener(this); - Menu menu= contextMenu.createContextMenu(viewer.getControl()); - viewer.getControl().setMenu(menu); - getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); - - int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; - Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() }; - viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); - viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); - } - - /** - * This is the method called to load a resource into the editing domain's resource set based on the editor's input. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createModel() { - URI resourceURI = EditUIUtil.getURI(getEditorInput()); - Exception exception = null; - Resource resource = null; - try { - // Load the resource through the editing domain. - // - resource = editingDomain.getResourceSet().getResource(resourceURI, true); - } - catch (Exception e) { - exception = e; - resource = editingDomain.getResourceSet().getResource(resourceURI, false); - } - - Diagnostic diagnostic = analyzeResourceProblems(resource, exception); - if (diagnostic.getSeverity() != Diagnostic.OK) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter); - } - - /** - * Returns a diagnostic describing the errors and warnings listed in the resource - * and the specified exception (if any). - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) { - if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) { - BasicDiagnostic basicDiagnostic = - new BasicDiagnostic - (Diagnostic.ERROR, - "edu.kit.ipd.descartes.mm.applicationlevel.editor", - 0, - getString("_UI_CreateModelError_message", resource.getURI()), - new Object [] { exception == null ? (Object)resource : exception }); - basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); - return basicDiagnostic; - } - else if (exception != null) { - return - new BasicDiagnostic - (Diagnostic.ERROR, - "edu.kit.ipd.descartes.mm.applicationlevel.editor", - 0, - getString("_UI_CreateModelError_message", resource.getURI()), - new Object[] { exception }); - } - else { - return Diagnostic.OK_INSTANCE; - } - } - - /** - * This is the method used by the framework to install your own controls. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void createPages() { - // Creates the model from the editor input - // - createModel(); - - // Only creates the other pages if there is something that can be edited - // - if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { - // Create a page for the selection tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), SystemEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - selectionViewer = (TreeViewer)viewerPane.getViewer(); - selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - - selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - selectionViewer.setInput(editingDomain.getResourceSet()); - selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - viewerPane.setTitle(editingDomain.getResourceSet()); - - new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - - createContextMenuFor(selectionViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_SelectionPage_label")); - } - - // Create a page for the parent tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), SystemEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - parentViewer = (TreeViewer)viewerPane.getViewer(); - parentViewer.setAutoExpandLevel(30); - parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); - parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(parentViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ParentPage_label")); - } - - // This is the page for the list viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), SystemEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new ListViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - listViewer = (ListViewer)viewerPane.getViewer(); - listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(listViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ListPage_label")); - } - - // This is the page for the tree viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), SystemEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - treeViewer = (TreeViewer)viewerPane.getViewer(); - treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); - - createContextMenuFor(treeViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreePage_label")); - } - - // This is the page for the table viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), SystemEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TableViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - tableViewer = (TableViewer)viewerPane.getViewer(); - - Table table = tableViewer.getTable(); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableColumn objectColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(3, 100, true)); - objectColumn.setText(getString("_UI_ObjectColumn_label")); - objectColumn.setResizable(true); - - TableColumn selfColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(2, 100, true)); - selfColumn.setText(getString("_UI_SelfColumn_label")); - selfColumn.setResizable(true); - - tableViewer.setColumnProperties(new String [] {"a", "b"}); - tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(tableViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TablePage_label")); - } - - // This is the page for the table tree viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), SystemEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); - - Tree tree = treeViewerWithColumns.getTree(); - tree.setLayoutData(new FillLayout()); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); - - TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); - objectColumn.setText(getString("_UI_ObjectColumn_label")); - objectColumn.setResizable(true); - objectColumn.setWidth(250); - - TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); - selfColumn.setText(getString("_UI_SelfColumn_label")); - selfColumn.setResizable(true); - selfColumn.setWidth(200); - - treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); - treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(treeViewerWithColumns); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); - } - - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - setActivePage(0); - } - }); - } - - // Ensures that this editor will only display the page's tab - // area if there are more than one page - // - getContainer().addControlListener - (new ControlAdapter() { - boolean guard = false; - @Override - public void controlResized(ControlEvent event) { - if (!guard) { - guard = true; - hideTabs(); - guard = false; - } - } - }); - - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - updateProblemIndication(); - } - }); - } - - /** - * If there is just one page in the multi-page editor part, - * this hides the single tab at the bottom. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void hideTabs() { - if (getPageCount() <= 1) { - setPageText(0, ""); - if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(1); - Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y + 6); - } - } - } - - /** - * If there is more than one page in the multi-page editor part, - * this shows the tabs at the bottom. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void showTabs() { - if (getPageCount() > 1) { - setPageText(0, getString("_UI_SelectionPage_label")); - if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); - Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y - 6); - } - } - } - - /** - * This is used to track the active viewer. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected void pageChange(int pageIndex) { - super.pageChange(pageIndex); - - if (contentOutlinePage != null) { - handleContentOutlineSelection(contentOutlinePage.getSelection()); - } - } - - /** - * This is how the framework determines which interfaces we implement. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("rawtypes") - @Override - public Object getAdapter(Class key) { - if (key.equals(IContentOutlinePage.class)) { - return showOutlineView() ? getContentOutlinePage() : null; - } - else if (key.equals(IPropertySheetPage.class)) { - return getPropertySheetPage(); - } - else if (key.equals(IGotoMarker.class)) { - return this; - } - else { - return super.getAdapter(key); - } - } - - /** - * This accesses a cached version of the content outliner. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IContentOutlinePage getContentOutlinePage() { - if (contentOutlinePage == null) { - // The content outline is just a tree. - // - class MyContentOutlinePage extends ContentOutlinePage { - @Override - public void createControl(Composite parent) { - super.createControl(parent); - contentOutlineViewer = getTreeViewer(); - contentOutlineViewer.addSelectionChangedListener(this); - - // Set up the tree viewer. - // - contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - contentOutlineViewer.setInput(editingDomain.getResourceSet()); - - // Make sure our popups work. - // - createContextMenuFor(contentOutlineViewer); - - if (!editingDomain.getResourceSet().getResources().isEmpty()) { - // Select the root object in the view. - // - contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - } - } - - @Override - public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) { - super.makeContributions(menuManager, toolBarManager, statusLineManager); - contentOutlineStatusLineManager = statusLineManager; - } - - @Override - public void setActionBars(IActionBars actionBars) { - super.setActionBars(actionBars); - getActionBarContributor().shareGlobalActions(this, actionBars); - } - } - - contentOutlinePage = new MyContentOutlinePage(); - - // Listen to selection so that we can handle it is a special way. - // - contentOutlinePage.addSelectionChangedListener - (new ISelectionChangedListener() { - // This ensures that we handle selections correctly. - // - public void selectionChanged(SelectionChangedEvent event) { - handleContentOutlineSelection(event.getSelection()); - } - }); - } - - return contentOutlinePage; - } - - /** - * This accesses a cached version of the property sheet. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IPropertySheetPage getPropertySheetPage() { - if (propertySheetPage == null) { - propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { - @Override - public void setSelectionToViewer(List<?> selection) { - SystemEditor.this.setSelectionToViewer(selection); - SystemEditor.this.setFocus(); - } - - @Override - public void setActionBars(IActionBars actionBars) { - super.setActionBars(actionBars); - getActionBarContributor().shareGlobalActions(this, actionBars); - } - }; - propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); - } - - return propertySheetPage; - } - - /** - * This deals with how we want selection in the outliner to affect the other views. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void handleContentOutlineSelection(ISelection selection) { - if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { - Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); - if (selectedElements.hasNext()) { - // Get the first selected element. - // - Object selectedElement = selectedElements.next(); - - // If it's the selection viewer, then we want it to select the same selection as this selection. - // - if (currentViewerPane.getViewer() == selectionViewer) { - ArrayList<Object> selectionList = new ArrayList<Object>(); - selectionList.add(selectedElement); - while (selectedElements.hasNext()) { - selectionList.add(selectedElements.next()); - } - - // Set the selection to the widget. - // - selectionViewer.setSelection(new StructuredSelection(selectionList)); - } - else { - // Set the input to the widget. - // - if (currentViewerPane.getViewer().getInput() != selectedElement) { - currentViewerPane.getViewer().setInput(selectedElement); - currentViewerPane.setTitle(selectedElement); - } - } - } - } - } - - /** - * This is for implementing {@link IEditorPart} and simply tests the command stack. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean isDirty() { - return ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded(); - } - - /** - * This is for implementing {@link IEditorPart} and simply saves the model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void doSave(IProgressMonitor progressMonitor) { - // Save only resources that have actually changed. - // - final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); - saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - - // Do the work within an operation because this is a long running activity that modifies the workbench. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - // This is the method that gets invoked when the operation runs. - // - @Override - public void execute(IProgressMonitor monitor) { - // Save the resources to the file system. - // - boolean first = true; - for (Resource resource : editingDomain.getResourceSet().getResources()) { - if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) { - try { - long timeStamp = resource.getTimeStamp(); - resource.save(saveOptions); - if (resource.getTimeStamp() != timeStamp) { - savedResources.add(resource); - } - } - catch (Exception exception) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - first = false; - } - } - } - }; - - updateProblemIndication = false; - try { - // This runs the options, and shows progress. - // - new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); - - // Refresh the necessary state. - // - ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone(); - firePropertyChange(IEditorPart.PROP_DIRTY); - } - catch (Exception exception) { - // Something went wrong that shouldn't. - // - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - updateProblemIndication = true; - updateProblemIndication(); - } - - /** - * This returns whether something has been persisted to the URI of the specified resource. - * The implementation uses the URI converter from the editor's resource set to try to open an input stream. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean isPersisted(Resource resource) { - boolean result = false; - try { - InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI()); - if (stream != null) { - result = true; - stream.close(); - } - } - catch (IOException e) { - // Ignore - } - return result; - } - - /** - * This always returns true because it is not currently supported. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean isSaveAsAllowed() { - return true; - } - - /** - * This also changes the editor's input. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void doSaveAs() { - SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell()); - saveAsDialog.open(); - IPath path = saveAsDialog.getResult(); - if (path != null) { - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); - if (file != null) { - doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file)); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void doSaveAs(URI uri, IEditorInput editorInput) { - (editingDomain.getResourceSet().getResources().get(0)).setURI(uri); - setInputWithNotify(editorInput); - setPartName(editorInput.getName()); - IProgressMonitor progressMonitor = - getActionBars().getStatusLineManager() != null ? - getActionBars().getStatusLineManager().getProgressMonitor() : - new NullProgressMonitor(); - doSave(progressMonitor); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void gotoMarker(IMarker marker) { - try { - if (marker.getType().equals(EValidator.MARKER)) { - String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null); - if (uriAttribute != null) { - URI uri = URI.createURI(uriAttribute); - EObject eObject = editingDomain.getResourceSet().getEObject(uri, true); - if (eObject != null) { - setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject))); - } - } - } - } - catch (CoreException exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - } - } - - /** - * This is called during startup. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void init(IEditorSite site, IEditorInput editorInput) { - setSite(site); - setInputWithNotify(editorInput); - setPartName(editorInput.getName()); - site.setSelectionProvider(this); - site.getPage().addPartListener(partListener); - ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setFocus() { - if (currentViewerPane != null) { - currentViewerPane.setFocus(); - } - else { - getControl(getActivePage()).setFocus(); - } - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void addSelectionChangedListener(ISelectionChangedListener listener) { - selectionChangedListeners.add(listener); - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void removeSelectionChangedListener(ISelectionChangedListener listener) { - selectionChangedListeners.remove(listener); - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ISelection getSelection() { - return editorSelection; - } - - /** - * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection. - * Calling this result will notify the listeners. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSelection(ISelection selection) { - editorSelection = selection; - - for (ISelectionChangedListener listener : selectionChangedListeners) { - listener.selectionChanged(new SelectionChangedEvent(this, selection)); - } - setStatusLineManager(selection); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setStatusLineManager(ISelection selection) { - IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? - contentOutlineStatusLineManager : getActionBars().getStatusLineManager(); - - if (statusLineManager != null) { - if (selection instanceof IStructuredSelection) { - Collection<?> collection = ((IStructuredSelection)selection).toList(); - switch (collection.size()) { - case 0: { - statusLineManager.setMessage(getString("_UI_NoObjectSelected")); - break; - } - case 1: { - String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next()); - statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text)); - break; - } - default: { - statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size()))); - break; - } - } - } - else { - statusLineManager.setMessage(""); - } - } - } - - /** - * This looks up a string in the plugin's plugin.properties file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static String getString(String key) { - return ApplicationlevelEditorPlugin.INSTANCE.getString(key); - } - - /** - * This looks up a string in plugin.properties, making a substitution. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static String getString(String key, Object s1) { - return ApplicationlevelEditorPlugin.INSTANCE.getString(key, new Object [] { s1 }); - } - - /** - * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void menuAboutToShow(IMenuManager menuManager) { - ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EditingDomainActionBarContributor getActionBarContributor() { - return (EditingDomainActionBarContributor)getEditorSite().getActionBarContributor(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IActionBars getActionBars() { - return getActionBarContributor().getActionBars(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public AdapterFactory getAdapterFactory() { - return adapterFactory; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void dispose() { - updateProblemIndication = false; - - ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener); - - getSite().getPage().removePartListener(partListener); - - adapterFactory.dispose(); - - if (getActionBarContributor().getActiveEditor() == this) { - getActionBarContributor().setActiveEditor(null); - } - - if (propertySheetPage != null) { - propertySheetPage.dispose(); - } - - if (contentOutlinePage != null) { - contentOutlinePage.dispose(); - } - - super.dispose(); - } - - /** - * Returns whether the outline view should be presented to the user. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean showOutlineView() { - return true; - } -} diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/system/presentation/SystemModelWizard.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/system/presentation/SystemModelWizard.java deleted file mode 100644 index 5aa9b889..00000000 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/system/presentation/SystemModelWizard.java +++ /dev/null @@ -1,630 +0,0 @@ -/** - * Copyright 2009-2012, Descartes Research Group, SDQ, IPD, KIT - */ -package edu.kit.ipd.descartes.mm.applicationlevel.system.presentation; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.StringTokenizer; - -import org.eclipse.emf.common.CommonPlugin; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; - -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.EObject; - -import org.eclipse.emf.ecore.xmi.XMLResource; - -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; - -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.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; - -import org.eclipse.core.runtime.IProgressMonitor; - -import org.eclipse.jface.dialogs.MessageDialog; - -import org.eclipse.jface.viewers.IStructuredSelection; - -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; - -import org.eclipse.swt.SWT; - -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.ModifyEvent; - -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; - -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; - -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; - -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - -import edu.kit.ipd.descartes.mm.applicationlevel.system.SystemFactory; -import edu.kit.ipd.descartes.mm.applicationlevel.system.SystemPackage; -import edu.kit.ipd.descartes.mm.applicationlevel.provider.ApplicationlevelEditPlugin; - - -import edu.kit.ipd.descartes.mm.applicationlevel.presentation.ApplicationlevelEditorPlugin; - -import org.eclipse.core.runtime.Path; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; - -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; - - -/** - * This is a simple wizard for creating a new model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class SystemModelWizard extends Wizard implements INewWizard { - /** - * The supported extensions for created files. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<String> FILE_EXTENSIONS = - Collections.unmodifiableList(Arrays.asList(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_SystemEditorFilenameExtensions").split("\\s*,\\s*"))); - - /** - * A formatted list of supported file extensions, suitable for display. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String FORMATTED_FILE_EXTENSIONS = - ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_SystemEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); - - /** - * This caches an instance of the model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected SystemPackage systemPackage = SystemPackage.eINSTANCE; - - /** - * This caches an instance of the model factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected SystemFactory systemFactory = systemPackage.getSystemFactory(); - - /** - * This is the file creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected SystemModelWizardNewFileCreationPage newFileCreationPage; - - /** - * This is the initial object creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected SystemModelWizardInitialObjectCreationPage initialObjectCreationPage; - - /** - * Remember the selection during initialization for populating the default container. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStructuredSelection selection; - - /** - * Remember the workbench during initialization. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IWorkbench workbench; - - /** - * Caches the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected List<String> initialObjectNames; - - /** - * This just records the information. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); - setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(ApplicationlevelEditorPlugin.INSTANCE.getImage("full/wizban/NewSystem"))); - } - - /** - * Returns the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getInitialObjectNames() { - if (initialObjectNames == null) { - initialObjectNames = new ArrayList<String>(); - for (EClassifier eClassifier : systemPackage.getEClassifiers()) { - if (eClassifier instanceof EClass) { - EClass eClass = (EClass)eClassifier; - if (!eClass.isAbstract()) { - initialObjectNames.add(eClass.getName()); - } - } - } - Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); - } - return initialObjectNames; - } - - /** - * Create a new model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObject createInitialModel() { - EClass eClass = (EClass)systemPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); - EObject rootObject = systemFactory.create(eClass); - return rootObject; - } - - /** - * Do the work after everything is specified. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @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<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); - resource.save(options); - } - catch (Exception exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(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(), ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); - return false; - } - - return true; - } - catch (Exception exception) { - ApplicationlevelEditorPlugin.INSTANCE.log(exception); - return false; - } - } - - /** - * This is the one page of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class SystemModelWizardNewFileCreationPage extends WizardNewFileCreationPage { - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SystemModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { - super(pageId, selection); - } - - /** - * The framework calls this to see if the file is correct. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean validatePage() { - if (super.validatePage()) { - String extension = new Path(getFileName()).getFileExtension(); - if (extension == null || !FILE_EXTENSIONS.contains(extension)) { - String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; - setErrorMessage(ApplicationlevelEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); - return false; - } - return true; - } - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); - } - } - - /** - * This is the page where the type of object to create is selected. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class SystemModelWizardInitialObjectCreationPage extends WizardPage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo initialObjectField; - - /** - * @generated - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - */ - protected List<String> encodings; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo encodingField; - - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SystemModelWizardInitialObjectCreationPage(String pageId) { - super(pageId); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 12; - composite.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - } - - Label containerLabel = new Label(composite, SWT.LEFT); - { - containerLabel.setText(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_ModelObject")); - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - containerLabel.setLayoutData(data); - } - - initialObjectField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - initialObjectField.setLayoutData(data); - } - - for (String objectName : getInitialObjectNames()) { - initialObjectField.add(getLabel(objectName)); - } - - if (initialObjectField.getItemCount() == 1) { - initialObjectField.select(0); - } - initialObjectField.addModifyListener(validator); - - Label encodingLabel = new Label(composite, SWT.LEFT); - { - encodingLabel.setText(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - encodingLabel.setLayoutData(data); - } - encodingField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - encodingField.setLayoutData(data); - } - - for (String encoding : getEncodings()) { - encodingField.add(encoding); - } - - encodingField.select(0); - encodingField.addModifyListener(validator); - - setPageComplete(validatePage()); - setControl(composite); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModifyListener validator = - new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(validatePage()); - } - }; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean validatePage() { - return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - if (initialObjectField.getItemCount() == 1) { - initialObjectField.clearSelection(); - encodingField.setFocus(); - } - else { - encodingField.clearSelection(); - initialObjectField.setFocus(); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getInitialObjectName() { - String label = initialObjectField.getText(); - - for (String name : getInitialObjectNames()) { - if (getLabel(name).equals(label)) { - return name; - } - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getEncoding() { - return encodingField.getText(); - } - - /** - * Returns the label for the specified type name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected String getLabel(String typeName) { - try { - return ApplicationlevelEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); - } - catch(MissingResourceException mre) { - ApplicationlevelEditorPlugin.INSTANCE.log(mre); - } - return typeName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getEncodings() { - if (encodings == null) { - encodings = new ArrayList<String>(); - for (StringTokenizer stringTokenizer = new StringTokenizer(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) { - encodings.add(stringTokenizer.nextToken()); - } - } - return encodings; - } - } - - /** - * The framework calls this to create the contents of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void addPages() { - // Create a page, set the title, and the initial model file name. - // - newFileCreationPage = new SystemModelWizardNewFileCreationPage("Whatever", selection); - newFileCreationPage.setTitle(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_SystemModelWizard_label")); - newFileCreationPage.setDescription(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_SystemModelWizard_description")); - newFileCreationPage.setFileName(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_SystemEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); - addPage(newFileCreationPage); - - // Try and get the resource selection to determine a current directory for the file dialog. - // - if (selection != null && !selection.isEmpty()) { - // Get the resource... - // - Object selectedElement = selection.iterator().next(); - if (selectedElement instanceof IResource) { - // Get the resource parent, if its a file. - // - IResource selectedResource = (IResource)selectedElement; - if (selectedResource.getType() == IResource.FILE) { - selectedResource = selectedResource.getParent(); - } - - // This gives us a directory... - // - if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { - // Set this for the container. - // - newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); - - // Make up a unique new name here. - // - String defaultModelBaseFilename = ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_SystemEditorFilenameDefaultBase"); - String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); - String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; - for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { - modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; - } - newFileCreationPage.setFileName(modelFilename); - } - } - } - initialObjectCreationPage = new SystemModelWizardInitialObjectCreationPage("Whatever2"); - initialObjectCreationPage.setTitle(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_SystemModelWizard_label")); - initialObjectCreationPage.setDescription(ApplicationlevelEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); - addPage(initialObjectCreationPage); - } - - /** - * Get the file from the page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return newFileCreationPage.getModelFile(); - } - -} -- GitLab