/** * Create an instance of EntityEditorPageSettings for an extension point entry. * * @param cfg The extension point config element. */ public EntityEditorPageSettings(IExtension extension, IConfigurationElement cfg) throws EPProcessorException { try { this.pageFactory = (IEntityEditorPageFactory) cfg.createExecutableExtension("class"); // $NON-NLS-1$ } catch (Exception e) { throw new EPProcessorException( "The class attribute was not valid ", extension, e); // $NON-NLS-1$ } // this.pageClass = cfg.getAttribute("class"); this.editorID = cfg.getAttribute("editorID"); // $NON-NLS-1$ if (editorID == null || "".equals(editorID)) // $NON-NLS-1$ throw new EPProcessorException("The editorID is not defined.", extension); // $NON-NLS-1$ String indexHintStr = cfg.getAttribute("indexHint"); // $NON-NLS-1$ if (indexHintStr != null) try { this.indexHint = Integer.parseInt(indexHintStr); } catch (Exception e) { this.indexHint = Integer.MAX_VALUE / 2; } else this.indexHint = Integer.MAX_VALUE / 2; String smallIconPath = cfg.getAttribute("icon16x16"); // $NON-NLS-1$ if (smallIconPath != null) { this.smallIconDesc = AbstractUIPlugin.imageDescriptorFromPlugin(cfg.getNamespaceIdentifier(), smallIconPath); } String iconPath = cfg.getAttribute("icon48x48"); // $NON-NLS-1$ if (iconPath != null) { this.iconDesc = AbstractUIPlugin.imageDescriptorFromPlugin(cfg.getNamespaceIdentifier(), iconPath); } this.description = cfg.getAttribute("description"); // $NON-NLS-1$ }
public static Image getImage(AbstractUIPlugin plugin, String path) { ImageRegistry registry = plugin.getImageRegistry(); Image image = registry.get(path); if (image == null) { ImageDescriptor id = getImageDescriptor(plugin.getBundle().getSymbolicName(), path); if (id == null) { return null; } registry.put(path, id); image = registry.get(path); } return image; }
/** Get image descriptors for the clear button. */ static { ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin( PlatformUI.PLUGIN_ID, "$nl$/icons/full/etool16/clear_co.gif"); // $NON-NLS-1$ if (descriptor != null) { JFaceResources.getImageRegistry().put(CLEAR_ICON, descriptor); } descriptor = AbstractUIPlugin.imageDescriptorFromPlugin( PlatformUI.PLUGIN_ID, "$nl$/icons/full/dtool16/clear_co.gif"); // $NON-NLS-1$ if (descriptor != null) { JFaceResources.getImageRegistry().put(DCLEAR_ICON, descriptor); } }
void createActions() { collapseAllAction = new Action() { @Override public void run() { viewer.collapseAll(); } }; collapseAllAction.setText("Collapse All"); collapseAllAction.setToolTipText("Collapse All"); collapseAllAction.setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin(Plugin.PLUGIN_ID, "/icons/collapseall.gif")); refreshAction = new Action() { @Override public void run() { doRefresh(); } }; refreshAction.setText("Refresh"); refreshAction.setToolTipText("Refresh Repositories Tree"); refreshAction.setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin(Plugin.PLUGIN_ID, "/icons/arrow_refresh.png")); addBundlesAction = new Action() { @Override public void run() { IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); Object element = selection.getFirstElement(); if (element != null && element instanceof RepositoryPlugin) { RepositoryPlugin repo = (RepositoryPlugin) element; if (repo.canWrite()) { AddFilesToRepositoryWizard wizard = new AddFilesToRepositoryWizard(repo, new File[0]); WizardDialog dialog = new WizardDialog(getViewSite().getShell(), wizard); dialog.open(); viewer.refresh(repo); } } } }; addBundlesAction.setEnabled(false); addBundlesAction.setText("Add"); addBundlesAction.setToolTipText("Add Bundles to Repository"); addBundlesAction.setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin(Plugin.PLUGIN_ID, "/icons/brick_add.png")); }
/* * (non-Javadoc) * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) */ public void start(BundleContext context) throws Exception { super.start(context); getPreferenceStore().setDefault(USERNAME, DEFAULT_USERNAME); getPreferenceStore().setDefault(PASSWORD, DEFAULT_PASSWORD); getPreferenceStore().setDefault(TAG_FILTER, DEFAULT_TAG_FILTER); getPreferenceStore().setDefault(URL_FILTER, DEFAULT_URL_FILTER); }
/** * This method is called upon plug-in activation * * @param context The context * @throws Exception if a problem occurs */ @Override public void start(final BundleContext context) throws Exception { ErlLogger.debug("Starting UI " + Thread.currentThread()); super.start(context); if (SystemConfiguration.getInstance().isDeveloper()) { BackendManagerPopup.init(); } loadDefaultEditorColors(); ErlLogger.debug("Started UI"); erlConsoleManager = new ErlConsoleManager(); if (SystemConfiguration.getInstance().isDeveloper()) { try { final IBackend ideBackend = BackendCore.getBackendManager().getIdeBackend(); if (!ideBackend.getData().hasConsole()) { erlConsoleManager.runtimeAdded(ideBackend); } } catch (final Exception e) { ErlLogger.warn(e); } } erlangDebuggerBackendListener = new ErlangDebuggerBackendListener(); BackendCore.getBackendManager().addBackendListener(erlangDebuggerBackendListener); startPeriodicCacheCleaner(); }
/* * (non-Javadoc) * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) */ public void start(BundleContext context) throws Exception { super.start(context); plugin = this; Job job = new CSSMetadataLoader(); job.schedule(); }
/** * Start. * * @param context the context * @throws Exception the exception * @generated */ @Override public void start(BundleContext context) throws Exception { super.start(context); PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore()); plugin = this; log = new LogHelper(plugin); }
@Override public void start(BundleContext context) throws Exception { instance = this; super.start(context); URL url = getBundle().getEntry("/templates"); templateRoot = FileLocator.toFileURL(url).getPath(); }
/* * (non-Javadoc) * * @see * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext * ) */ public void start(BundleContext context) throws Exception { super.start(context); plugin = this; // The EcorePlugin Activator tries to open the workspace, but the // workspace // is only set when the application inisitalized, if the plugin is // self-starting // this will thrown an exception that the data area is not set. // System.getProperties() // .setProperty( // "org.eclipse.emf.ecore.plugin.EcorePlugin.doNotLoadResourcesPlugin", // "false"); // As we auto start this plugin, and EMF requires a workspace, in it'c // core // plugin. pu.readProperties(this.getBundle(), propertiesFile, getProperties()); injector = Guice.createInjector(osgiModule(context), new ProductModule()); // TODO, Export with Peaberry. final IWorkbenchService instance = injector.getInstance(IWorkbenchService.class); // Register our product workbench service to customize the application // at startup. workbenchService = context.registerService(IWorkbenchService.class, instance, null); }
/* * (non-Javadoc) * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) */ public void start(BundleContext context) throws Exception { super.start(context); plugin = this; GLLogger.infoUser( "starting the examples plugin which proposes the creation of examples of workflows", getClass()); }
@Override protected void findModelTypes() { modelTypes = new ArrayList<ModelTypeExtension>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint extensionPoint = registry.getExtensionPoint("org.eclipse.epsilon.common.dt.modelType"); IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements(); try { for (int i = 0; i < configurationElements.length; i++) { IConfigurationElement configurationElement = configurationElements[i]; // Intercept the EMF model as we want to provide our reduced dialog String type = configurationElement.getAttribute("type"); ModelTypeExtension modelType = new ModelTypeExtension(); modelType.setClazz(configurationElement.getAttribute("class")); modelType.setType(type); modelType.setLabel(configurationElement.getAttribute("label")); modelType.setStable(Boolean.parseBoolean(configurationElement.getAttribute("stable"))); String contributingPlugin = configurationElement.getDeclaringExtension().getNamespaceIdentifier(); Image image = AbstractUIPlugin.imageDescriptorFromPlugin( contributingPlugin, configurationElement.getAttribute("icon")) .createImage(); modelType.setImage(image); modelType.setConfigurationElement(configurationElement); modelTypes.add(modelType); } } catch (Exception ex) { LogUtil.log(ex); } }
@Override public void stop(final BundleContext context) throws Exception { plugin = null; bundleContext = null; super.stop(context); }
/* * (non-Javadoc) * * @see * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext * ) */ @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; tags = TagsFactory.eINSTANCE.createTagsRegistry(); }
/** * Adds a new row to the table with an error icon. * * @param row The pre-divied sections of the error message. */ public void addRow(final String[] row) { addRow( row, AbstractUIPlugin.imageDescriptorFromPlugin( ConsoleLogPlugin.PLUGIN_ID, "icons/views/error_st_obj.gif") .createImage()); //$NON-NLS-1$ }
public void stop(BundleContext context) throws Exception { try { controlJSPIndexing(false); } finally { super.stop(context); } }
public MoveupAction() { setText("上移"); setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( ARESEditorPlugin.PLUGIN_ID, "icons/full/obj16/up.gif")); setId(IActionIDConstant.CV_MOVE_UP); }
@Override protected void initializeImageRegistry(ImageRegistry pReg) { super.initializeImageRegistry(pReg); internalRegisterImg(pReg, ImageConstants.SOURCE_FOLDER); internalRegisterImg(pReg, ImageConstants.EXTENSION_POINT); }
/** Load the generator images. */ private static void loadGeneratorImages(IConfigurationElement[] cf) { int size = cf.length; for (int i = 0; i < size; i++) { try { String name = cf[i].getDeclaringExtension().getContributor().getName(); String iconPath = cf[i].getAttribute("icon"); ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(name, iconPath); if (imageDescriptor == null && iconPath != null && iconPath.length() > 0) imageDescriptor = ImageDescriptor.getMissingImageDescriptor(); if (imageDescriptor != null) { String[] typeIds = StringUtils.tokenize(cf[i].getAttribute("typeIds"), ","); int size2 = typeIds.length; for (int j = 0; j < size2; j++) { imageRegistry.put(typeIds[j], imageDescriptor); imageDescriptors.put(typeIds[j], imageDescriptor); } } Trace.trace(Trace.CONFIG, " Loaded generatorImage: " + cf[i].getAttribute("id")); } catch (Throwable t) { Trace.trace( Trace.SEVERE, " Could not load generatorImage: " + cf[i].getAttribute("id"), t); } } }
@Override public void start(BundleContext context) throws Exception { super.start(context); IPrologProcessService prologProcessService = PDTConnectorPlugin.getDefault().getPrologProcessService(); prologProcessService.registerPDTReloadExecutor(new ConsoleReloadExecutor()); }
@Override public void start(BundleContext context) throws Exception { super.start(context); fgModel = new Model(); System.out.println("Starting the OSC core plugin"); }
public ConfigureWifiSnifferAction(WifiToolbar toolbar) { setId(ID); this.toolbar = toolbar; setToolTipText("Configure Wireless Sniffer"); setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/configure.png")); }
@Override public void addExtension(IExtensionTracker tracker, IExtension extension) { IConfigurationElement[] elements = extension.getConfigurationElements(); for (int i = 0; i < elements.length; i++) { IConfigurationElement element = elements[i]; if (element.getName().equals(tag)) { String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID); String file = element.getAttribute(IWorkbenchRegistryConstants.ATT_ICON); if (file == null || id == null) { Persistence.log( element, Persistence.ACTIVITY_IMAGE_BINDING_DESC, "definition must contain icon and ID"); //$NON-NLS-1$ continue; // ignore - malformed } if (registry.getDescriptor(id) == null) { // first come, first serve ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(element.getNamespace(), file); if (descriptor != null) { registry.put(id, descriptor); tracker.registerObject(extension, id, IExtensionTracker.REF_WEAK); } } } } }
/** * If the object is a {@link ProjectElementAdapter} it returns the image returned by the * extension's labelProvider or the icon defined in the extension (if it is defined). If the * element is not a ProjectElementAdapter the a default image is returned * * @generated NOT */ public Object getImage(Object object) { ProjectElementAdapter projectElementAdapter = ((ProjectElementAdapter) object); IGenericProjectElement backingObject = projectElementAdapter.getBackingObject(); if (backingObject == null) { return null; } String extensionId = backingObject.getExtensionId(); IConfigurationElement extension = findExtension(extensionId); String labelProviderAtt = extension.getAttribute(LABEL_PROVIDER_ATT); Object image = null; if (labelProviderAtt != null) { try { IBaseLabelProvider baseProvider = (IBaseLabelProvider) extension.createExecutableExtension(LABEL_PROVIDER_ATT); if (baseProvider instanceof ILabelProvider) { ILabelProvider labelProvider = (ILabelProvider) baseProvider; image = labelProvider.getImage(backingObject); } } catch (CoreException e) { // not good log this ProjectEditPlugin.log("Unable to load the LabelProvider for Element: " + extensionId, e); } } String iconPath = extension.getAttribute(ICON_ATT); if (image == null && iconPath != null) { image = AbstractUIPlugin.imageDescriptorFromPlugin(extension.getNamespaceIdentifier(), iconPath); } return image; }
public SetQueryAction(IWorkbenchPartSite workbenchPartSite) { site = workbenchPartSite; setText(FLATTT.getResourceString("actions.SetQueryAction.Top.Label")); setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin(FLATTT.ID_PLUGIN, "icons/magnifier.png")); setToolTipText(FLATTT.getResourceString("actions.SetQueryAction.Top.ToolTip")); }
public void testBadIcon() { Image i1 = null; Image i2 = null; try { i1 = fWorkbench .getEditorRegistry() .getDefaultEditor("foo.icontest3") .getImageDescriptor() .createImage(); i2 = AbstractUIPlugin.imageDescriptorFromPlugin( "org.eclipse.ui", "icons/full/obj16/file_obj.png") .createImage(); ImageTests.assertEquals(i1, i2); } finally { if (i1 != null) { i1.dispose(); } if (i2 != null) { i2.dispose(); } } }
private static Image getImage(String path) { final ImageRegistry imageRegistry = Activator.getDefault().getImageRegistry(); if (imageRegistry.getDescriptor(path) == null) { imageRegistry.put(path, AbstractUIPlugin.imageDescriptorFromPlugin(Activator.ID, path)); } return imageRegistry.get(path); }
/* * (non-Javadoc) * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) */ @Override public void start(BundleContext context) throws Exception { fgBundleContext = context; super.start(context); DEBUG = "true" .equals( Platform.getDebugOption( "org.eclipse.cdt.dsf.ui/debug")); //$NON-NLS-1$//$NON-NLS-2$ fSourceDocumentProvider = new SourceDocumentProvider(); EvaluationContextManager.startup(); // Register the DSF backend for our disassembly view (the CDT debug UI // plugin registers the CDI one) Platform.getAdapterManager() .registerAdapters(new DisassemblyBackendDsfFactory(), IDMVMContext.class); // Register the factory that provides descriptions of stack frames // to the CSourceNotFoundEditor. Platform.getAdapterManager() .registerAdapters(new CSourceNotFoundDescriptionFactory(), IFrameDMContext.class); DsfDebugUITools.enableActivity("org.eclipse.cdt.debug.ui.cdtActivity", true); // $NON-NLS-1$ }
@Override public void stop(BundleContext context) throws Exception { plugin = null; imageCache.dispose(); imageCache = null; super.stop(context); }
/** @param configurationElement */ private void processSplashElementIcon(IConfigurationElement configurationElement) { // Get attribute icon String iconImageFilePath = configurationElement.getAttribute(F_ELEMENT_ICON); // Abort if an icon attribute was not specified if ((iconImageFilePath == null) || (iconImageFilePath.length() == 0)) { return; } // Create a corresponding image descriptor ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin( configurationElement.getNamespaceIdentifier(), iconImageFilePath); // Abort if no corresponding image was found if (descriptor == null) { return; } // Create the image Image image = descriptor.createImage(); // Abort if image creation failed if (image == null) { return; } // Abort if the image does not have dimensions of 50x50 if ((image.getBounds().width != F_IMAGE_WIDTH) || (image.getBounds().height != F_IMAGE_HEIGHT)) { // Dipose of the image image.dispose(); return; } // Store the image and tooltip fImageList.add(image); }