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

The following are top voted examples for showing how to use org.eclipse.ui.plugin.AbstractUIPlugin. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: com.onpositive.prefeditor   File: ViewerPage.java   Source Code and License 7 votes vote down vote up
protected void createFilterControls(Composite con) {
	Label filterLabel = new Label(con,SWT.NONE);
	filterLabel.setText("Filter:");
	GridDataFactory.swtDefaults().applyTo(filterLabel);
	Text filterText = new Text(con, SWT.BORDER);
	filterText.setMessage("(" + PreferenceFilter.MIN_FILTER_CHARS + " chars at least)");
	filterText.addModifyListener(event -> {
		filterChanged(filterText.getText());
	});
	GridDataFactory.fillDefaults().grab(true,false).applyTo(filterText);
	Button clearBtn = new Button(con, SWT.PUSH);
	clearBtn.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(PrefEditorPlugin.PLUGIN_ID,"icons/clear.gif").createImage());
	GridDataFactory.swtDefaults().applyTo(clearBtn);
	clearBtn.addSelectionListener(new SelectionAdapter() {
		
		@Override
		public void widgetSelected(SelectionEvent e) {
			filterText.setText("");
			filterChanged("");
		}
		
	});
}
 
Example 2
Project: team-explorer-everywhere   File: CommonStructureControl.java   Source Code and License 6 votes vote down vote up
private void createActions() {
    newNodeAction = new NewNodeAction(this);
    renameNodeAction = new RenameNodeAction(this);
    deleteNodeAction = new DeleteNodeAction(this);
    moveUpNodeAction = new MoveUpNodeAction(this);
    moveDownNodeAction = new MoveDownNodeAction(this);
    promoteNodeAction = new PromoteNodeAction(this);
    demoteNodeAction = new DemoteNodeAction(this);
    refreshAction = new Action() {
        @Override
        public void run() {
            refresh();
        }
    };
    refreshAction.setText(Messages.getString("CommonStructureControl.RefreshActionText")); //$NON-NLS-1$
    refreshAction.setImageDescriptor(
        AbstractUIPlugin.imageDescriptorFromPlugin(TFSCommonUIClientPlugin.PLUGIN_ID, "icons/Refresh.gif")); //$NON-NLS-1$
}
 
Example 3
Project: team-explorer-everywhere   File: V1AntBuildWizard.java   Source Code and License 6 votes vote down vote up
@Override
public void init(final IBuildDefinition buildDefinition) {
    this.buildDefinition = buildDefinition;
    setWindowTitle(Messages.getString("V1AntBuildWizard.WizardTitle")); //$NON-NLS-1$
    setDefaultPageImageDescriptor(
        AbstractUIPlugin.imageDescriptorFromPlugin(TFSTeamBuildPlugin.PLUGIN_ID, "icons/ant_wiz.png")); //$NON-NLS-1$
    setNeedsProgressMonitor(true);

    // setup default workspace.
    if (buildDefinition.getWorkspace().getMappings().length == 0) {
        buildDefinition.getWorkspace().map(
            ServerPath.ROOT + buildDefinition.getTeamProject(),
            BuildConstants.SOURCE_DIR_ENVIRONMENT_VARIABLE);
    }

}
 
Example 4
Project: team-explorer-everywhere   File: QueuedBuildsTableControl.java   Source Code and License 6 votes vote down vote up
/**
 * Constructs a {@link QueuedBuildsTableControl}. The {@link IBuildServer}
 * may be <code>null</code> (column text for a V3 build server will be
 * shown); call {@link #setBuildServer(IBuildServer)} to update the control.
 *
 * @param buildServer
 *        the build server to use (may be <code>null</code>)
 */
public QueuedBuildsTableControl(
    final Composite parent,
    final int style,
    final IBuildServer buildServer,
    final String viewDataKey) {
    super(parent, style, IQueuedBuild.class, viewDataKey);
    this.buildServer = buildServer;

    reasonHeaderImage = AbstractUIPlugin.imageDescriptorFromPlugin(
        TFSTeamBuildPlugin.PLUGIN_ID,
        "/icons/ColumnHeaderReason.gif").createImage(); //$NON-NLS-1$

    statusHeaderImage = AbstractUIPlugin.imageDescriptorFromPlugin(
        TFSTeamBuildPlugin.PLUGIN_ID,
        "/icons/ColumnHeaderStatus.gif").createImage(); //$NON-NLS-1$

    setupTableColumns();

    setUseDefaultContentProvider();
    getViewer().setSorter(createSorter());
    getViewer().setLabelProvider(new LabelProvider());
    setEnableTooltips(true, true);

}
 
Example 5
Project: subclipse   File: SVNPluginAction.java   Source Code and License 6 votes vote down vote up
public SVNPluginAction(IConfigurationElement element) {
	super(element.getAttribute(ATT_LABEL), getStyleFromElement(element));
	this.element = element;
	pluginId = element.getContributor().getName();
	
	createDelegate();
	
	setId(element.getAttribute(ATT_ID));
	setToolTipText(element.getAttribute(ATT_TOOLTIP));
	
	if ((getStyle() == AS_RADIO_BUTTON) || (getStyle() == AS_CHECK_BOX)) {
		String bool = element.getAttribute(ATT_STATE);
		setChecked("true".equals(bool));	//$NON-NLS-1$
	}
	
	String iconPath = element.getAttribute(ATT_ICON);
	if ((iconPath != null) && (iconPath.length() > 0)) {
		ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, iconPath);
		if (desc != null) {
			setImageDescriptor(desc);
		}
	}
	
	 // Give delegate a chance to adjust enable state
       selectionChanged(StructuredSelection.EMPTY);
}
 
Example 6
Project: http4e   File: ResourceUtils.java   Source Code and License 6 votes vote down vote up
public static Image getImage( String pluginID, String image){
   /*--- create from class file location
   ImageDescriptor iDescr = ImageDescriptor.createFromFile(CoreResources.class, name);
   Image image = resourceCache.getImage(iDescr);
   return image;
   --- get workbench shared image
   IWorkbench workbench = PlatformUI.getWorkbench();
   ISharedImages images = workbench.getSharedImages();
   image = images.getImage(ISharedImages.IMG_OBJ_FOLDER);      
   --- image from plugin
   MyPlugin.getImageDescriptor("icons/a_image.gif").createImage();
   AbstractUIPlugin.imageDescriptorFromPlugin(myPluginID, image)).createImage();
    */
   if (Utils.isIDE()) {
      return resourceCache.getImage(AbstractUIPlugin.imageDescriptorFromPlugin(pluginID, image));
   } else {
      return resourceCache.getImage(image);
   }
}
 
Example 7
Project: hadoop-EAR   File: ImageLibrary.java   Source Code and License 6 votes vote down vote up
/**
 * Register an image from the workspace shared image pool. If the image
 * resource does not exist or fails to load, a default "error" resource is
 * supplied.
 * 
 * @param name name of the image
 * @param sharedName name of the shared image ({@link ISharedImages})
 * @return whether the image has correctly been loaded
 */
private boolean newPluginImage(String name, String pluginId,
    String filename) {

  boolean success = true;
  ImageDescriptor id =
      AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, filename);

  if (id == null) {
    id = ImageDescriptor.getMissingImageDescriptor();
    // id = getSharedByName(ISharedImages.IMG_OBJS_ERROR_TSK);
    success = false;
  }

  descMap.put(name, id);
  imageMap.put(name, id.createImage(true));

  return success;
}
 
Example 8
Project: PDFReporter-Studio   File: TabDescriptor.java   Source Code and License 6 votes vote down vote up
/**
 * Constructor for TabDescriptor.
 * 
 * @param configurationElement
 *            the configuration element for the tab descriptor.
 */
public TabDescriptor(IConfigurationElement configurationElement) {
	super();
	if (configurationElement != null) {
		id = configurationElement.getAttribute(ATT_ID);
		label = configurationElement.getAttribute(ATT_LABEL);
		String imageString = configurationElement.getAttribute(ATT_IMAGE);
		if (imageString != null) {
			image = AbstractUIPlugin.imageDescriptorFromPlugin(
					configurationElement.getDeclaringExtension()
							.getNamespaceIdentifier(), imageString);
		}
		String indentedString = configurationElement.getAttribute(ATT_INDENTED);
		indented = indentedString != null && indentedString.equals("true"); //$NON-NLS-1$
		String scrollableString = configurationElement.getAttribute(ATT_SCROLLABLE);
		scrollable= scrollableString == null || scrollableString.toLowerCase().equals("true"); //$NON-NLS-1$
		category = configurationElement.getAttribute(ATT_CATEGORY);
		afterTab = configurationElement.getAttribute(ATT_AFTER_TAB);
		if (id == null || label == null || category == null) {
			// the tab id, label and category are mandatory - log error
			handleTabError(configurationElement, null);
		}
	}
	selected = false;
}
 
Example 9
Project: APICloud-Studio   File: UIUtils.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 10
Project: APICloud-Studio   File: SWTUtils.java   Source Code and License 6 votes vote down vote up
private static Image getImage(String bundleSymbolicName, String path, ImageDescriptor id)
{
	String computedName = bundleSymbolicName + path;
	Image image = JFaceResources.getImage(computedName);
	if (image != null)
	{
		return image;
	}

	if (id == null)
	{
		id = AbstractUIPlugin.imageDescriptorFromPlugin(bundleSymbolicName, path);
	}

	if (id != null)
	{
		JFaceResources.getImageRegistry().put(computedName, id);
		return JFaceResources.getImage(computedName);
	}
	return null;
}
 
Example 11
Project: APICloud-Studio   File: SVNPluginAction.java   Source Code and License 6 votes vote down vote up
public SVNPluginAction(IConfigurationElement element) {
	super(element.getAttribute(ATT_LABEL), getStyleFromElement(element));
	this.element = element;
	pluginId = element.getContributor().getName();
	
	createDelegate();
	
	setId(element.getAttribute(ATT_ID));
	setToolTipText(element.getAttribute(ATT_TOOLTIP));
	
	if ((getStyle() == AS_RADIO_BUTTON) || (getStyle() == AS_CHECK_BOX)) {
		String bool = element.getAttribute(ATT_STATE);
		setChecked("true".equals(bool));	//$NON-NLS-1$
	}
	
	String iconPath = element.getAttribute(ATT_ICON);
	if ((iconPath != null) && (iconPath.length() > 0)) {
		ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, iconPath);
		if (desc != null) {
			setImageDescriptor(desc);
		}
	}
	
	 // Give delegate a chance to adjust enable state
       selectionChanged(StructuredSelection.EMPTY);
}
 
Example 12
Project: n4js   File: NFARExportWizard.java   Source Code and License 5 votes vote down vote up
@Override
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
	this.selection = currentSelection;

	setWindowTitle(NFARExportMessages.WizardTitle_export);
	setDefaultPageImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
			"org.eclipse.ui.ide", "$nl$/icons/full/wizban/exportzip_wiz.png"));//$NON-NLS-1$
	setNeedsProgressMonitor(true);
}
 
Example 13
Project: eclipse-batch-editor   File: AbstractFilterableTreeQuickDialog.java   Source Code and License 5 votes vote down vote up
@Override
protected final IDialogSettings getDialogSettings() {
	AbstractUIPlugin activator = getUIPlugin();
	if (activator == null) {
		return null;
	}
	return activator.getDialogSettings();
}
 
Example 14
Project: eclipse-bash-editor   File: AbstractFilterableTreeQuickDialog.java   Source Code and License 5 votes vote down vote up
@Override
protected final IDialogSettings getDialogSettings() {
	AbstractUIPlugin activator = getUIPlugin();
	if (activator == null) {
		return null;
	}
	return activator.getDialogSettings();
}
 
Example 15
Project: egradle   File: AbstractFilterableTreeQuickDialog.java   Source Code and License 5 votes vote down vote up
@Override
protected final IDialogSettings getDialogSettings() {
	AbstractUIPlugin activator = getUIPlugin();
	if (activator == null) {
		return null;
	}
	return activator.getDialogSettings();
}
 
Example 16
Project: eclipse-asciidoctools   File: Activator.java   Source Code and License 5 votes vote down vote up
/**
 * Loads image in Image Registry is not available in it
 *
 * @param pluginId
 *            : Id of the plugin containing thie image
 * @param imageFilePath
 *            : image File Path in plugin
 * @return Image if loaded
 */
private synchronized Image loadImage(String pluginId, String imageFilePath) {
	String id = pluginId + ":" + imageFilePath;
	Image image = Activator.getDefault().getImageRegistry().get(id);
	if (image != null)
		return image;
	ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, imageFilePath);
	if (imageDescriptor != null) {
		image = imageDescriptor.createImage();
		Activator.getDefault().getImageRegistry().put(pluginId + ":" + imageFilePath, image);
	}
	return image;
}
 
Example 17
Project: team-explorer-everywhere   File: CSSNodeAction.java   Source Code and License 5 votes vote down vote up
public CSSNodeAction(
    final CommonStructureControl cssControl,
    final String text,
    final String toolTipText,
    final String iconPath) {
    super(cssControl);
    this.cssControl = cssControl;
    setText(text);
    if (toolTipText != null && toolTipText.length() > 0) {
        setToolTipText(toolTipText);
    }
    if (iconPath != null && iconPath.length() > 0) {
        setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(TFSCommonUIClientPlugin.PLUGIN_ID, iconPath));
    }
}
 
Example 18
Project: team-explorer-everywhere   File: Utils.java   Source Code and License 5 votes vote down vote up
public static ImageDescriptor getImageDescriptor(
    final IConfigurationElement configElement,
    final String attributeName,
    final String extensionPointName) {
    final String s = configElement.getAttribute(attributeName);
    if (s == null) {
        return null;
    }

    final String contributor = getContributorFor(configElement);

    return AbstractUIPlugin.imageDescriptorFromPlugin(contributor, s);
}
 
Example 19
Project: team-explorer-everywhere   File: CreateBuildConfigurationWizardNode.java   Source Code and License 5 votes vote down vote up
public ImageDescriptor getIcon() {
    if (icon != null) {
        return icon;
    }

    final String iconPath = configElement.getAttribute(ATT_ICON);
    if (iconPath == null) {
        return null;
    }

    icon = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, iconPath);
    return icon;
}
 
Example 20
Project: team-explorer-everywhere   File: GitAntBuildWizard.java   Source Code and License 5 votes vote down vote up
@Override
public void init(final IBuildDefinition buildDefinition) {
    this.buildDefinition = buildDefinition;
    setWindowTitle(Messages.getString("V2AntBuildWizard.WindowTitle")); //$NON-NLS-1$
    setDefaultPageImageDescriptor(
        AbstractUIPlugin.imageDescriptorFromPlugin(TFSTeamBuildPlugin.PLUGIN_ID, "icons/ant_wiz.png")); //$NON-NLS-1$
    setNeedsProgressMonitor(true);
}
 
Example 21
Project: team-explorer-everywhere   File: V2AntBuildWizard.java   Source Code and License 5 votes vote down vote up
@Override
public void init(final IBuildDefinition buildDefinition) {
    this.buildDefinition = buildDefinition;
    setWindowTitle(Messages.getString("V2AntBuildWizard.WindowTitle")); //$NON-NLS-1$
    setDefaultPageImageDescriptor(
        AbstractUIPlugin.imageDescriptorFromPlugin(TFSTeamBuildPlugin.PLUGIN_ID, "icons/ant_wiz.png")); //$NON-NLS-1$
    setNeedsProgressMonitor(true);

}
 
Example 22
Project: team-explorer-everywhere   File: GitMavenBuildWizard.java   Source Code and License 5 votes vote down vote up
@Override
public void init(final IBuildDefinition buildDefinition) {
    this.buildDefinition = buildDefinition;
    setWindowTitle(Messages.getString("V2MavenBuildWizard.WindowTitle")); //$NON-NLS-1$
    setDefaultPageImageDescriptor(
        AbstractUIPlugin.imageDescriptorFromPlugin(TFSTeamBuildPlugin.PLUGIN_ID, "icons/build_wiz.png")); //$NON-NLS-1$
    setNeedsProgressMonitor(true);
}
 
Example 23
Project: team-explorer-everywhere   File: V2MavenBuildWizard.java   Source Code and License 5 votes vote down vote up
@Override
public void init(final IBuildDefinition buildDefinition) {
    this.buildDefinition = buildDefinition;
    setWindowTitle(Messages.getString("V2MavenBuildWizard.WindowTitle")); //$NON-NLS-1$
    setDefaultPageImageDescriptor(
        AbstractUIPlugin.imageDescriptorFromPlugin(TFSTeamBuildPlugin.PLUGIN_ID, "icons/build_wiz.png")); //$NON-NLS-1$
    setNeedsProgressMonitor(true);
}
 
Example 24
Project: team-explorer-everywhere   File: BuildExplorer.java   Source Code and License 5 votes vote down vote up
public BuildExplorer() {
    super();
    queuedPageImage = AbstractUIPlugin.imageDescriptorFromPlugin(
        TFSTeamBuildPlugin.PLUGIN_ID,
        "/icons/BuildStatusNotStarted.gif").createImage(); //$NON-NLS-1$
    completedPageImage = AbstractUIPlugin.imageDescriptorFromPlugin(
        TFSTeamBuildPlugin.PLUGIN_ID,
        "/icons/BuildStatusPartial.gif").createImage(); //$NON-NLS-1$

    refreshAction = new RefreshBuildExplorerAction();
    instance = this;
}
 
Example 25
Project: ftc   File: FtcCompletionProcessor.java   Source Code and License 5 votes vote down vote up
@Override
protected Image getImage(Template template) {
	ImageRegistry registry = FtcPlugin.getDefault().getImageRegistry();
	Image image = registry.get(TEMPLATE_IMAGE);
	if (image == null) {
		ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(PluginConst.PLUGIN_NAME, TEMPLATE_IMAGE);
		registry.put(TEMPLATE_IMAGE, desc);
		image = registry.get(TEMPLATE_IMAGE);

	}
	return image;
}
 
Example 26
Project: mesfavoris   File: AbstractImportTeamProject.java   Source Code and License 5 votes vote down vote up
@Override
public void setInitializationData(IConfigurationElement config,
		String propertyName, Object data) throws CoreException {
	String iconResource = config.getAttribute("icon");
	this.imageDescriptor = iconResource == null ? null : AbstractUIPlugin
			.imageDescriptorFromPlugin(config.getDeclaringExtension().getContributor().getName(), iconResource);
}
 
Example 27
Project: mesfavoris   File: RemoteBookmarkStoreDescriptor.java   Source Code and License 5 votes vote down vote up
public RemoteBookmarkStoreDescriptor(String id,
		String label, String iconResource, String iconOverlayResource, String bundleSymbolicName) {
	this.id = id;
	this.label = label;
	this.imageDescriptor = iconResource == null ? null : AbstractUIPlugin
			.imageDescriptorFromPlugin(bundleSymbolicName, iconResource);
	this.imageOverlayDescriptor = iconOverlayResource == null ? null : AbstractUIPlugin
			.imageDescriptorFromPlugin(bundleSymbolicName, iconOverlayResource);
}
 
Example 28
Project: dsl-devkit   File: ConfigurableTemplateStore.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("PMD.ConstructorCallsOverridableMethod")
@Inject
public ConfigurableTemplateStore(final ContextTypeRegistry registry, final IPreferenceStore store, @Named(Constants.LANGUAGE_NAME) final String key, final AbstractUIPlugin plugin) {
  super(registry, store, key + ".templates"); //$NON-NLS-1$
  this.res = getTemplateFileURL(plugin);
  this.preferenceStore = store;
  this.key = key + ".sharedTemplates"; //$NON-NLS-1$
  try {
    load();
  } catch (IOException e) {
    LOG.error(e.getMessage(), e);
  }
}
 
Example 29
Project: eclipse-wtp-json   File: BowerEditorPluginImageHelper.java   Source Code and License 5 votes vote down vote up
/**
 * 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 30
Project: typescript.java   File: NPMEditorPluginImageHelper.java   Source Code and License 5 votes vote down vote up
/**
 * 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 31
Project: skin4eclipse   File: PresentationPlugin.java   Source Code and License 5 votes vote down vote up
/**
 * Returns an image descriptor for the image file at the given plug-in
 * relative path.
 *
 * @param path
 *            the path
 * @return the image descriptor
 */
public static ImageDescriptor getImageDescriptor(String path) {
    if (path == null) {
        return null;
    }
    ImageRegistry imageRegistry = getDefault().getImageRegistry();
    ImageDescriptor imageDescriptor = imageRegistry.getDescriptor(path);
    if (imageDescriptor == null) {
        imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(
                "de.loskutov.eclipseskins.extvs", path);
        imageRegistry.put(path, imageDescriptor);
    }
    return imageDescriptor;
}
 
Example 32
Project: org.csstudio.display.builder   File: DisplayEditorPart.java   Source Code and License 5 votes vote down vote up
private Menu createContextMenu(final Control parent)
{
    final MenuManager mm = new MenuManager();

    final Action execute = new ExecuteDisplayAction(this);

    final MenuManager morph = new MorphWidgetMenuSupport(editor).getMenuManager();

    final ImageDescriptor icon = AbstractUIPlugin.imageDescriptorFromPlugin(ModelPlugin.ID, "icons/display.png");
    final Action perspective = new OpenPerspectiveAction(icon, Messages.OpenEditorPerspective, EditorPerspective.ID);
    final Action reload = new ReloadDisplayAction(this);

    mm.setRemoveAllWhenShown(true);
    mm.addMenuListener(manager ->
    {
        manager.add(execute);

        final List<Widget> selection = editor.getWidgetSelectionHandler().getSelection();
        if (! selection.isEmpty())
        {
            if (selection.size() > 1)
                manager.add(new CreateGroupAction(editor, selection));
            if (selection.size() == 1  &&  selection.get(0) instanceof GroupWidget)
                manager.add(new RemoveGroupAction(editor, (GroupWidget)selection.get(0)));
            if (selection.size() == 1  &&  selection.get(0) instanceof EmbeddedDisplayWidget)
                manager.add(new EditEmbeddedDisplayAction((EmbeddedDisplayWidget)selection.get(0)));
            manager.add(morph);
        }

        manager.add(reload);

        final DisplayModel model = editor.getModel();
        if (model != null  &&  !model.isClassModel())
            manager.add(new ReloadClassesAction(this));

        manager.add(perspective);
    });

    return mm.createContextMenu(parent);
}
 
Example 33
Project: bts   File: XtextTemplateStore.java   Source Code and License 5 votes vote down vote up
@Inject
public XtextTemplateStore(ContextTypeRegistry registry, IPreferenceStore store, @Named(Constants.LANGUAGE_NAME) String key,
		AbstractUIPlugin plugin) {
	super(registry, store, key + ".templates");
	res = getTemplateFileURL(plugin);
	try {
		load();
	} catch (IOException e) {
		log.error(e.getMessage(), e);
	}
}
 
Example 34
Project: pep-tools   File: ShowPluginsAction.java   Source Code and License 5 votes vote down vote up
public ShowPluginsAction(ConfigurableViewer configurableViewer) {
	super("", AS_CHECK_BOX);
	this.configurableViewer = configurableViewer;

	setToolTipText("Show Included Plugins and Fragments");
	setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(FeatureExplorerConstants.PLUGIN_ID,
			"icons/plugins_and_fragments.gif"));
}
 
Example 35
Project: dockerfoundry   File: DockerFoundryImages.java   Source Code and License 5 votes vote down vote up
public static ImageDescriptor getWizardBanner(String serverTypeId) {
	IConfigurationElement config = DockerFoundryBrandingExtensionPoint.getConfigurationElement(serverTypeId);
	String wizBanner = DockerFoundryBrandingExtensionPoint.getWizardBannerPath(serverTypeId);
	if (config != null && wizBanner != null && wizBanner.trim().length() > 0) {
		String bundle = config.getContributor().getName();
		return AbstractUIPlugin.imageDescriptorFromPlugin(bundle, wizBanner);
	}
	return null;
}
 
Example 36
Project: eclipse-wtp-json   File: NPMEditorPluginImageHelper.java   Source Code and License 5 votes vote down vote up
/**
 * 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 37
Project: bpm-beans   File: RuleBeansIcons.java   Source Code and License 5 votes vote down vote up
private static ImageDescriptor loadIcon(String name)
{
  try
  {
    if (!PlatformUI.isWorkbenchRunning())
    {
      return NO_IMAGE;
    }
  } catch (Throwable ex)
  {
    return NO_IMAGE;
  }
  return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, "icons/"+name);
}
 
Example 38
Project: umple   File: PreferenceFacade.java   Source Code and License 5 votes vote down vote up
private void init(AbstractUIPlugin activator)
{

  if (activator != null && activator.getBundle() != null)
  {
    _preferences = activator.getPreferenceStore();
  }
  else
  {
    _preferences = null;
  }

  _allPreferences = new Hashtable<String, String>();
  _defaultPreferences = new Hashtable<String, String>();
}
 
Example 39
Project: eclipse-wtp-json   File: SortAction.java   Source Code and License 5 votes vote down vote up
public SortAction(TreeViewer viewer, IPreferenceStore store,
		String preferenceKey) {
	super(JSONUIMessages.SortAction_0, store, preferenceKey, false); //$NON-NLS-1$
	ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(
			JSONUIPlugin.PLUGIN_ID, JSONEditorPluginImages.IMG_OBJ_SORT);
	setImageDescriptor(desc);
	setToolTipText(getText());
	treeViewer = viewer;
	if (isChecked()) {
		treeViewer.setComparator(new ViewerComparator());
	}
}
 
Example 40
Project: PDFReporter-Studio   File: ExportDataAdapterAction.java   Source Code and License 5 votes vote down vote up
public ExportDataAdapterAction(TreeViewer treeViewer) {
	super();
	setId(ID);
	this.treeViewer = treeViewer;
	setText(Messages.ExportDataAdapterAction_exportName);
	setDescription(Messages.ExportDataAdapterAction_exportDescription);
	setToolTipText(Messages.ExportDataAdapterAction_exportTooltip);
	setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
			"org.eclipse.ui", "$nl$/icons/full/etool16/export_wiz.gif")); //$NON-NLS-1$ //$NON-NLS-2$
	setDisabledImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
			"org.eclipse.ui", "$nl$/icons/full/dtool16/export_wiz.gif")); //$NON-NLS-1 //$NON-NLS-1$ //$NON-NLS-2$

}