Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Displaying a file in tree view
Displaying a file in tree view [message #64188] Sat, 06 June 2009 14:34 Go to next message
Shrijeet is currently offline ShrijeetFriend
Messages: 14
Registered: July 2009
Junior Member
Hi,
I have created a tree view. I want to add files into the parent node using
a pop-up menu. How do I add file using this menu.

private void initialize() {

// Parent initializations

}

private void makeActions() {
action1 = new Action() {
public void run() {
// some code here
// The child to the parents above should be
//added in this action
}
};

However I am not able to call the parent.addChild(child); method in
action1 as the parent is not available in he run() method.

The initialize() is function of ViewContentProvider class and makeAction
is not.
Re: Displaying a file in tree view [message #64373 is a reply to message #64188] Tue, 09 June 2009 14:49 Go to previous message
William R. Swanson is currently offline William R. SwansonFriend
Messages: 10
Registered: July 2009
Junior Member
This isn't really a PDE-build related question; you should ask SWT questions
in the eclipse.platform.swt group.

That said, what I did was add a mouse listener to the tree view, which
detects the mouse-down right-click event and stores the mouse location
somewhere that the action will be able to get it. Then in the action use
that mouse location to look up the parent. Since an action itself doesn't
know who's going to be invoking it (menu item, toolbar button, etc.) it's up
to the invoker to provide context if the action needs it.

--- WRS

"Shrijeet " <shrijeet.polke@gmail.com> wrote in message
news:9cf952713ed3cefcf5aae842e8c41427$1@www.eclipse.org...
> Hi,
> I have created a tree view. I want to add files into the parent node using
> a pop-up menu. How do I add file using this menu.
>
> private void initialize() {
>
> // Parent initializations
> }
>
> private void makeActions() {
> action1 = new Action() {
> public void run() {
> // some code here // The child to the parents above should be
> //added in this action
> }
> };
>
> However I am not able to call the parent.addChild(child); method in
> action1 as the parent is not available in he run() method.
>
> The initialize() is function of ViewContentProvider class and makeAction
> is not.
>
Re: Displaying a file in tree view [message #598172 is a reply to message #64188] Tue, 09 June 2009 14:49 Go to previous message
William R. Swanson is currently offline William R. SwansonFriend
Messages: 10
Registered: July 2009
Junior Member
This isn't really a PDE-build related question; you should ask SWT questions
in the eclipse.platform.swt group.

That said, what I did was add a mouse listener to the tree view, which
detects the mouse-down right-click event and stores the mouse location
somewhere that the action will be able to get it. Then in the action use
that mouse location to look up the parent. Since an action itself doesn't
know who's going to be invoking it (menu item, toolbar button, etc.) it's up
to the invoker to provide context if the action needs it.

--- WRS

"Shrijeet " <shrijeet.polke@gmail.com> wrote in message
news:9cf952713ed3cefcf5aae842e8c41427$1@www.eclipse.org...
> Hi,
> I have created a tree view. I want to add files into the parent node using
> a pop-up menu. How do I add file using this menu.
>
> private void initialize() {
>
> // Parent initializations
> }
>
> private void makeActions() {
> action1 = new Action() {
> public void run() {
> // some code here // The child to the parents above should be
> //added in this action
> }
> };
>
> However I am not able to call the parent.addChild(child); method in
> action1 as the parent is not available in he run() method.
>
> The initialize() is function of ViewContentProvider class and makeAction
> is not.
>
Previous Topic:Headless build problem with re-exported packages.
Next Topic:Best Practices for debugging Extension Points
Goto Forum:
  


Current Time: Wed Jul 17 01:37:55 GMT 2024

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

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

Back to the top