Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » DELEGATE DoubleClick to my class(DELEGATE DoubleClick to my class)
DELEGATE DoubleClick to my class [message #715134] Fri, 12 August 2011 13:38 Go to next message
slayer  is currently offline slayer Friend
Messages: 4
Registered: August 2011
Junior Member
Hi,
I am using Nessi2, an RCP application. It is much like eclipse, projects etc. I want to change the double click listener when it is clicked from the resource navigator in the left side of the application. In this navigator, there are my projects, and for example when one clicks a text file, i want to open an editor with an image embedded in it. But i could not find my way to handle this. is there a way to delegate this open command to my function/class?
Thanks in advance.
Re: DELEGATE DoubleClick to my class [message #715196 is a reply to message #715134] Fri, 12 August 2011 17:11 Go to previous messageGo to next message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
Are you using the ResourceNavigator or CommonNavigator?

Re: DELEGATE DoubleClick to my class [message #715310 is a reply to message #715196] Sat, 13 August 2011 08:42 Go to previous messageGo to next message
slayer  is currently offline slayer Friend
Messages: 4
Registered: August 2011
Junior Member
Nessi2 is using CommonNavigator, i dont have direct access to this CommonNavigator instance. when i am creating a new view, i am parsing IViewPart instances and find CommonNavigator. At this time, i can attach a doubleclick listener to the CommonNavigator, but it still runs its former action listeners(opening respective editors etc) and my listener too. Can i remove already registered listeners and register mine? and can i do this at the start of the RCP application, not in the creation of a view? I am new to RCP programming, sorry for the misleading statements.

Here is the code i used for registration of doubleclick listener:
IViewPart [] parts = this.getSite().getWorkbenchWindow().getActivePage().getViews();
for(int i=0;i<parts.length;i++)
{
if(parts[i] instanceof CommonNavigator)
{
CommonNavigator navigator = (CommonNavigator)parts[i];
StructuredSelection sel =
(StructuredSelection)navigator.getCommonViewer().getSelection();
IResource resource = (IResource)sel.getFirstElement();
activeProject = resource.getProject();

navigator.getCommonViewer().addDoubleClickListener(new IDoubleClickListener() {

@Override
public void doubleClick(DoubleClickEvent event) {
System.out.println("DoubleClickEvent");

}
});
break;
}
}

Re: DELEGATE DoubleClick to my class [message #715764 is a reply to message #715310] Mon, 15 August 2011 12:51 Go to previous messageGo to next message
slayer  is currently offline slayer Friend
Messages: 4
Registered: August 2011
Junior Member
hi,
does anybody have a opinion about the topic?
thanks in advance.
Re: DELEGATE DoubleClick to my class [message #715815 is a reply to message #715764] Mon, 15 August 2011 15:58 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3801
Registered: July 2009
Senior Member
On 15.08.2011 14:51, slayer wrote:
> hi,
> does anybody have a opinion about the topic?
Did you try to register your editor for the files you want to open?

Dani
> thanks in advance.
>
Re: DELEGATE DoubleClick to my class [message #715986 is a reply to message #715815] Tue, 16 August 2011 07:08 Go to previous messageGo to next message
slayer  is currently offline slayer Friend
Messages: 4
Registered: August 2011
Junior Member
no, how can i achieve that?
Re: DELEGATE DoubleClick to my class [message #716383 is a reply to message #715986] Wed, 17 August 2011 08:09 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3801
Registered: July 2009
Senior Member
On 16.08.2011 09:08, slayer wrote:
> no, how can i achieve that?
Take a look at the 'org.eclipse.ui.editors' extension point.

Dani
Previous Topic:custom decorator (lightweight or not) overwrites marker in project tree
Next Topic:Using the view/perspective concept separately
Goto Forum:
  


Current Time: Fri Nov 28 17:17:43 GMT 2014

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

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