Export to GitHub

codeandme - issue #3

Updating after chaning filter definitions (not a bug)


Posted on Mar 5, 2013 by Swift Bear

I think this is not a bug. Its just, whenever I change my definitions the package explorer isn't updated properly, rather I have to deselect the "Resource Decorator" entry from the "Available label decorations"-list @ General->Appearance->Label Decorations, press Apply, and re-select it and press apply (or ok) again.

I think, this is still an known issue even in E4. For previous eclipse versions I found a work-around for this, which implies a manual "fire"-Event and a caching of the decorated elements.

I call the following refresh method whenever the performApply of the PreferencePage is invoked.

The decorator (which is the ILabelDecorator) contains a list of successful decorated elements. Yes, I had to cache all the elements. :-/

public static void refresh() { final UNummerDecorator decorator = getUNummerDecorator(); if (decorator == null) { return; } else { // Fire a label provider changed event to decorate the resources // whose labels needs to be updated decorator.fireLabelEvent(new LabelProviderChangedEvent(decorator, // decorator.successfulDeocoratedResources.getResources().toArray())); } }

private void fireLabelEvent(final LabelProviderChangedEvent event) { // We need to get the thread of execution to fire the label provider // changed event , else WSWB complains of thread exception. Display.getDefault().asyncExec(new Runnable() {

  @Override
  public void run() {
    fireLabelProviderChanged(event);
  }
});

}

Comment #1

Posted on Mar 6, 2013 by Grumpy Dog

I was experiencing your problems and was wondering where they come from. What I currently do is trigger an update of tree elements, but this does not work reliably. I still see the same issue when creating new decorators: not all of them get applied correctly.

Thanks for the code, I'll give it a try.

What helps right now is refreshing the workspace or collapsing/expanding stuff, so the decorator gets applied correctly.

Comment #2

Posted on Mar 7, 2013 by Grumpy Dog

fixed in v1.0.1

I should have read the decorators tutorial more thoroughly: http://www.eclipse.org/articles/Article-Decorators/decorators.html

Status: Fixed

Labels:
Type-Defect Priority-Medium