mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 02:15:31 +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.CoreException;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.jface.resource.ImageRegistry;
|
import org.eclipse.jface.resource.ImageRegistry;
|
||||||
|
@ -43,10 +44,17 @@ public class Activator extends AbstractUIPlugin {
|
||||||
// The plug-in ID
|
// The plug-in ID
|
||||||
public static final String PLUGIN_ID = "org.eclipse.launchbar.ui"; //$NON-NLS-1$
|
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
|
// Images
|
||||||
public static final String IMG_BUTTON_BUILD = "build"; //$NON-NLS-1$
|
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 = "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 = "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$
|
public static final String IMG_LOCAL_TARGET = "localTarget"; //$NON-NLS-1$
|
||||||
|
|
||||||
// Command ids
|
// Command ids
|
||||||
|
@ -72,19 +80,33 @@ public class Activator extends AbstractUIPlugin {
|
||||||
public Activator() {
|
public Activator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
super.start(context);
|
super.start(context);
|
||||||
plugin = this;
|
plugin = this;
|
||||||
|
|
||||||
ImageRegistry imageRegistry = getImageRegistry();
|
ImageRegistry imageRegistry = getImageRegistry();
|
||||||
imageRegistry.put(IMG_BUTTON_BUILD, imageDescriptorFromPlugin(PLUGIN_ID, "icons/build.png")); //$NON-NLS-1$
|
if ("true".equals(Platform.getDebugOption(OPTION_ICON_SIZE32))) { //$NON-NLS-1$
|
||||||
imageRegistry.put(IMG_BUTTON_LAUNCH, imageDescriptorFromPlugin(PLUGIN_ID, "icons/launch.png")); //$NON-NLS-1$
|
imageRegistry.put(IMG_BUTTON_BUILD, imageDescriptorFromPlugin(PLUGIN_ID, "icons/build.png")); //$NON-NLS-1$
|
||||||
imageRegistry.put(IMG_BUTTON_STOP, imageDescriptorFromPlugin(PLUGIN_ID, "icons/stop.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$
|
imageRegistry.put(IMG_LOCAL_TARGET, imageDescriptorFromPlugin(PLUGIN_ID, "icons/localTarget.png")); //$NON-NLS-1$
|
||||||
|
|
||||||
context.registerService(ILaunchTargetUIManager.class, new LaunchTargetUIManager(), null);
|
context.registerService(ILaunchTargetUIManager.class, new LaunchTargetUIManager(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void stop(BundleContext context) throws Exception {
|
public void stop(BundleContext context) throws Exception {
|
||||||
plugin = null;
|
plugin = null;
|
||||||
super.stop(context);
|
super.stop(context);
|
||||||
|
@ -124,12 +146,10 @@ public class Activator extends AbstractUIPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void runCommand(String commandId, String... params) {
|
public static void runCommand(String commandId, String... params) {
|
||||||
final ICommandService commandService = (ICommandService) PlatformUI.getWorkbench()
|
final ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
|
||||||
.getService(ICommandService.class);
|
|
||||||
Command command = commandService.getCommand(commandId);
|
Command command = commandService.getCommand(commandId);
|
||||||
final Event trigger = new Event();
|
final Event trigger = new Event();
|
||||||
final IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench()
|
final IHandlerService handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class);
|
||||||
.getService(IHandlerService.class);
|
|
||||||
ExecutionEvent executionEvent = handlerService.createExecutionEvent(command, trigger);
|
ExecutionEvent executionEvent = handlerService.createExecutionEvent(command, trigger);
|
||||||
if (params.length == 0) {
|
if (params.length == 0) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -65,9 +65,12 @@ public class LaunchBarControl implements ILaunchBarListener {
|
||||||
});
|
});
|
||||||
|
|
||||||
ToolBar toolBar = new ToolBar(container, SWT.FLAT);
|
ToolBar toolBar = new ToolBar(container, SWT.FLAT);
|
||||||
createButton(toolBar, Activator.IMG_BUTTON_BUILD, Messages.LaunchBarControl_Build, Activator.CMD_BUILD);
|
createButton(toolBar, Activator.IMG_BUTTON_BUILD, Activator.IMG_BUTTON_BUILD_HOT,
|
||||||
createButton(toolBar, Activator.IMG_BUTTON_LAUNCH, Messages.LaunchBarControl_Launch, Activator.CMD_LAUNCH);
|
Messages.LaunchBarControl_Build, Activator.CMD_BUILD);
|
||||||
createButton(toolBar, Activator.IMG_BUTTON_STOP, Messages.LaunchBarControl_Stop, Activator.CMD_STOP);
|
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 = new ModeSelector(container, SWT.NONE);
|
||||||
modeSelector.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
|
modeSelector.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
|
||||||
|
@ -106,10 +109,13 @@ public class LaunchBarControl implements ILaunchBarListener {
|
||||||
manager.removeListener(this);
|
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);
|
ToolItem button = new ToolItem((ToolBar) parent, SWT.FLAT);
|
||||||
Image srcImage = Activator.getDefault().getImage(imageName);
|
Image srcImage = Activator.getDefault().getImage(imageName);
|
||||||
button.setImage(srcImage);
|
button.setImage(srcImage);
|
||||||
|
Image hotImage = Activator.getDefault().getImage(hotImageName);
|
||||||
|
button.setHotImage(hotImage);
|
||||||
button.setToolTipText(toolTipText);
|
button.setToolTipText(toolTipText);
|
||||||
button.setData("command", command); //$NON-NLS-1$
|
button.setData("command", command); //$NON-NLS-1$
|
||||||
button.addSelectionListener(new SelectionAdapter() {
|
button.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
|
@ -16,6 +16,7 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.debug.core.ILaunchConfigurationType;
|
import org.eclipse.debug.core.ILaunchConfigurationType;
|
||||||
import org.eclipse.debug.core.ILaunchManager;
|
import org.eclipse.debug.core.ILaunchManager;
|
||||||
import org.eclipse.debug.core.ILaunchMode;
|
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;
|
String groupId = null;
|
||||||
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
|
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
|
||||||
groupId = IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP;
|
groupId = IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP;
|
||||||
|
@ -205,7 +206,9 @@ public class ModeSelector extends CSelector {
|
||||||
if (element == null)
|
if (element == null)
|
||||||
element = noModes[0];
|
element = noModes[0];
|
||||||
super.setSelection(element);
|
super.setSelection(element);
|
||||||
updateLaunchButton(findLaunchButton());
|
if ("true".equals(Platform.getDebugOption(Activator.OPTION_LAUNCH_ICON_UPDATER))) { //$NON-NLS-1$
|
||||||
|
updateLaunchButton(findLaunchButton());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ToolItem findLaunchButton() {
|
private ToolItem findLaunchButton() {
|
||||||
|
@ -229,6 +232,7 @@ public class ModeSelector extends CSelector {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
toolItem.setImage(Activator.getDefault().getImage(Activator.IMG_BUTTON_LAUNCH));
|
toolItem.setImage(Activator.getDefault().getImage(Activator.IMG_BUTTON_LAUNCH));
|
||||||
|
|
||||||
Object selection = getSelection();
|
Object selection = getSelection();
|
||||||
if (selection instanceof ILaunchMode) {
|
if (selection instanceof ILaunchMode) {
|
||||||
ILaunchMode lmode = (ILaunchMode) selection;
|
ILaunchMode lmode = (ILaunchMode) selection;
|
||||||
|
|
Loading…
Add table
Reference in a new issue