blob: fe3efdff8346551113a07d523dad528d872ca70a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/*******************************************************************************
* Copyright (c) 2007, 2016 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.ui;
import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
/**
* @author Doug Schaefer
*
*/
public class GDBJtagImages {
private static ImageRegistry imageRegistry = new ImageRegistry();
private static URL iconBaseURL = Activator.getDefault().getBundle().getEntry("/icons/"); //$NON-NLS-1$
private static final String NAME_PREFIX = Activator.PLUGIN_ID + '.';
private static final String T_TABS = "view16/"; //$NON-NLS-1$
private static final String IMG_VIEW_DEBUGGER_TAB = NAME_PREFIX + "debugger_tab.gif"; //$NON-NLS-1$
private static final String IMG_VIEW_STARTUP_TAB = NAME_PREFIX + "startup_tab.gif"; //$NON-NLS-1$
public static Image getDebuggerTabImage() {
return imageRegistry.get(IMG_VIEW_DEBUGGER_TAB);
}
public static Image getStartupTabImage() {
return imageRegistry.get(IMG_VIEW_STARTUP_TAB);
}
static {
createManaged(T_TABS, IMG_VIEW_DEBUGGER_TAB);
createManaged(T_TABS, IMG_VIEW_STARTUP_TAB);
}
private static void createManaged(String prefix, String name) {
imageRegistry.put(name,
ImageDescriptor.createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX.length()))));
}
private static URL makeIconFileURL(String prefix, String name) {
StringBuilder buffer = new StringBuilder(prefix);
buffer.append(name);
try {
return new URL(iconBaseURL, buffer.toString());
} catch (MalformedURLException e) {
Activator.log(e);
return null;
}
}
}
|