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);
}
}
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);
}
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;
}
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;
}
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);
}
Aggregations