mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-02 14:45:25 +02:00
Bug 487471 - Improve look and feel of Launch Bar.
New icons that have transparent backgrounds and are 24 pixels square and have hot image counterparts. The Launch button now looks different enough to turn off the mode specific icons for now. Change-Id: Iaa8454ffde5e5c6660a5d0d144ae2af971a7b8c6
This commit is contained in:
parent
584728a7ae
commit
91369b4692
10 changed files with 45 additions and 13 deletions
2
bundles/org.eclipse.launchbar.ui/.options
Normal file
2
bundles/org.eclipse.launchbar.ui/.options
Normal file
|
@ -0,0 +1,2 @@
|
|||
org.eclipse.launchbar.ui/iconSize32=false
|
||||
org.eclipse.launchbar.ui/launchIconUpdater=false
|
BIN
bundles/org.eclipse.launchbar.ui/icons/build2_24.png
Normal file
BIN
bundles/org.eclipse.launchbar.ui/icons/build2_24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
bundles/org.eclipse.launchbar.ui/icons/build2_hot_24.png
Normal file
BIN
bundles/org.eclipse.launchbar.ui/icons/build2_hot_24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
bundles/org.eclipse.launchbar.ui/icons/launch2_24.png
Normal file
BIN
bundles/org.eclipse.launchbar.ui/icons/launch2_24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
bundles/org.eclipse.launchbar.ui/icons/launch2_hot_24.png
Normal file
BIN
bundles/org.eclipse.launchbar.ui/icons/launch2_hot_24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
bundles/org.eclipse.launchbar.ui/icons/stop2_24.png
Normal file
BIN
bundles/org.eclipse.launchbar.ui/icons/stop2_24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
bundles/org.eclipse.launchbar.ui/icons/stop2_hot_24.png
Normal file
BIN
bundles/org.eclipse.launchbar.ui/icons/stop2_hot_24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -19,6 +19,7 @@ import org.eclipse.core.commands.ParameterizedCommand;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.OperationCanceledException;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.resource.ImageRegistry;
|
||||
|
@ -43,10 +44,17 @@ public class Activator extends AbstractUIPlugin {
|
|||
// The plug-in ID
|
||||
public static final String PLUGIN_ID = "org.eclipse.launchbar.ui"; //$NON-NLS-1$
|
||||
|
||||
// Options
|
||||
public static final String OPTION_ICON_SIZE32 = Activator.PLUGIN_ID + "/iconSize32"; //$NON-NLS-1$
|
||||
public static final String OPTION_LAUNCH_ICON_UPDATER = Activator.PLUGIN_ID + "/launchIconUpdater"; //$NON-NLS-1$
|
||||
|
||||
// Images
|
||||
public static final String IMG_BUTTON_BUILD = "build"; //$NON-NLS-1$
|
||||
public static final String IMG_BUTTON_BUILD_HOT = "build.hot"; //$NON-NLS-1$
|
||||
public static final String IMG_BUTTON_LAUNCH = "launch"; //$NON-NLS-1$
|
||||
public static final String IMG_BUTTON_LAUNCH_HOT = "launch.hot"; //$NON-NLS-1$
|
||||
public static final String IMG_BUTTON_STOP = "stop"; //$NON-NLS-1$
|
||||
public static final String IMG_BUTTON_STOP_HOT = "stop.hot"; //$NON-NLS-1$
|
||||
public static final String IMG_LOCAL_TARGET = "localTarget"; //$NON-NLS-1$
|
||||
|
||||
// Command ids
|
||||
|
@ -72,19 +80,33 @@ public class Activator extends AbstractUIPlugin {
|
|||
public Activator() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
plugin = this;
|
||||
|
||||
ImageRegistry imageRegistry = getImageRegistry();
|
||||
imageRegistry.put(IMG_BUTTON_BUILD, imageDescriptorFromPlugin(PLUGIN_ID, "icons/build.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_LAUNCH, imageDescriptorFromPlugin(PLUGIN_ID, "icons/launch.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_STOP, imageDescriptorFromPlugin(PLUGIN_ID, "icons/stop.png")); //$NON-NLS-1$
|
||||
if ("true".equals(Platform.getDebugOption(OPTION_ICON_SIZE32))) { //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_BUILD, imageDescriptorFromPlugin(PLUGIN_ID, "icons/build.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_BUILD_HOT, imageDescriptorFromPlugin(PLUGIN_ID, "icons/build.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_LAUNCH, imageDescriptorFromPlugin(PLUGIN_ID, "icons/launch.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_LAUNCH_HOT, imageDescriptorFromPlugin(PLUGIN_ID, "icons/launch.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_STOP, imageDescriptorFromPlugin(PLUGIN_ID, "icons/stop.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_STOP_HOT, imageDescriptorFromPlugin(PLUGIN_ID, "icons/stop.png")); //$NON-NLS-1$
|
||||
} else {
|
||||
imageRegistry.put(IMG_BUTTON_BUILD, imageDescriptorFromPlugin(PLUGIN_ID, "icons/build2_24.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_BUILD_HOT, imageDescriptorFromPlugin(PLUGIN_ID, "icons/build2_hot_24.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_LAUNCH, imageDescriptorFromPlugin(PLUGIN_ID, "icons/launch2_24.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_LAUNCH_HOT, imageDescriptorFromPlugin(PLUGIN_ID, "icons/launch2_hot_24.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_STOP, imageDescriptorFromPlugin(PLUGIN_ID, "icons/stop2_24.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_STOP_HOT, imageDescriptorFromPlugin(PLUGIN_ID, "icons/stop2_hot_24.png")); //$NON-NLS-1$
|
||||
}
|
||||
imageRegistry.put(IMG_LOCAL_TARGET, imageDescriptorFromPlugin(PLUGIN_ID, "icons/localTarget.png")); //$NON-NLS-1$
|
||||
|
||||
context.registerService(ILaunchTargetUIManager.class, new LaunchTargetUIManager(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
super.stop(context);
|
||||
|
@ -124,12 +146,10 @@ public class Activator extends AbstractUIPlugin {
|
|||
}
|
||||
|
||||
public static void runCommand(String commandId, String... params) {
|
||||
final ICommandService commandService = (ICommandService) PlatformUI.getWorkbench()
|
||||
.getService(ICommandService.class);
|
||||
final ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
|
||||
Command command = commandService.getCommand(commandId);
|
||||
final Event trigger = new Event();
|
||||
final IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench()
|
||||
.getService(IHandlerService.class);
|
||||
final IHandlerService handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class);
|
||||
ExecutionEvent executionEvent = handlerService.createExecutionEvent(command, trigger);
|
||||
if (params.length == 0) {
|
||||
try {
|
||||
|
|
|
@ -65,9 +65,12 @@ public class LaunchBarControl implements ILaunchBarListener {
|
|||
});
|
||||
|
||||
ToolBar toolBar = new ToolBar(container, SWT.FLAT);
|
||||
createButton(toolBar, Activator.IMG_BUTTON_BUILD, Messages.LaunchBarControl_Build, Activator.CMD_BUILD);
|
||||
createButton(toolBar, Activator.IMG_BUTTON_LAUNCH, Messages.LaunchBarControl_Launch, Activator.CMD_LAUNCH);
|
||||
createButton(toolBar, Activator.IMG_BUTTON_STOP, Messages.LaunchBarControl_Stop, Activator.CMD_STOP);
|
||||
createButton(toolBar, Activator.IMG_BUTTON_BUILD, Activator.IMG_BUTTON_BUILD_HOT,
|
||||
Messages.LaunchBarControl_Build, Activator.CMD_BUILD);
|
||||
createButton(toolBar, Activator.IMG_BUTTON_LAUNCH, Activator.IMG_BUTTON_LAUNCH_HOT,
|
||||
Messages.LaunchBarControl_Launch, Activator.CMD_LAUNCH);
|
||||
createButton(toolBar, Activator.IMG_BUTTON_STOP, Activator.IMG_BUTTON_STOP_HOT, Messages.LaunchBarControl_Stop,
|
||||
Activator.CMD_STOP);
|
||||
|
||||
modeSelector = new ModeSelector(container, SWT.NONE);
|
||||
modeSelector.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
|
||||
|
@ -106,10 +109,13 @@ public class LaunchBarControl implements ILaunchBarListener {
|
|||
manager.removeListener(this);
|
||||
}
|
||||
|
||||
private ToolItem createButton(Composite parent, String imageName, String toolTipText, final String command) {
|
||||
private ToolItem createButton(Composite parent, String imageName, String hotImageName, String toolTipText,
|
||||
final String command) {
|
||||
ToolItem button = new ToolItem((ToolBar) parent, SWT.FLAT);
|
||||
Image srcImage = Activator.getDefault().getImage(imageName);
|
||||
button.setImage(srcImage);
|
||||
Image hotImage = Activator.getDefault().getImage(hotImageName);
|
||||
button.setHotImage(hotImage);
|
||||
button.setToolTipText(toolTipText);
|
||||
button.setData("command", command); //$NON-NLS-1$
|
||||
button.addSelectionListener(new SelectionAdapter() {
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationType;
|
||||
import org.eclipse.debug.core.ILaunchManager;
|
||||
import org.eclipse.debug.core.ILaunchMode;
|
||||
|
@ -156,7 +157,7 @@ public class ModeSelector extends CSelector {
|
|||
});
|
||||
}
|
||||
|
||||
protected ILaunchGroup getDefaultLaunchGroup(String mode) throws CoreException {
|
||||
protected ILaunchGroup getDefaultLaunchGroup(String mode) {
|
||||
String groupId = null;
|
||||
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
|
||||
groupId = IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP;
|
||||
|
@ -205,7 +206,9 @@ public class ModeSelector extends CSelector {
|
|||
if (element == null)
|
||||
element = noModes[0];
|
||||
super.setSelection(element);
|
||||
updateLaunchButton(findLaunchButton());
|
||||
if ("true".equals(Platform.getDebugOption(Activator.OPTION_LAUNCH_ICON_UPDATER))) { //$NON-NLS-1$
|
||||
updateLaunchButton(findLaunchButton());
|
||||
}
|
||||
}
|
||||
|
||||
private ToolItem findLaunchButton() {
|
||||
|
@ -229,6 +232,7 @@ public class ModeSelector extends CSelector {
|
|||
return;
|
||||
}
|
||||
toolItem.setImage(Activator.getDefault().getImage(Activator.IMG_BUTTON_LAUNCH));
|
||||
|
||||
Object selection = getSelection();
|
||||
if (selection instanceof ILaunchMode) {
|
||||
ILaunchMode lmode = (ILaunchMode) selection;
|
||||
|
|
Loading…
Add table
Reference in a new issue