Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Menu visibility control
Menu visibility control [message #641545] Fri, 26 November 2010 01:26 Go to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
Hi

I have Check Box table and toolbar item, i want toolbar item to be enabled only when if user has checked more than once any row ...if he not checked any row toolbar item has to be disabled..

please can one provide "org.eclipse.core.expressions.definitions" fot this implementation or any other way to implements this

Thanks
ashok

[Updated on: Fri, 26 November 2010 01:27]

Report message to a moderator

Re: Menu visibility control [message #641977 is a reply to message #641545] Mon, 29 November 2010 12:36 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

ashok_kumar_rr@yahoo.com wrote:
>
> please can one provide "org.eclipse.core.expressions.definitions" fot
> this implementation or any other way to implements this

You would have to write your own property tester that could check the
state of your model for any checked items.

Then you would need to make sure as items are checked/unchecked, that
the expressions that use the property tester are updated using
org.eclipse.ui.services.IEvaluationService.requestEvaluation (String)

PW


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


Re: Menu visibility control [message #642069 is a reply to message #641545] Mon, 29 November 2010 17:55 Go to previous messageGo to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
Hi,

Do u have any sample code snippet

Thanks
ashok
Re: Menu visibility control [message #642073 is a reply to message #642069] Mon, 29 November 2010 18:12 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

ashok_kumar_rr@yahoo.com wrote:
> Hi,
>
> Do u have any sample code snippet

There are examples contained in the URLs in my signature.

You'll have to put together something, and then post the example if
there is something you can't figure out.

PW

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


Re: Menu visibility control [message #642079 is a reply to message #641545] Mon, 29 November 2010 18:23 Go to previous messageGo to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
Do u have any answer for this query

http://www.eclipse.org/forums/index.php?t=msg&th=201080& amp;start=0&S=ca432efd5b151f11704210f60d044330
Re: Menu visibility control [message #642089 is a reply to message #642079] Mon, 29 November 2010 18:35 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

ashok_kumar_rr@yahoo.com wrote:
> Do u have any answer for this query
> http://www.eclipse.org/forums/index.php?t=msg&th=201080& amp;start=0&S=ca432efd5b151f11704210f60d044330
>

No, and that's an SWT question, not RCP.

Later,
PW



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


Re: Menu visibility control [message #642282 is a reply to message #641545] Tue, 30 November 2010 16:47 Go to previous messageGo to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
Hi

How will i get the tableviwer instance are check row count to property tester class. so that i can enable are disable count i tryed to test the propertytester is invoked only on selection change its not invloked when user check the row check box


simple propert class package com.jobsleaf.audit.ui;

import org.eclipse.core.expressions.PropertyTester;

public class EditPropertyTester extends PropertyTester{

public EditPropertyTester() {
// TODO Auto-generated constructor stub
}

@Override
public boolean test(Object receiver, String property, Object[] args,
Object expectedValue) {
System.out.println("Receiver " + receiver);
System.out.println("property " + property);
System.out.println("args " + args);
System.out.println("expectedValue " + expectedValue);
return false;
}

}


<extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
class="com.jobsleaf.audit.ui.EditPropertyTester"
id="com.jobsleaf.audit.ui.edit.propertyTester"
namespace="com.jobsleaf"
properties="canEnable"
type="java.lang.Object">
</propertyTester>
</extension>



<handler
commandId="com.jobsleaf.audit.ui.handler1">
<activeWhen>
<iterate
ifEmpty="false">
<test
property="com.jobsleaf.canEnable"
value="ashok">
</test>
</iterate>
</activeWhen>
</handler>

Thanks
ashok
Re: Menu visibility control [message #642459 is a reply to message #642282] Wed, 01 December 2010 12:47 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

ashok_kumar_rr@yahoo.com wrote:
> Hi
>
> How will i get the tableviwer instance are check row count to
> property tester class. so that i can enable are disable count i tryed
> to test the propertytester is invoked only on selection change its not
> invloked when user check the row check box

You have to be able to track down your checkboxes from your property
tester yourself. As for only being evaluated on a selection change,
that's what
org.eclipse.ui.services.IEvaluationService.requestEvaluation (String) is
for. You (and your checkboxes) have introduced "state" into the system.
It's your responsibility for keeping it up to date and notifying
anybody that needs to know about it (in this case, but using
requestEvaluation(*)).

PW


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


Re: Menu visibility control [message #642559 is a reply to message #641545] Wed, 01 December 2010 19:07 Go to previous messageGo to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
Hi dude,,,,,


Thanks of ur instant reply


mViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IEvaluationService service (IEvaluationService) PlatformUI.getWorkbench().getService(IEvaluationService.clas s);
service.requestEvaluation("com.jobsleaf.canEnable");
}
});


in selection change of table i am trying to invoke requestEvaluation();

wht should be the type to be defined in plugin.xml

wht happens when i call requestEvaluation()....?
propertttester test method is invoked ? if yes ... for me its not invoking.

now how will i pass the count value to the property tests test()method so that
when no selection is there i can return false else true....

if have ready made example please provide me


service.requestEvaluation("com.jobsleaf.canEnable");

wht shld the parameter for requestevaluation weather i am passeing right paarmeter.


[Updated on: Thu, 02 December 2010 01:17]

Report message to a moderator

Re: Menu visibility control [message #642615 is a reply to message #642559] Thu, 02 December 2010 01:14 Go to previous messageGo to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
s

[Updated on: Thu, 02 December 2010 01:16]

Report message to a moderator

Re: Menu visibility control [message #643176 is a reply to message #641545] Sun, 05 December 2010 18:06 Go to previous messageGo to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
Hi ,

Can any once provide me the solution

Thanks
hoksa
Re: Menu visibility control [message #643312 is a reply to message #642559] Mon, 06 December 2010 13:20 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

ashok_kumar_rr@yahoo.com wrote:
> Hi dude,,,,,
>
> mViewer.addSelectionChangedListener(new ISelectionChangedListener() {
> public void selectionChanged(SelectionChangedEvent event) {
> IEvaluationService service (IEvaluationService)
> PlatformUI.getWorkbench().getService(IEvaluationService.clas s);
> service.requestEvaluation("com.jobsleaf.canEnable");
> }
> });
>
>
> in selection change of table i am trying to invoke requestEvaluation();
>
> wht happens when i call requestEvaluation()....?
> propertttester test method is invoked ? if yes ... for me its not
> invoking.

Show us the property tester definition and where you use it. The
property tester contract is simply that your test(*) method will be
passed the "receiver" object (the default variable from your current
core expression) and any args/values defined in the XML. Then it is up
to you to do something with them.

> now how will i pass the count value to the property tests test()method
> so that when no selection is there i can return false else true....

Have it look up your view from the system, and then you can deal
directly with your own view.

PW



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


Re: Menu visibility control [message #643422 is a reply to message #641545] Mon, 06 December 2010 19:35 Go to previous messageGo to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
Hi,

Still my question remained un answerd how will i pass no of row selected in the table to propertyTestes test method

i have implemented the test program

please download the svn link to c my code and make changes and u can go ahead and commit the code as wellll

SVN url :https://jobsleaf.googlecode.com/svn/trunk/
com.jobsleaf.command.propertytester

password: wQ9dU8BD5Vk6

password can expire any time i am sure abt it.. can u please make the changes to the code and commit to my ssvn...

How to pass No rows checked in the table viewer to the propertytesterclasss.


Thanks
Ashok

[Updated on: Mon, 06 December 2010 19:39]

Report message to a moderator

Re: Menu visibility control [message #643430 is a reply to message #643422] Mon, 06 December 2010 19:58 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

ashok_kumar_rr@yahoo.com wrote:
> How to pass No rows checked in the table viewer to the
> propertytesterclasss.

That's the work you have to do yourself. Given a method "public boolean
test(*)" how can you find your own ViewPart. Your view part would
expose methods that would allow it to be queried.

Worst case:

IWorkbenchPage page =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage();

Then use org.eclipse.ui.IWorkbenchPage.findViewReference(String, String)

Always check the return types of get*() to make sure you can handle all
return values (like null).

PW


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


Re: Menu visibility control [message #643549 is a reply to message #641545] Tue, 07 December 2010 11:14 Go to previous messageGo to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
Hi,,

Thanks for ur quick reply...

i thought i will implemenyt with the help of any selectprovider
are any selection change event.... that was i was excepting.

i dont want to carry view reference to the property tester class..

Thats the reason i was thing how to get the count.

Thanks
Ashok

[Updated on: Tue, 07 December 2010 11:17]

Report message to a moderator

Re: Menu visibility control [message #643616 is a reply to message #641545] Tue, 07 December 2010 16:25 Go to previous messageGo to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
is there anyway tom pass expected value to the propertytester classs,,,,

or

is there any way to sent any arbitary info to property tester class with any kind of service...t
other than selection provider....

or to set Object[] args of property tester classs....

Thanks
ashok
Re: Menu visibility control [message #643752 is a reply to message #643616] Wed, 08 December 2010 07:39 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
On 12/7/2010 17:25, ashok_kumar_rr@yahoo.com wrote:

I strongly suggest to honor the basics of questions in newsgroups:

http://www.catb.org/~esr/faqs/smart-questions.html

> is there anyway tom pass expected value to the propertytester classs,,,,

Yes, please read the (short) documentation of test expression in

http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/reference/api/org/eclipse/core/expressions/ package-summary.html

A similar example can be found in

http://wiki.eclipse.org/Command_Core_Expressions

or here:

http://blog.richclientgui.com/?p=50#test

HTH & Greetings from Bremen
Re: Menu visibility control [message #644002 is a reply to message #641545] Thu, 09 December 2010 01:41 Go to previous messageGo to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
Is it possible to send information at the runtime...
I dont want to pass value in plugin.xml file


Re: Menu visibility control [message #644060 is a reply to message #644002] Thu, 09 December 2010 10:06 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
On 12/9/2010 02:41, ashok_kumar_rr@yahoo.com wrote:
> Is it possible to send information at the runtime...
> I dont want to pass value in plugin.xml file

There would be several options to realize that, but it is clear that
those would not provide the context information via the Object[] args or
via the Object expectedValue parameter since these are deduced from the
extension points which are by definition static information. Of-course
this static information can be easily transformed in dynamic
information, if you consider a given static parameter as the key or
argument of some service or map, that allows to dispatch the argument
into runtime behaviour (e.g. an interface method call).

Some more explicit examples:

- Use your own Java properties (global state, ugly, but possible)
- Retrieve the information from services that exist or that you have
defined. You can always ask the Workbench itself for a service
- Use the adaptable mechanism: Either the tested object implements
IAdaptable or you directly query the adapter manager (IAdapterManager
from Platform.getAdapterManager()) and ask for a "service" that has been
associated to your type. You can use the
org.eclipse.core.runtime.adapters ext. pt to register your own adapter
factories.

Thus, there are numerous solutions. Since we don't know, what exactly
you want, we can only guess here. I strongly recommend to provide useful
information, because otherwise you cannot expect much helpful replies.

HTH & Greetings from Bremen,

- Daniel Krügler
Re: Menu visibility control [message #644906 is a reply to message #641545] Tue, 14 December 2010 17:09 Go to previous message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
Hi ,

https://jobsleaf.googlecode.com/svn/trunk/com.jobsleaf.comma nd.propertytester

i added variable to IEvaluationservice and used the same vbariable in the propertytester class when ever i switch between the vew variable wht i have set in IEvaluationservice is removed.... how to fix this issue...

variable contins the information no of rows checked in the table..

please download the source through svn...
Thanks
Previous Topic:Context menu in a Form Dialog
Next Topic:Remember the scroll bar position in a TextEditor
Goto Forum:
  


Current Time: Thu Apr 18 23:57:42 GMT 2024

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

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

Back to the top