~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ManagedBuilderUIImages.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2011-10-06 21:15:04 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111006211504-8dutmljjih0zikfv
Tags: 8.0.1-1
* New upstream release.
* Split the JNI packages into a separate architecture dependent
  package and made eclipse-cdt architecture independent.
* Install JNI libraries into multiarch aware location
* Bumped Standards-Version to 3.9.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
 * Copyright (c) 2002, 2011 Rational Software Corporation and others.
 
3
 * All rights reserved. This program and the accompanying materials
 
4
 * are made available under the terms of the Eclipse Public License v1.0
 
5
 * which accompanies this distribution, and is available at
 
6
 * http://www.eclipse.org/legal/epl-v10.html
 
7
 *
 
8
 * Contributors:
 
9
 * IBM Rational Software - Initial API and implementation
 
10
 *******************************************************************************/
 
11
package org.eclipse.cdt.managedbuilder.ui.properties;
 
12
 
 
13
 
 
14
import java.net.MalformedURLException;
 
15
import java.net.URL;
 
16
 
 
17
import org.eclipse.core.runtime.Platform;
 
18
import org.eclipse.jface.resource.ImageDescriptor;
 
19
import org.eclipse.jface.resource.ImageRegistry;
 
20
import org.eclipse.swt.graphics.Image;
 
21
 
 
22
 
 
23
/**
 
24
 * Bundle of all images used by the C plugin.
 
25
 * 
 
26
 * @noextend This class is not intended to be subclassed by clients.
 
27
 * @noinstantiate This class is not intended to be instantiated by clients.
 
28
 */
 
29
public class ManagedBuilderUIImages {
 
30
        
 
31
        // The plugin registry
 
32
        private static ImageRegistry imageRegistry = new ImageRegistry();
 
33
 
 
34
        // Subdirectory (under the package containing this class) where 16 color images are
 
35
        private static URL iconBaseURL = null;
 
36
        static {
 
37
                iconBaseURL = Platform.getBundle(ManagedBuilderUIPlugin.getUniqueIdentifier()).getEntry("icons/"); //$NON-NLS-1$
 
38
        }       
 
39
 
 
40
        private static final String NAME_PREFIX= ManagedBuilderUIPlugin.getUniqueIdentifier() + '.';
 
41
        private static final int NAME_PREFIX_LENGTH= NAME_PREFIX.length();
 
42
 
 
43
        public static final String T_BUILD= "elcl16/"; //$NON-NLS-1$
 
44
        // list icons dir
 
45
        public static final String T_LIST= "elcl16/"; //$NON-NLS-1$
 
46
        public static final String T_OBJ= "obj16/"; //$NON-NLS-1$
 
47
 
 
48
 
 
49
        // For the managed build images
 
50
        public static final String IMG_BUILD_CONFIG = NAME_PREFIX + "build_configs.gif"; //$NON-NLS-1$
 
51
        public static final ImageDescriptor DESC_BUILD_CONFIG = createManaged(T_BUILD, IMG_BUILD_CONFIG);
 
52
        public static final String IMG_BUILD_COMPILER = NAME_PREFIX + "config-compiler.gif"; //$NON-NLS-1$
 
53
        public static final ImageDescriptor DESC_BUILD_COMPILER = createManaged(T_BUILD, IMG_BUILD_COMPILER);
 
54
        public static final String IMG_BUILD_LINKER = NAME_PREFIX + "config-linker.gif"; //$NON-NLS-1$
 
55
        public static final ImageDescriptor DESC_BUILD_LINKER = createManaged(T_BUILD, IMG_BUILD_LINKER);
 
56
        public static final String IMG_BUILD_LIBRARIAN = NAME_PREFIX + "config-librarian.gif"; //$NON-NLS-1$
 
57
        public static final ImageDescriptor DESC_BUILD_LIBRARIAN = createManaged(T_BUILD, IMG_BUILD_LIBRARIAN);
 
58
        public static final String IMG_BUILD_COMMAND = NAME_PREFIX + "config-command.gif"; //$NON-NLS-1$
 
59
        public static final ImageDescriptor DESC_BUILD_COMMAND = createManaged(T_BUILD, IMG_BUILD_COMMAND);
 
60
        public static final String IMG_BUILD_PREPROCESSOR = NAME_PREFIX + "config-preprocessor.gif"; //$NON-NLS-1$
 
61
        public static final ImageDescriptor DESC_BUILD_PREPROCESSOR = createManaged(T_BUILD, IMG_BUILD_PREPROCESSOR);
 
62
        public static final String IMG_BUILD_TOOL = NAME_PREFIX + "config-tool.gif"; //$NON-NLS-1$
 
63
        public static final ImageDescriptor DESC_BUILD_TOOL = createManaged(T_BUILD, IMG_BUILD_TOOL);
 
64
        public static final String IMG_BUILD_CAT = NAME_PREFIX + "config-category.gif"; //$NON-NLS-1$
 
65
        public static final ImageDescriptor DESC_BUILD_CAT = createManaged(T_BUILD, IMG_BUILD_CAT);
 
66
        
 
67
        // new images 
 
68
        public static final String IMG_READ_ONLY = NAME_PREFIX + "read_only.gif"; //$NON-NLS-1$
 
69
        public static final ImageDescriptor DESC_READ_ONLY = createManaged(T_OBJ, IMG_READ_ONLY);
 
70
        public static final String IMG_EDITABLE = NAME_PREFIX + "editable.gif"; //$NON-NLS-1$
 
71
        public static final ImageDescriptor DESC_EDITABLE = createManaged(T_OBJ, IMG_EDITABLE);
 
72
        public static final String IMG_BUILT_IN = NAME_PREFIX + "built_in.gif"; //$NON-NLS-1$
 
73
        public static final ImageDescriptor DESC_BUILT_IN = createManaged(T_OBJ, IMG_BUILT_IN);
 
74
        
 
75
        // refresh policy tab
 
76
        /**
 
77
         * @since 8.0
 
78
         */
 
79
        public static final String IMG_FILE_OBJ = NAME_PREFIX + "file_obj.gif"; //$NON-NLS-1$
 
80
        /**
 
81
         * @since 8.0
 
82
         */
 
83
        public static final ImageDescriptor DESC_FILE_OBJ = createManaged(T_OBJ, IMG_FILE_OBJ);
 
84
        /**
 
85
         * @since 8.0
 
86
         */
 
87
        public static final String IMG_TEXTFILE_OBJ = NAME_PREFIX + "textfile_obj.gif"; //$NON-NLS-1$
 
88
        /**
 
89
         * @since 8.0
 
90
         */
 
91
        public static final ImageDescriptor DESC_TEXTFILE_OBJ = createManaged(T_OBJ, IMG_TEXTFILE_OBJ);
 
92
        /**
 
93
         * @since 8.0
 
94
         */
 
95
        public static final String IMG_FILE_FOLDER_OBJ = NAME_PREFIX + "fileFolder_obj.gif"; //$NON-NLS-1$
 
96
        /**
 
97
         * @since 8.0
 
98
         */
 
99
        public static final ImageDescriptor DESC_FILE_FOLDER_OBJ = createManaged(T_OBJ, IMG_FILE_FOLDER_OBJ);
 
100
        
 
101
        
 
102
        private static ImageDescriptor createManaged(String prefix, String name) {
 
103
                return createManaged(imageRegistry, prefix, name);
 
104
        }
 
105
        
 
106
        private static ImageDescriptor createManaged(ImageRegistry registry, String prefix, String name) {
 
107
                ImageDescriptor result= ImageDescriptor.createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
 
108
                registry.put(name, result);
 
109
                return result;
 
110
        }
 
111
        
 
112
        public static Image get(String key) {
 
113
                return imageRegistry.get(key);
 
114
        }
 
115
        
 
116
        private static URL makeIconFileURL(String prefix, String name) {
 
117
                StringBuffer buffer= new StringBuffer(prefix);
 
118
                buffer.append(name);
 
119
                try {
 
120
                        return new URL(iconBaseURL, buffer.toString());
 
121
                } catch (MalformedURLException e) {
 
122
                        ManagedBuilderUIPlugin.log(e);
 
123
                        return null;
 
124
                }
 
125
        }
 
126
        
 
127
        /**
 
128
         * Helper method to access the image registry from the JavaPlugin class.
 
129
         */
 
130
        static ImageRegistry getImageRegistry() {
 
131
                return imageRegistry;
 
132
        }
 
133
}