1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 06:32:10 +02:00

Update to fill out the LaunchImage class which was not loading images.

This commit is contained in:
Thomas Fletcher 2003-07-09 21:51:48 +00:00
parent d71d9270d8
commit c52d8ebf71
9 changed files with 88 additions and 12 deletions

View file

@ -1,3 +1,7 @@
2003-07-09 David Inglis
* src/org/eclipse/cdt/launch/internal/ui/LaunchImages.java
Filled out this class which previously wasn't loading images ... now it is.
2003-07-03 David Inglis
* src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
* src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java

View file

Before

Width:  |  Height:  |  Size: 108 B

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

View file

@ -1,5 +1,11 @@
package org.eclipse.cdt.launch.internal.ui;
import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
/*
@ -7,18 +13,72 @@ import org.eclipse.swt.graphics.Image;
* All Rights Reserved.
*/
public class LaunchImages {
public static String IMG_VIEW_ARGUMENTS_TAB = "";
public static String IMG_VIEW_ENVIRONMENT_TAB = "";
public static String IMG_VIEW_MAIN_TAB = "";
public static String IMG_VIEW_DEBUGGER_TAB = "";
private static final String NAME_PREFIX= LaunchUIPlugin.PLUGIN_ID + '.';
private static final int NAME_PREFIX_LENGTH= NAME_PREFIX.length();
// The plugin registry
private static ImageRegistry imageRegistry = new ImageRegistry();
/**
* Method get.
* @param string
* @return Image
*/
public static Image get(String string) {
return null;
// Subdirectory (under the package containing this class) where 16 color images are
private static URL fgIconBaseURL;
static {
try {
fgIconBaseURL= new URL(LaunchUIPlugin.getDefault().getDescriptor().getInstallURL(), "icons/" );
} catch (MalformedURLException e) {
//LaunchUIPlugin.getDefault().log(e);
}
}
private static final String T_TABS = "tabs/";
public static String IMG_VIEW_MAIN_TAB = NAME_PREFIX + "main_tab.gif";
public static String IMG_VIEW_ARGUMENTS_TAB = NAME_PREFIX + "arguments_tab.gif";
public static String IMG_VIEW_ENVIRONMENT_TAB = NAME_PREFIX + "environment_tab.gif";
public static String IMG_VIEW_DEBUGGER_TAB = NAME_PREFIX + "debugger_tab.gif";
public static String IMG_VIEW_SOURCE_TAB = NAME_PREFIX + "source_tab.gif";
public static final ImageDescriptor DESC_TAB_MAIN= createManaged(T_TABS, IMG_VIEW_MAIN_TAB);
public static final ImageDescriptor DESC_TAB_ARGUMENTS = createManaged(T_TABS, IMG_VIEW_ARGUMENTS_TAB);
public static final ImageDescriptor DESC_TAB_ENVIRONMENT = createManaged(T_TABS, IMG_VIEW_ENVIRONMENT_TAB);
public static final ImageDescriptor DESC_TAB_DEBUGGER = createManaged(T_TABS, IMG_VIEW_DEBUGGER_TAB);
public static final ImageDescriptor DESC_TAB_SOURCE = createManaged(T_TABS, IMG_VIEW_SOURCE_TAB);
public static void initialize() {
}
private static ImageDescriptor createManaged(String prefix, String name) {
return createManaged(imageRegistry, prefix, name);
}
private static ImageDescriptor createManaged(ImageRegistry registry, String prefix, String name) {
ImageDescriptor result= ImageDescriptor.createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
registry.put(name, result);
return result;
}
public static Image get(String key) {
return imageRegistry.get(key);
}
private static ImageDescriptor create(String prefix, String name) {
return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
}
private static URL makeIconFileURL(String prefix, String name) {
StringBuffer buffer= new StringBuffer(prefix);
buffer.append(name);
try {
return new URL(fgIconBaseURL, buffer.toString());
} catch (MalformedURLException e) {
CUIPlugin.getDefault().log(e);
return null;
}
}
/**
* Helper method to access the image registry from the JavaPlugin class.
*/
static ImageRegistry getImageRegistry() {
return imageRegistry;
}
}

View file

@ -23,6 +23,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
*/
public class LaunchUIPlugin extends AbstractUIPlugin
implements IDebugEventSetListener {
public static final String PLUGIN_ID = "org.eclipse.cdt.launch";
/**
* Launch UI plug-in instance
@ -173,6 +174,7 @@ public class LaunchUIPlugin extends AbstractUIPlugin
public void startup() throws CoreException {
super.startup();
DebugPlugin.getDefault().addDebugEventListener(this);
LaunchImages.initialize();
}
/**

View file

@ -8,6 +8,7 @@ package org.eclipse.cdt.launch.ui;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.ui.sourcelookup.SourceLookupBlock;
import org.eclipse.cdt.launch.internal.ui.LaunchImages;
import org.eclipse.cdt.launch.sourcelookup.DefaultSourceLocator;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
@ -15,6 +16,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@ -115,6 +117,13 @@ public class CSourceLookupTab extends CLaunchConfigurationTab
return "Source";
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
*/
public Image getImage() {
return LaunchImages.get(LaunchImages.IMG_VIEW_SOURCE_TAB);
}
private IProject getProject( ILaunchConfiguration configuration )
{
IProject project = null;
@ -134,4 +143,5 @@ public class CSourceLookupTab extends CLaunchConfigurationTab
{
return string == null || string.length() == 0;
}
}