Skip to main content



      Home
Home » Eclipse Projects » JFace » dialog java package
dialog java package [message #648952] Sun, 16 January 2011 10:13 Go to next message
Eclipse UserFriend
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 10:44] by Moderator

Re: dialog java package [message #648988 is a reply to message #648952] Mon, 17 January 2011 00:29 Go to previous message
Eclipse UserFriend
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:[databinding] custom validators
Next Topic:[Databinding] TableViewer (rows vs columns)
Goto Forum:
  


Current Time: Tue Jul 22 20:51:18 EDT 2025

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

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

Back to the top