Search in sources :

Example 46 with ImageDescriptor

use of org.eclipse.jface.resource.ImageDescriptor in project bndtools by bndtools.

the class Activator method loadBundleImages.

private static void loadBundleImages(ImageRegistry reg, String rootPath, String parent, String filePattern) {
    Enumeration<URL> en = plugin.getBundle().findEntries(rootPath + "/" + parent, filePattern, false);
    if (en == null) {
        return;
    }
    while (en.hasMoreElements()) {
        URL url = en.nextElement();
        String name = getResourceName(url);
        ImageDescriptor id = ImageDescriptor.createFromURL(url);
        //$NON-NLS-1$
        reg.put(parent + "_" + name, id);
    }
}
Also used : ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) URL(java.net.URL)

Example 47 with ImageDescriptor

use of org.eclipse.jface.resource.ImageDescriptor in project bndtools by bndtools.

the class OverlayImageDescriptor method drawCompositeImage.

@Override
protected void drawCompositeImage(int width, int height) {
    Image id = reg.get(baseImage);
    // Draw the base image using the base image's image data
    drawImage(id.getImageData(), 0, 0);
    // Overlaying the icon in the top left corner i.e. x and y
    // coordinates are both zero
    ImageDescriptor imgDescr = reg.getDescriptor(overlayImage);
    if (imgDescr == null) {
        return;
    }
    drawImage(imgDescr.getImageData(), xValue, yValue);
}
Also used : CompositeImageDescriptor(org.eclipse.jface.resource.CompositeImageDescriptor) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) Image(org.eclipse.swt.graphics.Image)

Example 48 with ImageDescriptor

use of org.eclipse.jface.resource.ImageDescriptor in project che by eclipse.

the class ParameterGuesser method evaluateVisibleMatches.

private List<Variable> evaluateVisibleMatches(String expectedType, IJavaElement[] suggestions) throws JavaModelException {
    IType currentType = null;
    if (fEnclosingElement != null) {
        currentType = (IType) fEnclosingElement.getAncestor(IJavaElement.TYPE);
    }
    ArrayList<Variable> res = new ArrayList<Variable>();
    for (int i = 0; i < suggestions.length; i++) {
        Variable variable = createVariable(suggestions[i], currentType, expectedType, i);
        if (variable != null) {
            if (fAlreadyMatchedNames.contains(variable.name)) {
                variable.alreadyMatched = true;
            }
            res.add(variable);
        }
    }
    // add 'this'
    if (currentType != null && !(fEnclosingElement instanceof IMethod && Flags.isStatic(((IMethod) fEnclosingElement).getFlags()))) {
        String fullyQualifiedName = currentType.getFullyQualifiedName('.');
        if (fullyQualifiedName.equals(expectedType)) {
            ImageDescriptor desc = new JavaElementImageDescriptor(JavaPluginImages.DESC_FIELD_PUBLIC, JavaElementImageDescriptor.FINAL | JavaElementImageDescriptor.STATIC);
            res.add(new Variable(fullyQualifiedName, "this", Variable.LITERALS, false, res.size(), new char[] { '.' }, //$NON-NLS-1$
            desc));
        }
    }
    Code primitiveTypeCode = getPrimitiveTypeCode(expectedType);
    if (primitiveTypeCode == null) {
        // add 'null'
        //$NON-NLS-1$
        res.add(new Variable(expectedType, "null", Variable.LITERALS, false, res.size(), NO_TRIGGERS, null));
    } else {
        String typeName = primitiveTypeCode.toString();
        boolean isAutoboxing = !typeName.equals(expectedType);
        if (primitiveTypeCode == PrimitiveType.BOOLEAN) {
            // add 'true', 'false'
            //$NON-NLS-1$
            res.add(new Variable(typeName, "true", Variable.LITERALS, isAutoboxing, res.size(), NO_TRIGGERS, null));
            //$NON-NLS-1$
            res.add(new Variable(typeName, "false", Variable.LITERALS, isAutoboxing, res.size(), NO_TRIGGERS, null));
        } else {
            // add 0
            //$NON-NLS-1$
            res.add(new Variable(typeName, "0", Variable.LITERALS, isAutoboxing, res.size(), NO_TRIGGERS, null));
        }
    }
    return res;
}
Also used : ILocalVariable(org.eclipse.jdt.core.ILocalVariable) ArrayList(java.util.ArrayList) JavaElementImageDescriptor(org.eclipse.jdt.ui.JavaElementImageDescriptor) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) IMethod(org.eclipse.jdt.core.IMethod) Code(org.eclipse.jdt.core.dom.PrimitiveType.Code) JavaElementImageDescriptor(org.eclipse.jdt.ui.JavaElementImageDescriptor) IType(org.eclipse.jdt.core.IType)

Example 49 with ImageDescriptor

use of org.eclipse.jface.resource.ImageDescriptor in project che by eclipse.

the class ParameterGuesser method getImageDescriptor.

private ImageDescriptor getImageDescriptor(IJavaElement elem) {
    JavaElementImageProvider imageProvider = new JavaElementImageProvider();
    ImageDescriptor desc = imageProvider.getBaseImageDescriptor(elem, JavaElementImageProvider.OVERLAY_ICONS);
    imageProvider.dispose();
    return desc;
}
Also used : JavaElementImageDescriptor(org.eclipse.jdt.ui.JavaElementImageDescriptor) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) JavaElementImageProvider(org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider)

Example 50 with ImageDescriptor

use of org.eclipse.jface.resource.ImageDescriptor in project che by eclipse.

the class JavaElementImageProvider method getJavaImageDescriptor.

//	/**
//	 * Returns an image descriptor for a compilation unit not on the class path.
//	 * The descriptor includes overlays, if specified.
//	 * @param file the cu resource file
//	 * @param flags the image flags
//	 * @return returns the image descriptor
//	 */
//	public ImageDescriptor getCUResourceImageDescriptor(IFile file, int flags) {
//		Point size = useSmallSize(flags) ? SMALL_SIZE : BIG_SIZE;
//		return new JavaElementImageDescriptor(JavaPluginImages.DESC_OBJS_CUNIT_RESOURCE, 0, size);
//	}
/**
	 * Returns an image descriptor for a java element. The descriptor includes overlays, if specified.
	 * @param element the Java element
	 * @param flags the image flags
	 * @return returns the image descriptor
	 */
public ImageDescriptor getJavaImageDescriptor(IJavaElement element, int flags) {
    Point size = useSmallSize(flags) ? SMALL_SIZE : BIG_SIZE;
    ImageDescriptor baseDesc = getBaseImageDescriptor(element, flags);
    if (baseDesc != null) {
        int adornmentFlags = computeJavaAdornmentFlags(element, flags);
        return new JavaElementImageDescriptor(baseDesc, adornmentFlags);
    }
    return new JavaElementImageDescriptor(JavaPluginImages.DESC_OBJS_GHOST, 0);
}
Also used : JavaElementImageDescriptor(org.eclipse.jdt.ui.JavaElementImageDescriptor) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) Point(org.eclipse.swt.graphics.Point) Point(org.eclipse.swt.graphics.Point) JavaElementImageDescriptor(org.eclipse.jdt.ui.JavaElementImageDescriptor)

Aggregations

ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)106 Image (org.eclipse.swt.graphics.Image)25 ArrayList (java.util.ArrayList)21 List (java.util.List)18 ToolEntry (org.eclipse.gef.palette.ToolEntry)14 URL (java.net.URL)12 ImageData (org.eclipse.swt.graphics.ImageData)11 ResourceImageDescriptor (de.jaret.util.ui.ResourceImageDescriptor)9 Point (org.eclipse.swt.graphics.Point)6 Node (org.talend.designer.core.ui.editor.nodes.Node)6 Path (org.eclipse.core.runtime.Path)5 JavaElementImageDescriptor (org.eclipse.jdt.ui.JavaElementImageDescriptor)5 File (java.io.File)4 HashMap (java.util.HashMap)4 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)4 IComponent (org.talend.core.model.components.IComponent)4 INode (org.talend.core.model.process.INode)4 MalformedURLException (java.net.MalformedURLException)3 Set (java.util.Set)3 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)3