public void dispose()
{
}
};
final ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
final ILabelProvider labelProvider = new ILabelProvider()
{
private Image errorImage;
private Image warningImage;
public String getText( final Object element )
{
return ( (Status) element ).message();
}
public Image getImage( final Object element )
{
if( ( (Status) element ).severity() == Status.Severity.ERROR )
{
return getErrorImage();
}
else
{
return getWarningImage();
}
}
private Image getErrorImage()
{
if( this.errorImage == null )
{
this.errorImage = SwtUtil.createImageDescriptor( SwtResourceCache.class, "Error.png" ).createImage();
}
return this.errorImage;
}
private Image getWarningImage()
{
if( this.warningImage == null )
{
this.warningImage = SwtUtil.createImageDescriptor( SwtResourceCache.class, "Warning.png" ).createImage();
}
return this.warningImage;
}
public void addListener( final ILabelProviderListener listener )
{
}
public void removeListener( final ILabelProviderListener listener )
{
}
public boolean isLabelProperty( final Object element,
final String property )
{
return false;
}
public void dispose()
{
if( this.errorImage != null )
{
this.errorImage.dispose();
}
if( this.warningImage != null )
{
this.warningImage.dispose();
}
}
};
this.treeViewer.setContentProvider( contentProvider );
this.treeViewer.setLabelProvider( labelProvider );
this.treeViewer.setInput( this );
final Menu menu = new Menu( this.tree );
this.tree.setMenu( menu );
final MenuItem copyMenuItem = new MenuItem( menu, SWT.PUSH );
copyMenuItem.setText( copyMenuItemLabel.text() );
copyMenuItem.setImage( sharedImages.getImage( ISharedImages.IMG_TOOL_COPY ) );
copyMenuItem.addSelectionListener
(
new SelectionAdapter()
{