Кто-нибудь здесь знает, как удалить тот или иной декоратор с ресурса? Я расширил org.eclipse.ui.decorators
для своего проекта и создал класс, который реализует ILightweightLabelDecorator
. В классе декоратора я проверял, была ли запись проектом, и другой тест перед вызовом decorator.addOverlay()
. Я не реализовал другие функции, такие как removeListener
, isLabelProperty
, dispose
, addListener
, так как в настоящее время я не вижу использования.
Любая идея, ресурсы, комментарии о том, как поступить, очень помогли бы.
Код: функция декоратора
QualifiedName decorator = new QualifiedName("decorator", "value");
if (element instanceof IProject) {
IProject res = (IProject) element;
if (!res.isOpen()) {
return;
}
String val = null;
try {
val = res.getPersistentProperty(decorator);
} catch (CoreException e) {
e.printStackTrace();
}
if (val != null && val.equals(DecoratorState.ACTIVE)) {
decoration.addOverlay(ImageDescriptor.createFromFile(MyDecorator.class,
"/icons/sample.gif"), IDecoration.BOTTOM_RIGHT);
decoration.addSuffix(" [Using Enhancement]");
}
}