Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » how to refresh non-IResource folder in project explorer view
how to refresh non-IResource folder in project explorer view [message #790294] Sat, 04 February 2012 03:06 Go to next message
John Bodkin is currently offline John BodkinFriend
Messages: 39
Registered: November 2011
Member
I created a content provider that replaces IFolder with MyFolder which extends PlatformObject implements IWorkbenchAdapter. MyFolder holds onto the IFolder it replaces in order to return the IFolder when getAdapter is called. By having MyFolder in the Project Explorer tree I can allow the user to reorder IResources in MyFolder. It also allows my DropAdapter to be invoked instead of Resources navigator content dropAdapter. I have all of this working.

When I finish reordering I get the IFolder from MyFolder and call refreshLocal in order to get the Project Explorer view to update and show the change the user just made. However after calling refreshLocal nothing happens. If I refresh manually (hit F5) in the Project Explorer view the tree is redrawn and the changes are visible.

How do I get the common navigator to refresh MyFolder from the handleDrop method of the CommonDropAdapterAssistant? or is there a way for MyFolder to notify the viewer that it should be refreshed?

[Updated on: Sat, 04 February 2012 04:35]

Report message to a moderator

Re: how to refresh non-IResource folder in project explorer viewe [message #792030 is a reply to message #790294] Mon, 06 February 2012 14:30 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 04.02.2012 04:06, John Mising name wrote:
> I created a content provider that replaces IFolder with MyFolder which
> extends PlatformObject implements IWorkbenchAdapter. MyFolder holds
> onto the IFolder it replaces in order to return the IFolder when
> getAdapter is called. By having MyFolder in the Project Explorer tree
> I can allow the user to reorder IResources in MyFolder. It also allows
> my DropAdapter to be invoked instead of Resources navigator content
> dropAdapter. I have all of this working.
>
> When I finish reordering I get the IFolder from MyFolder and call
> refreshLocal in order to get the Project Explorer view to update and
> show the change the user just made. However after calling refreshLocal
> nothing happens. If I refresh manually (hit F5) in the Project
> Explorer view the tree is redrawn and the changes are visible.
Are you doing the F5 on the same resource for which you call
refreshLocal(...)?

Dani
>
> How do I get the common navigator to refresh MyFolder from the
> handleDrop method of the CommonDropAdapterAssistant?
>
Re: how to refresh non-IResource folder in project explorer viewe [message #792442 is a reply to message #792030] Tue, 07 February 2012 01:54 Go to previous message
John Bodkin is currently offline John BodkinFriend
Messages: 39
Registered: November 2011
Member
I hit F5 when MyFolder is selected. I can also click the "Refresh F5" context menu item on MyFolder because it adapts to IFolder/IResource.

Technically I'm calling refreshLocal on the IFolder which isn't actually in the tree but MyFolder is in the tree.

I ended up implementing my own refresh on MyFolder
IViewReference[] viewRefs = PlatformUI.getWorkbench()
		.getActiveWorkbenchWindow().getActivePage().getViewReferences();
		for (IViewReference viewRef : viewRefs) {
			IWorkbenchPart part;
			if ((part = viewRef.getPart(false)) != null) {
				ISetSelectionTarget target;
				if (part instanceof ISetSelectionTarget) {
					target = (ISetSelectionTarget) part;
				} else {
					target = (ISetSelectionTarget) part
					.getAdapter(ISetSelectionTarget.class);
				}
				if (target != null) {
					IViewPart vPart = viewRef.getView(false);
					if (vPart instanceof CommonNavigator) {
						CommonNavigator comNav = (CommonNavigator) vPart;
						comNav.getCommonViewer().refresh(itemToRefresh);
						comNav.getCommonViewer().expandToLevel(itemToExpand,
								IResource.DEPTH_ONE);
					}
				}
			}
		}

[Updated on: Tue, 07 February 2012 01:59]

Report message to a moderator

Previous Topic:Decorators extension point and expression-based constraints
Next Topic:PropertyDescriptor with Combobox and String values
Goto Forum:
  


Current Time: Fri Apr 26 11:03:45 GMT 2024

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

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

Back to the top