Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » projectNatureImages and project refresh
projectNatureImages and project refresh [message #912858] Fri, 14 September 2012 09:42 Go to next message
Thorsten Schemm is currently offline Thorsten SchemmFriend
Messages: 2
Registered: September 2012
Junior Member
Hi,
I managed to add and remove a context menu entry that adds my custom nature to an existing java project. It works via the 'Configure' submenu within the context menu. A custom icon overlay is added using the org.eclipse.ui.ide.projectNatureImages extension point. The problem is that the icon is not visible right away. After adding the nature the user has to manually refresh the project from the context menu, or restart eclipse. The same when the nature is removed.
How can I handle this automatically?
Best regards,
Thorsten.
Re: projectNatureImages and project refresh [message #913042 is a reply to message #912858] Fri, 14 September 2012 16:44 Go to previous messageGo to next message
Curtis Windatt is currently offline Curtis WindattFriend
Messages: 166
Registered: July 2009
Senior Member
The PDE forum is probably not the most helpful place to post this.

Did you try calling refreshLocal on the IProject?

http://wiki.eclipse.org/FAQ_When_should_I_use_refreshLocal%3F
Re: projectNatureImages and project refresh [message #915042 is a reply to message #913042] Sun, 16 September 2012 08:52 Go to previous message
Thorsten Schemm is currently offline Thorsten SchemmFriend
Messages: 2
Registered: September 2012
Junior Member
Thanks for your response. I guess I got lost in the myriad of subforums.

I already tried the suggested refreshLocal, but it did not have the desired effect. Neither did project.touch() or a refresh of the workspace. But the following method did the trick:

private void updatePackageExplorer() {
                final IViewPart foundView = PlatformUI.getWorkbench()
                                .getActiveWorkbenchWindow().getActivePage()
                                .findView(JavaUI.ID_PACKAGES);

                if (foundView instanceof IPackagesViewPart) {
                        final IPackagesViewPart packageExplorerView = (IPackagesViewPart) foundView;
                        final TreeViewer treeViewer = packageExplorerView.getTreeViewer();
                        treeViewer.refresh();
                }

        }


Here is the origin of this snippet:
code.google.com/p/quick-matcher/source/browse/quick-matcher/org.javaadam.quickmatcher.jdt/src/org/javaadam/quickmatcher/jdt/internal/ToolbarControlContribution.java?spec=svn755d20198b970d4553007be3e56c92b0f058bd43&r=755d20198b970d4553007be3e56c92b0f058bd43
Previous Topic:Code manipulation
Next Topic:Including JRE in Eclipse RCP product (cross-platform build)
Goto Forum:
  


Current Time: Tue Apr 16 04:36:07 GMT 2024

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

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

Back to the top