EclipseJDT ASTViewer Source Viewer

Home|eclipse_jdt_astviewer/src/org/eclipse/jdt/astview/ASTViewImages.java
1/*******************************************************************************
2 * Copyright (c) 2000, 2006 IBM Corporation and others.
3 *
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
8 *
9 * SPDX-License-Identifier: EPL-2.0
10 *
11 * Contributors:
12 *     IBM Corporation - initial API and implementation
13 *******************************************************************************/
14package org.eclipse.jdt.astview;
15
16import java.net.URL;
17
18import org.eclipse.core.runtime.FileLocator;
19import org.eclipse.core.runtime.IPath;
20import org.eclipse.core.runtime.Path;
21
22import org.eclipse.jface.action.IAction;
23import org.eclipse.jface.resource.ImageDescriptor;
24
25import org.osgi.framework.Bundle;
26
27public class ASTViewImages {
28
29    private static final IPath ICONS_PATH= new Path("$nl$/icons"); //$NON-NLS-1$
30
31    public static final String COLLAPSE"collapseall.png"//$NON-NLS-1$
32    public static final String EXPAND"expandall.png"//$NON-NLS-1$
33    public static final String LINK_WITH_EDITOR"synced.png"//$NON-NLS-1$
34
35    public static final String SETFOCUS"setfocus.png"//$NON-NLS-1$
36    public static final String REFRESH"refresh.png"//$NON-NLS-1$
37    public static final String CLEAR"clear.png"//$NON-NLS-1$
38
39    public static final String ADD_TO_TRAY"add.png"//$NON-NLS-1$
40
41    //---- Helper methods to access icons on the file system --------------------------------------
42
43    public static void setImageDescriptors(IAction actionString type) {
44        ImageDescriptor idcreate("d"type); //$NON-NLS-1$
45        if (id != null)
46            action.setDisabledImageDescriptor(id);
47
48        idcreate("e"type); //$NON-NLS-1$
49        if (id != null) {
50            action.setHoverImageDescriptor(id);
51            action.setImageDescriptor(id);
52        } else {
53            action.setImageDescriptor(ImageDescriptor.getMissingImageDescriptor());
54        }
55    }
56
57    private static ImageDescriptor create(String prefixString name) {
58        IPath pathICONS_PATH.append(prefix).append(name);
59        return createImageDescriptor(ASTViewPlugin.getDefault().getBundle(), path);
60    }
61
62    /*
63     * Since 3.1.1. Load from icon paths with $NL$
64     */
65    public static ImageDescriptor createImageDescriptor(Bundle bundleIPath path) {
66        URL urlFileLocator.find(bundlepathnull);
67        if (url != null) {
68            return ImageDescriptor.createFromURL(url);
69        }
70        return null;
71    }
72
73    private ASTViewImages() {
74    }
75}
76
MembersX
ASTViewImages:SETFOCUS
ASTViewImages:CLEAR
ASTViewImages:ASTViewImages
ASTViewImages:create
ASTViewImages:createImageDescriptor
ASTViewImages:ICONS_PATH
ASTViewImages:REFRESH
ASTViewImages:LINK_WITH_EDITOR
ASTViewImages:ADD_TO_TRAY
ASTViewImages:create:Block:path
ASTViewImages:setImageDescriptors
ASTViewImages:COLLAPSE
ASTViewImages:setImageDescriptors:Block:id
ASTViewImages:EXPAND
ASTViewImages:createImageDescriptor:Block:url
Members
X