Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Change folder icon
Change folder icon [message #1019417] Fri, 15 March 2013 16:25 Go to next message
Mr Manner is currently offline Mr MannerFriend
Messages: 26
Registered: January 2013
Junior Member
Hi,

I am developing an eclipse plugin where you can mark an IFolder with some meta data and this meta data is used to validate the content of that fodler. This meta data is stored in a model somewhere, and you can change the type of the folder with a Command that is set on popup:org.eclipse.ui.navigator.ProjectExplorer#PopupMenu.

An example of the Project Explorere:

+ MyProject
  + FolderType1 (should have a type1 icon)
    - file1.json
    - file2.json
  + FolderType2 (should have a type2 icon)
    - file1.json
    - file2.json


There needs to be an special icon for the folder to inform the user that this folder uses a special validation step. How can I change the folder icon in my AbstractHandler.execute method?

	  @Override
	  public Object execute(ExecutionEvent event) throws ExecutionException {
		 // Get workbench window
		 IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
		 // Set selection service
		 ISelectionService service = window.getSelectionService();
		 // Set structured selection
		 IStructuredSelection structured = (IStructuredSelection) service.getSelection();
		 Object first = structured.getFirstElement();
		 if (first instanceof IFolder) {
			 IFolder folder = (IFolder) first;
			 
                        // Change icon ...
		 }
		 return null;
	  }


Addionaly I want to know what the best place is to store this meta data persistently (.settings file?) and what api to use?
Re: Change folder icon [message #1019858 is a reply to message #1019417] Sat, 16 March 2013 22:07 Go to previous messageGo to next message
Mr Manner is currently offline Mr MannerFriend
Messages: 26
Registered: January 2013
Junior Member
To pre-empt the suggestion that I should create a custom project instead of one project with multiple folders, I played with the idea but that does not fit the way my plugin is going to be used.
Re: Change folder icon [message #1020755 is a reply to message #1019417] Mon, 18 March 2013 21:33 Go to previous messageGo to next message
Mr Manner is currently offline Mr MannerFriend
Messages: 26
Registered: January 2013
Junior Member
Is there an other place where I should post this question?
Re: Change folder icon [message #1021101 is a reply to message #1020755] Tue, 19 March 2013 14:16 Go to previous message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
I've never used them, but I think you are looking for the Decorators feature. From the Platform Plugin Developers Guide:
Quote:
Your plug-in can use decorators to annotate the images for resources and other objects that appear in the workbench views. Decorators are useful when your plug-in adds functionality for existing resource types. Many of the standard workbench views participate in showing decorations.

For example, PDE contributes decorators that allow you to distinguish between binary and source projects.


Decorators are discussed in the Advanced Workbench concepts section of the guide.
Previous Topic:How to include specific platform plugin in update site
Next Topic:How execute actions after content assist selection
Goto Forum:
  


Current Time: Thu Apr 25 20:43:53 GMT 2024

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

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

Back to the top