/** * There is no official method/extension point for replacing the shared * workbench images. Thus, we access the internal WorkbenchImages class here * and replace some images with our own here. */ private void changeWorkbenchImages() { try { WorkbenchImages.declareImage( IWorkbenchGraphicConstants.IMG_WIZBAN_IMPORT_WIZ, RcpActivator.getImageDescriptor("icons/wizard/import.png"), true); WorkbenchImages.declareImage( IWorkbenchGraphicConstants.IMG_WIZBAN_EXPORT_WIZ, RcpActivator.getImageDescriptor("icons/wizard/export.png"), true); WorkbenchImages.declareImage( ISharedImages.IMG_OBJ_FOLDER, RcpActivator.getImageDescriptor("icons/folder_open.png"), true); } catch (Exception e) { Logger log = LoggerFactory.getLogger(getClass()); log.error("failed to patch workbench images", e); } }
private Image getImage(Object element) { if (element instanceof ItemsListSeparator) { return WorkbenchImages .getImage(IWorkbenchGraphicConstants.IMG_OBJ_SEPARATOR); } return provider.getImage(element); }
@Override public void init(IWorkbench workbench, IStructuredSelection selection) { this.projectTemplateSection.setSelection(selection); String imageName = projectTemplate.getLargeIcon().getId(); setDefaultPageImageDescriptor(WorkbenchImages.getImageDescriptor(imageName)); setWindowTitle("New " + projectTemplate.getName()); }
private void declareImageDescriptors() { /* this code is neccessary at this time because certain eclipse resources have been removed from other places. */ final ImageDescriptor errorImageDescriptor = imageDescriptorFromPlugin(IDEWorkbenchPlugin .IDE_WORKBENCH, "icons/full/obj16/error_tsk.gif"); final ImageDescriptor warningImageDescriptor = imageDescriptorFromPlugin(IDEWorkbenchPlugin .IDE_WORKBENCH, "icons/full/obj16/warn_tsk.gif"); /* final ImageDescriptor infoImageDescriptor = imageDescriptorFromPlugin(IDEWorkbenchPlugin .IDE_WORKBENCH, "icons/full/obj16/info_tsk.gif"); */ final boolean shared = true; WorkbenchImages.declareImage(IDEInternalWorkbenchImages .IMG_OBJS_ERROR_PATH, errorImageDescriptor, shared); WorkbenchImages.declareImage(IDEInternalWorkbenchImages .IMG_OBJS_WARNING_PATH, warningImageDescriptor, shared); /* WorkbenchImages.declareImage(IDEInternalWorkbenchImages .IMG_OBJS_INFO_PATH, infoImageDescriptor, shared); */ }
public IWorkbenchAction create(IWorkbenchWindow window) { if (window == null) { throw new IllegalArgumentException(); } RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_print); action.setToolTipText(WorkbenchMessages.Workbench_printToolTip); window.getPartService().addPartListener(action); action.setActionDefinitionId(getCommandId()); action.setImageDescriptor(WorkbenchImages .getImageDescriptor(ISharedImages.IMG_ETOOL_PRINT_EDIT)); action.setDisabledImageDescriptor(WorkbenchImages .getImageDescriptor(ISharedImages.IMG_ETOOL_PRINT_EDIT_DISABLED)); return action; }
/** * Returns an image descriptor for this file system element */ public ImageDescriptor getImageDescriptor(Object object) { if (isDirectory()) { return WorkbenchImages .getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER); } else { return WorkbenchPlugin.getDefault().getEditorRegistry() .getImageDescriptor(name); //TODO: what are the implications for content types? Should I guess? } }
public HostPagePathLabelProvider() { image = WorkbenchImages.getImage(ISharedImages.IMG_OBJ_FOLDER); }
private void addImage(ProjectTemplateIcon icon, ProjectTemplate template) { if (icon.getUrl() != null && template.getId().equals(icon.getTemplateId())) { ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(icon.getUrl()); WorkbenchImages.declareImage(icon.getId(), imageDescriptor, false); } }
private void removeImage(ProjectTemplateIcon icon, ProjectTemplate template) { if (icon.getUrl() != null && template.getId().equals(icon.getTemplateId())) { WorkbenchImages.getDescriptors().remove(icon.getId()); } }
public void createCollaborationPart(Composite parent) { collaborationGroup = new Group(parent, SWT.NONE); GridLayout gridLayout = new GridLayout(); collaborationGroup.setLayout(gridLayout); gridLayout.numColumns = 2; collaborationGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); collaborationGroup.setText("Collaboration"); Label proposedByLabel = new Label(collaborationGroup, SWT.NONE); proposedByLabel.setText("Proposed by"); Composite proposedAndButton = new Composite(collaborationGroup, SWT.NONE); GridLayout gridLayout2 = new GridLayout(); proposedAndButton.setLayout(gridLayout2); gridLayout2.numColumns = 2; proposedAndButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); proposedByText = new Text(proposedAndButton, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY); proposedByText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); proposedByText.setText(""); saveButton = new Button(proposedAndButton, SWT.BORDER | SWT.PUSH); saveButton.setText(""); saveButton.setImage(WorkbenchImages.getImage(ISharedImages.IMG_ETOOL_SAVE_EDIT)); Label rationaleLabel = new Label(collaborationGroup, SWT.NONE); rationaleLabel.setText("Rationale"); rationaleText = new Text(collaborationGroup, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI | SWT.WRAP); rationaleText.setText(""); rationaleText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Label votesAgreeLabel = new Label(collaborationGroup, SWT.NONE); votesAgreeLabel.setText("Votes Agree:"); votesAgreeText = new Text(collaborationGroup, SWT.BORDER | SWT.READ_ONLY); GridData gridData1 = new GridData(); gridData1.horizontalAlignment = SWT.FILL; votesAgreeText.setLayoutData(gridData1); Label votesDisagreeLabel = new Label(collaborationGroup, SWT.NONE); votesDisagreeLabel.setText("Votes Disagree"); votesDisagreeText = new Text(collaborationGroup, SWT.BORDER | SWT.READ_ONLY); votesDisagreeText.setLayoutData(gridData1); parent.layout(true); }
public SynsAction() { ImageDescriptor imageDesc = WorkbenchImages .getImageDescriptor(IWorkbenchGraphicConstants.IMG_DTOOL_NEW_FASTVIEW); setHoverImageDescriptor(imageDesc); this.setToolTipText("同步"); }
public BooksAction() { ImageDescriptor imageDesc = WorkbenchImages .getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_EXPORT_WIZ); setHoverImageDescriptor(imageDesc); this.setToolTipText("笔记本"); }
@Override public ImageDescriptor getImageDescriptor() { return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER); }
@Override public ImageDescriptor getImageDescriptor(final Object object) { return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER); }