Inside my eclipse plugin I want to create this button in 开发者_如何学Ca composite:

Where do I get the icon? How do I create that button?
Here's the solution I found by digging a little deeper...
Create an IAction:
private class RemoveCurrentGraphAction extends Action {
    @Override
    public void run() {
        updateWith(new ModuleGraph());
    }
    public RemoveCurrentGraphAction() {
        setToolTipText("Reset to empty graph");
    }
    @Override
    public int getStyle() {
        return IAction.AS_PUSH_BUTTON;
    }
    @Override
    public ImageDescriptor getImageDescriptor() {
        return PlatformUI.getWorkbench().getSharedImages()
                .getImageDescriptor(org.eclipse.ui.ISharedImages.IMG_ELCL_REMOVE);
    }
}
Then when creating the view, add the action to the toolbar:
IActionBars bars = getViewSite().getActionBars();
bars.getToolBarManager().add(new RemoveCurrentGraphAction());
Just import the plugin org.eclipse.ui (Import -> Plug-ins and Fragments) and search the icon. I found an icon very similar (eclipse 4.2) located at icons/full/dlcl16/progress_rem.gif
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论