private void createRemoveMenuItem() { MenuItem removeItem = new MenuItem(popupMenu, SWT.PUSH); removeItem.setText("Delete"); ImageDescriptor descriptor = ImageDescriptor.createFromURL( Plugin.getDefault().getBundle().getEntry(getDeleteImagePath())); removeItem.setImage(SharedImages.INSTANCE.getImage(descriptor)); removeItem.setEnabled(hasSelection()); removeItem.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { removeSelectedObject(); } }); }
private void createAddEsbNotifierMenuItem(Menu menu) { MenuItem addEsbNotifierMenuItem = new MenuItem(menu, SWT.PUSH); addEsbNotifierMenuItem.setText("New ESB Notifier"); ImageDescriptor enabledDescriptor = ImageDescriptor.createFromURL( Plugin.getDefault().getBundle().getEntry("/icons/full/obj16/esb_enabled.gif")); addEsbNotifierMenuItem.setImage(SharedImages.INSTANCE.getImage(enabledDescriptor)); addEsbNotifierMenuItem.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { addNewActionElement(ESB_NOTIFIER_ID); if (((MenuItem) e.widget).getParent() != popupMenu) { elementToCreate = ESB_NOTIFIER_ID; setEsbNotifierInfo(addActionElementToolbarContributionItem.getAction()); } } }); }