From 1a71acf71c05b39b6cfaf12de4ffb09284fb56ed Mon Sep 17 00:00:00 2001 From: kkomissarchik <kkomissarchik> Date: Fri, 18 Aug 2006 19:49:20 +0000 Subject: [PATCH] [nocr] Added documentation on using the property tester to enable ui based on the presence of a facet. --- .../facets/downloads/enablement-example.zip | Bin 0 -> 5346 bytes .../html/facets/enabling-based-on-facets.html | 108 ++++++++++++++++++ docs/org.eclipse.wst.doc.isv/toc_WST.xml | 3 + 3 files changed, 111 insertions(+) create mode 100644 docs/org.eclipse.wst.doc.isv/html/facets/downloads/enablement-example.zip create mode 100644 docs/org.eclipse.wst.doc.isv/html/facets/enabling-based-on-facets.html diff --git a/docs/org.eclipse.wst.doc.isv/html/facets/downloads/enablement-example.zip b/docs/org.eclipse.wst.doc.isv/html/facets/downloads/enablement-example.zip new file mode 100644 index 0000000000000000000000000000000000000000..03e7c89e4d3cf499c1422054f32740dce7ac28c7 GIT binary patch literal 5346 zcmc&&XH=7Iwxt*8y;qSc0a2>-CPg4XK$>6(5$O>U;iD>2L_k2Kd{mJl0fLlBks?J( zA{`06OA!zd5S2P%#<?=i9oHJ~T{Guh?^?;PbKbqqe)irE(2$sfnScWSBtaNu2~L$V z{<oL6GXM&4cY*mp0lq$P0L<IV6$*g^Zh|3DH~{Jg_JFxVeE?8Tu%kQF1L_Hv0zlls zK0Yuo{8nb13RR0VvyL<Au~w&NQM#5J1M;a>l9@9SlN;Nfl1kSf;$`s=pj6WkpqTMC zdT>=gfyzomRv6x;`-H$-QV2&mnH)VERxqfcwpird18Q{9+Q=kmXh_J_P5?S9o{QT; z=uYdGmY;oz;((otCB8$Sg%s!a8befxS4;+Grc^?+SVBf(2-;tg-kjymBP}=0NnQ>{ z!Z(G#_Ee>O4Vz!y-oFeqB&QhS&KStYf9yp<0s`Q_ghT1~;P{SM!{cUSVgdSy-n6f@ z-BaQI+v?R(oL;iRL*%IygOW7VBqL)TZ1F?xmP~Z*;|FTn+eSCu?78pEg{g`f7B5Cf zrjtHKXFd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ASw)6jppa}8r^!pKHf9`bJ z2%p4*A0<ilJDvWwu<&!w)1rQ2v47Ncyv+amX#W2j?w=<<ef*x7jUPoy^<SF!pRLEw oL!YMTi8A~s8hlFpPr>|8Isr5!#cvkDUvD!3_|qec{^Z|Z03*M#$p8QV literal 0 HcmV?d00001 diff --git a/docs/org.eclipse.wst.doc.isv/html/facets/enabling-based-on-facets.html b/docs/org.eclipse.wst.doc.isv/html/facets/enabling-based-on-facets.html new file mode 100644 index 000000000..50ce36a1d --- /dev/null +++ b/docs/org.eclipse.wst.doc.isv/html/facets/enabling-based-on-facets.html @@ -0,0 +1,108 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> +<html> + +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <title>Enabling UI Elements Based on Project Facets</title> + <link type="text/css" rel="stylesheet" href="tutorial/tutorial.css"/> +</head> + +<body> + +<h1 align="center">Enabling UI Elements Based on Project Facets</h1> + +<p>User interface elements often need to be selectively enabled based on the +presence of a facet in a project. The two most common examples are project +properties pages and menu actions associated with a facet. The Faceted Project +Framework provides a way to do that via a property tester that can be used in +any extension point that supports the Eclipse Platform's common expression +language.</p> + +<p> + <b>Property Name:</b> <code>org.eclipse.wst.common.project.facet.core.projectFacet</code><br/> + <b>Property Value:</b> <code>[facet.id](:[version.expr])?</code> +</p> + +<p>As you can see from the format of the property value, you can either test +using just the project facet id or you can also include a version expression if +only certain versions should be matched.</p> + +<p>The following two examples demonstrate how the facets property tester can be +used. To explore further, you can also download the +<a href="downloads/enablement-example.zip">complete runnable source</a> of these +examples.</p> + +<p><b>Example 1</b></p> + +<p>Enables a project properties page based on the presence of a facet. Note the +use of the <code>forcePluginActivation</code> attribute. This attribute makes +sure that the property tester will be invoked even if the Faceted Project +Framework plugins have not been activated yet. Omitting this attribute will cause +the test expression to return false in that situation. Also note the use of the +<code>adapt</code> operator to adapt the object to <code>IProject</code>. This +is necessary as some views may represent project entities using other types. For +instance, in the JDT's Package Explorer the projects are instances of +<code>org.eclipse.jdt.core.IJavaProject</code>.</p> + +<div class="code"> +<pre class="code-xml"><extension point="<span class="code-text">org.eclipse.ui.propertyPages</span>"> + <page + id="<span class="code-text">ExampleFacetPropertiesPage</span>" + objectClass="<span class="code-text">org.eclipse.core.resources.IProject</span>" + adaptable="<span class="code-text">true</span>" + name="<span class="code-text">Example Facet Properties</span>" + class="<span class="code-text">org.eclipse.wst.project.facet.examples.enablement.ExampleFacetPropertiesPage</span>"> + <enabledWhen> + <adapt type="<span class="code-text">org.eclipse.core.resources.IProject</span>"> + <test + forcePluginActivation="<span class="code-text">true</span>" + property="<span class="code-text">org.eclipse.wst.common.project.facet.core.projectFacet</span>" + value="<span class="code-text">example.facet1</span>"/> + </adapt> + </enabledWhen> + </page> +</extension></pre> +</div> + +<p><b>Example 2</b></p> + +<p>Enables a menu action if either one of the two facets specified is installed +in a project. Note the use of a version expression to match only certain versions.</p> + +<div class="code"> +<pre class="code-xml"><extension point="<span class="code-text">org.eclipse.ui.popupMenus</span>"> + <objectContribution + id="<span class="code-text">exampleFacetPopup</span>" + objectClass="<span class="code-text">org.eclipse.core.resources.IProject</span>" + adaptable="<span class="code-text">true</span>"> + <action + id="<span class="code-text">exampleFacetPopupAction</span>" + label="<span class="code-text">Example Facet Popup</span>" + class="<span class="code-text">org.eclipse.wst.project.facet.examples.enablement.ExampleFacetPopupAction</span>" + menubarPath="<span class="code-text">additions</span>" + enablesFor="<span class="code-text">+</span>"> + </action> + <enablement> + <adapt type="<span class="code-text">org.eclipse.core.resources.IProject</span>"> + <or> + <test + forcePluginActivation="<span class="code-text">true</span>" + property="<span class="code-text">org.eclipse.wst.common.project.facet.core.projectFacet</span>" + value="<span class="code-text">example.facet1:1.0</span>"/> + <test + forcePluginActivation="<span class="code-text">true</span>" + property="<span class="code-text">org.eclipse.wst.common.project.facet.core.projectFacet</span>" + value="<span class="code-text">example.facet2:[1.1-2.2]</span>"/> + </or> + </adapt> + </enablement> + </objectContribution> +</extension></pre> +</div> + +<br/><br/><br/><br/> + +</body> + +</html> diff --git a/docs/org.eclipse.wst.doc.isv/toc_WST.xml b/docs/org.eclipse.wst.doc.isv/toc_WST.xml index a423239ef..3b9f19210 100644 --- a/docs/org.eclipse.wst.doc.isv/toc_WST.xml +++ b/docs/org.eclipse.wst.doc.isv/toc_WST.xml @@ -25,6 +25,9 @@ <topic label="Tutorial" href="html/facets/tutorial/tutorial.html"> </topic> + <topic label="Enabling UI Elements Based on Project Facets" + href="html/facets/enabling-based-on-facets.html"> + </topic> <topic label="Questions & Answers" href="html/facets/questions.html"> </topic> -- GitLab