From d44f8af60a9ceccbde557def42cc10a967f9c5dd Mon Sep 17 00:00:00 2001 From: Marc SAINT-PIERRE Date: Fri, 24 Oct 2025 17:50:36 +0200 Subject: [PATCH 1/4] Provide the new adapter spy Fixes : https://github.com/eclipse-pde/eclipse.pde/issues/2005 --- ui/org.eclipse.pde.spy.adapter/.classpath | 7 + ui/org.eclipse.pde.spy.adapter/.project | 28 ++ .../.settings/org.eclipse.jdt.core.prefs | 9 + .../META-INF/MANIFEST.MF | 22 + .../OSGI-INF/l10n/bundle.properties | 3 + ui/org.eclipse.pde.spy.adapter/about.html | 31 ++ .../build.properties | 8 + .../icons/ext_point_obj.png | Bin 0 -> 385 bytes .../icons/ext_point_obj@2x.png | Bin 0 -> 8296 bytes .../icons/from_type.png | Bin 0 -> 628 bytes .../icons/innerinterface_public_obj.png | Bin 0 -> 603 bytes ui/org.eclipse.pde.spy.adapter/icons/osgi.png | Bin 0 -> 470 bytes .../icons/to_type.png | Bin 0 -> 409 bytes ui/org.eclipse.pde.spy.adapter/notice.html | 108 ++++ ui/org.eclipse.pde.spy.adapter/plugin.xml | 15 + ui/org.eclipse.pde.spy.adapter/pom.xml | 16 + .../pde/spy/adapter/AdapterSpyPart.java | 401 +++++++++++++++ .../org/eclipse/pde/spy/adapter/Messages.java | 41 ++ .../pde/spy/adapter/Messages.properties | 25 + .../spy/adapter/hook/EclipseAdapterHook.java | 28 ++ .../pde/spy/adapter/model/AdapterData.java | 464 ++++++++++++++++++ .../spy/adapter/model/AdapterElementType.java | 20 + .../spy/adapter/model/AdapterRepository.java | 120 +++++ .../pde/spy/adapter/tools/AdapterHelper.java | 149 ++++++ .../viewer/AdapterContentProvider.java | 144 ++++++ .../adapter/viewer/AdapterDataComparator.java | 57 +++ .../pde/spy/adapter/viewer/AdapterFilter.java | 90 ++++ .../viewer/ColumnLabelProviderCustom.java | 12 + .../ColumnViewerToolTipSupportCustom.java | 76 +++ .../pde/spy/adapter/viewer/FilterData.java | 88 ++++ 30 files changed, 1962 insertions(+) create mode 100644 ui/org.eclipse.pde.spy.adapter/.classpath create mode 100644 ui/org.eclipse.pde.spy.adapter/.project create mode 100644 ui/org.eclipse.pde.spy.adapter/.settings/org.eclipse.jdt.core.prefs create mode 100644 ui/org.eclipse.pde.spy.adapter/META-INF/MANIFEST.MF create mode 100644 ui/org.eclipse.pde.spy.adapter/OSGI-INF/l10n/bundle.properties create mode 100644 ui/org.eclipse.pde.spy.adapter/about.html create mode 100644 ui/org.eclipse.pde.spy.adapter/build.properties create mode 100644 ui/org.eclipse.pde.spy.adapter/icons/ext_point_obj.png create mode 100644 ui/org.eclipse.pde.spy.adapter/icons/ext_point_obj@2x.png create mode 100644 ui/org.eclipse.pde.spy.adapter/icons/from_type.png create mode 100644 ui/org.eclipse.pde.spy.adapter/icons/innerinterface_public_obj.png create mode 100644 ui/org.eclipse.pde.spy.adapter/icons/osgi.png create mode 100644 ui/org.eclipse.pde.spy.adapter/icons/to_type.png create mode 100644 ui/org.eclipse.pde.spy.adapter/notice.html create mode 100644 ui/org.eclipse.pde.spy.adapter/plugin.xml create mode 100644 ui/org.eclipse.pde.spy.adapter/pom.xml create mode 100644 ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/AdapterSpyPart.java create mode 100644 ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/Messages.java create mode 100644 ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/Messages.properties create mode 100644 ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/hook/EclipseAdapterHook.java create mode 100644 ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterData.java create mode 100644 ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterElementType.java create mode 100644 ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterRepository.java create mode 100644 ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/tools/AdapterHelper.java create mode 100644 ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/AdapterContentProvider.java create mode 100644 ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/AdapterDataComparator.java create mode 100644 ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/AdapterFilter.java create mode 100644 ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/ColumnLabelProviderCustom.java create mode 100644 ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/ColumnViewerToolTipSupportCustom.java create mode 100644 ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/FilterData.java diff --git a/ui/org.eclipse.pde.spy.adapter/.classpath b/ui/org.eclipse.pde.spy.adapter/.classpath new file mode 100644 index 00000000000..f5399bf4179 --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ui/org.eclipse.pde.spy.adapter/.project b/ui/org.eclipse.pde.spy.adapter/.project new file mode 100644 index 00000000000..a5f9836e6ad --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/.project @@ -0,0 +1,28 @@ + + + org.eclipse.pde.spy.adapter + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ui/org.eclipse.pde.spy.adapter/.settings/org.eclipse.jdt.core.prefs b/ui/org.eclipse.pde.spy.adapter/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..5867b6520da --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=14 +org.eclipse.jdt.core.compiler.compliance=14 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=14 diff --git a/ui/org.eclipse.pde.spy.adapter/META-INF/MANIFEST.MF b/ui/org.eclipse.pde.spy.adapter/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..a53107a6925 --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/META-INF/MANIFEST.MF @@ -0,0 +1,22 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %Bundle-Name +Bundle-SymbolicName: org.eclipse.pde.spy.adapter;singleton:=true +Bundle-Version: 0.1.0.qualifier +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.swt, + org.eclipse.e4.core.contexts, + org.eclipse.e4.core.di, + org.eclipse.e4.core.services, + org.eclipse.e4.ui.di, + org.eclipse.e4.ui.workbench, + org.eclipse.emf.ecore, + org.eclipse.jface, + org.eclipse.equinox.common, + org.eclipse.e4.ui.services +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Automatic-Module-Name: org.eclipse.pde.spy.adapter +Bundle-ActivationPolicy: lazy +Bundle-Vendor: %Bundle-Vendor +Import-Package: jakarta.annotation;version="[2.1.0,3.0.0)", + jakarta.inject;version="[2.0.0,3.0.0)" diff --git a/ui/org.eclipse.pde.spy.adapter/OSGI-INF/l10n/bundle.properties b/ui/org.eclipse.pde.spy.adapter/OSGI-INF/l10n/bundle.properties new file mode 100644 index 00000000000..03f66eb891b --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,3 @@ +#Properties file for org.eclipse.pde.spy.adapter +Bundle-Vendor = Eclipse.org +Bundle-Name = Adapter Spy \ No newline at end of file diff --git a/ui/org.eclipse.pde.spy.adapter/about.html b/ui/org.eclipse.pde.spy.adapter/about.html new file mode 100644 index 00000000000..527b8491ded --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/about.html @@ -0,0 +1,31 @@ + + + + +About + + +

About This Content

+ +

January 30, 2014

+

License

+ +

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

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + + + + diff --git a/ui/org.eclipse.pde.spy.adapter/build.properties b/ui/org.eclipse.pde.spy.adapter/build.properties new file mode 100644 index 00000000000..fed38af73a3 --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/build.properties @@ -0,0 +1,8 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + icons/,\ + plugin.xml,\ + OSGI-INF/l10n/bundle.properties,\ + OSGI-INF/ diff --git a/ui/org.eclipse.pde.spy.adapter/icons/ext_point_obj.png b/ui/org.eclipse.pde.spy.adapter/icons/ext_point_obj.png new file mode 100644 index 0000000000000000000000000000000000000000..60f8dce5bba0a826ab50d4ff603671bc3f0e207d GIT binary patch literal 385 zcmV-{0e=38P)Pi+55OiloUOWzM(E6IZH@sT7oeHNRMkfOjG{>1(wbq-sFXdp z4udoU0Njn}sx76%S-?H4yRuluOJ{&e*@F}UL~#oEl8U7usAmDj7%VMRF&P#S6kQM} zAf2SZ>)Qthf$C%eiIMN!=^Dk1fnp35L#fdPcaObh!S7~n;W<`HFMKF@7Blq{zLbWF zbqYLRZa-y}e|Lab-fZ>On{yKb(ijd$BaT!4NnerZ_6eW87!;@9kP9%eIX`XP>4Oh(Kl_jR+(LkVybQz>C^sa^fpZ z!H{o@!VFHz1YNRhepz7p^WwR4q0z;6&EXurDmamO*{P@>6}@E_0-aBqn0)v94J{eu0OtKM8}}!F3|zJ=F4~bXv^Aj^!+hYJzOAlrEpw) z9)r!8_{s}$(LMb!iOpcVGsN$q8YHUD`rgh99~EETmX};e$b1*&G%c&tMg5SrD6P*k zhoWkJ8cUfA{Ic*Me#gu_PlwN^_BO2cp%v+LZC%RDr?FF_6|2>LgSdwLxv@UH@{9z> zLCB7oyN$|=q7P>lOCChZ1aZaK47`01R@%wY?$?7E9PxWAc~K%+?CU~G?kY#t(h;7a zLwe_tSt83*ce}E~#Ccl9FA~sxA`!z7dlovBOxE6!IyJsX9f9%qYstc z*PiF033>80R{_}7W7#2EX|-LQFI(7kFGob~=wWRtC>WQ2MMmzC;<3T$YwtQ;pueI7 z+%x1XWH>Ma0@trT56_h3gZIgq3&+YGj&vj|<|WJJUyYAD-Y(OkqBWInS$03c78e_5 z0cpDG>bi{7kG6N{xYOtAhVN;9dbvh|!}aaMi~DMp`WVpK6?N`Rp^KN)78FQ*Jq4NA zhTW=bi&@ng7u_^_LnB6&cT}VGbn|<@z5?eo>;)}u^4<~$Z{Sz4TNaD?WV?;`xob5V zU!)JbDK*F2$Su7q&$kr6fsu^sCDfJbY+nQUl`8jI-SvGEP?;v?Ot~Ud8@kP=>yBBL zLSMQ2o7^K6@1{ThqLKBw#do5P>vadhb7tFHMXu0(Vw1L?{^v*Cu`b^7^CS2Ag_>%> z6X8-$?_u)Dj9Y{KLjX3-diA{hBVz=!;m(I|lRqV0L)6VZlh*MFe%~;@npJN!w`X76 ztL%MEUttZ#aWfJ?h-7up?i%&960hPexSNQ&Q_94PU)$%8ZOl>Xu2# zdE$03{eGF)Vfl~54c&p(Qv>nihbP)ek+3VfCE@YGQ90+AR5hz!vGswXz9ow%JA4}Fa>|t(y@o?xhZP-k&3teXQ=8@Ezk~L= zktlXEVD-K;CR9c3c;3rfnt?NHN4aVfJgv+c>^=R`?pG6${P5>ZR&lf3i%n`4;+*H9 zr!IdrQQK1(JbGZn;6o&Fao5v<(i>^v5Bb-gTxt&+W?vlQ%$Zi7jOVGC(vav23EuHB z$1VQs6?f5`{<YV=g$}3TZYAD*+?G07oE3MJ3+3myKswbu&rPwIqcAYA2z zdm>BM_w{QK7t;_a*u4QSm?sZdVWhJ|cb^Mr5I=rvzVW8I1MZp_7cu9cNuGlm%0gT; zH%qiU${bX_@f4E(F?{x+WI_Wu-J6$Ry0mwNe{aC`PFvp-hav=C#LkGY8zG2>V!(;oA|fwMvqua_az+UIVE@JPxB7+b!pVyGf6&4PTx(^CU>s zCCM-%s9wQ1)*1WF-#REluvsI>>6U|R8(^JBR1re5J~)8 zG`q|fi^3=?cO<=NSLD@3$=Rq?^c4-AHrUg~bw8D_e zb(cM1nQ-l>z}fDu!xgq0*s9gEfY@gq-u^2>$1nHJ*hx>7*Bcg<9Fc$J+i9bk^V~Ee zvyk8Z7qi>QW#F;LZSRX-<;eg-rd0V8d7g3ZcJ_;F=r2$Kc5zoH29fW-?&e9r?o{k+R~gVj752+ zom6BU1WxK74o{dJ_>pZg~Z*6n+fBbv!E4mc~i`N8YtK7UeG$$!iMD=B;NwO zz29i&f}1+m#1*?DjJFw9%QY4TLckwUyKzh21rh_}X>T7}?Vmn#a(AwW#8VMZs6$Wn zfTc%RF`-34&ZW0Senz~5P2zg|n@87c&nY#L&jUFLNiiiU_l5N;2Sqzy z?VKF2V2FVs0~FJ2_!TVAP44D?fjw8Wz>R?ytlRUdlI!hcUJNMcJ}+@}>j{VLF)Q+~ zYch^*v>Oz>e&oi)iqCt!lWZLu$6}Q3W80;o!fr`3EhX?h+8p~Dw^yrsF9x{B6hWRn z$S?@AGmm`Cpj?X?Gz~E{Dcun&60|q2+WK@Vlho!JmR-mfu$GgnR%QHm>Wjob{6x+o|l`@RtLtT=b zE2RMAlpzvlYNz*Jy)HY~m}RorV4={-fM)^1uRILLV-=6iS~6wp#qOc^#~CifCu2(w zjpeorUVSE|i};%1J0IB)eZ+m>*KL-({KZF`6OgOX33iG_O807ZMZdDPkei%g8nu`V z)dVlkwBBN5Qh=MBSRB=tsRIJB=7B%RS+jVP0G9DbfX(q1J%dSrqFDnq z)_Pa~C;|r41j7(ugckH?f7UDp^Sd{N@k2$Hp3nd+4GM?Apx)kp@?bDc{QijdmmUm9 z)?*6Pp2(p3((yzSKO%)G`*Tp5moMYzn7$0+rfDm0F9He5N@^?e&pu{ojP36}n=-nS zy=hw>o9LgB1pMzfnlIgJ3q!y|iC#o+Rw4`*GyG3@CYkid2K{M0n=}8C2rJz0{C`6K zrq@<3Te_l*sd(SbplD+q&}P0U0u@gtpte2|Nt$qVq$(V&iohemYU)TBSPOyE1gmRl zXuydC1c{^t`-uuoVKA{2JaLnXMGhgecyM@C9F{;Nfk`lu23So4p$XPfWii6FRN-m} zB0*D4Q}ZVZ8#-OK~T% zPTL=?_M4sj7iEl4RVCupU>abgrWTRa33xad$9e}Nkg6J*>Z$})EEf4^b_SKi^vBYP z2JWmHVC^%jwYK&dsIXOiihoA?dk|SQq6~whU@*}4?FDK>HxJa`mZ!aWvix-2VdebY#=4%dE|1XPua7^(E1>LpVEW8QFr7ZQ-qQF$!MA8YFu@HK_ zMQH}y>6+i{y80T*KfRnlEbEmt-4*3>o>PeTq(UycgpaGQy-FTguct}x^}0M=@wL*0 zSUj7PN6b;Z&(dE$3@BMy2cYXYyEi5^rDgR`?C}_on%Q{nlX~FnH}R@x!@r*7NM4hx z9UI6o)Ax|5s-k$d?W5i2;MWx|SFDN4EU;Ao%)2jPw1B_xE!_;Py|d!84j>ej_6g8v z+?PZZPt~^9Y@kkUtXh@UNoSbSs|rj+_OSjJvK?n>W(@eY`I}W+7|*is(991rSYI&i z-h8nEQq#p)MlL2AW5PAXzGF97^Woj}ZvX&C8QR#u(dF^`BpvEelbvCiDLT@t$0S;0 z{Ibk#^K5}Y5U+?KFlN>xMnS)_vfE%jaa`Y^J~Im>u*;qoxC_lTX&I9h()jT9)T_nY zszyF#B1w&}c_XbVI!>+*`H!XaG~@;dfAeWY2%i2Hf75edIcOpLjT5?>ljisAwyb?))+WE#HeyXq3vU zxN`y0nc5=mPXbu7wUSaD)r#L#+NW6WBAvTmYJQb;%q2vZc~(Pj9fxs1jjyiRJG}|B zH$SS>s}u{K-EPEPUX#qVL*#^~r)8Pn+?@VcRQTZNWV*#wr|do_5V6oI53vC{EOSGr{ribId$O$%N+(S3Zt(u1Un7B$f`~$MWx1e3PT)D zY&ge9qJY3z`6DI@4j~0T?Ho!I20M3#3iFg8u(}py)veH-Y#$8n0;SpCX?Rf{Ph_r4Dw zf8Qz1eE4DCbt^tnJiD>jg2ILio2l-S{_v1{iOds2rz?jpe)s^&tG)0fRKj0y%%a%s z(7BG~)c(T}CEe~4G7Ibzux)yy+Mg|u-LIAQwy@7KRuYut!G}Jm2WlD^-<+JWxV+qZ zpwKmOu64?~)2w8oIde4qwJk|ztpT!NBhg)TXYNF8VugDZ%H`>5+Dg)`FP+U+P`}e< zZ;v1d5)LsLSWWgv{?hzAN~O*OrU+IsR^E3V8dN&{YT^^Bx_*``x2qHOyx~&tI7fSO zSk2doJHlfEDR;XZN4a}eM2*xnG`gb5mBMG^TBp^iFR<>X3WsK^kE~o^P;b5$eDTY$ z3Pq>~B9L{y_SWaMn;9$V!+wWFgW9xn-oF3v%b66+8KzxoQ RHdZqO&?eT#Wriot{}(9!bV2|C literal 0 HcmV?d00001 diff --git a/ui/org.eclipse.pde.spy.adapter/icons/from_type.png b/ui/org.eclipse.pde.spy.adapter/icons/from_type.png new file mode 100644 index 0000000000000000000000000000000000000000..bc915da4420060b4ea9984fc662935f10f19449a GIT binary patch literal 628 zcmV-)0*n2LP)g-ia8S4 z)-Hc8;YhlwO+G7fkWfXdbcbL=xD=a2Ea9jq+t6qFMm!n9z)KIhC(oc`5ptxi6;<>S2tU z;TrZJ^el>wAvZK(6I8Ut?U$6_X!ibf52>PAvAL2ZiLGt&oYbdbIwb;^0tSEwlpiALlp^M-UNY$wk z5tO>PsNkZL_y=^5($-B#P(g91pzR+Z=%P@mPDUe|Xnwuq{kZoy#JncKp_||B+UD{7*NJuo)j{2P7=+K;KQs@(i-c~yi(Y_SQ>m!y~X_O>H?8i8X7WXdSAja3<0O< z;aAydw_2WL(AC1L+{!-z+1b^*Qpj5e4yL1f$CHCWD1P~k&)emIG|uNYa*z7}S$pjm z1l}Gwx*ucdI2Nv*=rfm!b*w+#!na}-pSH_24)k<)9033%>E`HITv>4gj^p8Z{sWRJ z3(1s)kMDor<+Cj~j)#%a7-BKQBteT^xB&nRoG~p!HtOxaiPbQ@R&C?^*IHN)Crz{M z1gH7{U>;_r(X6`w0MnGA!S{mj8~}8n!QkV403s?j8tz0SB07NB4#0B*bUOn8*HvJ! zKQIEn@jNxb;7+QqLxa)`&sRGg`ARXx+}T4|yfK4l zL_(5)QcMv1pnD(wgZa}B9|?mpsSzu>XFP#k`MyHsr-N$M^;q$f{OjC>{v`rn-Mq{} ze5z7uo%DPqEz5wE0<0NMD?q*8Rs5r0004!A37OKh&JG37t><6W`rTP zUo|lB5Y+ssgTdxg7vug-+JZnokQ1{oc1TC}0UV#^awCTQvYRya(dXUyk*8 zz~n&Qfr`HesR4z@{{{vYxMq;wAR*0A@cnqd0@T@`A?!{WsOI}1J}^2nplV|fA>Ylo z8X8^OL42U|ZGakngS_$WL~jWwJiean^#QxIlW93fEl3Z-1&|a6j&D#jg2aHD&VN7I zGaKmd=^z&X1DEAvJA(>P&39P3K=wa8)dADMV~|2fOmugH0uac){l1?;0OWV1#Pu3s z08j(e8?T{~-#<;0=y<<1O8)=;sXQNN$mJth@*1R;R-2#{Rs{dw%EVcCGD=cH^mYb)M(xobz-HtwT_z9HTmgrR}g5At7N9GkQFOX2>^%(}z7= zJ{^n2)N#1{QEa#Z3t=WWZz?TNq9D-76|xxdO`=E@^E`7<2*nJ~)v7MkHL#eVwBRv+ z2U{2{Hf&|%^ZN^aACN=jPX6;Xk=IMQ`VT02+g3S3To#|eIerhnlFZ7j + + + + +Eclipse Foundation Software User Agreement + + + +

Eclipse Foundation Software User Agreement

+

February 1, 2011

+ +

Usage Of Content

+ +

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

+ +

Applicable Licenses

+ +

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

+ +

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

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

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

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

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

+ +

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

+ + + +

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

+ + +

Use of Provisioning Technology

+ +

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse + Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or + other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to + install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html + ("Specification").

+ +

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the + applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology + in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the + Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

+ +
    +
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology + on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based + product.
  2. +
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be + accessed and copied to the Target Machine.
  4. +
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable + Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target + Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern + the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such + indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. +
+ +

Cryptography

+ +

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

+ +

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

+ + diff --git a/ui/org.eclipse.pde.spy.adapter/plugin.xml b/ui/org.eclipse.pde.spy.adapter/plugin.xml new file mode 100644 index 00000000000..b10d10b88a3 --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/plugin.xml @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/ui/org.eclipse.pde.spy.adapter/pom.xml b/ui/org.eclipse.pde.spy.adapter/pom.xml new file mode 100644 index 00000000000..09489370fb1 --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + + org.eclipse.e4.tools + e4-tools-aggregator + 0.18.0-SNAPSHOT + ../../ + + + org.eclipse.e4 + 0.1.0-SNAPSHOT + org.eclipse.pde.spy.adapter + eclipse-plugin + + \ No newline at end of file diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/AdapterSpyPart.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/AdapterSpyPart.java new file mode 100644 index 00000000000..187eb647577 --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/AdapterSpyPart.java @@ -0,0 +1,401 @@ +/******************************************************************************* + * Copyright (c) Lacherp. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Lacherp - initial API and implementation + *******************************************************************************/ +package org.eclipse.pde.spy.adapter; + +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.e4.core.contexts.ContextInjectionFactory; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.core.di.annotations.Optional; +import org.eclipse.e4.ui.di.UISynchronize; +import org.eclipse.e4.ui.services.IServiceConstants; +import org.eclipse.e4.ui.workbench.modeling.ESelectionService; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.TreeViewerColumn; +import org.eclipse.pde.spy.adapter.model.AdapterData; +import org.eclipse.pde.spy.adapter.model.AdapterRepository; +import org.eclipse.pde.spy.adapter.tools.AdapterHelper; +import org.eclipse.pde.spy.adapter.viewer.AdapterContentProvider; +import org.eclipse.pde.spy.adapter.viewer.AdapterDataComparator; +import org.eclipse.pde.spy.adapter.viewer.AdapterFilter; +import org.eclipse.pde.spy.adapter.viewer.ColumnViewerToolTipSupportCustom; +import org.eclipse.pde.spy.adapter.viewer.FilterData; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.SashForm; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.swt.widgets.Tree; + +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; +import jakarta.inject.Inject; +import jakarta.inject.Named; + + +/** + * Adapter Spy part + * @author pascal + * + */ +public class AdapterSpyPart { + + private TreeViewer adapterTreeViewer; + + private AdapterContentProvider adapterContentProvider; + + private static final String NAMED_UPDATE_TREE_SOURCE_TO_DESTINATION = "updateTreeSourceToDestination"; + private static final String NAMED_UPDATE_TREE_DESTINATION_TO_SOURCE = "updateTreeDestinationToSource"; + private static final String SWITCH_TO_SOURCE = "switch to Source Type first"; + private static final String SWITCH_TO_DESTINATION = "switch to Destination Type first"; + + @Inject + UISynchronize uisync; + + @Inject + IEclipseContext context; + + + @Inject + AdapterRepository adapterRepo; + + @Inject + ESelectionService selectService; + + AdapterFilter adapterFilter; + + boolean sourceToDestination = true; + + private TreeViewerColumn sourceOrDestinationTvc; + + private AdapterDataComparator comparator; + + @Inject + public AdapterSpyPart(IEclipseContext context) { + // wrap eclipse adapter + AdapterHelper.wrapperEclipseAdapter(); + adapterFilter = ContextInjectionFactory.make(AdapterFilter.class, context); + context.set(ImageRegistry.class, AdapterHelper.getImageRegistry(this)); + } + + @PostConstruct + public void createControls(Composite parent, IExtensionRegistry extensionRegistry, ImageRegistry imgr) { + + parent.setLayout(new GridLayout(1, false)); + createToolBarZone(parent, imgr); + + SashForm sashForm = new SashForm(parent, SWT.VERTICAL | SWT.V_SCROLL | SWT.H_SCROLL); + sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + AdapterHelper.getServicesContext().set(AdapterRepository.class, adapterRepo); + adapterRepo.clear(); + + Collection adapterDatalist = adapterRepo.getAdapters(); + + // Adapter TreeViewer + adapterTreeViewer = new TreeViewer(sashForm); + adapterContentProvider = ContextInjectionFactory.make(AdapterContentProvider.class, context); + adapterContentProvider.setColumnIndex(0); + adapterTreeViewer.setContentProvider(adapterContentProvider); + adapterTreeViewer.setLabelProvider(adapterContentProvider); + adapterTreeViewer.setFilters(adapterFilter); + + // add comparator + comparator = new AdapterDataComparator(0); + adapterTreeViewer.setComparator(comparator); + + // define columns + final Tree cTree = adapterTreeViewer.getTree(); + cTree.setHeaderVisible(true); + cTree.setLinesVisible(true); + cTree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + sourceOrDestinationTvc = new TreeViewerColumn(adapterTreeViewer, SWT.NONE); + sourceOrDestinationTvc.getColumn().setText("Source Type"); + sourceOrDestinationTvc.getColumn().setWidth(500); + sourceOrDestinationTvc.setLabelProvider(adapterContentProvider); + cTree.setSortColumn(sourceOrDestinationTvc.getColumn()); + sourceOrDestinationTvc.getColumn().addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + comparator.setColumn(0); + adapterTreeViewer.getTree().setSortDirection(comparator.getDirection()); + adapterTreeViewer.refresh(); + } + }); + sourceOrDestinationTvc.setEditingSupport(new EditingSupport(adapterTreeViewer) { + + @Override + protected void setValue(Object element, Object value) { + } + + @Override + protected Object getValue(Object element) { + return null; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return null; + } + @Override + protected boolean canEdit(Object element) { + if(element instanceof AdapterData) + { + ((AdapterData)element).setSelectedColumn(0); + selectService.setSelection(element); + } + return false; + } + }); + + + TreeViewerColumn adapterFactoryClassTvc = new TreeViewerColumn(adapterTreeViewer, SWT.NONE); + adapterFactoryClassTvc.getColumn().setText("AdapterFactory"); + adapterFactoryClassTvc.getColumn().setWidth(700); + AdapterContentProvider adapterContentProvider2 = ContextInjectionFactory.make(AdapterContentProvider.class, context); + adapterContentProvider2.setColumnIndex(1); + adapterFactoryClassTvc.setLabelProvider(adapterContentProvider2); + adapterFactoryClassTvc.setEditingSupport(new EditingSupport(adapterTreeViewer) { + + @Override + protected void setValue(Object element, Object value) { + } + @Override + protected Object getValue(Object element) { + return null; + } + @Override + protected CellEditor getCellEditor(Object element) { + return null; + } + + @Override + protected boolean canEdit(Object element) { + if(element instanceof AdapterData) + { + ((AdapterData)element).setSelectedColumn(1); + selectService.setSelection(element); + } + return false; + } + }); + + + ColumnViewerToolTipSupportCustom.enableFor(adapterTreeViewer); + context.set(NAMED_UPDATE_TREE_SOURCE_TO_DESTINATION, adapterDatalist); + + } + + @Inject + @Optional + private void updateAdapterTreeViewerSourceToType( + @Named(NAMED_UPDATE_TREE_SOURCE_TO_DESTINATION) Collection adapaters) { + if (adapaters == null) { + return; + } + refreshAdapterTree(NAMED_UPDATE_TREE_SOURCE_TO_DESTINATION, adapaters); + } + + @Inject + @Optional + private void udpateAdapterTreeViewTypeToSource( + @Named(NAMED_UPDATE_TREE_DESTINATION_TO_SOURCE) Collection adapaters) { + if (adapaters == null) { + return; + } + // reduce source Type + Collection reduceresult = reduceType(adapaters); + refreshAdapterTree(NAMED_UPDATE_TREE_SOURCE_TO_DESTINATION, reduceresult); + } + + @PreDestroy + public void dispose() { + adapterTreeViewer = null; + if (adapterContentProvider != null) { + ContextInjectionFactory.uninject(adapterContentProvider, context); + } + if (adapterFilter != null) { + ContextInjectionFactory.uninject(adapterFilter, context); + } + AdapterHelper.restoreOriginalEclipseAdapter(); + context.set(AdapterFilter.UPDATE_CTX_FILTER, null); + adapterRepo.clear(); + + } + + @Inject + @Optional + public void handleSelection(@Named(IServiceConstants.ACTIVE_SELECTION) AdapterData adapterDataSelected) { + if (adapterDataSelected == null) { + return; + } + String toCopy =""; + if( adapterDataSelected.getSelectedColumn() == 0 && adapterDataSelected.getParent() == null ) { + toCopy = ((sourceToDestination)? adapterDataSelected.getSourceType():adapterDataSelected.getDestinationType()); + } + if( adapterDataSelected.getSelectedColumn() == 0 && adapterDataSelected.getParent() != null ) { + toCopy = ((sourceToDestination)? adapterDataSelected.getDestinationType():adapterDataSelected.getSourceType()); + } + if( adapterDataSelected.getSelectedColumn() == 1 ) { + if (!sourceToDestination) + toCopy = adapterDataSelected.getAdapterDataParent().getAdapterClassName(); + else + toCopy = adapterDataSelected.getAdapterClassName(); + } + Clipboard clipboard = new Clipboard(null); + try { + TextTransfer textTransfer = TextTransfer.getInstance(); + Transfer[] transfers = new Transfer[] { textTransfer }; + Object[] data = new Object[] { toCopy }; + clipboard.setContents(data, transfers); + } finally { + clipboard.dispose(); + } + + } + + private void createToolBarZone(Composite parent, ImageRegistry imgr) { + final Composite comp = new Composite(parent, SWT.NONE); + comp.setLayout(new GridLayout(4, false)); + + Text filterText = new Text(comp, SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL); + GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).applyTo(filterText); + filterText.setMessage("Search data"); + filterText.setToolTipText("Find any element in tree"); + + filterText.addModifyListener(e -> { + FilterData fdata = getFilterData(); + if (filterText.getText().isEmpty()) { + fdata.setTxtSeachFilter(""); + } else { + fdata.setTxtSeachFilter(filterText.getText()); + } + context.set(AdapterFilter.UPDATE_CTX_FILTER, fdata); + adapterTreeViewer.refresh(true); + + }); + + Button showPackageFilter = new Button(comp, SWT.CHECK); + showPackageFilter.setText("Show package"); + + showPackageFilter.setToolTipText("Show source type with packages name"); + showPackageFilter.setEnabled(true); + showPackageFilter.setSelection(true); + showPackageFilter.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FilterData fdata = getFilterData(); + fdata.setShowPackage(!fdata.getShowPackage()); + context.set(AdapterFilter.UPDATE_CTX_FILTER, fdata); + adapterTreeViewer.refresh(true); + } + }); + + + ToolBar toolBar = new ToolBar(comp, SWT.NONE); + ToolItem switchButton = new ToolItem(toolBar, SWT.CHECK); + switchButton.setImage(imgr.get(AdapterHelper.DESTINATION_TYPE_IMG_KEY)); + switchButton.setToolTipText(SWITCH_TO_DESTINATION); + + // sourceToType event + switchButton.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent event) { + Object source = event.getSource(); + if (source instanceof ToolItem) { + FilterData fdata = getFilterData(); + sourceToDestination = !sourceToDestination; + String tooltiptext = sourceToDestination ? SWITCH_TO_DESTINATION :SWITCH_TO_SOURCE; + String imageKey = sourceToDestination ? AdapterHelper.DESTINATION_TYPE_IMG_KEY + : AdapterHelper.SOURCE_TYPE_IMG_KEY; + switchButton.setToolTipText(tooltiptext); + switchButton.setImage(imgr.get(imageKey)); + + if (sourceToDestination) { + sourceOrDestinationTvc.getColumn().setText("Source Type"); + context.set(NAMED_UPDATE_TREE_SOURCE_TO_DESTINATION, adapterRepo.getAdapters()); + } else { + sourceOrDestinationTvc.getColumn().setText("Destination Type"); + context.set(NAMED_UPDATE_TREE_DESTINATION_TO_SOURCE, adapterRepo.revertSourceToType()); + } + fdata.setSourceToDestination(sourceToDestination); + context.set(AdapterFilter.UPDATE_CTX_FILTER, fdata); + adapterTreeViewer.refresh(true); + } + + } + }); + uisync.asyncExec(() -> comp.pack()); + + } + + private FilterData getFilterData() { + if (context.get(AdapterFilter.UPDATE_CTX_FILTER) == null) { + return new FilterData(); + } + return new FilterData((FilterData) context.get(AdapterFilter.UPDATE_CTX_FILTER)); + } + + + + private Collection reduceType(Collection originalList) { + Collection reduceresult = originalList; + + Map> resultmap = groupBy(originalList); + reduceresult.clear(); + resultmap.forEach((k, v) -> { + AdapterData firstElem = v.get(0); + reduceresult.add(firstElem); + for (int idx = 1; idx < v.size(); idx++) { + firstElem.getChildrenList().addAll(v.get(idx).getChildrenList()); + } + }); + + return reduceresult; + } + + private Map> groupBy(Collection originalList) { + return originalList.stream().collect(Collectors.groupingBy(AdapterData::getDestinationType)); + } + + + private void refreshAdapterTree(String namedContext, Collection result) { + uisync.syncExec(() -> { + if (adapterTreeViewer != null) { + adapterTreeViewer.setInput(result); + context.set(namedContext, null); + } + }); + } + +} diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/Messages.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/Messages.java new file mode 100644 index 00000000000..a6331681e0f --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/Messages.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) Lacherp. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Lacherp - initial API and implementation + *******************************************************************************/ +package org.eclipse.pde.spy.adapter; + +import org.eclipse.pde.spy.adapter.tools.AdapterHelper; +import org.eclipse.osgi.util.NLS; + +/** + * Messages constant class + * @author pascal + * + */ +public class Messages extends NLS { + + public static String rootSourceTypeTooltip; + public static String rootDestinationTypeToolTip; + public static String childSourceTypeToolTip; + public static String childDestinationTypeToolTip; + public static String adapterFactory; + + + static { + // load message values from bundle file + reloadMessages(); + } + + public static void reloadMessages() { + NLS.initializeMessages(AdapterHelper.BUNDLE_ID+ ".messages.Messages", Messages.class); + } +} diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/Messages.properties b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/Messages.properties new file mode 100644 index 00000000000..60f6c1d957d --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/Messages.properties @@ -0,0 +1,25 @@ +################################################################################ +# Copyright (c) Lacherp. +# +# This program and the accompanying materials +# are made available under the terms of the Eclipse Public License 2.0 +# which accompanies this distribution, and is available at +# https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Lacherp - initial API and implementation +################################################################################ + +# root node tooltip +rootSourceTypeTooltip = expand this node to know the types in which \"{0}\" can be adapted +rootDestinationTypeToolTip = expand this node to know the types that can be adapted to \"{0}\" + +# child node tooltip +childSourceTypeToolTip = \"{0}\" can be adapted to \"{1}\"\n by the \"{2}\" +childDestinationTypeToolTip = \"{0}\" can be obtained from \"{1}\" using \"{2}\" adapter factory' + +# Adapter Factory column +adapterFactory = \"{0}\" adapter factory can transform \"{1}\" to \"{2}\" + diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/hook/EclipseAdapterHook.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/hook/EclipseAdapterHook.java new file mode 100644 index 00000000000..588cb99ff88 --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/hook/EclipseAdapterHook.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) Lacherp. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Lacherp - initial API and implementation + *******************************************************************************/ +package org.eclipse.pde.spy.adapter.hook; + +import org.eclipse.e4.core.internal.services.EclipseAdapter; + +@SuppressWarnings("restriction") +public class EclipseAdapterHook extends EclipseAdapter { + + + @Override + public T adapt(Object element, Class adapterType) { + return super.adapt(element, adapterType); + } + + +} diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterData.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterData.java new file mode 100644 index 00000000000..412b4017bb9 --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterData.java @@ -0,0 +1,464 @@ +/******************************************************************************* + * Copyright (c) Lacherp. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Lacherp - initial API and implementation + *******************************************************************************/ +package org.eclipse.pde.spy.adapter.model; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.eclipse.pde.spy.adapter.Messages; +import org.eclipse.pde.spy.adapter.tools.AdapterHelper; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.widgets.Display; +import org.osgi.framework.Bundle; + +/** + * Adapter data model Object This class is used to store ConfigarationElement + * elements which use an adapter + * + * @author pascal + * + */ +public class AdapterData implements Comparable { + + String sourceType; + String destinationType; + String adapterClassName; + boolean isInterface = false; + boolean checkInterfaceClass = false; + AdapterData parent; + List children = new ArrayList<>(); + AdapterElementType elemType; + boolean visibilityFilter = true; + Boolean showPackage; + + int selectedColumn; + + /** + * @return the selectedColumn + */ + public int getSelectedColumn() { + return selectedColumn; + } + + /** + * @param selectedColumn the selectedColumn to set + */ + public void setSelectedColumn(int selectedColumn) { + this.selectedColumn = selectedColumn; + } + + /** + * Ctor + * + * @param elemType + */ + public AdapterData(AdapterElementType elemType) { + this.elemType = elemType; + showPackage = Boolean.TRUE; + } + + public AdapterData(AdapterData adapterData) { + this.elemType = adapterData.getAdapterElementType(); + this.showPackage = Boolean.TRUE; + this.destinationType = adapterData.getDestinationType(); + this.adapterClassName = adapterData.getAdapterClassName(); + this.sourceType = adapterData.getSourceType(); + } + + /** + * propagate visibility to children + */ + public void propagateVisibility() { + children.forEach(d -> { + d.setVisibilityFilter(isVisibilityFilter()); + d.propagateVisibility(); + }); + } + + public void textSearch(String txtSearch, AtomicBoolean bfound) { + + if (bfound.get()) { + return; + } + String txt = this.toString(); + bfound.set(txt.contains(txtSearch)); + // check in adapter class + children.forEach(d -> { + d.textSearch(txtSearch, bfound); + }); + + } + + /** + * @return the sourceType + */ + public String getSourceType() { + return checkNull(sourceType); + } + + /** + * @param sourceType the sourceType to set + */ + public void setSourceType(String sourceType) { + this.sourceType = sourceType; + } + + /** + * @return the destinationType + */ + public String getDestinationType() { + return checkNull(destinationType); + } + + /** + * @param destinationType the destinationType to set + */ + public void setDestinationType(String destinationType) { + this.destinationType = destinationType; + } + + /** + * @return the adapterClassName + */ + public String getAdapterClassName() { + return checkNull(adapterClassName); + } + + /** + * @param adapterClassName the adapterClassName to set + */ + public void setAdapterClassName(String adapterClassName) { + this.adapterClassName = adapterClassName; + } + + public boolean hasChildren() { + return !children.isEmpty(); + } + + public List getChildrenList() { + return this.children; + } + + public Object getChildren(boolean sourceToDestination) { + if (!children.isEmpty()) { + Collections.sort(children); + if( sourceToDestination) { + Map> childs = children.stream().collect(Collectors.groupingBy(AdapterData::getDestinationType)); + children.clear(); + childs.values().forEach(ls-> children.add(ls.get(0))); + return children.toArray(); + }else { + Map> childs = children.stream().collect(Collectors.groupingBy(AdapterData::getSourceType)); + children.clear(); + childs.values().forEach(ls-> children.add(ls.get(0))); + return children.toArray(); + } + } + return new AdapterData[0]; + } + + public Object getParent() { + return this.parent; + } + + public AdapterData getAdapterDataParent() { + return (AdapterData) this.parent; + } + + public void setParent(AdapterData parent) { + this.parent = parent; + } + + public AdapterElementType getAdapterElementType() { + return this.elemType; + } + + /** + * @return the isInterface + */ + public boolean isInterface() { + return isInterface; + } + + /** + * @param isInterface the isInterface to set + */ + public void setInterface(boolean isInterface) { + this.isInterface = isInterface; + } + + /** + * @return the showPackage + */ + public boolean isShowPackage() { + return showPackage; + } + + /** + * @param showPackage the showPackage to set + */ + public void setShowPackage(boolean showPackage) { + this.showPackage = showPackage; + } + + public String getText(int columnIndex) { + if (columnIndex == 0) { + return elemType.equals(AdapterElementType.SOURCE_TYPE) ? displayPackage(getSourceType()) + : displayPackage(getDestinationType()); + } + if (columnIndex == 1 && getParent() != null) { + + return elemType.equals(AdapterElementType.DESTINATION_TYPE) ? displayPackage(getAdapterClassName()) + : displayPackage(((AdapterData) getParent()).getAdapterClassName()); + } + return ""; + } + + public String getImageName() { + String className = elemType.equals(AdapterElementType.SOURCE_TYPE) ? getSourceType():getDestinationType(); + if (elemType.equals(AdapterElementType.DESTINATION_TYPE)) { + return AdapterHelper.DESTINATION_TYPE_IMG_KEY; + } + if(!checkInterfaceClass) { + Bundle bundle = AdapterHelper.getBundleForClassName(className); + if (bundle != null) + setInterface(AdapterHelper.isInterfaceTypeClass(bundle, className)); + else { + // may be it's an interface + if (subStringPackage(className).startsWith("I")) { + return AdapterHelper.INTERFACE_IMG_KEY; + } + return AdapterHelper.SOURCE_TYPE_IMG_KEY; + } + checkInterfaceClass = true; + } + if (elemType.equals(AdapterElementType.SOURCE_TYPE)) { + if( isInterface()) { + return AdapterHelper.INTERFACE_IMG_KEY; + } + return AdapterHelper.SOURCE_TYPE_IMG_KEY; + } + + return null; + + } + + /** + * @return the visibilityFilter + */ + public boolean isVisibilityFilter() { + return visibilityFilter; + } + + /** + * @param visibilityFilter the visibilityFilter to set + */ + public void setVisibilityFilter(boolean visibilityFilter) { + this.visibilityFilter = visibilityFilter; + } + + public Stream convertSourceToType() { + final ArrayList result = new ArrayList<>(); + this.getChildrenList().forEach(child -> { + AdapterData newAdapterData = new AdapterData(child); + AdapterData soon = new AdapterData(this); + soon.setParent(child); + newAdapterData.getChildrenList().add(soon); + + result.add(newAdapterData); + }); + return result.stream(); + } + + @Override + public String toString() { + return getSourceType() + "@" + getDestinationType() + getAdapterClassName(); + } + + + @Override + public int compareTo(AdapterData o) { + return this.getText(0).compareTo(o.getText(0)); + } + + public String getToolTipText(boolean sourceToDestination, int columnIndex) { + + if (columnIndex == 1) { + return getAdapterClassName().isEmpty() ? "" : getAdapterFactorySourceTooltip(); + } + // column 0 + if (sourceToDestination && getParent() == null) { + return getRootSourceTypeTooltip(); + } + if (!sourceToDestination && getParent() == null) { + return getRootDesinationTypeTooltip(); + } + if (sourceToDestination && getParent() != null) { + return getChildSourceTypeToolTip(); + } + return getChildDestinationTypeToolTip(); + + } + + public StyleRange[] getToolTipStyleRanges(Boolean sourceToDestination, int columnIndex) { + if (columnIndex == 1) { + return getAdapterClassName().isEmpty() ? null : getAdapterFactorySourceTooltipStyleRanges(); + } + // column 0 + if (sourceToDestination && getParent() == null) { + return getRootSourceTypeTooltipStyleRanges(); + } + if (!sourceToDestination && getParent() == null) { + return getRootDesinationTypeTooltipStyleRanges(); + } + if (sourceToDestination && getParent() != null) { + return getChildSourceTypeToolTipStyleRanges(); + } + return getChildDestinationTypeToolTipStyleRanges(); + + } + + private String getRootSourceTypeTooltip() { + return NLS.bind(Messages.rootSourceTypeTooltip, subStringPackage(getSourceType())); + } + + private String getRootDesinationTypeTooltip() { + return NLS.bind(Messages.rootDestinationTypeToolTip, subStringPackage(getDestinationType())); + } + + private String getAdapterFactorySourceTooltip() { + List bindings = Arrays.asList(subStringPackage(getAdapterClassName()), + subStringPackage(((AdapterData) getParent()).getSourceType()), concatChildren(true)); + return NLS.bind(Messages.adapterFactory, bindings.toArray()); + } + + private String getChildDestinationTypeToolTip() { + List bindings = Arrays.asList(subStringPackage(getSourceType()), + subStringPackage(((AdapterData) getParent()).getDestinationType()), + subStringPackage(((AdapterData) getParent()).getAdapterClassName())); + return NLS.bind(Messages.childDestinationTypeToolTip, bindings.toArray()); + } + + private String getChildSourceTypeToolTip() { + List bindings = Arrays.asList(subStringPackage(((AdapterData) getParent()).getSourceType()), + subStringPackage(getDestinationType()), subStringPackage(getAdapterClassName())); + return NLS.bind(Messages.childSourceTypeToolTip, bindings.toArray()); + } + + private StyleRange[] getAdapterFactorySourceTooltipStyleRanges() { + int length0 = subStringPackage(getAdapterClassName()).length(); + int length1 =subStringPackage(((AdapterData) getParent()).getSourceType()).length(); + int length2 = concatChildren(true).length(); + + StyleRange [] styleRanges = new StyleRange[4]; + styleRanges[0] = getBoldStyle(0, length0); + styleRanges[1] = getStandard(length0+1, 30); + styleRanges[2] = getBoldStyle(length0+31, length1); + styleRanges[3] = getBoldStyle(length0+35+length1, length2); + + return styleRanges; + } + + private StyleRange[] getRootSourceTypeTooltipStyleRanges() { + StyleRange [] styleRanges = new StyleRange[2]; + styleRanges[0] = getStandard(0, 43); + styleRanges[1] = getBoldStyle(44, subStringPackage(getSourceType()).length()); + return styleRanges; + } + + private StyleRange[] getRootDesinationTypeTooltipStyleRanges() { + StyleRange [] styleRanges = new StyleRange[2]; + styleRanges[0] = getStandard(0, 57); + styleRanges[1] = getBoldStyle(58, subStringPackage(getDestinationType()).length()); + return styleRanges; + } + + private StyleRange[] getChildSourceTypeToolTipStyleRanges() { + + int length0 = subStringPackage(((AdapterData) getParent()).getSourceType()).length(); + int length1 = subStringPackage(getDestinationType()).length(); + int length2 = subStringPackage(getAdapterClassName()).length(); + StyleRange [] styleRanges = new StyleRange[4]; + styleRanges[0] = getBoldStyle(0, length0); + styleRanges[1] = getStandard(length0+1, 18); + styleRanges[2] = getBoldStyle(length0+19, length1); + styleRanges[3] = getBoldStyle(length0+28+length1, length2); + return styleRanges; + } + + private StyleRange[] getChildDestinationTypeToolTipStyleRanges() { + + int length0 = subStringPackage(getSourceType()).length(); + int length1 = subStringPackage(((AdapterData) getParent()).getDestinationType()).length(); + int length2 = subStringPackage(((AdapterData) getParent()).getAdapterClassName()).length(); + StyleRange [] styleRanges = new StyleRange[4]; + styleRanges[0] = getBoldStyle(0, length0); + styleRanges[1] = getStandard(length0+1, 20); + styleRanges[2] = getBoldStyle(length0+22, length1); + styleRanges[3] = getBoldStyle(length0+28+length1, length2); + return styleRanges; + } + + private StyleRange getStandard(int start,int length) { + StyleRange styleRange = new StyleRange(); + styleRange.start = start; + styleRange.length = length; + styleRange.fontStyle = SWT.NORMAL; + styleRange.foreground = Display.getDefault().getSystemColor(SWT.COLOR_BLACK); + return styleRange; + } + + private StyleRange getBoldStyle(int start,int length) { + StyleRange styleRange = new StyleRange(); + styleRange.start = start; + styleRange.length = length; + styleRange.fontStyle = SWT.BOLD; + styleRange.foreground = Display.getDefault().getSystemColor(SWT.COLOR_BLUE); + return styleRange; + } + + private String checkNull(String val) { + return (val == null) ? "" : val; + } + + private String displayPackage(String value) { + if (Boolean.TRUE.equals(showPackage)) { + return value; + } + return subStringPackage(value); + } + + + + private String subStringPackage(String value) { + return value.substring(value.lastIndexOf(".") + 1, value.length()); + } + + private String concatChildren(boolean sourceToDestination) { + if (sourceToDestination) + return ((AdapterData) getParent()).children.stream().map((a) -> a.subStringPackage(a.getDestinationType())) + .collect(Collectors.joining(", ")); + else + return ""; + } + +} diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterElementType.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterElementType.java new file mode 100644 index 00000000000..018284e31ee --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterElementType.java @@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) Lacherp. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Lacherp - initial API and implementation + *******************************************************************************/ +package org.eclipse.pde.spy.adapter.model; + +public enum AdapterElementType { + PLUGIN, + SOURCE_TYPE, + DESTINATION_TYPE; +} diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterRepository.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterRepository.java new file mode 100644 index 00000000000..4da31feea4e --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterRepository.java @@ -0,0 +1,120 @@ +package org.eclipse.pde.spy.adapter.model; + +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.Optional; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; + +import org.eclipse.core.internal.runtime.AdapterManager; +import org.eclipse.core.internal.runtime.IAdapterFactoryExt; +import org.eclipse.core.runtime.IAdapterFactory; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.e4.core.di.annotations.Creatable; +import org.eclipse.pde.spy.adapter.tools.AdapterHelper; + +import jakarta.inject.Inject; +import jakarta.inject.Singleton; + + +@SuppressWarnings("restriction") +@Creatable +@Singleton +public class AdapterRepository { + + @Inject + IExtensionRegistry extensionRegistry; + + Map sourceTypeToAdapterDataMap = new HashMap<>(); + Map destinationTypeToAdapterDataMap = new HashMap<>(); + List configEleme; + + public Collection getAdapters() { + + if(!sourceTypeToAdapterDataMap.isEmpty()) { + return sourceTypeToAdapterDataMap.values(); + } + + Map> factories = Collections.synchronizedMap(AdapterManager.getDefault().getFactories()); + AtomicReference refAdapterData= new AtomicReference<>(); + factories.forEach( (k,v) -> { + + if (!sourceTypeToAdapterDataMap.containsKey(k)) + { + AdapterData adapData = new AdapterData(AdapterElementType.SOURCE_TYPE); + adapData.setSourceType(k); + sourceTypeToAdapterDataMap.put(k, adapData); + } + refAdapterData.set(sourceTypeToAdapterDataMap.get(k)); + final List configsForSourceType = getAdapterFactoryClassFromExtension(k); + v.forEach(l -> { + if( l instanceof IAdapterFactoryExt) { + + IAdapterFactoryExt adapfext = (IAdapterFactoryExt) l; + AtomicReference refClassName = new AtomicReference<>(); + for( String targetType :adapfext.getAdapterNames()) { + AdapterData adapData = new AdapterData(AdapterElementType.DESTINATION_TYPE); + adapData.setParent(refAdapterData.get()); + adapData.setDestinationType(targetType); + destinationTypeToAdapterDataMap.put(targetType, adapData); + refClassName.set(""); + configsForSourceType.forEach( config -> { + for ( IConfigurationElement child :config.getChildren()) { + String type = child.getAttribute(AdapterHelper.EXT_POINT_ATTR_TYPE); + if( type.equals(targetType)) + { + refClassName.set(config.getAttribute(AdapterHelper.EXT_POINT_ATTR_CLASS)); + } + } + }); + adapData.setAdapterClassName(refClassName.get()); + refAdapterData.get().getChildrenList().add(adapData); + } + } + }); + + }); + destinationTypeToAdapterDataMap.values().forEach( ad -> { + String destType = ad.getDestinationType(); + Optional found = sourceTypeToAdapterDataMap.values().stream().filter( ads -> ads.getSourceType().equals(destType)).findAny(); + if(found.isPresent()) { + found.get().getChildrenList().forEach( adchild -> { + if (((AdapterData)ad.getParent()).getSourceType().equals(adchild.getDestinationType())) { + AdapterData adpd=new AdapterData(adchild); + ad.getChildrenList().add(adpd); + return; + } + ad.getChildrenList().add(adchild); + }); + } + }); + return sourceTypeToAdapterDataMap.values(); + } + + + public List revertSourceToType(){ + return sourceTypeToAdapterDataMap.values().stream().flatMap(AdapterData::convertSourceToType) + .collect(Collectors.toList()); + } + + + public void clear() { + sourceTypeToAdapterDataMap.clear(); + destinationTypeToAdapterDataMap.clear(); + } + + + private List getAdapterFactoryClassFromExtension(String sourceType) { + if( configEleme ==null) { + configEleme = Arrays.asList(extensionRegistry.getConfigurationElementsFor(AdapterHelper.EXT_POINT_ID)); + } + return configEleme.stream().filter( config-> config.getAttribute(AdapterHelper.EXT_POINT_ATTR_ADAPTABLE_TYPE).equals(sourceType)).collect(Collectors.toList()); + + } + +} diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/tools/AdapterHelper.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/tools/AdapterHelper.java new file mode 100644 index 00000000000..8b04f3c943b --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/tools/AdapterHelper.java @@ -0,0 +1,149 @@ +/******************************************************************************* + * Copyright (c) Lacherp. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Lacherp - initial API and implementation + *******************************************************************************/ +package org.eclipse.pde.spy.adapter.tools; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.e4.core.contexts.ContextInjectionFactory; +import org.eclipse.e4.core.contexts.EclipseContextFactory; +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.core.internal.services.EclipseAdapter; +import org.eclipse.e4.core.services.adapter.Adapter; +import org.eclipse.pde.spy.adapter.hook.EclipseAdapterHook; +import org.eclipse.pde.spy.adapter.model.AdapterRepository; +import org.eclipse.e4.ui.internal.workbench.E4Workbench; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.widgets.Display; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +/** + * Helper class + * @author pascal + * + */ +@SuppressWarnings("restriction") +public final class AdapterHelper { + + // Bundle ID + public static final String BUNDLE_ID ="org.eclipse.pde.spy.adapter"; + + // Image keys constants + public static final String BUNDLE_IMG_KEY = "icons/osgi.png"; + public static final String SOURCE_TYPE_IMG_KEY = "icons/from_type.png"; + public static final String DESTINATION_TYPE_IMG_KEY = "icons/to_type.png"; + public static final String INTERFACE_IMG_KEY = "icons/innerinterface_public_obj.png"; + + // extension constant string + public static final String EXT_POINT_ID = "org.eclipse.core.runtime.adapters"; + public static final String EXT_POINT_ATTR_ADAPTABLE_TYPE = "adaptableType"; + public static final String EXT_POINT_ATTR_CLASS = "class"; + public static final String EXT_POINT_ATTR_ADAPTER = "adapter"; + public static final String EXT_POINT_ATTR_TYPE = "type"; + + private static final Map classNameToBundleMap =new HashMap<>(); + private static List bundlesList = new ArrayList<>(); + private static final BundleContext bc = FrameworkUtil.getBundle(AdapterRepository.class).getBundleContext(); + + private static EclipseAdapter originalEclipseAdpater; + + private static BundleContext bcontext; + + private static Color TOOLTIP_BACKGROUND; + + private AdapterHelper() { + // do nothing + } + + + + public static void wrapperEclipseAdapter() { + IEclipseContext serviceContext = E4Workbench.getServiceContext(); + if (serviceContext == null) { + System.err.println("service contextr is null, unable to wrap eclipse adapter"); + return; + } + EclipseAdapter eclipseAdapter = (EclipseAdapter) serviceContext.get(Adapter.class); + if (originalEclipseAdpater == null) { + originalEclipseAdpater = (EclipseAdapter) serviceContext.get(Adapter.class); + } + if (!(eclipseAdapter instanceof EclipseAdapterHook)) { + serviceContext.set(Adapter.class, ContextInjectionFactory.make(EclipseAdapterHook.class, serviceContext)); + } + } + + public static void restoreOriginalEclipseAdapter() { + IEclipseContext serviceContext = E4Workbench.getServiceContext(); + if (serviceContext != null && originalEclipseAdpater != null) { + serviceContext.set(Adapter.class, originalEclipseAdpater); + } + } + + public static IEclipseContext getServicesContext() { + return EclipseContextFactory.getServiceContext(bcontext); + } + + public static ImageRegistry getImageRegistry(Object instance) { + Bundle b = FrameworkUtil.getBundle(instance.getClass()); + bcontext = b.getBundleContext(); + ImageRegistry imgReg = new ImageRegistry(); + imgReg.put(BUNDLE_IMG_KEY, ImageDescriptor.createFromURL(b.getEntry(BUNDLE_IMG_KEY))); + imgReg.put(SOURCE_TYPE_IMG_KEY, ImageDescriptor.createFromURL(b.getEntry(SOURCE_TYPE_IMG_KEY))); + imgReg.put(DESTINATION_TYPE_IMG_KEY, ImageDescriptor.createFromURL(b.getEntry(DESTINATION_TYPE_IMG_KEY))); + imgReg.put(INTERFACE_IMG_KEY, ImageDescriptor.createFromURL(b.getEntry(INTERFACE_IMG_KEY))); + return imgReg; + } + + public static boolean isInterfaceTypeClass(Bundle bundle,String className){ + + try { + Class clazz = bundle.loadClass(className); + return clazz.isInterface(); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + return false; + } + + public static Bundle getBundleForClassName(String className) { + if (bundlesList.isEmpty()) + { + bundlesList = Arrays.asList(bc.getBundles()); + } + if (!classNameToBundleMap.containsKey(className)) + { + final String classpath = "/"+className.replace(".", "/") +".class"; + Bundle bundlefound = bundlesList.parallelStream().filter( b -> b.getEntry( classpath)!= null).findFirst().orElse(null); + classNameToBundleMap.put(className, bundlefound); + } + return classNameToBundleMap.get(className); + } + + public static Color getColor(Display display,String colorName) { + if( colorName != null && "TOOLTIP_BACKGROUND".equals(colorName)) { + return TOOLTIP_BACKGROUND == null ? (TOOLTIP_BACKGROUND = new Color(display, new RGB(245, 245, 220))): TOOLTIP_BACKGROUND; + } + return null; + + } + + +} diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/AdapterContentProvider.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/AdapterContentProvider.java new file mode 100644 index 00000000000..cfc1fa36c26 --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/AdapterContentProvider.java @@ -0,0 +1,144 @@ +/******************************************************************************* + * Copyright (c) Lacherp. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Lacherp - initial API and implementation + *******************************************************************************/ +package org.eclipse.pde.spy.adapter.viewer; + +import java.util.Collection; + +import org.eclipse.e4.core.di.annotations.Optional; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.pde.spy.adapter.model.AdapterData; +import org.eclipse.pde.spy.adapter.tools.AdapterHelper; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; + +import jakarta.inject.Inject; +import jakarta.inject.Named; + +/** + * This provider is used to display available plugins which contribute to + * adapters.exsd extension point + * + * @author pascal + * + */ +public class AdapterContentProvider extends ColumnLabelProviderCustom implements ITreeContentProvider { + + @Inject + private ImageRegistry imgReg; + + private int columnIndex; + + private Boolean sourceToDestination = true; + + @Override + public Object[] getElements(Object inputElement) { + + if (inputElement instanceof Collection) { + return ((Collection) inputElement).toArray(); + } + return (Object[]) inputElement; + } + + @Override + public Object[] getChildren(Object parentElement) { + if (parentElement instanceof AdapterData) { + return (Object[]) ((AdapterData) parentElement).getChildren(sourceToDestination); + } + + return new Object[0]; + } + + @Override + public Object getParent(Object element) { + if (element instanceof AdapterData) { + return ((AdapterData) element).getParent(); + } + return null; + } + + @Override + public boolean hasChildren(Object element) { + + if (element instanceof AdapterData) { + return ((AdapterData) element).hasChildren(); + } + return false; + } + + @Override + public String getText(Object element) { + + if (element instanceof AdapterData) { + return ((AdapterData) element).getText(columnIndex); + } + return ""; + } + + @Override + public Image getImage(Object element) { + if (columnIndex == 0) { + if (element instanceof AdapterData) { + String imgname = ((AdapterData) element).getImageName(); + return imgname == null ? super.getImage(element) : imgReg.get(imgname); + } + + } + return super.getImage(element); + } + + @Override + public int getToolTipStyle(Object object) { + return SWT.SHADOW_OUT; + } + + @Override + public Color getToolTipBackgroundColor(Object object) { + return AdapterHelper.getColor(Display.getDefault(),"TOOLTIP_BACKGROUND"); + + } + + @Override + protected StyleRange[] getToolTipStyleRanges(Object element) { + if (element instanceof AdapterData) { + return ((AdapterData) element).getToolTipStyleRanges(sourceToDestination, columnIndex); + } + return null; + } + + @Override + public String getToolTipText(Object element) { + if (element instanceof AdapterData && ((AdapterData) element).getToolTipText(sourceToDestination, columnIndex) != null) { + return ((AdapterData) element).getToolTipText(sourceToDestination, columnIndex).replaceAll("\"",""); + } + return ""; + } + + @Inject + @Optional + public void updateTextSearchFilter(@Named(AdapterFilter.UPDATE_CTX_FILTER) FilterData filterData) { + if (filterData == null) { + return; + } + this.sourceToDestination = filterData.getSourceToDestination(); + } + + public void setColumnIndex(int columnIndex) { + this.columnIndex = columnIndex; + + } +} diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/AdapterDataComparator.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/AdapterDataComparator.java new file mode 100644 index 00000000000..7188851907a --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/AdapterDataComparator.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) Lacherp. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Lacherp - initial API and implementation + *******************************************************************************/ +package org.eclipse.pde.spy.adapter.viewer; + +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerComparator; +import org.eclipse.pde.spy.adapter.model.AdapterData; +import org.eclipse.swt.SWT; + +public class AdapterDataComparator extends ViewerComparator { + + private int columnIndex; + private int direction; + + public AdapterDataComparator(int columnIndex) { + this.columnIndex = columnIndex; + direction = SWT.UP; + } + + /** Called when click on table header, reverse order */ + public void setColumn(int column) { + if (column == columnIndex) { + // Same column as last sort; toggle the direction + direction = (direction == SWT.UP) ? SWT.DOWN : SWT.UP; + } else { + // New column; do a descending sort + columnIndex = column; + direction = SWT.DOWN; + } + } + + @Override + public int compare(Viewer viewer, Object e1, Object e2) { + // Now can compare the text from label provider. + if (e1 instanceof AdapterData && e2 instanceof AdapterData) { + int rc = ((AdapterData) e1).compareTo((AdapterData) e2); + // If descending order, flip the direction + return (direction == SWT.DOWN) ? -rc : rc; + } + return -1; + } + + public int getDirection() { + return direction; + } +} diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/AdapterFilter.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/AdapterFilter.java new file mode 100644 index 00000000000..0837e6c303a --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/AdapterFilter.java @@ -0,0 +1,90 @@ +/******************************************************************************* + * Copyright (c) Lacherp. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Lacherp - initial API and implementation + *******************************************************************************/ +package org.eclipse.pde.spy.adapter.viewer; + +import java.util.concurrent.atomic.AtomicBoolean; + +import org.eclipse.e4.core.di.annotations.Optional; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.pde.spy.adapter.model.AdapterData; +import org.eclipse.pde.spy.adapter.model.AdapterElementType; + +import jakarta.inject.Inject; +import jakarta.inject.Named; + +/** + * Adapter Tree viewer filter + * @author pascal + * + */ +public class AdapterFilter extends ViewerFilter { + + public static final String UPDATE_CTX_FILTER ="updateCtxfilter"; + + private String txtSeachFilter; + private Boolean showPackageFilter = Boolean.TRUE; + private Boolean sourceToDestination = Boolean.TRUE; + + @Override + public boolean select(Viewer viewer, Object parentElement, Object element) { + + if(element instanceof AdapterData) { + + ((AdapterData)element).setShowPackage(showPackageFilter); + } + + if (txtSeachFilter != null && !txtSeachFilter.isEmpty()) { + doFilter((AdapterData) element); + } + if(txtSeachFilter != null && txtSeachFilter.isEmpty()) + { + ((AdapterData)element).setVisibilityFilter(true); + ((AdapterData)element).propagateVisibility(); + } + return ((AdapterData)element).isVisibilityFilter(); + } + + @Inject + @Optional + public void updateTextSearchFilter(@Named(UPDATE_CTX_FILTER) FilterData filterData) { + if( filterData == null ) + { + return; + } + this.txtSeachFilter = filterData.getTxtSeachFilter(); + this.showPackageFilter= filterData.getShowPackage(); + this.sourceToDestination = filterData.getSourceToDestination(); + } + + + private void doFilter(AdapterData AdapterData2) + { + if( Boolean.TRUE.equals(sourceToDestination) && AdapterData2.getAdapterElementType().equals(AdapterElementType.SOURCE_TYPE)) + { + doVisibility(AdapterData2); + } + if( Boolean.FALSE.equals(sourceToDestination) && AdapterData2.getAdapterElementType().equals(AdapterElementType.DESTINATION_TYPE)) + { + doVisibility(AdapterData2); + } + } + + private void doVisibility(AdapterData AdapterData2) { + AtomicBoolean bfound = new AtomicBoolean(false); + AdapterData2.textSearch(txtSeachFilter, bfound); + AdapterData2.setVisibilityFilter(bfound.get()); + AdapterData2.propagateVisibility(); + } +} diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/ColumnLabelProviderCustom.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/ColumnLabelProviderCustom.java new file mode 100644 index 00000000000..bf6319721b8 --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/ColumnLabelProviderCustom.java @@ -0,0 +1,12 @@ +package org.eclipse.pde.spy.adapter.viewer; + +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.swt.custom.StyleRange; + +public class ColumnLabelProviderCustom extends ColumnLabelProvider { + + protected StyleRange[] getToolTipStyleRanges(Object element) { + return null; + } + +} diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/ColumnViewerToolTipSupportCustom.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/ColumnViewerToolTipSupportCustom.java new file mode 100644 index 00000000000..a1596338546 --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/ColumnViewerToolTipSupportCustom.java @@ -0,0 +1,76 @@ +package org.eclipse.pde.spy.adapter.viewer; + +import org.eclipse.jface.util.Policy; +import org.eclipse.jface.viewers.CellLabelProvider; +import org.eclipse.jface.viewers.ColumnViewer; +import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; +import org.eclipse.jface.viewers.ViewerRow; +import org.eclipse.jface.window.ToolTip; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; + +public class ColumnViewerToolTipSupportCustom extends ColumnViewerToolTipSupport { + + private ColumnViewer viewer; + private static final String VIEWER_CELL_KEY = Policy.JFACE + + "_VIEWER_CELL_KEY"; //$NON-NLS-1$ + + private StyleRange [] ranges; + protected ColumnViewerToolTipSupportCustom(ColumnViewer viewer, int style, boolean manualActivation) { + super(viewer, style, manualActivation); + this.viewer = viewer; + } + + /** + * Enable ToolTip support for the viewer by creating an instance from this + * class. To get all necessary informations this support class consults the + * {@link CellLabelProvider}. + * + * @param viewer + * the viewer the support is attached to + */ + public static void enableFor(ColumnViewer viewer) { + new ColumnViewerToolTipSupportCustom(viewer, ToolTip.NO_RECREATE, false); + } + + @Override + protected boolean shouldCreateToolTip(Event event) { + boolean rv = super.shouldCreateToolTip(event); + if (!rv) { + return false; + } + Point pt = new Point(event.x,event.y); + ViewerRow row = viewer.getCell(pt).getViewerRow(); + Object element = row.getItem().getData(); + ColumnLabelProviderCustom customlabelProvider = (ColumnLabelProviderCustom) viewer.getLabelProvider(viewer.getCell(pt).getColumnIndex()); ranges = customlabelProvider.getToolTipStyleRanges(element); + ranges = customlabelProvider.getToolTipStyleRanges(element); + String txt = customlabelProvider.getToolTipText(element); + return !txt.isEmpty(); + } + + + @Override + protected Composite createToolTipContentArea(Event event, Composite parent) { + setData(VIEWER_CELL_KEY, null); + String text = getText(event); + Color bgColor = getBackgroundColor(event); + StyledText styledText = new StyledText(parent, SWT.NONE); + if (text != null) { + styledText.setText(text); + } + if ( ranges != null) { + + styledText.setStyleRanges(ranges); + } + if(bgColor != null) { + styledText.setBackground(bgColor); + } + return styledText; + } + +} diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/FilterData.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/FilterData.java new file mode 100644 index 00000000000..b38bec583a1 --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/FilterData.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) Lacherp. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Lacherp - initial API and implementation + *******************************************************************************/ +package org.eclipse.pde.spy.adapter.viewer; + +/** + * This class is used to store data filter in the context + * @author pascal + * + */ +public class FilterData { + + String txtSeachFilter; + Boolean showPackage; + Boolean sourceToDestination; + /** + * Ctor + */ + public FilterData() { + showPackage = Boolean.TRUE; + sourceToDestination = Boolean.TRUE; + } + + /** + * Copy ctor + * @param fdata + */ + public FilterData(FilterData fdata) + { + this.txtSeachFilter = fdata.txtSeachFilter; + this.showPackage = fdata.showPackage; + this.sourceToDestination = fdata.sourceToDestination; + } + /** + * @return the txtSeachFilter + */ + public String getTxtSeachFilter() { + return txtSeachFilter; + } + + /** + * @param txtSeachFilter the txtSeachFilter to set + */ + public void setTxtSeachFilter(String txtSeachFilter) { + this.txtSeachFilter = txtSeachFilter; + + } + + /** + * @return the showPackage + */ + public Boolean getShowPackage() { + return showPackage; + } + + /** + * @param showPackage the showPackage to set + */ + public void setShowPackage(Boolean showPackage) { + this.showPackage = showPackage; + } + + /** + * @return the sourceToDestination + */ + public Boolean getSourceToDestination() { + return sourceToDestination; + } + + /** + * @param sourceToDestination the sourceToDestination to set + */ + public void setSourceToDestination(Boolean sourceToDestination) { + this.sourceToDestination = sourceToDestination; + } + + +} From c558824f07047d2b3ca84f26f33e5d3118dbefa6 Mon Sep 17 00:00:00 2001 From: Marc SAINT-PIERRE Date: Mon, 1 Dec 2025 16:03:03 +0100 Subject: [PATCH 2/4] Fix before PR --- .../META-INF/MANIFEST.MF | 4 +- .../OSGI-INF/l10n/bundle.properties | 3 - .../plugin.properties | 18 ++++ .../pde/spy/adapter/AdapterSpyPart.java | 96 +++++++++++-------- 4 files changed, 78 insertions(+), 43 deletions(-) delete mode 100644 ui/org.eclipse.pde.spy.adapter/OSGI-INF/l10n/bundle.properties create mode 100644 ui/org.eclipse.pde.spy.adapter/plugin.properties diff --git a/ui/org.eclipse.pde.spy.adapter/META-INF/MANIFEST.MF b/ui/org.eclipse.pde.spy.adapter/META-INF/MANIFEST.MF index a53107a6925..9da2b82ac84 100644 --- a/ui/org.eclipse.pde.spy.adapter/META-INF/MANIFEST.MF +++ b/ui/org.eclipse.pde.spy.adapter/META-INF/MANIFEST.MF @@ -1,6 +1,6 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: %Bundle-Name +Bundle-Name: %name Bundle-SymbolicName: org.eclipse.pde.spy.adapter;singleton:=true Bundle-Version: 0.1.0.qualifier Require-Bundle: org.eclipse.core.runtime, @@ -17,6 +17,6 @@ Require-Bundle: org.eclipse.core.runtime, Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.eclipse.pde.spy.adapter Bundle-ActivationPolicy: lazy -Bundle-Vendor: %Bundle-Vendor +Bundle-Vendor: %provider-name Import-Package: jakarta.annotation;version="[2.1.0,3.0.0)", jakarta.inject;version="[2.0.0,3.0.0)" diff --git a/ui/org.eclipse.pde.spy.adapter/OSGI-INF/l10n/bundle.properties b/ui/org.eclipse.pde.spy.adapter/OSGI-INF/l10n/bundle.properties deleted file mode 100644 index 03f66eb891b..00000000000 --- a/ui/org.eclipse.pde.spy.adapter/OSGI-INF/l10n/bundle.properties +++ /dev/null @@ -1,3 +0,0 @@ -#Properties file for org.eclipse.pde.spy.adapter -Bundle-Vendor = Eclipse.org -Bundle-Name = Adapter Spy \ No newline at end of file diff --git a/ui/org.eclipse.pde.spy.adapter/plugin.properties b/ui/org.eclipse.pde.spy.adapter/plugin.properties new file mode 100644 index 00000000000..452b1e0ac1a --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/plugin.properties @@ -0,0 +1,18 @@ +############################################################################### +# Copyright (c) 2025, amelodev. +# +# This program and the accompanying materials +# are made available under the terms of the Eclipse Public License 2.0 +# which accompanies this distribution, and is available at +# https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Marc SAINT-PIERRE - initial API and implementation +############################################################################### +# +# +name = Adapter Spy +provider-name = Eclipse.org +description = Adapter spy to display the adapter hierarchy \ No newline at end of file diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/AdapterSpyPart.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/AdapterSpyPart.java index 187eb647577..412f728fb49 100644 --- a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/AdapterSpyPart.java +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/AdapterSpyPart.java @@ -51,8 +51,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.ToolBar; -import org.eclipse.swt.widgets.ToolItem; import org.eclipse.swt.widgets.Tree; import jakarta.annotation.PostConstruct; @@ -74,8 +72,12 @@ public class AdapterSpyPart { private static final String NAMED_UPDATE_TREE_SOURCE_TO_DESTINATION = "updateTreeSourceToDestination"; private static final String NAMED_UPDATE_TREE_DESTINATION_TO_SOURCE = "updateTreeDestinationToSource"; - private static final String SWITCH_TO_SOURCE = "switch to Source Type first"; - private static final String SWITCH_TO_DESTINATION = "switch to Destination Type first"; + private static final String SOURCE_TYPE = "Source Type"; + private static final String DESTINATION_TYPE = "Destination Type"; + private static final String DISPLAY_SOURCE_TYPE = "Display " + SOURCE_TYPE; + private static final String DISPLAY_DESTINATION_TYPE = "Display " + DESTINATION_TYPE; + private static final String TOOLTIP_SOURCE_TYPE = "Display the source type first, and list\nall destination types derived from that source as child elements."; + private static final String TOOLTIP_DESTINATION_TYPE = "Display the destination type first, and list\nall source types that can adapt to it as child elements."; @Inject UISynchronize uisync; @@ -288,7 +290,8 @@ private void createToolBarZone(Composite parent, ImageRegistry imgr) { comp.setLayout(new GridLayout(4, false)); Text filterText = new Text(comp, SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL); - GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).applyTo(filterText); + GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.CENTER).hint(250, SWT.DEFAULT).applyTo(filterText); + filterText.setMessage("Search data"); filterText.setToolTipText("Find any element in tree"); @@ -320,41 +323,58 @@ public void widgetSelected(SelectionEvent e) { } }); + // --- Vertical radio buttons to choose display direction --- + Composite radioGroup = new Composite(comp, SWT.NONE); + radioGroup.setLayout(new GridLayout(1, false)); + + Button rbSource = new Button(radioGroup, SWT.RADIO); + rbSource.setText(DISPLAY_SOURCE_TYPE); + rbSource.setToolTipText(TOOLTIP_SOURCE_TYPE); + + Button rbDestination = new Button(radioGroup, SWT.RADIO); + rbDestination.setText(DISPLAY_DESTINATION_TYPE); + rbDestination.setToolTipText(TOOLTIP_DESTINATION_TYPE); + + rbSource.setSelection(sourceToDestination); + rbDestination.setSelection(!sourceToDestination); + + // Factorized refresh logic + Runnable refreshView = () -> { + FilterData fdata = getFilterData(); + fdata.setSourceToDestination(sourceToDestination); + context.set(AdapterFilter.UPDATE_CTX_FILTER, fdata); + + if (sourceToDestination) { + sourceOrDestinationTvc.getColumn().setText(SOURCE_TYPE); + context.set(NAMED_UPDATE_TREE_SOURCE_TO_DESTINATION, adapterRepo.getAdapters()); + } else { + sourceOrDestinationTvc.getColumn().setText(DESTINATION_TYPE); + context.set(NAMED_UPDATE_TREE_DESTINATION_TO_SOURCE, adapterRepo.revertSourceToType()); + } + adapterTreeViewer.refresh(true); + }; + + // Listeners + rbSource.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (rbSource.getSelection()) { + sourceToDestination = true; + refreshView.run(); + } + } + }); - ToolBar toolBar = new ToolBar(comp, SWT.NONE); - ToolItem switchButton = new ToolItem(toolBar, SWT.CHECK); - switchButton.setImage(imgr.get(AdapterHelper.DESTINATION_TYPE_IMG_KEY)); - switchButton.setToolTipText(SWITCH_TO_DESTINATION); - - // sourceToType event - switchButton.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent event) { - Object source = event.getSource(); - if (source instanceof ToolItem) { - FilterData fdata = getFilterData(); - sourceToDestination = !sourceToDestination; - String tooltiptext = sourceToDestination ? SWITCH_TO_DESTINATION :SWITCH_TO_SOURCE; - String imageKey = sourceToDestination ? AdapterHelper.DESTINATION_TYPE_IMG_KEY - : AdapterHelper.SOURCE_TYPE_IMG_KEY; - switchButton.setToolTipText(tooltiptext); - switchButton.setImage(imgr.get(imageKey)); - - if (sourceToDestination) { - sourceOrDestinationTvc.getColumn().setText("Source Type"); - context.set(NAMED_UPDATE_TREE_SOURCE_TO_DESTINATION, adapterRepo.getAdapters()); - } else { - sourceOrDestinationTvc.getColumn().setText("Destination Type"); - context.set(NAMED_UPDATE_TREE_DESTINATION_TO_SOURCE, adapterRepo.revertSourceToType()); - } - fdata.setSourceToDestination(sourceToDestination); - context.set(AdapterFilter.UPDATE_CTX_FILTER, fdata); - adapterTreeViewer.refresh(true); - } - - } + rbDestination.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (rbDestination.getSelection()) { + sourceToDestination = false; + refreshView.run(); + } + } }); + uisync.asyncExec(() -> comp.pack()); } From 8291c5ffe09f750642700207e8f7134d417123ad Mon Sep 17 00:00:00 2001 From: Marc SAINT-PIERRE Date: Fri, 20 Feb 2026 14:34:27 +0100 Subject: [PATCH 3/4] Java 21 UTF-8 modern SVG icon for AdapterSpy --- ui/org.eclipse.pde.spy.adapter/.classpath | 2 +- .../.settings/org.eclipse.core.resources.prefs | 2 ++ .../.settings/org.eclipse.jdt.core.prefs | 12 +++++++++--- .../META-INF/MANIFEST.MF | 2 +- ui/org.eclipse.pde.spy.adapter/about.html | 4 ++-- ui/org.eclipse.pde.spy.adapter/plugin.xml | 2 +- ui/org.eclipse.pde.spy.adapter/pom.xml | 16 ---------------- 7 files changed, 16 insertions(+), 24 deletions(-) create mode 100644 ui/org.eclipse.pde.spy.adapter/.settings/org.eclipse.core.resources.prefs delete mode 100644 ui/org.eclipse.pde.spy.adapter/pom.xml diff --git a/ui/org.eclipse.pde.spy.adapter/.classpath b/ui/org.eclipse.pde.spy.adapter/.classpath index f5399bf4179..375961e4d61 100644 --- a/ui/org.eclipse.pde.spy.adapter/.classpath +++ b/ui/org.eclipse.pde.spy.adapter/.classpath @@ -1,6 +1,6 @@ - + diff --git a/ui/org.eclipse.pde.spy.adapter/.settings/org.eclipse.core.resources.prefs b/ui/org.eclipse.pde.spy.adapter/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000000..99f26c0203a --- /dev/null +++ b/ui/org.eclipse.pde.spy.adapter/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/ui/org.eclipse.pde.spy.adapter/.settings/org.eclipse.jdt.core.prefs b/ui/org.eclipse.pde.spy.adapter/.settings/org.eclipse.jdt.core.prefs index 5867b6520da..306cb687c4f 100644 --- a/ui/org.eclipse.pde.spy.adapter/.settings/org.eclipse.jdt.core.prefs +++ b/ui/org.eclipse.pde.spy.adapter/.settings/org.eclipse.jdt.core.prefs @@ -1,9 +1,15 @@ eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=14 -org.eclipse.jdt.core.compiler.compliance=14 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=21 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=21 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.release=enabled -org.eclipse.jdt.core.compiler.source=14 +org.eclipse.jdt.core.compiler.source=21 +encoding/org.eclipse.pde.spy.adapter=UTF-8 \ No newline at end of file diff --git a/ui/org.eclipse.pde.spy.adapter/META-INF/MANIFEST.MF b/ui/org.eclipse.pde.spy.adapter/META-INF/MANIFEST.MF index 9da2b82ac84..30cc49c3342 100644 --- a/ui/org.eclipse.pde.spy.adapter/META-INF/MANIFEST.MF +++ b/ui/org.eclipse.pde.spy.adapter/META-INF/MANIFEST.MF @@ -14,7 +14,7 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.jface, org.eclipse.equinox.common, org.eclipse.e4.ui.services -Bundle-RequiredExecutionEnvironment: JavaSE-11 +Bundle-RequiredExecutionEnvironment: JavaSE-21 Automatic-Module-Name: org.eclipse.pde.spy.adapter Bundle-ActivationPolicy: lazy Bundle-Vendor: %provider-name diff --git a/ui/org.eclipse.pde.spy.adapter/about.html b/ui/org.eclipse.pde.spy.adapter/about.html index 527b8491ded..3c90a2af4be 100644 --- a/ui/org.eclipse.pde.spy.adapter/about.html +++ b/ui/org.eclipse.pde.spy.adapter/about.html @@ -13,8 +13,8 @@

License

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

If you did not receive this Content directly from the Eclipse Foundation, the Content is diff --git a/ui/org.eclipse.pde.spy.adapter/plugin.xml b/ui/org.eclipse.pde.spy.adapter/plugin.xml index b10d10b88a3..33f2e7a8ce3 100644 --- a/ui/org.eclipse.pde.spy.adapter/plugin.xml +++ b/ui/org.eclipse.pde.spy.adapter/plugin.xml @@ -5,7 +5,7 @@ point="org.eclipse.pde.spy.core.spyPart"> diff --git a/ui/org.eclipse.pde.spy.adapter/pom.xml b/ui/org.eclipse.pde.spy.adapter/pom.xml deleted file mode 100644 index 09489370fb1..00000000000 --- a/ui/org.eclipse.pde.spy.adapter/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - 4.0.0 - - org.eclipse.e4.tools - e4-tools-aggregator - 0.18.0-SNAPSHOT - ../../ - - - org.eclipse.e4 - 0.1.0-SNAPSHOT - org.eclipse.pde.spy.adapter - eclipse-plugin - - \ No newline at end of file From db2393cf106608bd25bd97ff29dfba4b5c55ae51 Mon Sep 17 00:00:00 2001 From: Marc SAINT-PIERRE Date: Tue, 24 Feb 2026 14:17:44 +0100 Subject: [PATCH 4/4] Copilot Review changes --- .../META-INF/MANIFEST.MF | 3 +++ .../build.properties | 3 +-- .../plugin.properties | 4 ++-- ui/org.eclipse.pde.spy.adapter/plugin.xml | 4 ++-- .../pde/spy/adapter/AdapterSpyPart.java | 6 +++--- .../org/eclipse/pde/spy/adapter/Messages.java | 2 +- .../pde/spy/adapter/Messages.properties | 2 +- .../pde/spy/adapter/model/AdapterData.java | 2 +- .../spy/adapter/model/AdapterRepository.java | 13 ++++++++++++ .../pde/spy/adapter/tools/AdapterHelper.java | 15 +++++++------- .../pde/spy/adapter/viewer/AdapterFilter.java | 20 +++++++++---------- .../viewer/ColumnLabelProviderCustom.java | 13 ++++++++++++ .../ColumnViewerToolTipSupportCustom.java | 15 +++++++++++++- .../pde/spy/adapter/viewer/FilterData.java | 20 +++++++++---------- 14 files changed, 81 insertions(+), 41 deletions(-) diff --git a/ui/org.eclipse.pde.spy.adapter/META-INF/MANIFEST.MF b/ui/org.eclipse.pde.spy.adapter/META-INF/MANIFEST.MF index 30cc49c3342..9386a2517af 100644 --- a/ui/org.eclipse.pde.spy.adapter/META-INF/MANIFEST.MF +++ b/ui/org.eclipse.pde.spy.adapter/META-INF/MANIFEST.MF @@ -20,3 +20,6 @@ Bundle-ActivationPolicy: lazy Bundle-Vendor: %provider-name Import-Package: jakarta.annotation;version="[2.1.0,3.0.0)", jakarta.inject;version="[2.0.0,3.0.0)" +Bundle-Localization: plugin +Export-Package: org.eclipse.pde.spy.adapter +Require-Capability: eclipse.swt;filter:="(image.format=svg)" diff --git a/ui/org.eclipse.pde.spy.adapter/build.properties b/ui/org.eclipse.pde.spy.adapter/build.properties index fed38af73a3..639937d9fc7 100644 --- a/ui/org.eclipse.pde.spy.adapter/build.properties +++ b/ui/org.eclipse.pde.spy.adapter/build.properties @@ -4,5 +4,4 @@ bin.includes = META-INF/,\ .,\ icons/,\ plugin.xml,\ - OSGI-INF/l10n/bundle.properties,\ - OSGI-INF/ + plugin.properties diff --git a/ui/org.eclipse.pde.spy.adapter/plugin.properties b/ui/org.eclipse.pde.spy.adapter/plugin.properties index 452b1e0ac1a..959be25e3a6 100644 --- a/ui/org.eclipse.pde.spy.adapter/plugin.properties +++ b/ui/org.eclipse.pde.spy.adapter/plugin.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2025, amelodev. +# Copyright (c) Lacherp. # # This program and the accompanying materials # are made available under the terms of the Eclipse Public License 2.0 @@ -9,7 +9,7 @@ # SPDX-License-Identifier: EPL-2.0 # # Contributors: -# Marc SAINT-PIERRE - initial API and implementation +# Lacherp - initial API and implementation ############################################################################### # # diff --git a/ui/org.eclipse.pde.spy.adapter/plugin.xml b/ui/org.eclipse.pde.spy.adapter/plugin.xml index 33f2e7a8ce3..4ace6694510 100644 --- a/ui/org.eclipse.pde.spy.adapter/plugin.xml +++ b/ui/org.eclipse.pde.spy.adapter/plugin.xml @@ -4,9 +4,9 @@ diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/AdapterSpyPart.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/AdapterSpyPart.java index 412f728fb49..3250205d1f1 100644 --- a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/AdapterSpyPart.java +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/AdapterSpyPart.java @@ -229,7 +229,7 @@ private void updateAdapterTreeViewerSourceToType( @Inject @Optional - private void udpateAdapterTreeViewTypeToSource( + private void updateAdapterTreeViewTypeToSource( @Named(NAMED_UPDATE_TREE_DESTINATION_TO_SOURCE) Collection adapaters) { if (adapaters == null) { return; @@ -298,9 +298,9 @@ private void createToolBarZone(Composite parent, ImageRegistry imgr) { filterText.addModifyListener(e -> { FilterData fdata = getFilterData(); if (filterText.getText().isEmpty()) { - fdata.setTxtSeachFilter(""); + fdata.setTxtSearchFilter(""); } else { - fdata.setTxtSeachFilter(filterText.getText()); + fdata.setTxtSearchFilter(filterText.getText()); } context.set(AdapterFilter.UPDATE_CTX_FILTER, fdata); adapterTreeViewer.refresh(true); diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/Messages.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/Messages.java index a6331681e0f..1f26ba8f76d 100644 --- a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/Messages.java +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/Messages.java @@ -36,6 +36,6 @@ public class Messages extends NLS { } public static void reloadMessages() { - NLS.initializeMessages(AdapterHelper.BUNDLE_ID+ ".messages.Messages", Messages.class); + NLS.initializeMessages(AdapterHelper.BUNDLE_ID+ ".Messages", Messages.class); } } diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/Messages.properties b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/Messages.properties index 60f6c1d957d..d50b4ba52e6 100644 --- a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/Messages.properties +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/Messages.properties @@ -18,7 +18,7 @@ rootDestinationTypeToolTip = expand this node to know the types that can be adap # child node tooltip childSourceTypeToolTip = \"{0}\" can be adapted to \"{1}\"\n by the \"{2}\" -childDestinationTypeToolTip = \"{0}\" can be obtained from \"{1}\" using \"{2}\" adapter factory' +childDestinationTypeToolTip = \"{0}\" can be obtained from \"{1}\" using \"{2}\" adapter factory # Adapter Factory column adapterFactory = \"{0}\" adapter factory can transform \"{1}\" to \"{2}\" diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterData.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterData.java index 412b4017bb9..ebd079cfdf2 100644 --- a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterData.java +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterData.java @@ -31,7 +31,7 @@ import org.osgi.framework.Bundle; /** - * Adapter data model Object This class is used to store ConfigarationElement + * Adapter data model Object This class is used to store ConfigurationElement * elements which use an adapter * * @author pascal diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterRepository.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterRepository.java index 4da31feea4e..534fe416ad9 100644 --- a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterRepository.java +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/model/AdapterRepository.java @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) Lacherp. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Lacherp - initial API and implementation + *******************************************************************************/ package org.eclipse.pde.spy.adapter.model; import java.util.Arrays; diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/tools/AdapterHelper.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/tools/AdapterHelper.java index 8b04f3c943b..f5acdc8b0c0 100644 --- a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/tools/AdapterHelper.java +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/tools/AdapterHelper.java @@ -63,7 +63,7 @@ public final class AdapterHelper { private static List bundlesList = new ArrayList<>(); private static final BundleContext bc = FrameworkUtil.getBundle(AdapterRepository.class).getBundleContext(); - private static EclipseAdapter originalEclipseAdpater; + private static EclipseAdapter originalEclipseAdapter; private static BundleContext bcontext; @@ -78,12 +78,12 @@ private AdapterHelper() { public static void wrapperEclipseAdapter() { IEclipseContext serviceContext = E4Workbench.getServiceContext(); if (serviceContext == null) { - System.err.println("service contextr is null, unable to wrap eclipse adapter"); + System.err.println("service context is null, unable to wrap eclipse adapter"); return; } EclipseAdapter eclipseAdapter = (EclipseAdapter) serviceContext.get(Adapter.class); - if (originalEclipseAdpater == null) { - originalEclipseAdpater = (EclipseAdapter) serviceContext.get(Adapter.class); + if (originalEclipseAdapter == null) { + originalEclipseAdapter = (EclipseAdapter) serviceContext.get(Adapter.class); } if (!(eclipseAdapter instanceof EclipseAdapterHook)) { serviceContext.set(Adapter.class, ContextInjectionFactory.make(EclipseAdapterHook.class, serviceContext)); @@ -92,8 +92,8 @@ public static void wrapperEclipseAdapter() { public static void restoreOriginalEclipseAdapter() { IEclipseContext serviceContext = E4Workbench.getServiceContext(); - if (serviceContext != null && originalEclipseAdpater != null) { - serviceContext.set(Adapter.class, originalEclipseAdpater); + if (serviceContext != null && originalEclipseAdapter != null) { + serviceContext.set(Adapter.class, originalEclipseAdapter); } } @@ -118,12 +118,11 @@ public static boolean isInterfaceTypeClass(Bundle bundle,String className){ Class clazz = bundle.loadClass(className); return clazz.isInterface(); } catch (ClassNotFoundException e) { - e.printStackTrace(); } return false; } - public static Bundle getBundleForClassName(String className) { + public static synchronized Bundle getBundleForClassName(String className) { if (bundlesList.isEmpty()) { bundlesList = Arrays.asList(bc.getBundles()); diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/AdapterFilter.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/AdapterFilter.java index 0837e6c303a..a12c684e8a5 100644 --- a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/AdapterFilter.java +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/AdapterFilter.java @@ -63,28 +63,28 @@ public void updateTextSearchFilter(@Named(UPDATE_CTX_FILTER) FilterData filterDa { return; } - this.txtSeachFilter = filterData.getTxtSeachFilter(); + this.txtSeachFilter = filterData.getTxtSearchFilter(); this.showPackageFilter= filterData.getShowPackage(); this.sourceToDestination = filterData.getSourceToDestination(); } - private void doFilter(AdapterData AdapterData2) + private void doFilter(AdapterData adapterData) { - if( Boolean.TRUE.equals(sourceToDestination) && AdapterData2.getAdapterElementType().equals(AdapterElementType.SOURCE_TYPE)) + if( Boolean.TRUE.equals(sourceToDestination) && adapterData.getAdapterElementType().equals(AdapterElementType.SOURCE_TYPE)) { - doVisibility(AdapterData2); + doVisibility(adapterData); } - if( Boolean.FALSE.equals(sourceToDestination) && AdapterData2.getAdapterElementType().equals(AdapterElementType.DESTINATION_TYPE)) + if( Boolean.FALSE.equals(sourceToDestination) && adapterData.getAdapterElementType().equals(AdapterElementType.DESTINATION_TYPE)) { - doVisibility(AdapterData2); + doVisibility(adapterData); } } - private void doVisibility(AdapterData AdapterData2) { + private void doVisibility(AdapterData adapterData) { AtomicBoolean bfound = new AtomicBoolean(false); - AdapterData2.textSearch(txtSeachFilter, bfound); - AdapterData2.setVisibilityFilter(bfound.get()); - AdapterData2.propagateVisibility(); + adapterData.textSearch(txtSeachFilter, bfound); + adapterData.setVisibilityFilter(bfound.get()); + adapterData.propagateVisibility(); } } diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/ColumnLabelProviderCustom.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/ColumnLabelProviderCustom.java index bf6319721b8..708e39244a9 100644 --- a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/ColumnLabelProviderCustom.java +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/ColumnLabelProviderCustom.java @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) Lacherp. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Lacherp - initial API and implementation + *******************************************************************************/ package org.eclipse.pde.spy.adapter.viewer; import org.eclipse.jface.viewers.ColumnLabelProvider; diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/ColumnViewerToolTipSupportCustom.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/ColumnViewerToolTipSupportCustom.java index a1596338546..330268ac2f2 100644 --- a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/ColumnViewerToolTipSupportCustom.java +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/ColumnViewerToolTipSupportCustom.java @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) Lacherp. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Lacherp - initial API and implementation + *******************************************************************************/ package org.eclipse.pde.spy.adapter.viewer; import org.eclipse.jface.util.Policy; @@ -47,7 +60,7 @@ protected boolean shouldCreateToolTip(Event event) { Point pt = new Point(event.x,event.y); ViewerRow row = viewer.getCell(pt).getViewerRow(); Object element = row.getItem().getData(); - ColumnLabelProviderCustom customlabelProvider = (ColumnLabelProviderCustom) viewer.getLabelProvider(viewer.getCell(pt).getColumnIndex()); ranges = customlabelProvider.getToolTipStyleRanges(element); + ColumnLabelProviderCustom customlabelProvider = (ColumnLabelProviderCustom) viewer.getLabelProvider(viewer.getCell(pt).getColumnIndex()); ranges = customlabelProvider.getToolTipStyleRanges(element); String txt = customlabelProvider.getToolTipText(element); return !txt.isEmpty(); diff --git a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/FilterData.java b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/FilterData.java index b38bec583a1..a53d80cf6a2 100644 --- a/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/FilterData.java +++ b/ui/org.eclipse.pde.spy.adapter/src/org/eclipse/pde/spy/adapter/viewer/FilterData.java @@ -20,9 +20,9 @@ */ public class FilterData { - String txtSeachFilter; - Boolean showPackage; - Boolean sourceToDestination; + String txtSearchFilter; + boolean showPackage; + boolean sourceToDestination; /** * Ctor */ @@ -37,22 +37,22 @@ public FilterData() { */ public FilterData(FilterData fdata) { - this.txtSeachFilter = fdata.txtSeachFilter; + this.txtSearchFilter = fdata.txtSearchFilter; this.showPackage = fdata.showPackage; this.sourceToDestination = fdata.sourceToDestination; } /** - * @return the txtSeachFilter + * @return the txtSearchFilter */ - public String getTxtSeachFilter() { - return txtSeachFilter; + public String getTxtSearchFilter() { + return txtSearchFilter; } /** - * @param txtSeachFilter the txtSeachFilter to set + * @param txtSearchFilter the txtSearchFilter to set */ - public void setTxtSeachFilter(String txtSeachFilter) { - this.txtSeachFilter = txtSeachFilter; + public void setTxtSearchFilter(String txtSearchFilter) { + this.txtSearchFilter = txtSearchFilter; }