2012-04-03 57 views
1

有沒有人知道如何去除資源上的特定裝飾器?我將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]"); 

     } 
    } 

回答

1

對於誰是具有相同問題的人,它可以固定LabelProviderChangedEvent

相關問題