[AsnEditor-CVS] ASN1EditorPlugin/javasrc/net/sourceforge/asneditor/ui ASNPluginImages.java,NONE,1.1,
Brought to you by:
bogdans10
From: Bogdan S. <bog...@us...> - 2005-05-05 18:12:34
|
Update of /cvsroot/asneditor/ASN1EditorPlugin/javasrc/net/sourceforge/asneditor/ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29879/javasrc/net/sourceforge/asneditor/ui Added Files: ASNPluginImages.java Log Message: new outline icons --- NEW FILE: ASNPluginImages.java --- package net.sourceforge.asneditor.ui; import java.io.File; import java.io.IOException; import java.net.URL; import net.sourceforge.asneditor.ASNEditorPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.jface.action.IAction; import org.eclipse.jface.resource.ImageDescriptor; import org.osgi.framework.Bundle; /** * Created by Bogdan Stanca (bo...@st...) * Boss Data System * http://www.stanca.de/boss */ public class ASNPluginImages { public static final String ICONS_FOLDER = "icons"; public static final String TOOL_FOLDER = "full/elcl16/"; public static final String OBJ_FOLDER = "full/obj16/"; public static final String TOOL_REFRESH = TOOL_FOLDER+"refresh.gif"; public static final String TOOL_COLLAPSE_ALL = TOOL_FOLDER+"collapse.gif"; public static final String TOOL_EXPAND_ALL = TOOL_FOLDER+"expandall.gif"; public static final String OBJS_MODULE = OBJ_FOLDER+"module_obj.gif"; public static final String OBJS_IMPDECL = OBJ_FOLDER+"imp_obj.gif"; public static final String OBJS_IMPCONT = OBJ_FOLDER+"impc_obj.gif"; public static final String OBJS_EXPDECL = OBJ_FOLDER+"exp_obj.gif"; public static final String OBJS_EXPCONT = OBJ_FOLDER+"expc_obj.gif"; public static final ImageDescriptor DESC_OBJS_MODULE = getImageDescriptor(OBJS_MODULE); public static final ImageDescriptor DESC_OBJS_IMPDECL = getImageDescriptor(OBJS_IMPDECL); public static final ImageDescriptor DESC_OBJS_IMPCONT = getImageDescriptor(OBJS_IMPCONT); public static final ImageDescriptor DESC_OBJS_EXPDECL = getImageDescriptor(OBJS_EXPDECL); public static final ImageDescriptor DESC_OBJS_EXPCONT = getImageDescriptor(OBJS_EXPCONT); private static File getRelativePath(IPath relative) throws CoreException { Bundle bundle = ASNEditorPlugin.getDefault().getBundle(); URL bundleURL = Platform.find(bundle, relative); URL fileURL; try { fileURL = Platform.asLocalURL(bundleURL); File f = new File(fileURL.getPath()); return f; } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, ASNEditorPlugin.class.toString(), IStatus.ERROR, "Can't find python debug script", null)); } } public static File getIconPath(String icon) throws CoreException { IPath relative = new Path(ICONS_FOLDER).addTrailingSeparator().append(icon); return getRelativePath(relative); } public static void setImageDescriptors(IAction action, String iconRelativePath) { ImageDescriptor id = getImageDescriptor(iconRelativePath); if (id != null) { action.setDisabledImageDescriptor(id); action.setHoverImageDescriptor(id); action.setImageDescriptor(id); } } /** * @param iconRelativePath * @return */ public static ImageDescriptor getImageDescriptor(String iconRelativePath) { ImageDescriptor id; try { final File iconFile = getIconPath(iconRelativePath); id = ImageDescriptor.createFromURL(iconFile.toURL()); //$NON-NLS-1$ } catch (Exception e) { id = ImageDescriptor.getMissingImageDescriptor(); } return id; } /** * @param action * @param iconName */ void setToolImageDescriptors(IAction action, String iconName) { } } |