Java Code Examples for org.eclipse.ui.plugin.AbstractUIPlugin

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project droolsjbpm-tools, under directory /drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/.

Source file: DroolsEclipsePlugin.java

  17 
vote

/** 
 * Returns an image descriptor for the image file at the given plug-in relative path. Uses the plug ins image registry to "cache" it.
 * @param path the path
 * @return the image descriptor
 */
public static ImageDescriptor getImageDescriptor(String path){
  DroolsEclipsePlugin plugin=getDefault();
  ImageRegistry reg=plugin.getImageRegistry();
  ImageDescriptor des=reg.getDescriptor(path);
  if (des == null) {
    des=AbstractUIPlugin.imageDescriptorFromPlugin("org.drools.eclipse",path);
    reg.put(path,des);
  }
  return des;
}
 

Example 2

From project dawn-isenciaui, under directory /com.isencia.passerelle.workbench.model.editor.ui/src/main/java/com/isencia/passerelle/workbench/model/editor/ui/editor/actions/.

Source file: RenameAction.java

  16 
vote

protected void init(){
  setText("Rename...");
  setToolTipText("Rename");
  setId(ActionFactory.RENAME.getId());
  ImageDescriptor icon=AbstractUIPlugin.imageDescriptorFromPlugin("TutoGEF","icons/rename-icon.png");
  if (icon != null)   setImageDescriptor(icon);
  setEnabled(false);
}
 

Example 3

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.datatools.enablement.simpledb.editor.ui/src/com/amazonaws/eclipse/datatools/enablement/simpledb/editor/wizard/.

Source file: SDBTableDataWizard.java

  15 
vote

@Override public void addPages(){
  this.page=new SDBTableDataWizardPage(this.editor);
  ImageDescriptor image=AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID,"icons/sdb-wizard-75x66-shadow.png");
  this.page.setImageDescriptor(image);
  addPage(this.page);
}
 

Example 4

From project bndtools, under directory /bndtools.core/src/bndtools/editor/.

Source file: BndSourceEditorPage.java

  15 
vote

public BndSourceEditorPage(String id,BndEditor formEditor){
  this.id=id;
  this.formEditor=formEditor;
  setSourceViewerConfiguration(new BndSourceViewerConfiguration(getSharedColors()));
  formEditor.getEditModel().addPropertyChangeListener(propChangeListener);
  ImageDescriptor iconDescriptor=AbstractUIPlugin.imageDescriptorFromPlugin(Plugin.PLUGIN_ID,"icons/page_white_text.png");
  icon=iconDescriptor.createImage();
}
 

Example 5

From project CIShell, under directory /clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/.

Source file: DataGUIItem.java

  15 
vote

public static Image getImage(String name,String brandPluginID){
  if (Platform.isRunning()) {
    String imageLocation=String.format("%sicons%s%s",File.separator,File.separator,name);
    ImageDescriptor imageDescriptor=AbstractUIPlugin.imageDescriptorFromPlugin(brandPluginID,imageLocation);
    if (imageDescriptor != null) {
      return imageDescriptor.createImage();
    }
 else {
      String errorMessage=String.format("Could not find the icon '%s' in '%s'. Using the default image instead.",imageLocation,brandPluginID);
      System.err.println(errorMessage);
      return getDefaultImage();
    }
  }
 else {
    String format="Could not obtain the image '%s' in '%s', since the platform was not " + "running (?). Using the default image instead.";
    String errorMessage=String.format(format,name,brandPluginID);
    System.err.println(errorMessage);
    return getDefaultImage();
  }
}
 

Example 6

From project Eclipse, under directory /com.mobilesorcery.sdk.core/src/com/mobilesorcery/sdk/core/templates/.

Source file: ProjectTemplateExtension.java

  15 
vote

@Override public ImageDescriptor getImage(){
  String ns=element.getDeclaringExtension().getNamespaceIdentifier();
  String icon=element.getAttribute("image");
  ImageDescriptor imageDescriptor=AbstractUIPlugin.imageDescriptorFromPlugin(ns,icon);
  return imageDescriptor;
}
 

Example 7

From project eclipse-integration-cloudfoundry, under directory /org.cloudfoundry.ide.eclipse.server.ui/src/org/cloudfoundry/ide/eclipse/internal/server/ui/.

Source file: CloudFoundryImages.java

  15 
vote

public static ImageDescriptor getWizardBanner(String serverTypeId){
  IConfigurationElement config=CloudFoundryBrandingExtensionPoint.getConfigurationElement(serverTypeId);
  String wizBanner=CloudFoundryBrandingExtensionPoint.getWizardBannerPath(serverTypeId);
  if (config != null && wizBanner != null && wizBanner.trim().length() > 0) {
    String bundle=config.getContributor().getName();
    return AbstractUIPlugin.imageDescriptorFromPlugin(bundle,wizBanner);
  }
  return null;
}
 

Example 8

From project gmc, under directory /src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/.

Source file: ApplicationActionBarAdvisor.java

  15 
vote

protected void makeActions(final IWorkbenchWindow window){
  exitAction=ActionFactory.QUIT.create(window);
  register(exitAction);
  aboutAction=ActionFactory.ABOUT.create(window);
  aboutAction.setText("&About");
  aboutAction.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Application.PLUGIN_ID,IImageKeys.HELP_16x16));
  register(aboutAction);
  helpContentsAction=ActionFactory.HELP_CONTENTS.create(window);
  helpContentsAction.setText("&Management Console Help");
  helpContentsAction.setAccelerator(SWT.F1);
  register(helpContentsAction);
}
 

Example 9

From project grails-ide, under directory /org.grails.ide.eclipse.editor.groovy/src/org/grails/ide/eclipse/editor/groovy/.

Source file: EditorPluginImageHelper.java

  15 
vote

/** 
 * Creates an image descriptor from the given imageFilePath and adds the image descriptor to the image descriptor registry. If an image descriptor could not be created, the default "missing" image descriptor is returned but not added to the image descriptor registry.
 * @param imageFilePath
 * @return ImageDescriptor image descriptor for imageFilePath or default"missing" image descriptor if resource could not be found
 */
private ImageDescriptor createImageDescriptor(String imageFilePath){
  ImageDescriptor imageDescriptor=AbstractUIPlugin.imageDescriptorFromPlugin(PLUGINID,imageFilePath);
  if (imageDescriptor != null) {
    getImageDescriptorRegistry().put(imageFilePath,imageDescriptor);
  }
 else {
    imageDescriptor=ImageDescriptor.getMissingImageDescriptor();
  }
  return imageDescriptor;
}
 

Example 10

From project incubator, under directory /net.karlmartens.ui/src/net/karlmartens/ui/.

Source file: ResourceSupport.java

  15 
vote

public static ImageDescriptor imageDescriptorFromPlugin(String pluginId,Class<?> clazz,String imageFilePath){
  try {
    final ImageDescriptor d=AbstractUIPlugin.imageDescriptorFromPlugin(pluginId,imageFilePath);
    if (d != null)     return d;
  }
 catch (  Throwable t) {
  }
  final ImageDescriptor d=ImageDescriptor.createFromFile(clazz,imageFilePath);
  if (d != null)   return d;
  return ImageDescriptor.getMissingImageDescriptor();
}
 

Example 11

From project koneki.ldt, under directory /plugins/org.eclipse.koneki.ldt.debug.ui/src/org/eclipse/koneki/ldt/debug/ui/internal/.

Source file: Activator.java

  15 
vote

/** 
 * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry)
 */
@Override protected void initializeImageRegistry(ImageRegistry reg){
  reg.put(ImageConstants.LUA_DEBUG_UNREACHABLE_STACK_FRAME,AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID,ImageConstants.LUA_DEBUG_UNREACHABLE_STACK_FRAME));
  reg.put(ImageConstants.LUA_DEBUG_CCODE_STACK_FRAME,AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID,ImageConstants.LUA_DEBUG_CCODE_STACK_FRAME));
  reg.put(ImageConstants.LUA_DEBUG_SPECIAL_VAR,AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID,ImageConstants.LUA_DEBUG_SPECIAL_VAR));
  reg.put(ImageConstants.LUA_ATTACH_MAINTAB,AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID,ImageConstants.LUA_ATTACH_MAINTAB));
}
 

Example 12

From project libra, under directory /plugins/org.eclipse.libra.facet.ui/src/org/eclipse/libra/facet/ui/wizards/.

Source file: OSGiBundleFacetInstallPage.java

  15 
vote

public OSGiBundleFacetInstallPage(){
  super(WIZARD_PAGE_NAME);
  setTitle(Messages.OSGiBundleFacetInstallPage_Title);
  setDescription(Messages.OSGiBundleFacetInstallPage_Description);
  setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(LibraFacetUIPlugin.PLUGIN_ID,IMG_PATH_BUNDLE_WIZBAN));
}
 

Example 13

From project m2eclipse-webby, under directory /org.sonatype.m2e.webby/src/org/sonatype/m2e/webby/internal/.

Source file: WebbyImages.java

  15 
vote

private static ImageDescriptor createImageDescriptor(String key){
  WebbyPlugin plugin=WebbyPlugin.getDefault();
  String pluginId=WebbyPlugin.getPluginId();
  ImageDescriptor imageDescriptor=AbstractUIPlugin.imageDescriptorFromPlugin(pluginId,"icons/" + key);
  if (imageDescriptor == null) {
    plugin.getLog().log(new Status(IStatus.ERROR,pluginId,IStatus.ERROR,"Could not locate image " + key,null));
    return null;
  }
  return imageDescriptor;
}
 

Example 14

From project mylyn.builds, under directory /org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/builds/ui/spi/.

Source file: BuildConnectorUi.java

  15 
vote

public ImageDescriptor getImageDescriptor(){
  if (descriptor == null) {
    if (element != null) {
      String iconPath=element.getAttribute("icon");
      if (iconPath != null) {
        descriptor=AbstractUIPlugin.imageDescriptorFromPlugin(element.getContributor().getName(),iconPath);
      }
    }
  }
  return descriptor;
}
 

Example 15

From project mylyn.context, under directory /org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/.

Source file: ContextUiPlugin.java

  15 
vote

private static void readBridge(IConfigurationElement element){
  try {
    Object bridge=element.createExecutableExtension(UiExtensionPointReader.ELEMENT_CLASS);
    Object contentType=element.getAttribute(UiExtensionPointReader.ELEMENT_UI_BRIDGE_CONTENT_TYPE);
    if (bridge instanceof AbstractContextUiBridge && contentType != null) {
      ContextUiPlugin.getDefault().internalAddBridge((String)contentType,(AbstractContextUiBridge)bridge);
      String iconPath=element.getAttribute(ELEMENT_STRUCTURE_BRIDGE_SEARCH_ICON);
      if (iconPath != null) {
        ImageDescriptor descriptor=AbstractUIPlugin.imageDescriptorFromPlugin(element.getDeclaringExtension().getContributor().getName(),iconPath);
        if (descriptor != null) {
          ContextUiPlugin.getDefault().setActiveSearchIcon((AbstractContextUiBridge)bridge,descriptor);
        }
      }
      String label=element.getAttribute(ELEMENT_STRUCTURE_BRIDGE_SEARCH_LABEL);
      if (label != null) {
        ContextUiPlugin.getDefault().setActiveSearchLabel((AbstractContextUiBridge)bridge,label);
      }
    }
 else {
      StatusHandler.log(new Status(IStatus.ERROR,ContextUiPlugin.ID_PLUGIN,"Could not load bridge: " + bridge.getClass().getCanonicalName() + " must implement "+ AbstractContextUiBridge.class.getCanonicalName()));
    }
  }
 catch (  CoreException e) {
    StatusHandler.log(new Status(IStatus.ERROR,ContextUiPlugin.ID_PLUGIN,"Could not load bridge extension",e));
  }
}
 

Example 16

From project mylyn.docs, under directory /org.eclipse.mylyn.docs.epub.ui/src/org/eclipse/mylyn/internal/docs/epub/ui/.

Source file: MainPage.java

  15 
vote

/** 
 * Create the wizard.
 * @wbp.parser.constructor
 */
public MainPage(){
  super("wizardPage");
  setMessage(Messages.MainPage_0);
  setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EPUBUIPlugin.PLUGIN_ID,"icons/wizard-banner.png"));
  setTitle(Messages.MainPage_1);
}
 

Example 17

From project mylyn.incubator, under directory /org.eclipse.mylyn.examples.monitor.study/src/org/eclipse/mylyn/examples/monitor/study/.

Source file: FeedbackWizard.java

  15 
vote

/** 
 * Constructor for SampleNewWizard.
 */
public FeedbackWizard(UsageSubmissionWizard wizard){
  super();
  studyParameters=UiUsageMonitorPlugin.getDefault().getStudyParameters();
  setNeedsProgressMonitor(true);
  super.setDefaultPageImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(UiUsageMonitorPlugin.ID_PLUGIN,"icons/wizban/banner-user.gif"));
  super.setWindowTitle(studyParameters.getStudyName() + " Feedback");
  feedbackPage=new SubmitFeedbackPage(wizard,studyParameters);
}
 

Example 18

From project netifera, under directory /platform/com.netifera.platform.net.packets/com.netifera.platform.net.daemon.sniffing.ui/src/com/netifera/platform/net/daemon/sniffing/ui/.

Source file: CaptureFileAction.java

  15 
vote

CaptureFileAction(SniffingActionManager manager){
  this.manager=manager;
  setId(ID);
  setToolTipText("Open A Packet Capture File");
  setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID,"icons/open_capfile.png"));
}
 

Example 19

From project org.eclipse.mylyn.github, under directory /org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/.

Source file: GitHubTaskEditorPageFactory.java

  15 
vote

@Override public Image getPageImage(){
  if (gitLogoImage != null)   return gitLogoImage;
  ImageDescriptor imageDescriptor=AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.mylyn.github.ui","images/git-logo.png");
  if (imageDescriptor == null) {
    return null;
  }
  return gitLogoImage=new Image(Display.getCurrent(),imageDescriptor.getImageData());
}
 

Example 20

From project radrails, under directory /plugins/org.radrails.ide.ui/src/org/radrails/ide/ui/.

Source file: UpdateAction.java

  15 
vote

public UpdateAction(IWorkbenchWindow window){
  this.window=window;
  setId("org.radrails.newUpdates");
  setText("&Update RadRails...");
  setToolTipText("Search for updates to RadRails");
  setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin("org.radrails.ide.ui","icons/rails.gif"));
  window.getWorkbench().getHelpSystem().setHelp(this,"org.radrails.updates");
}
 

Example 21

From project recommenders, under directory /plugins/org.eclipse.recommenders.completion.rcp/src/org/eclipse/recommenders/internal/completion/rcp/.

Source file: SessionProcessorDescriptor.java

  15 
vote

public static SessionProcessorDescriptor[] parseExtensions(){
  IExtensionRegistry registry=Platform.getExtensionRegistry();
  IExtensionPoint point=registry.getExtensionPoint(EXT_POINT_SESSION_PROCESSORS);
  Set<String> disabledProcessors=getDisabledProcessors();
  PriorityQueue<SessionProcessorDescriptor> queue=new PriorityQueue<SessionProcessorDescriptor>();
  try {
    for (    IConfigurationElement elem : point.getConfigurationElements()) {
      try {
        final String pluginId=elem.getContributor().getName();
        String id=elem.getAttribute("id");
        String name=elem.getAttribute("name");
        final String iconPath=elem.getAttribute("icon");
        String priorityString=elem.getAttribute("priority");
        int priority=priorityString == null ? 10 : Integer.parseInt(priorityString);
        final Image icon=AbstractUIPlugin.imageDescriptorFromPlugin(pluginId,iconPath).createImage();
        SessionProcessor processor=(SessionProcessor)elem.createExecutableExtension("class");
        boolean enable=!disabledProcessors.contains(id);
        SessionProcessorDescriptor d=new SessionProcessorDescriptor(id,name,icon,priority,enable,processor);
        queue.add(d);
      }
 catch (      Exception e) {
        RecommendersPlugin.logError(e,"Exception during extension point parsing");
      }
    }
  }
 catch (  Exception e) {
    RecommendersPlugin.logError(e,"Exception during extension point parsing");
  }
  SessionProcessorDescriptor[] res=queue.toArray(new SessionProcessorDescriptor[0]);
  return res;
}
 

Example 22

From project samolisov-demo, under directory /Eclipse/RCP/Hyperbola/org.rcpbook.hyperbola.ui/src/org/rcpbook/hyperbola/ui/actions/.

Source file: AddContactAction.java

  15 
vote

public AddContactAction(IWorkbenchWindow window){
  this.window=window;
  setId(ID);
  setActionDefinitionId(ID);
  setText("&Add Contact...");
  setToolTipText("Add a contact to your contact list");
  setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Application.PLUGIN_ID,IImageKeys.ADD_CONTACT));
  window.getSelectionService().addSelectionListener(this);
}
 

Example 23

From project scisoft-icat, under directory /uk.ac.diamond.scisoft.icatexplorer.rcp/src/uk/ac/diamond/scisoft/icatexplorer/rcp/datafiles/.

Source file: FileIconService.java

  15 
vote

public Image getIcon(String filename){
  String iconName=iconMap.get("default");
  try {
    String fileExtension=FilenameUtils.getExtension(filename);
    if (iconMap.containsKey(fileExtension)) {
      iconName=iconMap.get(fileExtension);
    }
  }
 catch (  Exception e) {
    logger.error("problem mapping file extension to icon file",e);
  }
  return AbstractUIPlugin.imageDescriptorFromPlugin("uk.ac.diamond.scisoft.icatexplorer.rcp","icons/cnficons/" + iconName).createImage();
}
 

Example 24

From project scisoft-ui, under directory /uk.ac.diamond.scisoft.analysis.rcp/src/uk/ac/diamond/scisoft/analysis/rcp/views/plot/.

Source file: StaticScanPlotView.java

  15 
vote

/** 
 * @param sv
 * @return f
 */
public static IAction getSavePlotAction(final StaticScanPlotView sv){
  return new Action("Save plot",AbstractUIPlugin.imageDescriptorFromPlugin(sv.getSite().getPluginId(),"icons/disk.png")){
    FileDialog dialog;
    @Override public void run(){
      if (dialog == null) {
        dialog=new FileDialog(sv.getSite().getShell(),SWT.SAVE);
        dialog.setText("Save plot");
        dialog.setFilterExtensions(new String[]{"*.xml"});
        dialog.setFilterPath(System.getProperty(LocalProperties.GDA_DATA));
      }
      String path=dialog.open();
      if (path == null)       return;
      if (!path.toLowerCase().endsWith(".xml"))       path=path + ".xml";
      final File toSave=new File(path);
      if (toSave.exists()) {
        final boolean ok=MessageDialog.openConfirm(sv.getSite().getShell(),"Confirm Overwrite File","The file '" + toSave.getName() + "' already exists.\n\nWould you like to overwrite?");
        if (!ok)         return;
      }
      try {
        setPlotBeanToFile(toSave,sv.plotBean);
      }
 catch (      Exception ne) {
        logger.error("Cannot save graph",ne);
      }
    }
  }
;
}
 

Example 25

From project sisu, under directory /sisu-examples/guice-rcp/guice-rcp-plugin/src/org/sonatype/examples/guice/rcp/.

Source file: MessagePopupAction.java

  15 
vote

MessagePopupAction(String text,IWorkbenchWindow window){
  super(text);
  this.window=window;
  setId(ICommandIds.CMD_OPEN_MESSAGE);
  setActionDefinitionId(ICommandIds.CMD_OPEN_MESSAGE);
  setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin("guice-rcp","/icons/sample3.gif"));
}
 

Example 26

From project sketch, under directory /org.eclipse.sketch.examples.shapes.diagram/src/org/eclipse/sketch/examples/shapes/diagram/part/.

Source file: ShapesDiagramEditorPlugin.java

  15 
vote

/** 
 * Respects images residing in any plug-in. If path is relative, then this bundle is looked up for the image, otherwise, for absolute  path, first segment is taken as id of plug-in with image
 * @generated
 * @param path the path to image, either absolute (with plug-in id as first segment), or relative for bundled images
 * @return the image descriptor
 */
public static ImageDescriptor findImageDescriptor(String path){
  final IPath p=new Path(path);
  if (p.isAbsolute() && p.segmentCount() > 1) {
    return AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0),p.removeFirstSegments(1).makeAbsolute().toString());
  }
 else {
    return getBundledImageDescriptor(p.makeAbsolute().toString());
  }
}