private Image getImage(String subgroupName){ Bundle bundle = Platform.getBundle("hydrograph.ui.propertywindow"); URL fullPathString = null; if(StringUtils.equalsIgnoreCase(subgroupName, "CONFIGURATION")){ fullPathString = BundleUtility.find(bundle, "icons/config.png"); }else if(StringUtils.equalsIgnoreCase(subgroupName, "DISPLAY")){ fullPathString = BundleUtility.find(bundle, "icons/display.png"); }else if(StringUtils.equalsIgnoreCase(subgroupName, "RECORD STRUCTURE DETAILS")){ fullPathString = BundleUtility.find(bundle, "icons/schema.png"); } if(fullPathString!=null){ Image image = ImageDescriptor.createFromURL(fullPathString).createImage(); return image; }else{ return null; } }
public static URL getBundleAbsolutePath(String path) { Bundle bundle = Platform.getBundle(PLUGIN_ID); if (!BundleUtility.isReady(bundle)) { return null; } // look for the image (this will check both the plugin and fragment folders URL fullPathString = BundleUtility.find(bundle, path); if (fullPathString == null) { try { fullPathString = new URL(path); } catch (MalformedURLException e) { return null; } } return fullPathString; }
private void addPluginsTab(TabFolder tabFolder) { TabItem tabItem = new TabItem(tabFolder, SWT.NONE); languageSet.associate(tabItem, Messages.LocalizeDialog_TabTitle_Plugins); AboutBundleData[] bundleInfos; // create a data object for each bundle, remove duplicates, and include only resolved bundles (bug 65548) Map map = new HashMap(); Bundle[] bundles = WorkbenchPlugin.getDefault().getBundles(); for (int i = 0; i < bundles.length; ++i) { AboutBundleData data = new AboutBundleData(bundles[i]); if (BundleUtility.isReady(data.getState()) && !map.containsKey(data.getVersionedId())) { map.put(data.getVersionedId(), data); } } bundleInfos = (AboutBundleData[]) map.values().toArray( new AboutBundleData[0]); Composite c = new Composite(tabFolder, SWT.NONE); tabItem.setControl(c); createPluginsTab(c, bundleInfos); }
@SuppressWarnings("restriction") @Override public void fillContextMenu(IMenuManager menu) { super.fillContextMenu(menu); ActionContributionItem pasteContribution = getPasteContribution(menu.getItems()); menu.remove(pasteContribution); IAction pasteAction = new Action(PASTE_ACTION_TEXT) { @Override public void run() { IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench() .getService(IHandlerService.class); try { JobCopyParticipant.setCopiedFileList(new ArrayList<>()); handlerService.executeCommand(PASTE_COMMAND_ID, null); } catch (Exception exception) { logger.warn("Error while pasting job files :: {}",exception.getMessage()); } } }; pasteAction.setAccelerator(SWT.MOD1 | 'v'); Bundle bundle = Platform.getBundle(MENU_PLUGIN_NAME); URL imagePath = BundleUtility.find(bundle,ImagePathConstant.PASTE_IMAGE_PATH.getValue()); ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(imagePath); pasteAction.setImageDescriptor(imageDescriptor); menu.insertAfter(COPY_ACTION_ID, pasteAction); }
public PinFigure() { if (bimage == null) try { Bundle bundle = Platform.getBundle(JaspersoftStudioPlugin.PLUGIN_ID); if (BundleUtility.isReady(bundle)) bimage = ImageIO.read(BundleUtility.find(bundle, "icons/pin-16.png")); } catch (IOException e) { e.printStackTrace(); } }
public static String getAbsoluteURL(String path) { Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID); if (!BundleUtility.isReady(bundle)) { return null; } String loc = bundle.getLocation(); loc = loc.substring(loc.indexOf("file:"), loc.length()).concat(path); return loc; }
@Override protected void initializeImageRegistry(ImageRegistry reg) { reg.put(OBJ_ACTIVITY, ImageDescriptor .createFromURL(BundleUtility.find(getBundle(), "icons/full/eview/activity_obj.png"))); reg.put(IMG_TOOL_CURRENT, ImageDescriptor .createFromURL(BundleUtility.find(getBundle(), "icons/full/elcl/cur_nav.png"))); }
@Override public void addPages() { Bundle bundle = Platform.getBundle("de.fzi.sensidl.language.ui"); URL fullPathString = BundleUtility.find(bundle, "images/SensIDL_logo.jpg"); sensidlWizardPage = new SensidlWizardPage("SensIDL - Code Generation", "SensIDL - Code Generation", ImageDescriptor.createFromURL(fullPathString), modelPath, path, language, sensidlmodel != null); addPage(sensidlWizardPage); }
public static ImageDescriptor getImageDescriptor(String imageName) { Bundle bundle = Platform.getBundle(PLUGIN_ID); if (!BundleUtility.isReady(bundle)) { return null; } URL fullPathString = BundleUtility.find(bundle, "icons/" + imageName); return ImageDescriptor.createFromURL(fullPathString); }
/** * <p> * Initializes the instance with the current ShapeTreeView * </p> * * @param view * <p> * The current ShapeTreeView * </p> */ public ActionReplicateShape(ShapeTreeView view) { this.view = view; this.setText("Replicate Shape"); // Load replicate.gif icon from the bundle's icons/ directory Bundle bundle = FrameworkUtil.getBundle(getClass()); URL imagePath = BundleUtility.find(bundle, "icons/replicate.gif"); imageDescriptor = ImageDescriptor.createFromURL(imagePath); }
/** * <p> * Constructor for setting the current ShapeTreeViewer * </p> * * @param view * <p> * The current ShapeTreeView * </p> */ public ActionDeleteShape(ShapeTreeView view) { this.view = view; this.setText("Delete Shape"); // Load the delete.gif ImageDescriptor from the bundle's // `icons` directory Bundle bundle = FrameworkUtil.getBundle(getClass()); URL imagePath = BundleUtility.find(bundle, "icons/delete.gif"); imageDescriptor = ImageDescriptor.createFromURL(imagePath); }
/** * * @param view */ public ActionDuplicateShape(ShapeTreeView view) { this.view = view; this.setText("Duplicate Shape"); // Load duplicate.gif icon from the bundle's icons/ directory Bundle bundle = FrameworkUtil.getBundle(getClass()); URL imagePath = BundleUtility.find(bundle, "icons/duplicate.gif"); imageDescriptor = ImageDescriptor.createFromURL(imagePath); }
private ImageDescriptor createImageDescriptor() { Bundle bundle = Platform.getBundle("ch.pharmed.phmprescriber"); //$NON-NLS-1$ URL fullPathString = BundleUtility.find(bundle, "icons/logo_elexis.png"); //$NON-NLS-1$ return ImageDescriptor.createFromURL(fullPathString); }
/** * <p> * Creates a dropdown action with an icon label * </p> * * @param text * <p> * The tooltip text * </p> * @param imageFilename * <p> * The filename of the icon image, relative to the OSGi bundle * location * </p> */ public DropdownAction(String text, String imageFilename) { this(text); // Load the icon image Bundle bundle = FrameworkUtil.getBundle(getClass()); URL imagePath = BundleUtility.find(bundle, imageFilename); imageDescriptor = ImageDescriptor.createFromURL(imagePath); }