Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » CoreException when using property tester to hide action in popup menu
CoreException when using property tester to hide action in popup menu [message #327415] Fri, 18 April 2008 06:53 Go to next message
leo escorido is currently offline leo escoridoFriend
Messages: 5
Registered: July 2009
Junior Member
In my plugin.xml, i used objectContribution/enablement/test to make an
action of a popup menu visible if the selection is a Project and contains
certain file.

Created a property tester that checks if it contains the file.



plugin.xml

<extension point="org...popupMenus">
<objectContribution
adaptable="true"
objectClass="org.eclipse.core.resources.IProject"


<enablement>
<test property="x.y.z.hasFile" />
</enablement>

<action...

</extension>

<extension point="org...propertyTesters" >
<propertyTester id="x.y.z.MyTester"
type="org.eclipse.core.resources.IProject"
namespace="x.y.z"
properties="hasFile"
class="x.y.z.MyTester"
</propertyTester>
</extension>


MyTester.java

public boolean test(...) {
// do something and return boolean
}


However, I got CoreException "No property tester contributes a property
hasFile to type class org.eclipse.core.internal.resources.Project"
What's wrong with what I did?

My guess is in my plugin.xml, I defined IProject type. But as you can see
in the exception "...No property tester... to type class org...Project"

I've been searching a lot of related threads here but none seems to be the
same as what I have encountered..


Any help will be appreciated, thanks.
Re: CoreException when using property tester to hide action in popup menu [message #327429 is a reply to message #327415] Fri, 18 April 2008 14:32 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Leo E wrote:
>
> plugin.xml
>
> <extension point="org...popupMenus">
> <objectContribution
> adaptable="true"
> objectClass="org.eclipse.core.resources.IProject"
>
> <enablement>
> <test property="x.y.z.hasFile" />
> </enablement>
>
> <action...
>
> </extension>
>
> <extension point="org...propertyTesters" >
> <propertyTester id="x.y.z.MyTester"
> type="org.eclipse.core.resources.IProject"
> namespace="x.y.z"
> properties="hasFile"
> class="x.y.z.MyTester"
> </propertyTester>
> </extension>
>
> However, I got CoreException "No property tester contributes a property
> hasFile to type class org.eclipse.core.internal.resources.Project"
> What's wrong with what I did?

Your XML certainly looks correct. Are there any errors/warnings
associated with the type="..." line in your plugin.xml from the PDE
builder? Does your plugin depend on org.eclipse.core.expressions
(probably) and org.eclipse.core.resources?

When you run, are there any other exceptions in your log?

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: CoreException when using property tester to hide action in popup menu [message #327455 is a reply to message #327429] Mon, 21 April 2008 07:21 Go to previous messageGo to next message
leo escorido is currently offline leo escoridoFriend
Messages: 5
Registered: July 2009
Junior Member
Hi Paul,

Regarding your questions,

1. Are there any warnings/errors associated with the type="..."
- Nope,

2. Yes it depends on core.expressions and core.resources

3. When I right-clicked a project in the Package Explorer, the exception
occurs and is displayed in the Error log. No other exception besides this
happens performing the action.

org.eclipse.core.runtime.CoreException: No property tester contributes a
property hasPOM to type class org.eclipse.core.internal.resources.Project
at
org.eclipse.core.internal.expressions.TypeExtensionManager.g etProperty(TypeExtensionManager.java:109)
at
org.eclipse.core.internal.expressions.TestExpression.evaluat e(TestExpression.java:95)
at ....

Thanks for taking a look at this problem
Re: CoreException when using property tester to hide action in popup menu [message #327461 is a reply to message #327455] Mon, 21 April 2008 16:59 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Leo E wrote:
>
> 3. When I right-clicked a project in the Package Explorer, the exception
> occurs and is displayed in the Error log. No other exception besides
> this happens performing the action.
>
> org.eclipse.core.runtime.CoreException: No property tester contributes a
> property hasPOM to type class org.eclipse.core.internal.resources.Project
> at
> org.eclipse.core.internal.expressions.TypeExtensionManager.g etProperty(TypeExtensionManager.java:109)
>
> at
> org.eclipse.core.internal.expressions.TestExpression.evaluat e(TestExpression.java:95)
>
> at ....

it says hasPOM ... is that just different from your example (hasFile)?

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: CoreException when using property tester to hide action in popup menu [message #327480 is a reply to message #327461] Tue, 22 April 2008 02:06 Go to previous message
leo escorido is currently offline leo escoridoFriend
Messages: 5
Registered: July 2009
Junior Member
Yeah. Sorry about that. The actual code I use is hasPOM. I just used the
hasFile for posting purpose.
Previous Topic:hyperlink detector in the text framework
Next Topic:Update Manager through proxy server failed
Goto Forum:
  


Current Time: Fri Sep 27 04:05:44 GMT 2024

Powered by FUDForum. Page generated in 0.05187 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top