From 27790313f00ab7a6eea7030e53929df8a441a05e Mon Sep 17 00:00:00 2001 From: "elena.parovyshnaya" Date: Thu, 7 May 2020 15:10:48 +0300 Subject: [PATCH 1/6] Bug 561553 add `Component` utilization to FullFeather project template - design base ui prototype for the FF-based project - declare two licensing requirements via SOGi components Signed-off-by: elena.parovyshnaya --- .../BaseLicensedTemplateSection.java | 3 +- ...edE4FullFeatherProductTemplateSection.java | 77 +++++++++++------- .../$pluginId$.product | 1 + .../$packageName$.magic.EvilWitch.xml | 12 +++ .../$packageName$.magic.GoodWitch.xml | 9 ++ .../bin/icon/atribute.txt | 2 + .../bin/icon/frog16.png | Bin 0 -> 734 bytes .../bin/icon/frog32.png | Bin 0 -> 1590 bytes .../bin/icon/frog64.png | Bin 0 -> 2967 bytes .../bin/icon/prince16.png | Bin 0 -> 592 bytes .../bin/icon/prince32.png | Bin 0 -> 1077 bytes .../bin/icon/prince64.png | Bin 0 -> 2071 bytes .../{bin => e4xmi}/Application.e4xmi | 12 ++- .../java/AntimagicProtection.java | 18 ++++ .../java/CreatureLabelProvider.java | 41 ++++++++++ .../java/CreaturesContentProvider.java | 25 ++++++ .../java/CreaturesView.java | 30 +++++++ .../java/FrogsPart.java | 15 ++++ .../java/MagicPart.java | 27 ++++++ .../java/PrincesPart.java | 15 ++++ .../java/magic/Creature.java | 21 +++++ .../java/magic/Creatures.java | 18 ++++ .../java/magic/EvilWitch.java | 14 ++++ .../java/magic/FrogToPrinceMagic.java | 5 ++ .../java/magic/GoodWitch.java | 11 +++ .../java/magic/PrinceToFrogMagic.java | 5 ++ .../java/magic/Shape.java | 7 ++ .../java/magic/Universe.java | 25 ++++++ 28 files changed, 361 insertions(+), 32 deletions(-) create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.EvilWitch.xml create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.GoodWitch.xml create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/atribute.txt create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog16.png create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog32.png create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog64.png create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/prince16.png create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/prince32.png create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/prince64.png rename bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/{bin => e4xmi}/Application.e4xmi (69%) create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/AntimagicProtection.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreatureLabelProvider.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesContentProvider.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesView.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/FrogsPart.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/MagicPart.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/PrincesPart.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Creature.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Creatures.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/EvilWitch.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/FrogToPrinceMagic.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/GoodWitch.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/PrinceToFrogMagic.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Shape.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Universe.java diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/BaseLicensedTemplateSection.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/BaseLicensedTemplateSection.java index 63ff98a40..fa9b3f735 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/BaseLicensedTemplateSection.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/BaseLicensedTemplateSection.java @@ -189,7 +189,8 @@ protected List getRCP4Dependencies() { "org.eclipse.e4.ui.workbench", //$NON-NLS-1$ "org.eclipse.e4.core.contexts", //$NON-NLS-1$ "org.eclipse.passage.lic.equinox", //$NON-NLS-1$ - "org.eclipse.passage.lic.e4.ui"); //$NON-NLS-1$ + "org.eclipse.passage.lic.e4.ui", //$NON-NLS-1$ + "org.slf4j.api"); //$NON-NLS-1$ } } diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE4FullFeatherProductTemplateSection.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE4FullFeatherProductTemplateSection.java index 15f79525a..b5ea29d4b 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE4FullFeatherProductTemplateSection.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE4FullFeatherProductTemplateSection.java @@ -26,9 +26,6 @@ public final class LicensedE4FullFeatherProductTemplateSection extends BaseLicensedTemplateSection { - private static final String LICENSED_E4_PRODUCT = "LicensedE4FullFeatherProduct"; //$NON-NLS-1$ - private static final String E4_SWT_APPLICATION_ID = "org.eclipse.e4.ui.workbench.swt.E4Application"; //$NON-NLS-1$ - public LicensedE4FullFeatherProductTemplateSection() { setPageCount(1); createOptions(); @@ -43,13 +40,6 @@ public void addPages(Wizard wizard) { markPagesAdded(); } - private void createOptions() { - addOption(KEY_WINDOW_TITLE, PdeUiTemplatesMessages.LicensedE4ProductTemplateSection_key_window_title_label, - "Licensed E4 RCP", 0); //$NON-NLS-1$ - addOption(KEY_PACKAGE_NAME, PdeUiTemplatesMessages.LicensedE4ProductTemplateSection_key_package_name_label, - (String) null, 0); - } - @Override protected void initializeFields(IFieldData data) { // In a new project wizard, we don't know this yet - the @@ -66,7 +56,7 @@ public void initializeFields(IPluginModelBase modelBase) { @Override public String getSectionId() { - return LICENSED_E4_PRODUCT; + return "LicensedE4FullFeatherProduct"; //$NON-NLS-1$ } @Override @@ -77,38 +67,65 @@ protected void updateModel(IProgressMonitor monitor) throws CoreException { createProductExtension(); } + @Override + public IPluginReference[] getDependencies(String schemaVersion) { + return getDependencies(getRCP4Dependencies()); + } + + @Override + public String[] getNewFiles() { + return new String[] { // + "css/default.css", //$NON-NLS-1$ + "e4xmi/Application.e4xmi", //$NON-NLS-1$ + "OSGI-INF/" }; //$NON-NLS-1$ + } + + private void createOptions() { + addOption(KEY_WINDOW_TITLE, PdeUiTemplatesMessages.LicensedE4ProductTemplateSection_key_window_title_label, + "Full Feather Passage Licensed Product", 0); //$NON-NLS-1$ + addOption(KEY_PACKAGE_NAME, PdeUiTemplatesMessages.LicensedE4ProductTemplateSection_key_package_name_label, + (String) null, 0); + } + private void createProductExtension() throws CoreException { IPluginBase plugin = model.getPluginBase(); + IPluginExtension extension = productRuntime(); + IPluginElement product = product(extension); + addCssProperty(product); + addApplicationProperty(product); + extension.add(product); + plugin.add(extension); + } + + private IPluginExtension productRuntime() throws CoreException { IPluginExtension extension = createExtension("org.eclipse.core.runtime.products", true); //$NON-NLS-1$ extension.setId(VALUE_PRODUCT_ID); + return extension; + } - IPluginElement element = model.getFactory().createElement(extension); - element.setName("product"); //$NON-NLS-1$ - element.setAttribute("application", E4_SWT_APPLICATION_ID); //$NON-NLS-1$ - element.setAttribute("name", getStringOption(KEY_PACKAGE_NAME)); //$NON-NLS-1$ - + private void addApplicationProperty(IPluginElement element) throws CoreException { IPluginElement property; - property = model.getFactory().createElement(element); property.setName("property"); //$NON-NLS-1$ - property.setAttribute("name", "applicationCSS");//$NON-NLS-1$ //$NON-NLS-2$ - property.setAttribute("value", "platform:/plugin/" + getValue(KEY_PLUGIN_ID) + "/css/default.css"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + property.setAttribute("name", "applicationXMI");//$NON-NLS-1$ //$NON-NLS-2$ + property.setAttribute("value", "platform:/plugin/" + getValue(KEY_PLUGIN_ID) + "/e4xmi/Application.e4xmi"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ element.add(property); - - extension.add(element); - - if (!extension.isInTheModel()) - plugin.add(extension); } - @Override - public IPluginReference[] getDependencies(String schemaVersion) { - return getDependencies(getRCP4Dependencies()); + private void addCssProperty(IPluginElement element) throws CoreException { + IPluginElement property = model.getFactory().createElement(element); + property.setName("property"); //$NON-NLS-1$ + property.setAttribute("name", "applicationCSS");//$NON-NLS-1$ //$NON-NLS-2$ + property.setAttribute("value", "platform:/plugin/" + getValue(KEY_PLUGIN_ID) + "/css/default.css"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + element.add(property); } - @Override - public String[] getNewFiles() { - return new String[] { "css/default.css", "Application.e4xmi" }; //$NON-NLS-1$ //$NON-NLS-2$ + private IPluginElement product(IPluginExtension extension) throws CoreException { + IPluginElement element = model.getFactory().createElement(extension); + element.setName("product"); //$NON-NLS-1$ + element.setAttribute("application", "org.eclipse.e4.ui.workbench.swt.E4Application"); //$NON-NLS-1$ //$NON-NLS-2$ + element.setAttribute("name", getStringOption(KEY_PACKAGE_NAME)); //$NON-NLS-1$ + return element; } } diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/$pluginId$.product b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/$pluginId$.product index b90d1c85f..ce53e716e 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/$pluginId$.product +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/$pluginId$.product @@ -93,6 +93,7 @@ + diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.EvilWitch.xml b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.EvilWitch.xml new file mode 100644 index 000000000..5c61449a6 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.EvilWitch.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.GoodWitch.xml b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.GoodWitch.xml new file mode 100644 index 000000000..ce674fb62 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.GoodWitch.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/atribute.txt b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/atribute.txt new file mode 100644 index 000000000..b5d6ace55 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/atribute.txt @@ -0,0 +1,2 @@ +Icons made by Freepik from www.flaticon.com +Icons made by Good Ware from www.flaticon.com \ No newline at end of file diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog16.png b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog16.png new file mode 100644 index 0000000000000000000000000000000000000000..a0fa63900944bdbfb263ada7bdcf142b3efccc23 GIT binary patch literal 734 zcmV<40wMj0P)lx^UlC)_?Jy>ABpx z>x=v@FS*L_gF@g3r6Y%TaJ~a@_vIQ}OY~OOCNGM%H!MwBX0s7d$`^=fJ;Y;)!;w;hmflNge3HPEND`(nvF22G z@M&k(5-XQkdOs!qHhn!yc{lN#@nV)Gi6LsOQGD@wYX62(cLyL_JCsqfRcQEAGE@O} zyc-fXI)LJidjRxR+a>3?hAmNDK$T4AX9zbh3|z=hxkOGf^2^gR-6~ z&Cbbk!6KQS!7vq(;F9z?rU%Nr0?{Bqpjvp%8UQUdEvnvo-h3|7H&7Q{Hh6Ud+i78# z3K20(jD-@S&22$}7phhsAeqQqh&Qkobu}|iYUUI`7|J~0{cMlm*X+O6cQQ-$j$ozJ Qn*aa+07*qoM6N<$f<_ZX0ssI2 literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog32.png b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog32.png new file mode 100644 index 0000000000000000000000000000000000000000..447d4da5e13738b214f18c33312808737c30b08d GIT binary patch literal 1590 zcmV-62Fdw}P)=s1R+F~auGZr0!WC5Kxrjfq)3ROK7a&LOHfGKxKWy-M5#(CX>%ba zz9hao>$TUrJG-+phlh2{#vX5Mi6U`cX1;U&=lsu{?|d_7;QvkZ5XR!YBC2)kI@@Yx zO%BfM_kZ8ny=_8Ie5?(?IkojQJrc`$qqW4e)&ll~Zc$n)LFY4-Q(Lc~ z>;P@5zLb8Rpfz+!kUU<-1Sy^2?Pt%#{qs`geXAQySg_d%!~*|=KjoKlELkZw&D5TFqD50;7@z+IrlKYvwa)|9@>)r z4))I&`2Fd@JwqbKe#?mQ(ey#eC7V}{yu|3h5G|1&+9IC@Xh~)0@}u%iz(C>v zK{E}&wTqWH|5_ip>6?g{1SA2fCdi|O%Iro}Pl84oLoBirQ=B{A$Kb_(0uZv=YeAKS zAD8bbP)9Fg!EE^*TrIQn!98sIG1_%sCghnEgTRablT8d@|k+ zDCft%NY*}2Je8o}403+_OB9_O7$UDewTIzVR{)^1Wy|PT?iyM9ELr<3A{MGu0Ak@J z$yoa$HkIhWF6YUY`Z;}lKSBV-0U#I%b9d*CPI$wY$M+OmnfpqMnC1;v-Oy})l7gMX z^{ND{An|C1cr=47xc+N&;dH4oTbN?5Fh!+mV;KQrkre5~dQ8)zIh6Ux&dxtyT~!4P zF}5j$Ofg9(I!GrvRw`88qX@~SHj+(k%S@_@XX<|77t6SOV;PdaGvnICG^|NKy>9}; z)0b^m-PM28?@X@$7<~IZKije%ICgc{heh;Eb7VtDN1_KqLJflt-F&^FT?FQe6I>lR zJ?bev2Yb0zZ(r5}2JT^1>Btptkg}586??290rE&gbH4g6Z;$i>tT%+iz~^ssuU{M; z{Y2C%1oG5vO(wjX&4~kq&Go(n+3frZiMb5S{ffVjAF9`SZiJ?%cd5H588_bl?(iYi6Cfq|ZxE*t)Z4q$EGFj~7t&wlxYH=yTz-BY>ew|BAP7OQ|E>+84 z74(@~I@hZ*SC}LbYsEBbA9_t}>*~|Z%}+3y9iTO}iB$YQrlGM5l$`Q zf-An$o6uoE-!muKW~iq>_9bsD%O~H4!=0~0OoN|T2%lQ3XKVVt?!l3_#tnm}bZcp| z8akb9FPXq!*AhpS&sr!m2%Y`_ZyZ>6>$;$x3dKYH-+Yi-w^6(V@cbE4PK8+@S@V?z zU#a(9D*aaep3aX)hsS)U6%7c1VD0J#YbSQyRB67e>zuO``?Vfso;yan6(hX1Af8zz4^$geh?nE(I)07*qoM6N<$g3JQ*u>b%7 literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog64.png b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog64.png new file mode 100644 index 0000000000000000000000000000000000000000..48f5cf68da86ca9e2c1cdabf477b9604f68dc06b GIT binary patch literal 2967 zcmV;I3uyF-P)5M$OV2P1i!!2v5^+HU1x+fr zMJ-KYDwdi=D@J3~lqgn8OJh~2ilxRFL^PG9l2}HgsbG~G3Mx3MB)9>i(FhL1XkcKN z9cFr8-o5!SGu{2@Z5}W{68>NMo_m%)=e+ao`rs&z;wUB(x@G31g1lGe`t-9?3iBVK zAn#y7PLyH&_5yFBW%k=i?e0swHG92&dx1BbA8(m`RkA!jK>zN(soT)hl=# zlRo_z>-93cOb{k40f}hvVl)dz$%Tn%@ZxN~(A*1n&>B}He6vm2z^03VP4{48!V(~) zs47N-u1vR-GVRJ#6{Qa%ToYwjVUVdE?Wr<^gsWa*#Daw>CsBeD!uY$a= z2^|%%Ws8u&YZUAh!?ApRdv0#>)5{bgVoFsG1=)S6>LNsb#z zVC2a|z62yCyjKtZtOcuxhXPs^EV<)+{^s2KQUCT=@wN5^cK~ZC5RCdG-2foXq{9%cmNG&2w1n`Efza)-G=?DfY;g=d{3Z%pKDBF8UZXF!BWv2Jzq*C z=k-LpT}r3R*4)xIb*!C`u(By-47hcUUoPpxB`b+reQ0gvi{uBlpT}>V#^N{uuWws8 zTWQq_q&F}g*JP&qze}y>Tnym@Ae`!8SNM5)BClgx5+k0zr1_oe^4VU#j%Nj2lkML0 z%4;~G`erK2W&w~?A$EsWv3cNOqN&bo^@LKKzT`r-IElw`0#>)5{W5U*7+qnW%7Oj(`gCld)aZ)l~b zbEi%382`60L|K-f;v4Ouo4?W)x%H~`U6(C?r|a^2UDCL6jBf}J%>nzk*1dfvo8NCG znMkJl%8WW@R9|n4C#AT=NlZ?+!zW}D0r#0U=9BmTj2&Csky3K)U3b!a`l$dIq8z{Z z1%?tI0HD#03f2g%84mZOwZgJ816z$}KBml6Ra@&vJoUhGlu}GTshL|I_;H$7?>mpS z!R2XM2)mD^;A|Sy)MS&U5lFWqp%6Q^wgaG)qV2m1jI2>-cTqVzNOhI~p$4+aq_rpA_WAuBJF|JjsFa*I=QNvYB1?8e zCR2Qdw4aE@Qhhf1#JQ&-<%p|IvzqZ$WU3=>_3q;%cI6Uq^a^O?Hjy=@?TK%o(tT>0 zzW%AnVD*dTfKZX^oMLQWk}XIiOEp{E|~FN z53p*CPU$e4_uNNH1qpD_u zIJ^6$A1t!(PKjiGqv^+~B=whuo?OXqnE#x|w(u*l7 ziK{-e&fNh|nKUyswdu5mg;gsDoy6m~0)i3a?#lAI#z~daK-lxAQ6#K^yup{5J|@?m zU<*FS8DTKB{v^uWkE06c)Jwe4NNg7n0Eopy z^bhaK`^3f|g`~2)jzC2tQsm}4y8_0bm7;%mCwqh4d7t(e%G~8N1e)-ajm#EO8oIuw zu4Yc)#l7Q=$BqF3#5-AK^E;l}R1?Apq4C!pa zDWs&X`dDfzCKHMd5{?a#OvTYk;c}U{&2s$SK+bHUlqKR3YYFg^@&1>?b%36quV}pP z3cT(LC#J>)!!W7xH&Eqo7`IMbB^Ti!0S?CiQCC{#Fhi?}TMBEPHP0QP5C}(?hz|Dx zqQjB=VStdb-HE)T1Q>?c_k8P!gK3zK&IQMvfQ=jHn(aGU7e^DrrG*a@T!zVen_vFg z(w6ZL?&C_p#*K5$zDn~&1h)+g?H1@Gun2^pd+;-W+XIRh#+!t33H4Q*kD$2}AfAj6 z4Oh}wesDh9Y4lDlEi?{9lYML*dS{HhtXlDNU`Z*xk}JVAZ42gWso%j?ErRB%AJOQ$ zbpO1~!r)-2v``5|)#t3~n7?ngl9ID-Tg1j_Qo#e1nK8~NCQx(` zREC@)#xdY0)gIdRKFE&XGfeYeL!I|L+daTRfq@Wg(ubQ)A%rHW`{|CX;p3i%h^2Z(av68r7O7Fc7Ko!rAD5Nln1sZ$@_d)cPyNTQa3Sj4_NT7Ef^l4dvIiX&{%ss z6~5Ynf7CtD!EiYD$bL&}u1yGU!g39-<X4=@Xm5psXme za`T-RlRh_0*X^pU^JXMnaueur1rMOI?(>w&^U=ZtVJvt6OO1a&r{PM&WYgoXbKF>; z1X#8G+<+mCb-?t4=;x7&CS|hj(H5#-0C452^oE4N}D zCm#xbG&D)Q@BNlD6IT9q9!N1XZmUpKR%@($?frn18nG1i&xob0p?vKeX#U|b%2tot zu9r0$))zEqWs;fQb_fg2QUUN<`&pIB;e`S~Z_mdJ#Ye`rsxlAt4X5PDxRpD0(MjvO z_Q%6z>zFDuIorw|TdRo0Jpg#hVjMfuc@B&O{fjT<$UWgbilaC*_z!7mBO}DLP(%O# N002ovPDHLkV1gOLrV#)D literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/prince16.png b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/prince16.png new file mode 100644 index 0000000000000000000000000000000000000000..02bd291356804ce291e7dc8d7eb8882ae4184b19 GIT binary patch literal 592 zcmV-W0%(~xJhlgXrM^5o)C8 zR?pw-B)IUz0{}z9AWrhHJF!1YqB?N~0EpyCYSxnb z01z!-DDS@;`yPk5kFO_9zA6mr6sXMIfg+JS2Y_be zU}FXV*alzg6=w|gzBN+;JHhsszu4btLHKZ!L{R@_`y04K@N+xH?;V@=&I;HGnA^Yg zAWRU|Y}$8apbcT)58y69*x~asKI~S!=x)Z@o5j0jxLF~dzgt`)JgCZK45NWY7Hl|7EFZ14; z`|dq1hQv%}-uz@rdf>sk=bi66-@Eso!y#tIj_tc6y#Rohe_Purh1e-jrAAIFp%<0V ziz+p8a@Pd_JORKiKRmJP0tiUedT*JhojahukDpK_9SOaX{%WTjZ5#nWnx1wte7YSD z0T9X5a1u9PG+Rth8hBf}d;*}>f8^U_7yyJy#lH{`x0GD|p%uJ8GyD<(L)vF6I~Dt& z6|9<0Tu~jxoS%w+Bmf!*01%$RY|?6$gh1yu38j9w>Fl#f3xrbu3#U603#1wRF%LeCrXBS1wJFadZ?Nn=h;CxUPGkNq|g zy}8{jU7gH*-QODo%Y7NUoL`fFNS6md|NCp*-UA>^shPxe+&uEc_Kzyx^*Vr_?S9rE z?c0~O``51xA6@%Aw&WJ{dslpTW9Pk}9#?Z1PqGRN3NO5f7J3?N9^@Uzdmb|PC7is%dd3foD?F^<+X4kFFSz(;-off$)gs)y!cyAZTxVBGke;rJThI8& zu1Mq_1dFICU_ImG-#g_5OY;s&#Y*yGR#lumGf;9XV|>ZTu9S}_za~*~ss#oLu)7R& zL<|5xc&`b|t_s)t1KwfBv_qgoEZ|ZI%;orO|LKrgQH=DY=ME%FsR0z z?i&ds6c#WoLQgbQ9Y8?u!44P}VgHk%z=jZLkJ-{(2mlZ~&?=;u zllSjU9y)yV!ry87`Tf2jW|an-@86Hev{HIVF!XbeAvpjDVTfZw3+EcZ3%j467o_KX vQyxl*X!d+`+yL3Tky?SBv5%L30yF;y!-#M%i`%iz00000NkvXXu0mjfMfTo9 literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/prince64.png b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/prince64.png new file mode 100644 index 0000000000000000000000000000000000000000..87fa3c77ec693644c3e6a475c06e09fc33f1c1f2 GIT binary patch literal 2071 zcmV+y2BF3MTnM zQ)iEP$-z4ThPG`0qx;RAyg518eVbP_JQKiV=9d5{03ZZC;}wtm9B{nPFIvO{46Kct z#!=jNA?d2ulU)I!`Yr=l6&=^XIV5jjt!)pv>=yt=`Zhu!g}tLQ0KjpoFCtpxC4e0x z;1@#mO^T7N``qLpe7^kvRuz9s3GP$aQ*Qdisoriey!B;4@?V0>D`L3!Fi!7k;ezB> z0jw#>+6a>0ag_|w!E%$X(L-*!6q5Y_pidz`?1KRNf;4iEa1iddW@o!`a>sf%h!{g# zZv)tF3qhS4XMY!d*bSdJ*|iG5XUfeI>`@Me6V?*+H{5sjiW^)wv-W-wrY67ZhEJpd z34mhdW(G`fh4EhkxK?6MgYloZLS$&iY5#g=Q%z$ zI;O<=Mu0xgfP)HSA0f!xvXcNHVLXbtOAspvFm?SoH+*NJ(l9joDS$r%^fH0=D)+qe zd&^e1aAENVz<#ah$~W=JbC%F?gwuDa!nigL;O0_ubX=d8jVloCe8UPHcx_oaA#pUk zMKU>LWMyYyrSiq*{r`Ajp1;aP>45N?=a*|q6vlr(jk3ls1Sy~-8zv7ehtI@d&mmnm zFB)0dSt-v_JHd4zIw3|PgN2#222`H>%3*48HZm0o+k-ep9FB#PKf6vQ-V@1KrPQ8FAjo(Z*`>+c^uggJD1nMNZ(4 zk#%-RDS}ts`$fnc`;nde@nhXPXO47T)l>3oa*19qh5f@2!#=?=CWd~q4iF_GgRs#Ku6Zlu0)^6nJUi7mCUauHW z40I2qV)|bUP1baiT>E_hp@|63i{aka@anermnMnZ!=C`?eNL+uCi#-#?(db_QZI$? znmN)L)l%|7r@dZ^<-8F2s1V|u9EyAc{VZQEvp@NjLuizbpnj$%kM*3$%$Tp58nx6~ zZxPFVBNQTrXT*nkU(au#=$=|DG&I?s80NJQF~egiGhrn7OJ!O79+LJQLu``3&@| zgfIy4DShbzF2S(?*`$Clob_Dvl7_@JW3H~0Kss(Zs!Ixjp*bH$jsy?}Vd88Wmq#iQrXxD3K?-M`;YfhXqxtYnP8*mW*Qzd86pj{XClT`VfsKZw zVg_=ld?dyk4kOzFOpj|wPS1t!)P*cERfca-xJt0o5IrZ6ygtVxmljCH><=Sb0%YPQ zrY_76Um{@QTxQAnK+8zXmJqIlTw1`?7q3eS!px+G@|XSOb^F7}mH<;1a~7unVB{pO zUs`-91VS8ZIvbYsv9jF<)xY=|CmlB-Oe+y0U^cq6$fd9)z`C9w*a9W|A&&M&fp=TskwAvfDrD$Cf zfG{N(cXm1CxCMbm#a75JgbjV6s>gjLFb=4G=N;kcaai%OnnkP??_G#^O~7lsCxF)k zyv7YLfOQ{W7=Yq)|AWN>7)MjRe32w!@n8Hz=FGR&-ww#90PMzM-|_r^Lj&+vlJfCe zo}PLWC - + + + + + + + + + + + diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/AntimagicProtection.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/AntimagicProtection.java new file mode 100644 index 000000000..42bfb1f64 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/AntimagicProtection.java @@ -0,0 +1,18 @@ +package $packageName$; + +import org.eclipse.e4.core.di.annotations.CanExecute; +import org.eclipse.e4.core.di.annotations.Execute; + +public class AntimagicProtection { + @Execute + public void execute() { + System.err.println("Put on or take off the protection spell on a target"); //$NON-NLS-1$ + } + + @CanExecute + public boolean available() { + System.err.println("here we going to check license for 'antimagic-protection' fature"); //$NON-NLS-1$ + return true; + } + +} \ No newline at end of file diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreatureLabelProvider.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreatureLabelProvider.java new file mode 100644 index 000000000..e6335daa8 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreatureLabelProvider.java @@ -0,0 +1,41 @@ +package $packageName$; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ILabelProviderListener; +import $packageName$.magic.Creature; +import org.eclipse.swt.graphics.Image; + +final class CreatureLabelProvider implements ILabelProvider { + + @Override + public void addListener(ILabelProviderListener listener) { + // do nothing + } + + @Override + public void removeListener(ILabelProviderListener listener) { + // do nothing + } + + @Override + public void dispose() { + // do nothing + } + + @Override + public boolean isLabelProperty(Object element, String property) { + // do nothing + return false; + } + + @Override + public Image getImage(Object element) { + return null; // FIXME: ! + } + + @Override + public String getText(Object element) { + return ((Creature) element).name(); + } + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesContentProvider.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesContentProvider.java new file mode 100644 index 000000000..1615ef815 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesContentProvider.java @@ -0,0 +1,25 @@ +package $packageName$; + +import java.util.stream.Collectors; + +import org.eclipse.jface.viewers.IStructuredContentProvider; +import $packageName$.magic.Creatures; +import $packageName$.magic.Shape; + +final class CreaturesContentProvider implements IStructuredContentProvider { + + private final Shape shape; + + CreaturesContentProvider(Shape shape) { + this.shape = shape; + } + + @Override + public Object[] getElements(Object input) { + return ((Creatures) input).creatures().stream() // + .filter(creature -> shape.equals(creature.shape())) // + .collect(Collectors.toList())// + .toArray(); + } + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesView.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesView.java new file mode 100644 index 000000000..9fca48b2e --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesView.java @@ -0,0 +1,30 @@ +package $packageName$; + +import org.eclipse.jface.viewers.ListViewer; +import $packageName$.magic.Creatures; +import $packageName$.magic.Shape; +import $packageName$.magic.Universe; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; + +public final class CreaturesView { + + private final Creatures creatures; + private final Shape shape; + + CreaturesView(Shape shape) { + this.creatures = Universe.instance; + this.shape = shape; + } + + public void install(Composite parent) { + ListViewer list = new ListViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); + list.setContentProvider(new CreaturesContentProvider(shape)); + list.setLabelProvider(new CreatureLabelProvider()); + list.setInput(creatures); + list.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + } + +} + diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/FrogsPart.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/FrogsPart.java new file mode 100644 index 000000000..2e412c390 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/FrogsPart.java @@ -0,0 +1,15 @@ +package $packageName$; + +import javax.annotation.PostConstruct; + +import $packageName$.magic.Shape; +import org.eclipse.swt.widgets.Composite; + +public final class FrogsPart { + + @PostConstruct + public void postConstruct(Composite parent) { + new CreaturesView(Shape.FROG).install(parent); + } + +} \ No newline at end of file diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/MagicPart.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/MagicPart.java new file mode 100644 index 000000000..217d37755 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/MagicPart.java @@ -0,0 +1,27 @@ +package $packageName$; + +import javax.annotation.PostConstruct; +import javax.inject.Inject; + +import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; + +public final class MagicPart { + @Inject + private IEclipseContext context; + + @Inject + public MagicPart() { + + } + + @PostConstruct + public void postConstruct(Composite parent) { + Label label = new Label(parent, SWT.None); + label.setText("Magic field: context is " + context); //$NON-NLS-1$ + + } + +} \ No newline at end of file diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/PrincesPart.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/PrincesPart.java new file mode 100644 index 000000000..c536e19d6 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/PrincesPart.java @@ -0,0 +1,15 @@ +package $packageName$; + +import javax.annotation.PostConstruct; + +import $packageName$.magic.Shape; +import org.eclipse.swt.widgets.Composite; + +public final class PrincesPart { + + @PostConstruct + public void postConstruct(Composite parent) { + new CreaturesView(Shape.PRINCE).install(parent); + } + +} \ No newline at end of file diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Creature.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Creature.java new file mode 100644 index 000000000..94cd2b869 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Creature.java @@ -0,0 +1,21 @@ +package $packageName$.magic; + +public final class Creature { + + private final String name; + private final Shape shape; + + Creature(String name, Shape shape) { + this.name = name; + this.shape = shape; + } + + public String name() { + return name; + } + + public Shape shape() { + return shape; + } + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Creatures.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Creatures.java new file mode 100644 index 000000000..2d3f46b62 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Creatures.java @@ -0,0 +1,18 @@ +package $packageName$.magic; + +import java.util.Collections; +import java.util.Set; + +public interface Creatures { + + Set creatures(); + + public final class None implements Creatures { + + @Override + public Set creatures() { + return Collections.emptySet(); + } + + } +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/EvilWitch.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/EvilWitch.java new file mode 100644 index 000000000..c87035124 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/EvilWitch.java @@ -0,0 +1,14 @@ +package $packageName$.magic; + +import org.osgi.service.component.annotations.Component; + +@Component(property = { // + "licensing.feature.identifier=EvilWitch", // + "licensing.feature.name=Evil Witch", // + "licensing.restriction.level=info", // + "licensing.feature.version=13.4.1", // + "licensing.feature.provider=Universe" // +}) +public final class EvilWitch implements PrinceToFrogMagic { + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/FrogToPrinceMagic.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/FrogToPrinceMagic.java new file mode 100644 index 000000000..ddfb1cdc8 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/FrogToPrinceMagic.java @@ -0,0 +1,5 @@ +package $packageName$.magic; + +public interface FrogToPrinceMagic { + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/GoodWitch.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/GoodWitch.java new file mode 100644 index 000000000..a3a0ee0ed --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/GoodWitch.java @@ -0,0 +1,11 @@ +package $packageName$.magic; + +import org.osgi.service.component.annotations.Component; + +@Component(property = { // + "licensing.feature.identifier=GoodWitch", // + "licensing.restriction.level=fatal" // +}) +public final class GoodWitch implements FrogToPrinceMagic { + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/PrinceToFrogMagic.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/PrinceToFrogMagic.java new file mode 100644 index 000000000..9dc89c31b --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/PrinceToFrogMagic.java @@ -0,0 +1,5 @@ +package $packageName$.magic; + +public interface PrinceToFrogMagic { + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Shape.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Shape.java new file mode 100644 index 000000000..6d6e78dab --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Shape.java @@ -0,0 +1,7 @@ +package $packageName$.magic; + +public enum Shape { + + PRINCE, FROG + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Universe.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Universe.java new file mode 100644 index 000000000..c255d1a62 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Universe.java @@ -0,0 +1,25 @@ +package $packageName$.magic; + +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public final class Universe implements Creatures { + + private final Set creatures; + + public static Universe instance = new Universe(); + + private Universe() { + creatures = Stream.of(// + new Creature("Charming", Shape.PRINCE), //$NON-NLS-1$ + new Creature("Harold", Shape.FROG))//$NON-NLS-1$ + .collect(Collectors.toSet()); + } + + @Override + public Set creatures() { + return creatures; + } + +} From 7e32ab56c1482029bbf3c005f44c6708fc424d15 Mon Sep 17 00:00:00 2001 From: "elena.parovyshnaya" Date: Wed, 13 May 2020 10:56:50 +0300 Subject: [PATCH 2/6] Bug 561553 add `Component` utilization to FullFeather project template - evolve the sample, intermediate state Signed-off-by: elena.parovyshnaya --- .../.project | 5 + .../META-INF/MANIFEST.MF | 19 ++-- .../templates/temp/CreatureLabelProvider.java | 40 ++++++++ .../temp/CreaturesContentProvider.java | 27 ++++++ .../pde/ui/templates/temp/CreaturesView.java | 46 +++++++++ .../pde/ui/templates/temp/FrogsPart.java | 15 +++ .../pde/ui/templates/temp/MagicTool.java | 82 ++++++++++++++++ .../pde/ui/templates/temp/MagicTools.java | 96 +++++++++++++++++++ .../internal/pde/ui/templates/temp/Test.java | 40 ++++++++ .../templates/temp/magic/AntiMagicShield.java | 26 +++++ .../pde/ui/templates/temp/magic/Creature.java | 26 +++++ .../ui/templates/temp/magic/Creatures.java | 25 +++++ .../pde/ui/templates/temp/magic/Magic.java | 7 ++ .../temp/magic/MutationListener.java | 8 ++ .../pde/ui/templates/temp/magic/Shape.java | 23 +++++ .../pde/ui/templates/temp/magic/Universe.java | 51 ++++++++++ .../e4xmi/Application.e4xmi | 4 +- .../java/CreaturesContentProvider.java | 2 +- 18 files changed, 532 insertions(+), 10 deletions(-) create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreatureLabelProvider.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreaturesContentProvider.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreaturesView.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/FrogsPart.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/MagicTool.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/MagicTools.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/Test.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/AntiMagicShield.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Creature.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Creatures.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Magic.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/MutationListener.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Shape.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Universe.java diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/.project b/bundles/org.eclipse.passage.ldc.pde.ui.templates/.project index 55d454652..96b9fac00 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/.project +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/.project @@ -25,6 +25,11 @@ + + org.eclipse.pde.ds.core.builder + + + org.eclipse.pde.PluginNature diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/META-INF/MANIFEST.MF b/bundles/org.eclipse.passage.ldc.pde.ui.templates/META-INF/MANIFEST.MF index 55e4bcda2..d7a71b481 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/META-INF/MANIFEST.MF @@ -1,17 +1,22 @@ Manifest-Version: 1.0 -Automatic-Module-Name: org.eclipse.passage.ldc.pde.ui.templates Bundle-ManifestVersion: 2 +Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.passage.ldc.pde.ui.templates;singleton:=true Bundle-Version: 0.5.200.qualifier -Bundle-Name: %Bundle-Name Bundle-Vendor: %Bundle-Vendor -Bundle-Copyright: %Bundle-Copyright -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Export-Package: org.eclipse.passage.ldc.internal.pde.ui.templates;x-internal:=true, + org.eclipse.passage.ldc.internal.pde.ui.templates.i18n;x-internal:=true Require-Bundle: org.eclipse.core.runtime;bundle-version="0.0.0", org.eclipse.core.resources;bundle-version="0.0.0", org.eclipse.jface;bundle-version="0.0.0", org.eclipse.pde.ui;bundle-version="0.0.0", org.eclipse.pde.ui.templates;bundle-version="0.0.0", - org.eclipse.passage.lic.equinox;bundle-version="0.0.0" -Export-Package: org.eclipse.passage.ldc.internal.pde.ui.templates;x-internal:=true, - org.eclipse.passage.ldc.internal.pde.ui.templates.i18n;x-internal:=true + org.eclipse.passage.lic.equinox;bundle-version="0.0.0", + org.eclipse.e4.core.contexts, + org.eclipse.e4.core.di +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-Copyright: %Bundle-Copyright +Automatic-Module-Name: org.eclipse.passage.ldc.pde.ui.templates +Import-Package: javax.annotation;version="1.0.0";resolution:=optional, + javax.inject;version="1.0.0" +Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreatureLabelProvider.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreatureLabelProvider.java new file mode 100644 index 000000000..0716c6185 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreatureLabelProvider.java @@ -0,0 +1,40 @@ +package org.eclipse.passage.ldc.internal.pde.ui.templates.temp; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Creature; +import org.eclipse.swt.graphics.Image; + +final class CreatureLabelProvider implements ILabelProvider { + + @Override + public void addListener(ILabelProviderListener listener) { + // do nothing + } + + @Override + public void removeListener(ILabelProviderListener listener) { + // do nothing + } + + @Override + public void dispose() { + // do nothing + } + + @Override + public boolean isLabelProperty(Object element, String property) { + return false; // do nothing + } + + @Override + public Image getImage(Object element) { + return null; // FIXME: ! + } + + @Override + public String getText(Object element) { + return ((Creature) element).name(); + } + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreaturesContentProvider.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreaturesContentProvider.java new file mode 100644 index 000000000..960b955d3 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreaturesContentProvider.java @@ -0,0 +1,27 @@ +package org.eclipse.passage.ldc.internal.pde.ui.templates.temp; + +import java.util.function.Predicate; +import java.util.stream.Collectors; + +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Creature; +import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Creatures; +import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Shape; + +final class CreaturesContentProvider implements IStructuredContentProvider { + + private final Predicate shape; + + CreaturesContentProvider(Shape shape) { + this.shape = new Shape.Of(shape); + } + + @Override + public Object[] getElements(Object input) { + return ((Creatures) input).creatures().stream() // + .filter(shape) // + .collect(Collectors.toList()) // + .toArray(); + } + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreaturesView.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreaturesView.java new file mode 100644 index 000000000..cbc695947 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreaturesView.java @@ -0,0 +1,46 @@ +package org.eclipse.passage.ldc.internal.pde.ui.templates.temp; + +import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Creatures; +import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Shape; +import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Universe; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +public final class CreaturesView { + + private final Creatures creatures; + private final Shape shape; + + CreaturesView(Shape shape) { + this.creatures = Universe.instance; + this.shape = shape; + } + + public void install(Composite parent) { + ListViewer list = installControl(parent); + installDynamics(list); + } + + private ListViewer installControl(Composite parent) { + ListViewer list = new ListViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); + list.setContentProvider(new CreaturesContentProvider(shape)); + list.setLabelProvider(new CreatureLabelProvider()); + list.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + list.getControl().setFont(font(parent)); + list.setInput(creatures); + return list; + } + + private Font font(Control parent) { + return new Font(parent.getFont().getDevice(), "Sans serif", 22, SWT.NORMAL); //$NON-NLS-1$ + } + + private void installDynamics(ListViewer list) { + creatures.listenToMutation(() -> list.refresh(true)); + } + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/FrogsPart.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/FrogsPart.java new file mode 100644 index 000000000..748662f10 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/FrogsPart.java @@ -0,0 +1,15 @@ +package org.eclipse.passage.ldc.internal.pde.ui.templates.temp; + +import javax.annotation.PostConstruct; + +import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Shape; +import org.eclipse.swt.widgets.Composite; + +public class FrogsPart { + + @PostConstruct + public void postConstruct(Composite parent) { + new CreaturesView(Shape.FROG).install(parent); + } + +} \ No newline at end of file diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/MagicTool.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/MagicTool.java new file mode 100644 index 000000000..239bd03c5 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/MagicTool.java @@ -0,0 +1,82 @@ +package org.eclipse.passage.ldc.internal.pde.ui.templates.temp; + +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Creature; +import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Magic; +import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Shape; +import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Universe; +import org.eclipse.passage.lic.internal.equinox.EquinoxPassage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; + +@SuppressWarnings("restriction") +final class MagicTool implements ISelectionChangedListener { + + private final Magic magic; + private final Shape target; + private final String feature; + private Button spell; + + MagicTool(Shape target, String feature) { + this.target = target; + this.feature = feature; + this.magic = Universe.instance; + } + + public void install(Composite parent) { + Composite owner = owner(parent); + installInfo(owner); + installMagic(owner); + updateEnablement(Shape.NONE); + } + + private Composite owner(Composite parent) { + Composite owner = new Composite(parent, SWT.NONE); + owner.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, true)); + owner.setLayout(new GridLayout(1, false)); + return owner; + } + + private void installInfo(Composite parent) { + new Label(parent, SWT.NONE).setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, true)); + } + + private void installMagic(Composite parent) { + spell = button(parent); + spell.setText("To frog"); //$NON-NLS-1$ + // frog.addSelectionListener(SelectionListener.widgetSelectedAdapter( e-> + // magic.turn(creature, shape))); + } + + private Button button(Composite parent) { + Button turn = new Button(parent, SWT.PUSH); + turn.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false)); + return button(parent); + } + + @Override + public void selectionChanged(SelectionChangedEvent event) { + Creature creature = (Creature) ((IStructuredSelection) event.getSelection()).getFirstElement(); + updateEnablement(creature.shape()); + } + + private void updateEnablement(Shape shape) { + spell.setEnabled(shape != target && witchIsProperlyPayed()); + } + + /** + * Check if the magic {@code feature} with the configured + * {@code licensing.feature.identifier} (like "EvilWitch"), declared by + * an OSGi component is payed for and Passage allows it be to used. + */ + private boolean witchIsProperlyPayed() { + return new EquinoxPassage().canUse(feature); + } + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/MagicTools.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/MagicTools.java new file mode 100644 index 000000000..5ccbf52ad --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/MagicTools.java @@ -0,0 +1,96 @@ +package org.eclipse.passage.ldc.internal.pde.ui.templates.temp; + +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Creature; +import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Magic; +import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Shape; +import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Universe; +import org.eclipse.passage.lic.internal.equinox.EquinoxPassage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; + +@SuppressWarnings("restriction") +public final class MagicTools implements ISelectionChangedListener { + + private final Magic magic; + private Button frog; + private Button prince; + + public MagicTools() { + magic = Universe.instance; + } + + public void install(Composite parent) { + Composite owner = owner(parent); + installFiller(owner); + installEvilMagic(owner); + installGoodMagic(owner); + installFiller(owner); + updateEnablement(Shape.NONE); + } + + private Composite owner(Composite parent) { + Composite owner = new Composite(parent, SWT.NONE); + owner.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, true)); + owner.setLayout(new GridLayout(1, false)); + return owner; + } + + private void installFiller(Composite parent) { + new Label(parent, SWT.NONE).setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, true)); + } + + private void installEvilMagic(Composite parent) { + frog = button(parent); + frog.setText("To frog"); //$NON-NLS-1$ + // frog.addSelectionListener(SelectionListener.widgetSelectedAdapter( e-> + // magic.turn(creature, shape))); + } + + private void installGoodMagic(Composite parent) { + prince = button(parent); + prince.setText("To prince"); //$NON-NLS-1$ + } + + private Button button(Composite parent) { + Button turn = new Button(parent, SWT.PUSH); + turn.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false)); + return button(parent); + } + + @Override + public void selectionChanged(SelectionChangedEvent event) { + Creature target = (Creature) ((IStructuredSelection) event.getSelection()).getFirstElement(); + updateEnablement(target.shape()); + } + + private void updateEnablement(Shape shape) { + prince.setEnabled(shape == Shape.FROG && goodWitchIsPayed()); + frog.setEnabled(shape == Shape.PRINCE && evilWitchIsPayed()); + } + + /** + * Check if feature with {@code licensing.feature.identifier} + * "EvilWitch", declared by {@code magic.EvilWitch} OSGi component is + * payed for and Passage allows it be to used. + */ + private boolean evilWitchIsPayed() { + return new EquinoxPassage().canUse("EvilWitch"); //$NON-NLS-1$ + } + + /** + * Check if feature with {@code licensing.feature.identifier} + * "GoodWitch", declared by {@code magic.GoodWitch} OSGi component is + * payed for and Passage allows it be to used. + */ + private boolean goodWitchIsPayed() { + return new EquinoxPassage().canUse("GoodWitch"); //$NON-NLS-1$ + } + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/Test.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/Test.java new file mode 100644 index 000000000..932b689d7 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/Test.java @@ -0,0 +1,40 @@ +package org.eclipse.passage.ldc.internal.pde.ui.templates.temp; + +import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Shape; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +public final class Test { + + public static void main(String[] a) { + Display display = new Display(); + Shell shell = new Shell(display); + shell.setText("Magic"); //$NON-NLS-1$ + shell.setSize(900, 600); + shell.setLayout(new GridLayout(1, true)); + Composite owner = new Composite(shell, SWT.BORDER); + owner.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + owner.setLayout(new GridLayout(2, true)); + installUi(owner); + shell.open(); + while (!shell.isDisposed()) { + if (!display.readAndDispatch()) + display.sleep(); + } + display.dispose(); + } + + private static void installMagic(Composite parent) { + new MagicTools().install(parent); + } + + private static void installUi(Composite parent) { + new CreaturesView(Shape.PRINCE).install(parent); + installMagic(parent); + new CreaturesView(Shape.FROG).install(parent); + } +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/AntiMagicShield.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/AntiMagicShield.java new file mode 100644 index 000000000..798182e37 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/AntiMagicShield.java @@ -0,0 +1,26 @@ +package org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic; + +import java.util.HashSet; +import java.util.Set; + +final class AntiMagicShield { + + private final Set creatures = new HashSet<>(); + + void cover(Creature creature) { + creatures.add(creature); + } + + void uncover(Creature creature) { + creatures.remove(creature); + } + + boolean covered(Creature creature) { + return creatures.contains(creature); + } + + int amont() { + return creatures.size(); + } + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Creature.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Creature.java new file mode 100644 index 000000000..dcd49d702 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Creature.java @@ -0,0 +1,26 @@ +package org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic; + +public final class Creature { + + private final String name; + private final Shape shape; + + Creature(String name, Shape shape) { + this.name = name; + this.shape = shape; + } + + public String name() { + return name; + } + + public Shape shape() { + return shape; + } + + @Override + public String toString() { + return name + " the " + shape.name().toLowerCase(); //$NON-NLS-1$ + } + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Creatures.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Creatures.java new file mode 100644 index 000000000..089977c6d --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Creatures.java @@ -0,0 +1,25 @@ +package org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic; + +import java.util.Collections; +import java.util.Set; + +public interface Creatures { + + Set creatures(); + + void listenToMutation(MutationListener ear); + + public final class None implements Creatures { + + @Override + public Set creatures() { + return Collections.emptySet(); + } + + @Override + public void listenToMutation(MutationListener ear) { + // do nothing: no mutation is going to happen here + } + + } +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Magic.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Magic.java new file mode 100644 index 000000000..83e557bed --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Magic.java @@ -0,0 +1,7 @@ +package org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic; + +public interface Magic { + + void turn(Creature creature, Shape shape); + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/MutationListener.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/MutationListener.java new file mode 100644 index 000000000..6507e227a --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/MutationListener.java @@ -0,0 +1,8 @@ +package org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic; + +@FunctionalInterface +public interface MutationListener { + + void mutationHappenned(); + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Shape.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Shape.java new file mode 100644 index 000000000..d30695fb6 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Shape.java @@ -0,0 +1,23 @@ +package org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic; + +import java.util.function.Predicate; + +public enum Shape { + + PRINCE, FROG, NONE; + + public static final class Of implements Predicate { + private final Shape shape; + + public Of(Shape shape) { + this.shape = shape; + } + + @Override + public boolean test(Creature creature) { + return creature.shape().equals(shape); + } + + } + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Universe.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Universe.java new file mode 100644 index 000000000..9dec21ee2 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Universe.java @@ -0,0 +1,51 @@ +package org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public final class Universe implements Creatures, Magic { + + public static Universe instance = new Universe(); + private final Set creatures; + + private final List listeners = new ArrayList<>(); + + private Universe() { + creatures = Stream.of(// + new Creature("Charming", Shape.PRINCE), //$NON-NLS-1$ + new Creature("Harold", Shape.PRINCE), //$NON-NLS-1$ + new Creature("Michigan J.", Shape.FROG), //$NON-NLS-1$ + new Creature("Ed Bighead", Shape.FROG), //$NON-NLS-1$ + new Creature("Kermit", Shape.FROG), //$NON-NLS-1$ + new Creature("Robin", Shape.FROG), //$NON-NLS-1$ + new Creature("Jason Funderburker", Shape.FROG), //$NON-NLS-1$ + new Creature("Kek of Egypt", Shape.FROG), //$NON-NLS-1$ + new Creature("Naveen", Shape.PRINCE))//$NON-NLS-1$ + .collect(Collectors.toSet()); + } + + @Override + public Set creatures() { + return creatures; + } + + @Override + public void listenToMutation(MutationListener ear) { + listeners.add(ear); + } + + @Override + public void turn(Creature creature, Shape shape) { + creatures.remove(creature); + creatures.add(new Creature(creature.name(), shape)); + fireMutationHappenned(); + } + + private void fireMutationHappenned() { + listeners.forEach(MutationListener::mutationHappenned); + } + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/e4xmi/Application.e4xmi b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/e4xmi/Application.e4xmi index dc4795f0b..c9ee238d1 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/e4xmi/Application.e4xmi +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/e4xmi/Application.e4xmi @@ -1,7 +1,7 @@ - - + + diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesContentProvider.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesContentProvider.java index 1615ef815..142768727 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesContentProvider.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesContentProvider.java @@ -7,7 +7,7 @@ import $packageName$.magic.Shape; final class CreaturesContentProvider implements IStructuredContentProvider { - + private final Shape shape; CreaturesContentProvider(Shape shape) { From 63829da55828a7e3969c0803fdb9a9d1ed1579f4 Mon Sep 17 00:00:00 2001 From: "elena.parovyshnaya" Date: Thu, 14 May 2020 17:20:58 +0300 Subject: [PATCH 3/6] Bug 561553 add `Component` utilization to FullFeather project template - implement sample template project with two requirements declared by means of Component Signed-off-by: elena.parovyshnaya --- .../META-INF/MANIFEST.MF | 4 +- ...edE4FullFeatherProductTemplateSection.java | 1 + .../templates/temp/CreatureLabelProvider.java | 40 ----- .../temp/CreaturesContentProvider.java | 27 ---- .../pde/ui/templates/temp/CreaturesView.java | 46 ------ .../pde/ui/templates/temp/FrogsPart.java | 15 -- .../pde/ui/templates/temp/MagicTool.java | 82 ---------- .../pde/ui/templates/temp/MagicTools.java | 96 ------------ .../internal/pde/ui/templates/temp/Test.java | 40 ----- .../templates/temp/magic/AntiMagicShield.java | 26 ---- .../ui/templates/temp/magic/Creatures.java | 25 --- .../pde/ui/templates/temp/magic/Magic.java | 7 - .../temp/magic/MutationListener.java | 8 - .../pde/ui/templates/temp/magic/Universe.java | 51 ------- .../$packageName$.magic.GoodWitch.xml | 9 -- .../OSGI-INF/$packageName$.magic.Universe.xml | 8 + ...$packageName$.magic.service.EvilWitch.xml} | 9 +- .../$packageName$.magic.service.GoodWitch.xml | 10 ++ .../e4xmi/Application.e4xmi | 5 +- .../java/AntimagicProtection.java | 18 --- .../java/CreatureLabelProvider.java | 5 +- .../java/CreaturesContentProvider.java | 16 +- .../java/CreaturesView.java | 142 +++++++++++++++++- .../java/FrogsPart.java | 16 +- .../java/MagicPart.java | 27 ---- .../java/PrincesPart.java | 18 ++- .../java/magic/Creature.java | 21 --- .../java/magic/Creatures.java | 9 ++ .../java/magic/EvilWitch.java | 14 -- .../java/magic/FrogToPrinceMagic.java | 5 - .../java/magic/GoodWitch.java | 11 -- .../java/magic/MutationListener.java | 10 ++ .../java/magic/PrinceToFrogMagic.java | 5 - .../java/magic/Shape.java | 7 - .../java/magic/Universe.java | 41 ++++- .../java/magic/service}/Creature.java | 4 +- .../java/magic/service/EvilWitch.java | 32 ++++ .../java/magic/service/FrogToPrinceMagic.java | 5 + .../java/magic/service/GoodWitch.java | 30 ++++ .../java/magic/service/Magic.java | 9 ++ .../java/magic/service/MagicForces.java | 7 + .../java/magic/service/PrinceToFrogMagic.java | 5 + .../java/magic/service}/Shape.java | 4 +- 43 files changed, 346 insertions(+), 624 deletions(-) delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreatureLabelProvider.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreaturesContentProvider.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreaturesView.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/FrogsPart.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/MagicTool.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/MagicTools.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/Test.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/AntiMagicShield.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Creatures.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Magic.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/MutationListener.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Universe.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.GoodWitch.xml create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.Universe.xml rename bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/{$packageName$.magic.EvilWitch.xml => $packageName$.magic.service.EvilWitch.xml} (58%) create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.service.GoodWitch.xml delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/AntimagicProtection.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/MagicPart.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Creature.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/EvilWitch.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/FrogToPrinceMagic.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/GoodWitch.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/MutationListener.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/PrinceToFrogMagic.java delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Shape.java rename bundles/org.eclipse.passage.ldc.pde.ui.templates/{src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic => templates/LicensedE4FullFeatherProduct/java/magic/service}/Creature.java (75%) create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/EvilWitch.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/FrogToPrinceMagic.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/GoodWitch.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/Magic.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/MagicForces.java create mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/PrinceToFrogMagic.java rename bundles/org.eclipse.passage.ldc.pde.ui.templates/{src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic => templates/LicensedE4FullFeatherProduct/java/magic/service}/Shape.java (77%) diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/META-INF/MANIFEST.MF b/bundles/org.eclipse.passage.ldc.pde.ui.templates/META-INF/MANIFEST.MF index d7a71b481..ebe98e3da 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/META-INF/MANIFEST.MF @@ -12,8 +12,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="0.0.0", org.eclipse.pde.ui;bundle-version="0.0.0", org.eclipse.pde.ui.templates;bundle-version="0.0.0", org.eclipse.passage.lic.equinox;bundle-version="0.0.0", - org.eclipse.e4.core.contexts, - org.eclipse.e4.core.di + org.eclipse.e4.core.contexts;bundle-version="0.0.0", + org.eclipse.e4.core.di;bundle-version="0.0.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Copyright: %Bundle-Copyright Automatic-Module-Name: org.eclipse.passage.ldc.pde.ui.templates diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE4FullFeatherProductTemplateSection.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE4FullFeatherProductTemplateSection.java index b5ea29d4b..dc33d25f9 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE4FullFeatherProductTemplateSection.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE4FullFeatherProductTemplateSection.java @@ -62,6 +62,7 @@ public String getSectionId() { @Override protected void updateModel(IProgressMonitor monitor) throws CoreException { setManifestHeader("Bundle-ActivationPolicy", "lazy"); //$NON-NLS-1$ //$NON-NLS-2$ + setManifestHeader("Service-Component", "OSGI-INF/*"); //$NON-NLS-1$ //$NON-NLS-2$ String productFqn = model.getPluginBase().getId() + '.' + VALUE_PRODUCT_ID; createLicensingCapability(productFqn); createProductExtension(); diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreatureLabelProvider.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreatureLabelProvider.java deleted file mode 100644 index 0716c6185..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreatureLabelProvider.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.eclipse.passage.ldc.internal.pde.ui.templates.temp; - -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Creature; -import org.eclipse.swt.graphics.Image; - -final class CreatureLabelProvider implements ILabelProvider { - - @Override - public void addListener(ILabelProviderListener listener) { - // do nothing - } - - @Override - public void removeListener(ILabelProviderListener listener) { - // do nothing - } - - @Override - public void dispose() { - // do nothing - } - - @Override - public boolean isLabelProperty(Object element, String property) { - return false; // do nothing - } - - @Override - public Image getImage(Object element) { - return null; // FIXME: ! - } - - @Override - public String getText(Object element) { - return ((Creature) element).name(); - } - -} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreaturesContentProvider.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreaturesContentProvider.java deleted file mode 100644 index 960b955d3..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreaturesContentProvider.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.eclipse.passage.ldc.internal.pde.ui.templates.temp; - -import java.util.function.Predicate; -import java.util.stream.Collectors; - -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Creature; -import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Creatures; -import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Shape; - -final class CreaturesContentProvider implements IStructuredContentProvider { - - private final Predicate shape; - - CreaturesContentProvider(Shape shape) { - this.shape = new Shape.Of(shape); - } - - @Override - public Object[] getElements(Object input) { - return ((Creatures) input).creatures().stream() // - .filter(shape) // - .collect(Collectors.toList()) // - .toArray(); - } - -} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreaturesView.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreaturesView.java deleted file mode 100644 index cbc695947..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/CreaturesView.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.eclipse.passage.ldc.internal.pde.ui.templates.temp; - -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Creatures; -import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Shape; -import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Universe; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -public final class CreaturesView { - - private final Creatures creatures; - private final Shape shape; - - CreaturesView(Shape shape) { - this.creatures = Universe.instance; - this.shape = shape; - } - - public void install(Composite parent) { - ListViewer list = installControl(parent); - installDynamics(list); - } - - private ListViewer installControl(Composite parent) { - ListViewer list = new ListViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); - list.setContentProvider(new CreaturesContentProvider(shape)); - list.setLabelProvider(new CreatureLabelProvider()); - list.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - list.getControl().setFont(font(parent)); - list.setInput(creatures); - return list; - } - - private Font font(Control parent) { - return new Font(parent.getFont().getDevice(), "Sans serif", 22, SWT.NORMAL); //$NON-NLS-1$ - } - - private void installDynamics(ListViewer list) { - creatures.listenToMutation(() -> list.refresh(true)); - } - -} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/FrogsPart.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/FrogsPart.java deleted file mode 100644 index 748662f10..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/FrogsPart.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.eclipse.passage.ldc.internal.pde.ui.templates.temp; - -import javax.annotation.PostConstruct; - -import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Shape; -import org.eclipse.swt.widgets.Composite; - -public class FrogsPart { - - @PostConstruct - public void postConstruct(Composite parent) { - new CreaturesView(Shape.FROG).install(parent); - } - -} \ No newline at end of file diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/MagicTool.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/MagicTool.java deleted file mode 100644 index 239bd03c5..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/MagicTool.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.eclipse.passage.ldc.internal.pde.ui.templates.temp; - -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Creature; -import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Magic; -import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Shape; -import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Universe; -import org.eclipse.passage.lic.internal.equinox.EquinoxPassage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -@SuppressWarnings("restriction") -final class MagicTool implements ISelectionChangedListener { - - private final Magic magic; - private final Shape target; - private final String feature; - private Button spell; - - MagicTool(Shape target, String feature) { - this.target = target; - this.feature = feature; - this.magic = Universe.instance; - } - - public void install(Composite parent) { - Composite owner = owner(parent); - installInfo(owner); - installMagic(owner); - updateEnablement(Shape.NONE); - } - - private Composite owner(Composite parent) { - Composite owner = new Composite(parent, SWT.NONE); - owner.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, true)); - owner.setLayout(new GridLayout(1, false)); - return owner; - } - - private void installInfo(Composite parent) { - new Label(parent, SWT.NONE).setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, true)); - } - - private void installMagic(Composite parent) { - spell = button(parent); - spell.setText("To frog"); //$NON-NLS-1$ - // frog.addSelectionListener(SelectionListener.widgetSelectedAdapter( e-> - // magic.turn(creature, shape))); - } - - private Button button(Composite parent) { - Button turn = new Button(parent, SWT.PUSH); - turn.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false)); - return button(parent); - } - - @Override - public void selectionChanged(SelectionChangedEvent event) { - Creature creature = (Creature) ((IStructuredSelection) event.getSelection()).getFirstElement(); - updateEnablement(creature.shape()); - } - - private void updateEnablement(Shape shape) { - spell.setEnabled(shape != target && witchIsProperlyPayed()); - } - - /** - * Check if the magic {@code feature} with the configured - * {@code licensing.feature.identifier} (like "EvilWitch"), declared by - * an OSGi component is payed for and Passage allows it be to used. - */ - private boolean witchIsProperlyPayed() { - return new EquinoxPassage().canUse(feature); - } - -} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/MagicTools.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/MagicTools.java deleted file mode 100644 index 5ccbf52ad..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/MagicTools.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.eclipse.passage.ldc.internal.pde.ui.templates.temp; - -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Creature; -import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Magic; -import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Shape; -import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Universe; -import org.eclipse.passage.lic.internal.equinox.EquinoxPassage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -@SuppressWarnings("restriction") -public final class MagicTools implements ISelectionChangedListener { - - private final Magic magic; - private Button frog; - private Button prince; - - public MagicTools() { - magic = Universe.instance; - } - - public void install(Composite parent) { - Composite owner = owner(parent); - installFiller(owner); - installEvilMagic(owner); - installGoodMagic(owner); - installFiller(owner); - updateEnablement(Shape.NONE); - } - - private Composite owner(Composite parent) { - Composite owner = new Composite(parent, SWT.NONE); - owner.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, true)); - owner.setLayout(new GridLayout(1, false)); - return owner; - } - - private void installFiller(Composite parent) { - new Label(parent, SWT.NONE).setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, true)); - } - - private void installEvilMagic(Composite parent) { - frog = button(parent); - frog.setText("To frog"); //$NON-NLS-1$ - // frog.addSelectionListener(SelectionListener.widgetSelectedAdapter( e-> - // magic.turn(creature, shape))); - } - - private void installGoodMagic(Composite parent) { - prince = button(parent); - prince.setText("To prince"); //$NON-NLS-1$ - } - - private Button button(Composite parent) { - Button turn = new Button(parent, SWT.PUSH); - turn.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false)); - return button(parent); - } - - @Override - public void selectionChanged(SelectionChangedEvent event) { - Creature target = (Creature) ((IStructuredSelection) event.getSelection()).getFirstElement(); - updateEnablement(target.shape()); - } - - private void updateEnablement(Shape shape) { - prince.setEnabled(shape == Shape.FROG && goodWitchIsPayed()); - frog.setEnabled(shape == Shape.PRINCE && evilWitchIsPayed()); - } - - /** - * Check if feature with {@code licensing.feature.identifier} - * "EvilWitch", declared by {@code magic.EvilWitch} OSGi component is - * payed for and Passage allows it be to used. - */ - private boolean evilWitchIsPayed() { - return new EquinoxPassage().canUse("EvilWitch"); //$NON-NLS-1$ - } - - /** - * Check if feature with {@code licensing.feature.identifier} - * "GoodWitch", declared by {@code magic.GoodWitch} OSGi component is - * payed for and Passage allows it be to used. - */ - private boolean goodWitchIsPayed() { - return new EquinoxPassage().canUse("GoodWitch"); //$NON-NLS-1$ - } - -} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/Test.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/Test.java deleted file mode 100644 index 932b689d7..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/Test.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.eclipse.passage.ldc.internal.pde.ui.templates.temp; - -import org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic.Shape; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -public final class Test { - - public static void main(String[] a) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setText("Magic"); //$NON-NLS-1$ - shell.setSize(900, 600); - shell.setLayout(new GridLayout(1, true)); - Composite owner = new Composite(shell, SWT.BORDER); - owner.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - owner.setLayout(new GridLayout(2, true)); - installUi(owner); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); - } - - private static void installMagic(Composite parent) { - new MagicTools().install(parent); - } - - private static void installUi(Composite parent) { - new CreaturesView(Shape.PRINCE).install(parent); - installMagic(parent); - new CreaturesView(Shape.FROG).install(parent); - } -} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/AntiMagicShield.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/AntiMagicShield.java deleted file mode 100644 index 798182e37..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/AntiMagicShield.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic; - -import java.util.HashSet; -import java.util.Set; - -final class AntiMagicShield { - - private final Set creatures = new HashSet<>(); - - void cover(Creature creature) { - creatures.add(creature); - } - - void uncover(Creature creature) { - creatures.remove(creature); - } - - boolean covered(Creature creature) { - return creatures.contains(creature); - } - - int amont() { - return creatures.size(); - } - -} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Creatures.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Creatures.java deleted file mode 100644 index 089977c6d..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Creatures.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic; - -import java.util.Collections; -import java.util.Set; - -public interface Creatures { - - Set creatures(); - - void listenToMutation(MutationListener ear); - - public final class None implements Creatures { - - @Override - public Set creatures() { - return Collections.emptySet(); - } - - @Override - public void listenToMutation(MutationListener ear) { - // do nothing: no mutation is going to happen here - } - - } -} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Magic.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Magic.java deleted file mode 100644 index 83e557bed..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Magic.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic; - -public interface Magic { - - void turn(Creature creature, Shape shape); - -} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/MutationListener.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/MutationListener.java deleted file mode 100644 index 6507e227a..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/MutationListener.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic; - -@FunctionalInterface -public interface MutationListener { - - void mutationHappenned(); - -} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Universe.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Universe.java deleted file mode 100644 index 9dec21ee2..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Universe.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public final class Universe implements Creatures, Magic { - - public static Universe instance = new Universe(); - private final Set creatures; - - private final List listeners = new ArrayList<>(); - - private Universe() { - creatures = Stream.of(// - new Creature("Charming", Shape.PRINCE), //$NON-NLS-1$ - new Creature("Harold", Shape.PRINCE), //$NON-NLS-1$ - new Creature("Michigan J.", Shape.FROG), //$NON-NLS-1$ - new Creature("Ed Bighead", Shape.FROG), //$NON-NLS-1$ - new Creature("Kermit", Shape.FROG), //$NON-NLS-1$ - new Creature("Robin", Shape.FROG), //$NON-NLS-1$ - new Creature("Jason Funderburker", Shape.FROG), //$NON-NLS-1$ - new Creature("Kek of Egypt", Shape.FROG), //$NON-NLS-1$ - new Creature("Naveen", Shape.PRINCE))//$NON-NLS-1$ - .collect(Collectors.toSet()); - } - - @Override - public Set creatures() { - return creatures; - } - - @Override - public void listenToMutation(MutationListener ear) { - listeners.add(ear); - } - - @Override - public void turn(Creature creature, Shape shape) { - creatures.remove(creature); - creatures.add(new Creature(creature.name(), shape)); - fireMutationHappenned(); - } - - private void fireMutationHappenned() { - listeners.forEach(MutationListener::mutationHappenned); - } - -} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.GoodWitch.xml b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.GoodWitch.xml deleted file mode 100644 index ce674fb62..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.GoodWitch.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.Universe.xml b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.Universe.xml new file mode 100644 index 000000000..a11de23b8 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.Universe.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.EvilWitch.xml b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.service.EvilWitch.xml similarity index 58% rename from bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.EvilWitch.xml rename to bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.service.EvilWitch.xml index 5c61449a6..a48ec970b 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.EvilWitch.xml +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.service.EvilWitch.xml @@ -1,12 +1,13 @@ - + - + - - + + + \ No newline at end of file diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.service.GoodWitch.xml b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.service.GoodWitch.xml new file mode 100644 index 000000000..273fd7916 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/OSGI-INF/$packageName$.magic.service.GoodWitch.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/e4xmi/Application.e4xmi b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/e4xmi/Application.e4xmi index c9ee238d1..675e520fb 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/e4xmi/Application.e4xmi +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/e4xmi/Application.e4xmi @@ -1,11 +1,10 @@ - - + + - diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/AntimagicProtection.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/AntimagicProtection.java deleted file mode 100644 index 42bfb1f64..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/AntimagicProtection.java +++ /dev/null @@ -1,18 +0,0 @@ -package $packageName$; - -import org.eclipse.e4.core.di.annotations.CanExecute; -import org.eclipse.e4.core.di.annotations.Execute; - -public class AntimagicProtection { - @Execute - public void execute() { - System.err.println("Put on or take off the protection spell on a target"); //$NON-NLS-1$ - } - - @CanExecute - public boolean available() { - System.err.println("here we going to check license for 'antimagic-protection' fature"); //$NON-NLS-1$ - return true; - } - -} \ No newline at end of file diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreatureLabelProvider.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreatureLabelProvider.java index e6335daa8..05fac5ca0 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreatureLabelProvider.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreatureLabelProvider.java @@ -2,7 +2,7 @@ import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ILabelProviderListener; -import $packageName$.magic.Creature; +import $packageName$.magic.service.Creature; import org.eclipse.swt.graphics.Image; final class CreatureLabelProvider implements ILabelProvider { @@ -24,8 +24,7 @@ public void dispose() { @Override public boolean isLabelProperty(Object element, String property) { - // do nothing - return false; + return false; // do nothing } @Override diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesContentProvider.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesContentProvider.java index 142768727..9c2da3f63 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesContentProvider.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesContentProvider.java @@ -1,24 +1,30 @@ package $packageName$; +import java.util.Comparator; +import java.util.function.Predicate; import java.util.stream.Collectors; import org.eclipse.jface.viewers.IStructuredContentProvider; import $packageName$.magic.Creatures; -import $packageName$.magic.Shape; +import $packageName$.magic.service.Creature; +import $packageName$.magic.service.Shape; final class CreaturesContentProvider implements IStructuredContentProvider { - private final Shape shape; + private final Predicate shape; + private final Comparator comparator; CreaturesContentProvider(Shape shape) { - this.shape = shape; + this.shape = new Shape.Of(shape); + this.comparator = (first, second) -> first.name().compareTo(second.name()); } @Override public Object[] getElements(Object input) { return ((Creatures) input).creatures().stream() // - .filter(creature -> shape.equals(creature.shape())) // - .collect(Collectors.toList())// + .filter(shape) // + .sorted(comparator) // + .collect(Collectors.toList()) // .toArray(); } diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesView.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesView.java index 9fca48b2e..7f2f96c5b 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesView.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesView.java @@ -1,30 +1,158 @@ package $packageName$; +import java.util.Objects; + +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.StructuredSelection; import $packageName$.magic.Creatures; -import $packageName$.magic.Shape; -import $packageName$.magic.Universe; +import $packageName$.magic.service.Creature; +import $packageName$.magic.service.Magic; +import $packageName$.magic.service.Shape; +import org.eclipse.passage.lic.internal.equinox.EquinoxPassage; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Font; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.List; +import org.eclipse.swt.widgets.Text; +@SuppressWarnings("restriction") public final class CreaturesView { private final Creatures creatures; private final Shape shape; + private final Magic magic; + private final String feature; - CreaturesView(Shape shape) { - this.creatures = Universe.instance; + CreaturesView(Creatures creatures, Shape shape, Magic magic, String feature) { + Objects.requireNonNull(creatures); + Objects.requireNonNull(shape); + Objects.requireNonNull(magic); + Objects.requireNonNull(feature); + this.creatures = creatures; this.shape = shape; + this.magic = magic; + this.feature = feature; } public void install(Composite parent) { - ListViewer list = new ListViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); + Composite owner = owner(parent); + installTitle(owner); + ListViewer list = targetsList(owner); + Composite tools = magicTools(owner); + Button turn = magicWand(tools); + Text info = magicInfo(tools); + installDynamics(list, turn, info); + installData(list, turn, info); + } + + private void installTitle(Composite owner) { + Label label = new Label(owner, SWT.NONE); + label.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false)); + label.setFont(titleFont(owner)); + label.setForeground(owner.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY)); + label.setText(String.format("Creatures of %s shape", shape.name().toLowerCase())); //$NON-NLS-1$ + } + + private void installDynamics(ListViewer list, Button turn, Text info) { + ((List) list.getControl()).addSelectionListener( // + SelectionListener.widgetSelectedAdapter(e -> updateMagicTools(list, turn, info))); + creatures.listenToMutation((original, mutated) -> { + list.refresh(true); + if (mutated.shape() == shape) { + list.setSelection(new StructuredSelection(mutated)); + } + updateMagicTools(list, turn, info); + }); + turn.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { + Creature target = (Creature) ((IStructuredSelection) list.getSelection()).getFirstElement(); + magic.turn(target); + })); + } + + private void installData(ListViewer list, Button turn, Text info) { + list.setInput(creatures); + updateMagicTools(list, turn, info); + } + + private void updateMagicTools(ListViewer list, Button turn, Text info) { + if (magicIsProperlyPayedFor()) { + info.setText(String.format("Passage allows to use %s", feature)); //$NON-NLS-1$ + info.setBackground(info.getDisplay().getSystemColor(SWT.COLOR_CYAN)); + turn.setEnabled(!list.getSelection().isEmpty()); + } else { + info.setText(String.format("%s is not properly payed", feature)); //$NON-NLS-1$ + info.setBackground(info.getDisplay().getSystemColor(SWT.COLOR_MAGENTA)); + turn.setEnabled(false); + } + } + + private Composite owner(Composite parent) { + Composite owner = new Composite(parent, SWT.NONE); + owner.setLayout(new GridLayout(1, true)); + owner.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + owner.setFont(listFont(parent)); + return owner; + } + + private Text magicInfo(Composite tools) { + Text info = new Text(tools, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER); + GridData layout = new GridData(SWT.FILL, SWT.CENTER, true, false); + layout.minimumHeight = 30; + info.setLayoutData(layout); + info.setFont(textFont(tools)); + return info; + } + + private Button magicWand(Composite tools) { + Button turn = new Button(tools, SWT.PUSH); + turn.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false)); + turn.setFont(buttonFont(tools)); + turn.setText("\u2605 " + magic.purpose()); //$NON-NLS-1$ + return turn; + + } + + private Composite magicTools(Composite owner) { + Composite tools = new Composite(owner, SWT.NONE); + tools.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + tools.setLayout(new GridLayout(1, false)); + return tools; + } + + private ListViewer targetsList(Composite owner) { + ListViewer list = new ListViewer(owner, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); list.setContentProvider(new CreaturesContentProvider(shape)); list.setLabelProvider(new CreatureLabelProvider()); - list.setInput(creatures); list.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + list.getControl().setFont(listFont(owner)); + return list; } -} + private Font listFont(Control parent) { + return new Font(parent.getFont().getDevice(), "Sans serif", 16, SWT.NORMAL); //$NON-NLS-1$ + } + + private Font buttonFont(Control parent) { + return new Font(parent.getFont().getDevice(), "Sans serif", 12, SWT.BOLD); //$NON-NLS-1$ + } + + private Font textFont(Control parent) { + return new Font(parent.getFont().getDevice(), "Sans serif", 12, SWT.ITALIC); //$NON-NLS-1$ + } + + private Font titleFont(Control parent) { + return new Font(parent.getFont().getDevice(), "Serif", 12, SWT.ITALIC); //$NON-NLS-1$ + } + + private boolean magicIsProperlyPayedFor() { + return new EquinoxPassage().canUse(feature); + } +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/FrogsPart.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/FrogsPart.java index 2e412c390..4cf562d54 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/FrogsPart.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/FrogsPart.java @@ -2,14 +2,20 @@ import javax.annotation.PostConstruct; -import $packageName$.magic.Shape; +import org.eclipse.e4.ui.model.application.MApplication; +import $packageName$.magic.Creatures; +import $packageName$.magic.service.FrogToPrinceMagic; +import $packageName$.magic.service.Magic; +import $packageName$.magic.service.Shape; import org.eclipse.swt.widgets.Composite; -public final class FrogsPart { - +public class FrogsPart { + @PostConstruct - public void postConstruct(Composite parent) { - new CreaturesView(Shape.FROG).install(parent); + public void postConstruct(Composite parent, MApplication application) { + Creatures creatures = application.getContext().get(Creatures.class); + Magic magic = application.getContext().get(FrogToPrinceMagic.class); + new CreaturesView(creatures, Shape.FROG, magic, "GoodWitch").install(parent); //$NON-NLS-1$ } } \ No newline at end of file diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/MagicPart.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/MagicPart.java deleted file mode 100644 index 217d37755..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/MagicPart.java +++ /dev/null @@ -1,27 +0,0 @@ -package $packageName$; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -public final class MagicPart { - @Inject - private IEclipseContext context; - - @Inject - public MagicPart() { - - } - - @PostConstruct - public void postConstruct(Composite parent) { - Label label = new Label(parent, SWT.None); - label.setText("Magic field: context is " + context); //$NON-NLS-1$ - - } - -} \ No newline at end of file diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/PrincesPart.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/PrincesPart.java index c536e19d6..e56fe2919 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/PrincesPart.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/PrincesPart.java @@ -2,14 +2,20 @@ import javax.annotation.PostConstruct; -import $packageName$.magic.Shape; +import org.eclipse.e4.ui.model.application.MApplication; +import $packageName$.magic.Creatures; +import $packageName$.magic.service.Magic; +import $packageName$.magic.service.PrinceToFrogMagic; +import $packageName$.magic.service.Shape; import org.eclipse.swt.widgets.Composite; -public final class PrincesPart { - +public class PrincesPart { + @PostConstruct - public void postConstruct(Composite parent) { - new CreaturesView(Shape.PRINCE).install(parent); + public void postConstruct(Composite parent, MApplication application) { + Creatures creatures = application.getContext().get(Creatures.class); + Magic magic = application.getContext().get(PrinceToFrogMagic.class); + new CreaturesView(creatures, Shape.PRINCE, magic, "EvilWitch").install(parent); //$NON-NLS-1$ } - + } \ No newline at end of file diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Creature.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Creature.java deleted file mode 100644 index 94cd2b869..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Creature.java +++ /dev/null @@ -1,21 +0,0 @@ -package $packageName$.magic; - -public final class Creature { - - private final String name; - private final Shape shape; - - Creature(String name, Shape shape) { - this.name = name; - this.shape = shape; - } - - public String name() { - return name; - } - - public Shape shape() { - return shape; - } - -} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Creatures.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Creatures.java index 2d3f46b62..6cc7623e4 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Creatures.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Creatures.java @@ -3,10 +3,14 @@ import java.util.Collections; import java.util.Set; +import $packageName$.magic.service.Creature; + public interface Creatures { Set creatures(); + void listenToMutation(MutationListener ear); + public final class None implements Creatures { @Override @@ -14,5 +18,10 @@ public Set creatures() { return Collections.emptySet(); } + @Override + public void listenToMutation(MutationListener ear) { + // do nothing: no mutation is going to happen here + } + } } diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/EvilWitch.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/EvilWitch.java deleted file mode 100644 index c87035124..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/EvilWitch.java +++ /dev/null @@ -1,14 +0,0 @@ -package $packageName$.magic; - -import org.osgi.service.component.annotations.Component; - -@Component(property = { // - "licensing.feature.identifier=EvilWitch", // - "licensing.feature.name=Evil Witch", // - "licensing.restriction.level=info", // - "licensing.feature.version=13.4.1", // - "licensing.feature.provider=Universe" // -}) -public final class EvilWitch implements PrinceToFrogMagic { - -} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/FrogToPrinceMagic.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/FrogToPrinceMagic.java deleted file mode 100644 index ddfb1cdc8..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/FrogToPrinceMagic.java +++ /dev/null @@ -1,5 +0,0 @@ -package $packageName$.magic; - -public interface FrogToPrinceMagic { - -} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/GoodWitch.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/GoodWitch.java deleted file mode 100644 index a3a0ee0ed..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/GoodWitch.java +++ /dev/null @@ -1,11 +0,0 @@ -package $packageName$.magic; - -import org.osgi.service.component.annotations.Component; - -@Component(property = { // - "licensing.feature.identifier=GoodWitch", // - "licensing.restriction.level=fatal" // -}) -public final class GoodWitch implements FrogToPrinceMagic { - -} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/MutationListener.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/MutationListener.java new file mode 100644 index 000000000..9cc423469 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/MutationListener.java @@ -0,0 +1,10 @@ +package $packageName$.magic; + +import $packageName$.magic.service.Creature; + +@FunctionalInterface +public interface MutationListener { + + void mutationHappenned(Creature original, Creature mutated); + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/PrinceToFrogMagic.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/PrinceToFrogMagic.java deleted file mode 100644 index 9dc89c31b..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/PrinceToFrogMagic.java +++ /dev/null @@ -1,5 +0,0 @@ -package $packageName$.magic; - -public interface PrinceToFrogMagic { - -} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Shape.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Shape.java deleted file mode 100644 index 6d6e78dab..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Shape.java +++ /dev/null @@ -1,7 +0,0 @@ -package $packageName$.magic; - -public enum Shape { - - PRINCE, FROG - -} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Universe.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Universe.java index c255d1a62..9eb7282d7 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Universe.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/Universe.java @@ -1,19 +1,33 @@ package $packageName$.magic; +import java.util.ArrayList; +import java.util.List; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -public final class Universe implements Creatures { +import $packageName$.magic.service.Creature; +import $packageName$.magic.service.MagicForces; +import $packageName$.magic.service.Shape; +import org.osgi.service.component.annotations.Component; - private final Set creatures; +@Component +public final class Universe implements Creatures, MagicForces { - public static Universe instance = new Universe(); + private final Set creatures; + private final List listeners = new ArrayList<>(); - private Universe() { + public Universe() { creatures = Stream.of(// new Creature("Charming", Shape.PRINCE), //$NON-NLS-1$ - new Creature("Harold", Shape.FROG))//$NON-NLS-1$ + new Creature("Harold", Shape.PRINCE), //$NON-NLS-1$ + new Creature("Michigan J.", Shape.FROG), //$NON-NLS-1$ + new Creature("Ed Bighead", Shape.FROG), //$NON-NLS-1$ + new Creature("Kermit", Shape.FROG), //$NON-NLS-1$ + new Creature("Robin", Shape.FROG), //$NON-NLS-1$ + new Creature("Jason Funderburker", Shape.FROG), //$NON-NLS-1$ + new Creature("Kek of Egypt", Shape.FROG), //$NON-NLS-1$ + new Creature("Naveen", Shape.PRINCE))//$NON-NLS-1$ .collect(Collectors.toSet()); } @@ -22,4 +36,21 @@ public Set creatures() { return creatures; } + @Override + public void listenToMutation(MutationListener ear) { + listeners.add(ear); + } + + @Override + public void turn(Creature creature, Shape shape) { + creatures.remove(creature); + Creature mutated = new Creature(creature.name(), shape); + creatures.add(mutated); + fireMutationHappenned(creature, mutated); + } + + private void fireMutationHappenned(Creature creature, Creature mutated) { + listeners.forEach(l -> l.mutationHappenned(creature, mutated)); + } + } diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Creature.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/Creature.java similarity index 75% rename from bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Creature.java rename to bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/Creature.java index dcd49d702..5d5d121fb 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Creature.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/Creature.java @@ -1,11 +1,11 @@ -package org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic; +package $packageName$.magic.service; public final class Creature { private final String name; private final Shape shape; - Creature(String name, Shape shape) { + public Creature(String name, Shape shape) { this.name = name; this.shape = shape; } diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/EvilWitch.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/EvilWitch.java new file mode 100644 index 000000000..a83e9c6eb --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/EvilWitch.java @@ -0,0 +1,32 @@ +package $packageName$.magic.service; + +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +@Component(property = { // + "licensing.feature.identifier=EvilWitch", // + "licensing.feature.name=Evil Witch", // + "licensing.restriction.level=info", // + "licensing.feature.version=13.4.1", // + "licensing.feature.provider=Universe" // +}) +public final class EvilWitch implements PrinceToFrogMagic { + + private MagicForces forces; + + @Override + public void turn(Creature creature) { + // the power of a witch is the ability to appeal to the universe's magic forces + forces.turn(creature, Shape.FROG); + } + + @Reference + public void contractWithMagicForces(MagicForces universe) { + this.forces = universe; + } + + @Override + public String purpose() { + return "Turn to frog"; //$NON-NLS-1$ + } +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/FrogToPrinceMagic.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/FrogToPrinceMagic.java new file mode 100644 index 000000000..dcd866268 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/FrogToPrinceMagic.java @@ -0,0 +1,5 @@ +package $packageName$.magic.service; + +public interface FrogToPrinceMagic extends Magic { + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/GoodWitch.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/GoodWitch.java new file mode 100644 index 000000000..55b43fa6f --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/GoodWitch.java @@ -0,0 +1,30 @@ +package $packageName$.magic.service; + +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +@Component(property = { // + "licensing.feature.identifier=GoodWitch", // + "licensing.restriction.level=fatal" // +}) +public final class GoodWitch implements FrogToPrinceMagic { + + private MagicForces forces; + + @Override + public void turn(Creature creature) { + // the power of a witch is the ability to appeal to the universe's magic forces + forces.turn(creature, Shape.PRINCE); + } + + @Reference + public void contractWithForces(MagicForces universe) { + this.forces = universe; + } + + @Override + public String purpose() { + return "Turn to prince"; //$NON-NLS-1$ + } + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/Magic.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/Magic.java new file mode 100644 index 000000000..66406f26c --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/Magic.java @@ -0,0 +1,9 @@ +package $packageName$.magic.service; + +public interface Magic { + + String purpose(); + + void turn(Creature creature); + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/MagicForces.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/MagicForces.java new file mode 100644 index 000000000..c5e124b91 --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/MagicForces.java @@ -0,0 +1,7 @@ +package $packageName$.magic.service; + +public interface MagicForces { + + void turn(Creature creature, Shape shape); + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/PrinceToFrogMagic.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/PrinceToFrogMagic.java new file mode 100644 index 000000000..be0936e1b --- /dev/null +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/PrinceToFrogMagic.java @@ -0,0 +1,5 @@ +package $packageName$.magic.service; + +public interface PrinceToFrogMagic extends Magic { + +} diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Shape.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/Shape.java similarity index 77% rename from bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Shape.java rename to bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/Shape.java index d30695fb6..33e28e9ce 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/temp/magic/Shape.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/magic/service/Shape.java @@ -1,10 +1,10 @@ -package org.eclipse.passage.ldc.internal.pde.ui.templates.temp.magic; +package $packageName$.magic.service; import java.util.function.Predicate; public enum Shape { - PRINCE, FROG, NONE; + PRINCE, FROG; public static final class Of implements Predicate { private final Shape shape; From 745e08d0c7f5939027ac0872d239982a31a7acdb Mon Sep 17 00:00:00 2001 From: "elena.parovyshnaya" Date: Thu, 14 May 2020 17:36:48 +0300 Subject: [PATCH 4/6] Bug 561553 add `Component` utilization to FullFeather project template - memo for the further interface improvement Signed-off-by: elena.parovyshnaya --- .../LicensedE4FullFeatherProduct/java/CreaturesView.java | 1 + 1 file changed, 1 insertion(+) diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesView.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesView.java index 7f2f96c5b..8b841184c 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesView.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/java/CreaturesView.java @@ -30,6 +30,7 @@ public final class CreaturesView { private final Magic magic; private final String feature; + //FIXME: evolve constructor parameters: describe the magic by a single interface CreaturesView(Creatures creatures, Shape shape, Magic magic, String feature) { Objects.requireNonNull(creatures); Objects.requireNonNull(shape); From 0ded2c8c2892748bd066e898c7ff7bb13b68240b Mon Sep 17 00:00:00 2001 From: "elena.parovyshnaya" Date: Thu, 14 May 2020 17:44:58 +0300 Subject: [PATCH 5/6] Bug 561553 add `Component` utilization to FullFeather project template - wipe `org.eclipse.pde.ds.core.builder` as the need in it was temporary Signed-off-by: elena.parovyshnaya --- bundles/org.eclipse.passage.ldc.pde.ui.templates/.project | 5 ----- 1 file changed, 5 deletions(-) diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/.project b/bundles/org.eclipse.passage.ldc.pde.ui.templates/.project index 96b9fac00..55d454652 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/.project +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/.project @@ -25,11 +25,6 @@ - - org.eclipse.pde.ds.core.builder - - - org.eclipse.pde.PluginNature From a836bcf1bd89c23c88d99bb4ec050db470ef4d51 Mon Sep 17 00:00:00 2001 From: "elena.parovyshnaya" Date: Thu, 14 May 2020 17:46:55 +0300 Subject: [PATCH 6/6] Bug 561553 add `Component` utilization to FullFeather project template - wipe icons, will develop a ui without images Signed-off-by: elena.parovyshnaya --- .../bin/icon/atribute.txt | 2 -- .../bin/icon/frog16.png | Bin 734 -> 0 bytes .../bin/icon/frog32.png | Bin 1590 -> 0 bytes .../bin/icon/frog64.png | Bin 2967 -> 0 bytes .../bin/icon/prince16.png | Bin 592 -> 0 bytes .../bin/icon/prince32.png | Bin 1077 -> 0 bytes .../bin/icon/prince64.png | Bin 2071 -> 0 bytes 7 files changed, 2 deletions(-) delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/atribute.txt delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog16.png delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog32.png delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog64.png delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/prince16.png delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/prince32.png delete mode 100644 bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/prince64.png diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/atribute.txt b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/atribute.txt deleted file mode 100644 index b5d6ace55..000000000 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/atribute.txt +++ /dev/null @@ -1,2 +0,0 @@ -Icons made by Freepik from www.flaticon.com -Icons made by Good Ware from www.flaticon.com \ No newline at end of file diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog16.png b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog16.png deleted file mode 100644 index a0fa63900944bdbfb263ada7bdcf142b3efccc23..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 734 zcmV<40wMj0P)lx^UlC)_?Jy>ABpx z>x=v@FS*L_gF@g3r6Y%TaJ~a@_vIQ}OY~OOCNGM%H!MwBX0s7d$`^=fJ;Y;)!;w;hmflNge3HPEND`(nvF22G z@M&k(5-XQkdOs!qHhn!yc{lN#@nV)Gi6LsOQGD@wYX62(cLyL_JCsqfRcQEAGE@O} zyc-fXI)LJidjRxR+a>3?hAmNDK$T4AX9zbh3|z=hxkOGf^2^gR-6~ z&Cbbk!6KQS!7vq(;F9z?rU%Nr0?{Bqpjvp%8UQUdEvnvo-h3|7H&7Q{Hh6Ud+i78# z3K20(jD-@S&22$}7phhsAeqQqh&Qkobu}|iYUUI`7|J~0{cMlm*X+O6cQQ-$j$ozJ Qn*aa+07*qoM6N<$f<_ZX0ssI2 diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog32.png b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog32.png deleted file mode 100644 index 447d4da5e13738b214f18c33312808737c30b08d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1590 zcmV-62Fdw}P)=s1R+F~auGZr0!WC5Kxrjfq)3ROK7a&LOHfGKxKWy-M5#(CX>%ba zz9hao>$TUrJG-+phlh2{#vX5Mi6U`cX1;U&=lsu{?|d_7;QvkZ5XR!YBC2)kI@@Yx zO%BfM_kZ8ny=_8Ie5?(?IkojQJrc`$qqW4e)&ll~Zc$n)LFY4-Q(Lc~ z>;P@5zLb8Rpfz+!kUU<-1Sy^2?Pt%#{qs`geXAQySg_d%!~*|=KjoKlELkZw&D5TFqD50;7@z+IrlKYvwa)|9@>)r z4))I&`2Fd@JwqbKe#?mQ(ey#eC7V}{yu|3h5G|1&+9IC@Xh~)0@}u%iz(C>v zK{E}&wTqWH|5_ip>6?g{1SA2fCdi|O%Iro}Pl84oLoBirQ=B{A$Kb_(0uZv=YeAKS zAD8bbP)9Fg!EE^*TrIQn!98sIG1_%sCghnEgTRablT8d@|k+ zDCft%NY*}2Je8o}403+_OB9_O7$UDewTIzVR{)^1Wy|PT?iyM9ELr<3A{MGu0Ak@J z$yoa$HkIhWF6YUY`Z;}lKSBV-0U#I%b9d*CPI$wY$M+OmnfpqMnC1;v-Oy})l7gMX z^{ND{An|C1cr=47xc+N&;dH4oTbN?5Fh!+mV;KQrkre5~dQ8)zIh6Ux&dxtyT~!4P zF}5j$Ofg9(I!GrvRw`88qX@~SHj+(k%S@_@XX<|77t6SOV;PdaGvnICG^|NKy>9}; z)0b^m-PM28?@X@$7<~IZKije%ICgc{heh;Eb7VtDN1_KqLJflt-F&^FT?FQe6I>lR zJ?bev2Yb0zZ(r5}2JT^1>Btptkg}586??290rE&gbH4g6Z;$i>tT%+iz~^ssuU{M; z{Y2C%1oG5vO(wjX&4~kq&Go(n+3frZiMb5S{ffVjAF9`SZiJ?%cd5H588_bl?(iYi6Cfq|ZxE*t)Z4q$EGFj~7t&wlxYH=yTz-BY>ew|BAP7OQ|E>+84 z74(@~I@hZ*SC}LbYsEBbA9_t}>*~|Z%}+3y9iTO}iB$YQrlGM5l$`Q zf-An$o6uoE-!muKW~iq>_9bsD%O~H4!=0~0OoN|T2%lQ3XKVVt?!l3_#tnm}bZcp| z8akb9FPXq!*AhpS&sr!m2%Y`_ZyZ>6>$;$x3dKYH-+Yi-w^6(V@cbE4PK8+@S@V?z zU#a(9D*aaep3aX)hsS)U6%7c1VD0J#YbSQyRB67e>zuO``?Vfso;yan6(hX1Af8zz4^$geh?nE(I)07*qoM6N<$g3JQ*u>b%7 diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog64.png b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/frog64.png deleted file mode 100644 index 48f5cf68da86ca9e2c1cdabf477b9604f68dc06b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2967 zcmV;I3uyF-P)5M$OV2P1i!!2v5^+HU1x+fr zMJ-KYDwdi=D@J3~lqgn8OJh~2ilxRFL^PG9l2}HgsbG~G3Mx3MB)9>i(FhL1XkcKN z9cFr8-o5!SGu{2@Z5}W{68>NMo_m%)=e+ao`rs&z;wUB(x@G31g1lGe`t-9?3iBVK zAn#y7PLyH&_5yFBW%k=i?e0swHG92&dx1BbA8(m`RkA!jK>zN(soT)hl=# zlRo_z>-93cOb{k40f}hvVl)dz$%Tn%@ZxN~(A*1n&>B}He6vm2z^03VP4{48!V(~) zs47N-u1vR-GVRJ#6{Qa%ToYwjVUVdE?Wr<^gsWa*#Daw>CsBeD!uY$a= z2^|%%Ws8u&YZUAh!?ApRdv0#>)5{bgVoFsG1=)S6>LNsb#z zVC2a|z62yCyjKtZtOcuxhXPs^EV<)+{^s2KQUCT=@wN5^cK~ZC5RCdG-2foXq{9%cmNG&2w1n`Efza)-G=?DfY;g=d{3Z%pKDBF8UZXF!BWv2Jzq*C z=k-LpT}r3R*4)xIb*!C`u(By-47hcUUoPpxB`b+reQ0gvi{uBlpT}>V#^N{uuWws8 zTWQq_q&F}g*JP&qze}y>Tnym@Ae`!8SNM5)BClgx5+k0zr1_oe^4VU#j%Nj2lkML0 z%4;~G`erK2W&w~?A$EsWv3cNOqN&bo^@LKKzT`r-IElw`0#>)5{W5U*7+qnW%7Oj(`gCld)aZ)l~b zbEi%382`60L|K-f;v4Ouo4?W)x%H~`U6(C?r|a^2UDCL6jBf}J%>nzk*1dfvo8NCG znMkJl%8WW@R9|n4C#AT=NlZ?+!zW}D0r#0U=9BmTj2&Csky3K)U3b!a`l$dIq8z{Z z1%?tI0HD#03f2g%84mZOwZgJ816z$}KBml6Ra@&vJoUhGlu}GTshL|I_;H$7?>mpS z!R2XM2)mD^;A|Sy)MS&U5lFWqp%6Q^wgaG)qV2m1jI2>-cTqVzNOhI~p$4+aq_rpA_WAuBJF|JjsFa*I=QNvYB1?8e zCR2Qdw4aE@Qhhf1#JQ&-<%p|IvzqZ$WU3=>_3q;%cI6Uq^a^O?Hjy=@?TK%o(tT>0 zzW%AnVD*dTfKZX^oMLQWk}XIiOEp{E|~FN z53p*CPU$e4_uNNH1qpD_u zIJ^6$A1t!(PKjiGqv^+~B=whuo?OXqnE#x|w(u*l7 ziK{-e&fNh|nKUyswdu5mg;gsDoy6m~0)i3a?#lAI#z~daK-lxAQ6#K^yup{5J|@?m zU<*FS8DTKB{v^uWkE06c)Jwe4NNg7n0Eopy z^bhaK`^3f|g`~2)jzC2tQsm}4y8_0bm7;%mCwqh4d7t(e%G~8N1e)-ajm#EO8oIuw zu4Yc)#l7Q=$BqF3#5-AK^E;l}R1?Apq4C!pa zDWs&X`dDfzCKHMd5{?a#OvTYk;c}U{&2s$SK+bHUlqKR3YYFg^@&1>?b%36quV}pP z3cT(LC#J>)!!W7xH&Eqo7`IMbB^Ti!0S?CiQCC{#Fhi?}TMBEPHP0QP5C}(?hz|Dx zqQjB=VStdb-HE)T1Q>?c_k8P!gK3zK&IQMvfQ=jHn(aGU7e^DrrG*a@T!zVen_vFg z(w6ZL?&C_p#*K5$zDn~&1h)+g?H1@Gun2^pd+;-W+XIRh#+!t33H4Q*kD$2}AfAj6 z4Oh}wesDh9Y4lDlEi?{9lYML*dS{HhtXlDNU`Z*xk}JVAZ42gWso%j?ErRB%AJOQ$ zbpO1~!r)-2v``5|)#t3~n7?ngl9ID-Tg1j_Qo#e1nK8~NCQx(` zREC@)#xdY0)gIdRKFE&XGfeYeL!I|L+daTRfq@Wg(ubQ)A%rHW`{|CX;p3i%h^2Z(av68r7O7Fc7Ko!rAD5Nln1sZ$@_d)cPyNTQa3Sj4_NT7Ef^l4dvIiX&{%ss z6~5Ynf7CtD!EiYD$bL&}u1yGU!g39-<X4=@Xm5psXme za`T-RlRh_0*X^pU^JXMnaueur1rMOI?(>w&^U=ZtVJvt6OO1a&r{PM&WYgoXbKF>; z1X#8G+<+mCb-?t4=;x7&CS|hj(H5#-0C452^oE4N}D zCm#xbG&D)Q@BNlD6IT9q9!N1XZmUpKR%@($?frn18nG1i&xob0p?vKeX#U|b%2tot zu9r0$))zEqWs;fQb_fg2QUUN<`&pIB;e`S~Z_mdJ#Ye`rsxlAt4X5PDxRpD0(MjvO z_Q%6z>zFDuIorw|TdRo0Jpg#hVjMfuc@B&O{fjT<$UWgbilaC*_z!7mBO}DLP(%O# N002ovPDHLkV1gOLrV#)D diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/prince16.png b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/prince16.png deleted file mode 100644 index 02bd291356804ce291e7dc8d7eb8882ae4184b19..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 592 zcmV-W0%(~xJhlgXrM^5o)C8 zR?pw-B)IUz0{}z9AWrhHJF!1YqB?N~0EpyCYSxnb z01z!-DDS@;`yPk5kFO_9zA6mr6sXMIfg+JS2Y_be zU}FXV*alzg6=w|gzBN+;JHhsszu4btLHKZ!L{R@_`y04K@N+xH?;V@=&I;HGnA^Yg zAWRU|Y}$8apbcT)58y69*x~asKI~S!=x)Z@o5j0jxLF~dzgt`)JgCZK45NWY7Hl|7EFZ14; z`|dq1hQv%}-uz@rdf>sk=bi66-@Eso!y#tIj_tc6y#Rohe_Purh1e-jrAAIFp%<0V ziz+p8a@Pd_JORKiKRmJP0tiUedT*JhojahukDpK_9SOaX{%WTjZ5#nWnx1wte7YSD z0T9X5a1u9PG+Rth8hBf}d;*}>f8^U_7yyJy#lH{`x0GD|p%uJ8GyD<(L)vF6I~Dt& z6|9<0Tu~jxoS%w+Bmf!*01%$RY|?6$gh1yu38j9w>Fl#f3xrbu3#U603#1wRF%LeCrXBS1wJFadZ?Nn=h;CxUPGkNq|g zy}8{jU7gH*-QODo%Y7NUoL`fFNS6md|NCp*-UA>^shPxe+&uEc_Kzyx^*Vr_?S9rE z?c0~O``51xA6@%Aw&WJ{dslpTW9Pk}9#?Z1PqGRN3NO5f7J3?N9^@Uzdmb|PC7is%dd3foD?F^<+X4kFFSz(;-off$)gs)y!cyAZTxVBGke;rJThI8& zu1Mq_1dFICU_ImG-#g_5OY;s&#Y*yGR#lumGf;9XV|>ZTu9S}_za~*~ss#oLu)7R& zL<|5xc&`b|t_s)t1KwfBv_qgoEZ|ZI%;orO|LKrgQH=DY=ME%FsR0z z?i&ds6c#WoLQgbQ9Y8?u!44P}VgHk%z=jZLkJ-{(2mlZ~&?=;u zllSjU9y)yV!ry87`Tf2jW|an-@86Hev{HIVF!XbeAvpjDVTfZw3+EcZ3%j467o_KX vQyxl*X!d+`+yL3Tky?SBv5%L30yF;y!-#M%i`%iz00000NkvXXu0mjfMfTo9 diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/prince64.png b/bundles/org.eclipse.passage.ldc.pde.ui.templates/templates/LicensedE4FullFeatherProduct/bin/icon/prince64.png deleted file mode 100644 index 87fa3c77ec693644c3e6a475c06e09fc33f1c1f2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2071 zcmV+y2BF3MTnM zQ)iEP$-z4ThPG`0qx;RAyg518eVbP_JQKiV=9d5{03ZZC;}wtm9B{nPFIvO{46Kct z#!=jNA?d2ulU)I!`Yr=l6&=^XIV5jjt!)pv>=yt=`Zhu!g}tLQ0KjpoFCtpxC4e0x z;1@#mO^T7N``qLpe7^kvRuz9s3GP$aQ*Qdisoriey!B;4@?V0>D`L3!Fi!7k;ezB> z0jw#>+6a>0ag_|w!E%$X(L-*!6q5Y_pidz`?1KRNf;4iEa1iddW@o!`a>sf%h!{g# zZv)tF3qhS4XMY!d*bSdJ*|iG5XUfeI>`@Me6V?*+H{5sjiW^)wv-W-wrY67ZhEJpd z34mhdW(G`fh4EhkxK?6MgYloZLS$&iY5#g=Q%z$ zI;O<=Mu0xgfP)HSA0f!xvXcNHVLXbtOAspvFm?SoH+*NJ(l9joDS$r%^fH0=D)+qe zd&^e1aAENVz<#ah$~W=JbC%F?gwuDa!nigL;O0_ubX=d8jVloCe8UPHcx_oaA#pUk zMKU>LWMyYyrSiq*{r`Ajp1;aP>45N?=a*|q6vlr(jk3ls1Sy~-8zv7ehtI@d&mmnm zFB)0dSt-v_JHd4zIw3|PgN2#222`H>%3*48HZm0o+k-ep9FB#PKf6vQ-V@1KrPQ8FAjo(Z*`>+c^uggJD1nMNZ(4 zk#%-RDS}ts`$fnc`;nde@nhXPXO47T)l>3oa*19qh5f@2!#=?=CWd~q4iF_GgRs#Ku6Zlu0)^6nJUi7mCUauHW z40I2qV)|bUP1baiT>E_hp@|63i{aka@anermnMnZ!=C`?eNL+uCi#-#?(db_QZI$? znmN)L)l%|7r@dZ^<-8F2s1V|u9EyAc{VZQEvp@NjLuizbpnj$%kM*3$%$Tp58nx6~ zZxPFVBNQTrXT*nkU(au#=$=|DG&I?s80NJQF~egiGhrn7OJ!O79+LJQLu``3&@| zgfIy4DShbzF2S(?*`$Clob_Dvl7_@JW3H~0Kss(Zs!Ixjp*bH$jsy?}Vd88Wmq#iQrXxD3K?-M`;YfhXqxtYnP8*mW*Qzd86pj{XClT`VfsKZw zVg_=ld?dyk4kOzFOpj|wPS1t!)P*cERfca-xJt0o5IrZ6ygtVxmljCH><=Sb0%YPQ zrY_76Um{@QTxQAnK+8zXmJqIlTw1`?7q3eS!px+G@|XSOb^F7}mH<;1a~7unVB{pO zUs`-91VS8ZIvbYsv9jF<)xY=|CmlB-Oe+y0U^cq6$fd9)z`C9w*a9W|A&&M&fp=TskwAvfDrD$Cf zfG{N(cXm1CxCMbm#a75JgbjV6s>gjLFb=4G=N;kcaai%OnnkP??_G#^O~7lsCxF)k zyv7YLfOQ{W7=Yq)|AWN>7)MjRe32w!@n8Hz=FGR&-ww#90PMzM-|_r^Lj&+vlJfCe zo}PLWC