Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Re: Enable propertyPage for UML Model
Re: Enable propertyPage for UML Model [message #479746] Wed, 12 August 2009 06:44 Go to next message
Ed Merks is currently offline Ed Merks
Messages: 25918
Registered: July 2009
Senior Member
John,

This seems to be a general Eclipse UI extension questions that I know
nothing about. maybe someone on the platform newsgroup would have some
ideas, so I've added it to the "to" list of this reply.


John wrote:
> Hi,
> Using RSA v7.5.2 and am having trouble contributing a propertypage for
> an open UML model.
> Tried com.ibm.xtools.uml.navigator.ModelServerElement in the
> objectClass(see example below).
> This works fine but also presents the propertpage for any element
> selected within the model.
>
> Also tried *.emx in the nameFilter but the page is only presented when
> the unopened model is selected!
>
> Have also tried <filter name="umlType" value="Model"/> to no avail.
>
> Have also tried <enabledWhen>
> <adapt type="org.eclipse.uml2.uml.Model"></adapt>
> </enabledWhen>
>
> Would be grateful for any help.
>
> <extension point="org.eclipse.ui.propertyPages">
> <page class="mYPropertyPage" id="mYPropertyPage" name="mYPropertyPage"
> objectClass="com.ibm.xtools.uml.navigator.ModelServerElement "/>
> </extension>
>
Re: Enable propertyPage for UML Model [message #479774 is a reply to message #479746] Wed, 12 August 2009 09:23 Go to previous messageGo to next message
John  is currently offline John
Messages: 10
Registered: August 2009
Junior Member
Managed to get this working by using the propertyTester extension.

This seems to be a long way to do this and possibly even the wrong way -
but it works!

<extension point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
class="myClass.ModelPropertyTester"
id="myID.propertyTester"
namespace="myNameSpace.properties"
properties="isModel"
type="java.lang.Object">
</propertyTester>
</extension>

<extension point="org.eclipse.ui.propertyPages">
...
<enabledWhen>
<test
forcePluginActivation="true"
property="myNameSpace.isModel"
value="true">
</test>
</enabledWhen>
...
</extension>


code in "myClass.ModelPropertyTester"
public class ModelPropertyTester extends PropertyTester {

public boolean test(Object receiver,
String property,
Object[] args,
Object expectedValue) {

boolean result = false;

if (property.equalsIgnoreCase("isModel")){

if(receiver instanceof ModelServerElement){

ModelServerElement modelServerElement =
(ModelServerElement)receiver;

if (modelServerElement.getElement() instanceof Model) {
result = true;
}

}

}

return result;
}
}
Re: Enable propertyPage for UML Model [message #479781 is a reply to message #479774] Wed, 12 August 2009 09:46 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

I'm not sure why it works, but it doesn't look like it should. You define:
namespace="myNameSpace.properties"
properties="isModel"

and then use it as:
property="myNameSpace.isModel"

except your property tester is myNameSpace.properties.isModel

PW


Re: Enable propertyPage for UML Model [message #480766 is a reply to message #479781] Tue, 18 August 2009 08:43 Go to previous message
John  is currently offline John
Messages: 10
Registered: August 2009
Junior Member
Paul,
Apologies for that mistake and the delay in responding.

The line
namespace="myNameSpace.properties"

should be
namespace="myNameSpace"
Previous Topic:3.6 I-Build update site not working
Next Topic:How To Hide Resources From The Package Explorer After Creating Them
Goto Forum:
  


Current Time: Thu Jul 24 19:03:14 EDT 2014

Powered by FUDForum. Page generated in 0.03121 seconds