Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » dialog java package
dialog java package [message #648952] Sun, 16 January 2011 15:13 Go to next message
No real name is currently offline No real name
Messages: 1
Registered: January 2011
Junior Member
Hello,

I am developing an eclipse plugin and I need a dialog to choose a java package.
My solution so far:
            Display.getDefault().syncExec(new Runnable() {
                public void run() {                   
                    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(shell, new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());
                    dialog.setTitle("Tree Selection");
                    dialog.setMessage("Select the elements from the tree:");
                    dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
                    dialog.open();
                    Object firstResult = dialog.getFirstResult();
                    System.out.println(firstResult);
                    System.out.println(firstResult.getClass().getName());
              });

But I do not like this solution:
1) firstResult is not an IPackageFragement (it is a Folder)
2) no filter (user can also select some files)
3) (most important) instead of java package icons this dialog uses folder icons (because it does not know it should show java packages (and not some folder from hdd))

I am new here and I hope someone has some tips

regards,
flo

edit:
the java package could be in any (java) project

[Updated on: Sun, 16 January 2011 15:44]

Report message to a moderator

Re: dialog java package [message #648988 is a reply to message #648952] Mon, 17 January 2011 05:29 Go to previous message
Prakash G.R. is currently offline Prakash G.R.
Messages: 621
Registered: July 2009
Senior Member
On 16/01/11 8:43 PM, florlp@gmx.net wrote:
> I am developing an eclipse plugin and I need a dialog to choose a java
> package.

> ElementTreeSelectionDialog dialog = new
> ElementTreeSelectionDialog(shell, new WorkbenchLabelProvider(), new
> BaseWorkbenchContentProvider());

You are using the label & content providers from Platform UI, which
doesn't know anything about JDT elements. You should use JDT classes.

See:
http://help.eclipse.org/helios/topic/org.eclipse.jdt.doc.isv /guide/jdt_api_render.htm

http://help.eclipse.org/helios/topic/org.eclipse.jdt.doc.isv /reference/api/org/eclipse/jdt/ui/JavaUI.html#createPackageD ialog (org.eclipse.swt.widgets.Shell,%20org.eclipse.jdt.core.IJava Project,%20int)

--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Previous Topic:Only display one child of under a parent node in treeviewer
Next Topic:No selection in TableViewer on right mouse-click
Goto Forum:
  


Current Time: Wed Oct 01 14:22:48 GMT 2014

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

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