Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Modeling (top-level project) » Enable propertyPage for UML Model
Enable propertyPage for UML Model [message #479747] Wed, 12 August 2009 06:37 Go to next message
John  is currently offline John
Messages: 10
Registered: August 2009
Junior Member
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 #479748 is a reply to message #479747] Wed, 12 August 2009 06:44 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25748
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 #479775 is a reply to message #479748] Wed, 12 August 2009 09:23 Go to previous 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="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;
}
}

[Updated on: Wed, 12 August 2009 10:57]

Report message to a moderator

Re: Enable propertyPage for UML Model [message #617763 is a reply to message #479747] Wed, 12 August 2009 06:44 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25748
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 #617764 is a reply to message #479748] Wed, 12 August 2009 09:23 Go to previous 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;
}
}
Previous Topic:Enable propertyPage for UML Model
Next Topic:Amalgam downloads available
Goto Forum:
  


Current Time: Wed Apr 23 02:57:13 EDT 2014

Powered by FUDForum. Page generated in 0.02035 seconds