1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 07:05:24 +02:00

Bug 466095 - Externalize Strings and minimize warnings.

Removed dead code and minimize use of internal interfaces.

Change-Id: Ief9c29bff721940bf5a173dfacf60b715691dcf7
This commit is contained in:
Doug Schaefer 2015-05-01 13:41:52 -04:00
parent e8eec12ec4
commit 3c33b772b8
33 changed files with 242 additions and 242 deletions

View file

@ -23,7 +23,7 @@ import org.eclipse.launchbar.core.internal.Activator;
public abstract class LaunchConfigurationProvider implements ILaunchConfigurationProvider {
// Used to make sure this is the config we've created
protected static final String ORIGINAL_NAME = Activator.PLUGIN_ID + ".originalName";
protected static final String ORIGINAL_NAME = Activator.PLUGIN_ID + ".originalName"; //$NON-NLS-1$
@Override
public ILaunchConfiguration createLaunchConfiguration(ILaunchManager launchManager, ILaunchDescriptor descriptor) throws CoreException {
@ -71,7 +71,7 @@ public abstract class LaunchConfigurationProvider implements ILaunchConfiguratio
return false;
// we created it if it has the same name we created it with
return configuration.getAttribute(ORIGINAL_NAME, "").equals(configuration.getName());
return configuration.getAttribute(ORIGINAL_NAME, "").equals(configuration.getName()); //$NON-NLS-1$
}
}

View file

@ -28,9 +28,9 @@ public class ProjectLaunchDescriptor extends PlatformObject implements ILaunchDe
}
@Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
public <T> T getAdapter(Class<T> adapter) {
if (IProject.class.equals(adapter)) {
return project;
return adapter.cast(project);
}
return super.getAdapter(adapter);
}

View file

@ -21,7 +21,7 @@ import org.osgi.framework.ServiceReference;
public class Activator extends Plugin {
public static final String PLUGIN_ID = "org.eclipse.launchbar.core";
public static final String PLUGIN_ID = "org.eclipse.launchbar.core"; //$NON-NLS-1$
private static Activator plugin;
public void start(BundleContext bundleContext) throws Exception {
@ -71,10 +71,10 @@ public class Activator extends Plugin {
}
private static final String DEBUG_ONE =
PLUGIN_ID + "/debug/launchbar";
PLUGIN_ID + "/debug/launchbar"; //$NON-NLS-1$
public static void trace(String str) {
if (plugin == null || (plugin.isDebugging() && "true".equalsIgnoreCase(Platform.getDebugOption(DEBUG_ONE))))
System.out.println("launchbar: " + str);
if (plugin == null || (plugin.isDebugging() && "true".equalsIgnoreCase(Platform.getDebugOption(DEBUG_ONE)))) //$NON-NLS-1$
System.out.println("launchbar: " + str); //$NON-NLS-1$
}
}

View file

@ -30,9 +30,9 @@ public class DefaultLaunchDescriptor extends PlatformObject implements ILaunchDe
}
@Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
public <T> T getAdapter(Class<T> adapter) {
if (ILaunchConfiguration.class.equals(adapter)) {
return configuration;
return adapter.cast(configuration);
}
return super.getAdapter(adapter);
}

View file

@ -13,7 +13,7 @@ import org.eclipse.launchbar.core.ILaunchDescriptorType;
*/
public class DefaultLaunchDescriptorType implements ILaunchDescriptorType {
public static final String ID = Activator.PLUGIN_ID + ".descriptorType.default";
public static final String ID = Activator.PLUGIN_ID + ".descriptorType.default"; //$NON-NLS-1$
private Map<ILaunchConfiguration, DefaultLaunchDescriptor> descriptors = new HashMap<>();

View file

@ -120,9 +120,9 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
private IRemoteConnection activeLaunchTarget;
// private static final String PREF_ACTIVE_CONFIG_DESC = "activeConfigDesc";
private static final String PREF_ACTIVE_LAUNCH_MODE = "activeLaunchMode";
private static final String PREF_ACTIVE_LAUNCH_TARGET = "activeLaunchTarget";
private static final String PREF_CONFIG_DESC_ORDER = "configDescList";
private static final String PREF_ACTIVE_LAUNCH_MODE = "activeLaunchMode"; //$NON-NLS-1$
private static final String PREF_ACTIVE_LAUNCH_TARGET = "activeLaunchTarget"; //$NON-NLS-1$
private static final String PREF_CONFIG_DESC_ORDER = "configDescList"; //$NON-NLS-1$
boolean initialized = false;
@ -135,7 +135,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
remoteServicesManager.addRemoteConnectionChangeListener(this);
if (doInit) {
new Job("Launch Bar Initialization") {
new Job(Messages.LaunchBarManager_0) {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
@ -160,7 +160,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
// To allow override by tests
IExtensionPoint getExtensionPoint() throws CoreException {
return Platform.getExtensionRegistry().getExtensionPoint(Activator.PLUGIN_ID, "launchBarContributions");
return Platform.getExtensionRegistry().getExtensionPoint(Activator.PLUGIN_ID, "launchBarContributions"); //$NON-NLS-1$
}
// To allow override by tests
@ -173,7 +173,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
try {
// Fetch the desc order before the init messes it up
IEclipsePreferences store = getPreferenceStore();
String configDescIds = store.get(PREF_CONFIG_DESC_ORDER, "");
String configDescIds = store.get(PREF_CONFIG_DESC_ORDER, ""); //$NON-NLS-1$
// Load up the types
loadExtensions();
// Add in the default descriptor type
@ -188,7 +188,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
launchManager.addLaunchConfigurationListener(this);
// Reorder the descriptors based on the preference
if (!configDescIds.isEmpty()) {
String[] split = configDescIds.split(",");
String[] split = configDescIds.split(","); //$NON-NLS-1$
ILaunchDescriptor last = null;
for (String id : split) {
Pair<String, String> key = toId(id);
@ -222,17 +222,17 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
for (IConfigurationElement element : extension.getConfigurationElements()) {
try {
String elementName = element.getName();
if (elementName.equals("descriptorType")) {
if (elementName.equals("descriptorType")) { //$NON-NLS-1$
LaunchDescriptorTypeInfo typeInfo = new LaunchDescriptorTypeInfo(element);
addDescriptorType(typeInfo);
} else if (elementName.equals("targetType")) {
} else if (elementName.equals("targetType")) { //$NON-NLS-1$
LaunchTargetTypeInfo info = new LaunchTargetTypeInfo(element);
targetTypes.put(info.getId(), info);
} else if (elementName.equals("configType")) {
String descriptorTypeId = element.getAttribute("descriptorType");
String targetTypeId = element.getAttribute("targetType");
String launchConfigTypeId = element.getAttribute("launchConfigurationType");
String isDefaultStr = element.getAttribute("isDefault");
} else if (elementName.equals("configType")) { //$NON-NLS-1$
String descriptorTypeId = element.getAttribute("descriptorType"); //$NON-NLS-1$
String targetTypeId = element.getAttribute("targetType"); //$NON-NLS-1$
String launchConfigTypeId = element.getAttribute("launchConfigurationType"); //$NON-NLS-1$
String isDefaultStr = element.getAttribute("isDefault"); //$NON-NLS-1$
boolean isDefault = isDefaultStr != null ? Boolean.parseBoolean(isDefaultStr) : false;
// add to desc type -> target type mapping
@ -258,13 +258,13 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
// also assume that the target type works for the config type
addDefaultConfigTargetType(launchConfigTypeId, targetTypeId, isDefault);
} else if (elementName.equals("configProvider")) {
} else if (elementName.equals("configProvider")) { //$NON-NLS-1$
LaunchConfigProviderInfo info = new LaunchConfigProviderInfo(element);
configProviders.put(info.getLaunchConfigTypeId(), info);
} else if (elementName.equals("defaultConfigTarget")) {
String configTypeId = element.getAttribute("launchConfigurationType");
String targetTypeId = element.getAttribute("targetType");
String isDefaultStr = element.getAttribute("isDefault");
} else if (elementName.equals("defaultConfigTarget")) { //$NON-NLS-1$
String configTypeId = element.getAttribute("launchConfigurationType"); //$NON-NLS-1$
String targetTypeId = element.getAttribute("targetType"); //$NON-NLS-1$
String isDefaultStr = element.getAttribute("isDefault"); //$NON-NLS-1$
boolean isDefault = isDefaultStr != null ? Boolean.parseBoolean(isDefaultStr) : false;
addDefaultConfigTargetType(configTypeId, targetTypeId, isDefault);
}
@ -279,8 +279,8 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
for (IConfigurationElement element : extension.getConfigurationElements()) {
try {
String elementName = element.getName();
if (elementName.equals("objectProvider")) {
ILaunchObjectProvider objectProvider = (ILaunchObjectProvider) element.createExecutableExtension("class");
if (elementName.equals("objectProvider")) { //$NON-NLS-1$
ILaunchObjectProvider objectProvider = (ILaunchObjectProvider) element.createExecutableExtension("class"); //$NON-NLS-1$
addObjectProvider(objectProvider);
}
} catch (Exception e) {
@ -309,7 +309,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
orderedDescriptorTypes.add(typeInfo);
}
Activator.trace("registered descriptor type " + typeInfo.getId());
Activator.trace("registered descriptor type " + typeInfo.getId()); //$NON-NLS-1$
}
private void addDefaultConfigTargetType(String configTypeId, String targetTypeId, boolean isDefault) {
@ -371,7 +371,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
}
private String toString(Pair<String, String> key) {
return key.getFirst() + ":" + key.getSecond();
return key.getFirst() + ":" + key.getSecond(); //$NON-NLS-1$
}
private Pair<String, String> toId(String key) {
@ -476,7 +476,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
@Override
public ILaunchDescriptor launchObjectAdded(Object launchObject) {
Activator.trace("launch object added " + launchObject);
Activator.trace("launch object added " + launchObject); //$NON-NLS-1$
ILaunchDescriptor desc = objectDescriptorMap.get(launchObject);
if (desc != null)
return desc;
@ -498,7 +498,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
@Override
public void launchObjectRemoved(Object launchObject) throws CoreException {
Activator.trace("launch object removed " + launchObject);
Activator.trace("launch object removed " + launchObject); //$NON-NLS-1$
ILaunchDescriptor desc = objectDescriptorMap.get(launchObject);
removeDescriptor(launchObject, desc);
}
@ -545,16 +545,16 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
}
public void setActiveLaunchDescriptor(ILaunchDescriptor descriptor) throws CoreException {
Activator.trace("set active descriptor " + descriptor);
Activator.trace("set active descriptor " + descriptor); //$NON-NLS-1$
if (activeLaunchDesc == descriptor) {
// Sync since targets could be changed since last time (and modes theoretically too)
syncActiveTarget();
syncActiveMode();
Activator.trace("resync for " + descriptor);
Activator.trace("resync for " + descriptor); //$NON-NLS-1$
return;
}
if (descriptor != null && !descriptors.containsValue(descriptor))
throw new IllegalStateException("Active descriptor must be in the map of descriptors");
throw new IllegalStateException(Messages.LaunchBarManager_1);
if (descriptor == null)
descriptor = getLastUsedDescriptor(); // do not set to null unless no descriptors
activeLaunchDesc = descriptor;
@ -575,7 +575,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
}
private void storeActiveDescriptor(ILaunchDescriptor descriptor) {
Activator.trace("new active config is stored " + descriptor);
Activator.trace("new active config is stored " + descriptor); //$NON-NLS-1$
// Store the desc order, active one is the last one
StringBuffer buff = new StringBuffer();
@ -624,8 +624,8 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
String modeNames[] = new String[] {
storedModeId,
lastActiveModeId,
"run",
"debug",
"run", //$NON-NLS-1$
"debug", //$NON-NLS-1$
supportedModes[0].getIdentifier()
};
for (int i = 0; i < modeNames.length; i++) {
@ -736,7 +736,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
if (activeLaunchMode == mode)
return;
if (activeLaunchDesc != null && mode != null && !supportsMode(mode))
throw new IllegalStateException("Mode is not supported by descriptor");
throw new IllegalStateException(Messages.LaunchBarManager_2);
// change mode
activeLaunchMode = mode;
storeLaunchMode(activeLaunchDesc, mode);
@ -920,7 +920,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
@Override
public void launchConfigurationAdded(ILaunchConfiguration configuration) {
Activator.trace("launch config added " + configuration);
Activator.trace("launch config added " + configuration); //$NON-NLS-1$
try {
LaunchConfigProviderInfo info = configProviders.get(configuration.getType().getIdentifier());
if (info != null) {
@ -936,7 +936,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
}
configMap.put(provider, configuration);
}
Activator.trace("launch config claimed by " + provider);
Activator.trace("launch config claimed by " + provider); //$NON-NLS-1$
return;
}
}
@ -945,7 +945,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
Activator.log(e);
}
Activator.trace("launch config not claimed");
Activator.trace("launch config not claimed"); //$NON-NLS-1$
try {
ILaunchDescriptor desc = defaultDescriptorType.getDescriptor(configuration);
addDescriptor(configuration, desc);
@ -956,7 +956,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
@Override
public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
Activator.trace("launch config removed " + configuration);
Activator.trace("launch config removed " + configuration); //$NON-NLS-1$
// Is there any way this method is called when a LC still exists??? This may be dead code.
// configuration.getType() will fail when !configuration.exists()
@ -966,7 +966,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
if (info != null) {
ILaunchConfigurationProvider provider = info.getProvider();
if (provider.launchConfigurationRemoved(configuration)) {
Activator.trace("launch config removed by " + provider);
Activator.trace("launch config removed by " + provider); //$NON-NLS-1$
return;
}
}
@ -975,7 +975,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
}
}
Activator.trace("launch config not claimed");
Activator.trace("launch config not claimed"); //$NON-NLS-1$
ILaunchDescriptor desc = objectDescriptorMap.get(configuration);
if (desc == null) {
/* WARNING: This is slow. Call only as a last resort */
@ -990,7 +990,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
final ILaunchConfigurationProvider provider = e2.getKey();
try {
provider.launchConfigurationRemoved(e2.getValue());
Activator.trace("launch config removed by " + provider);
Activator.trace("launch config removed by " + provider); //$NON-NLS-1$
} catch (Throwable e) {
Activator.log(e);
}
@ -1007,7 +1007,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
for (ILaunchConfigurationProvider provider : configMap.keySet()) {
try {
if (provider.launchConfigurationRemoved(configuration)) {
Activator.trace("launch config removed by " + provider);
Activator.trace("launch config removed by " + provider); //$NON-NLS-1$
return;
}
} catch (Throwable e) {

View file

@ -10,7 +10,7 @@ public class LaunchConfigProviderInfo {
private ILaunchConfigurationProvider provider;
public LaunchConfigProviderInfo(IConfigurationElement element) {
this.launchConfigTypeId = element.getAttribute("launchConfigurationType");
this.launchConfigTypeId = element.getAttribute("launchConfigurationType"); //$NON-NLS-1$
this.element = element;
}
@ -20,7 +20,7 @@ public class LaunchConfigProviderInfo {
public ILaunchConfigurationProvider getProvider() throws CoreException {
if (provider == null) {
provider = (ILaunchConfigurationProvider) element.createExecutableExtension("class");
provider = (ILaunchConfigurationProvider) element.createExecutableExtension("class"); //$NON-NLS-1$
element = null;
}
return provider;

View file

@ -8,9 +8,9 @@ public class LaunchConfigTypeInfo {
private final String launchConfigTypeId;
public LaunchConfigTypeInfo(IConfigurationElement element) {
this.descriptorTypeId = element.getAttribute("descriptorType");
this.targetTypeId = element.getAttribute("targetType");
this.launchConfigTypeId = element.getAttribute("launchConfigurationType");
this.descriptorTypeId = element.getAttribute("descriptorType"); //$NON-NLS-1$
this.targetTypeId = element.getAttribute("targetType"); //$NON-NLS-1$
this.launchConfigTypeId = element.getAttribute("launchConfigurationType"); //$NON-NLS-1$
}
public String getDescriptorTypeId() {

View file

@ -11,8 +11,8 @@ public class LaunchDescriptorTypeInfo {
private ILaunchDescriptorType type;
public LaunchDescriptorTypeInfo(IConfigurationElement element) {
this.id = element.getAttribute("id");
String priorityStr = element.getAttribute("priority");
this.id = element.getAttribute("id"); //$NON-NLS-1$
String priorityStr = element.getAttribute("priority"); //$NON-NLS-1$
this.priority = 1;
if (priorityStr != null) {
try {
@ -42,7 +42,7 @@ public class LaunchDescriptorTypeInfo {
public ILaunchDescriptorType getType() throws CoreException {
if (type == null) {
type = (ILaunchDescriptorType) element.createExecutableExtension("class");
type = (ILaunchDescriptorType) element.createExecutableExtension("class"); //$NON-NLS-1$
element = null;
}
return type;

View file

@ -15,22 +15,22 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.remote.core.IRemoteConnection;
class LaunchTargetTypeInfo {
private static final String ANY = "";
private static final String ANY = ""; //$NON-NLS-1$
private final String id;
private final String connectionTypeId;
private String osname;
private String osarch;
public LaunchTargetTypeInfo(IConfigurationElement ce) {
id = ce.getAttribute("id");
connectionTypeId = ce.getAttribute("connectionTypeId");
id = ce.getAttribute("id"); //$NON-NLS-1$
connectionTypeId = ce.getAttribute("connectionTypeId"); //$NON-NLS-1$
if (id == null || connectionTypeId == null)
throw new NullPointerException();
osname = ce.getAttribute("osname");
osname = ce.getAttribute("osname"); //$NON-NLS-1$
if (osname == null) {
osname = ANY;
}
osarch = ce.getAttribute("osarch");
osarch = ce.getAttribute("osarch"); //$NON-NLS-1$
if (osarch == null) {
osarch = ANY;
}

View file

@ -14,6 +14,9 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.launchbar.core.internal.messages"; //$NON-NLS-1$
public static String LaunchBarManager_0;
public static String LaunchBarManager_1;
public static String LaunchBarManager_2;
public static String LocalTarget_name;
static {
// initialize resource bundle

View file

@ -1,3 +1,5 @@
LaunchBarManager_1=Active descriptor must be in the map of descriptors
LaunchBarManager_2=Mode is not supported by descriptor
################################################################################
# Copyright (c) 2014 QNX Software Systems and others.
# All rights reserved. This program and the accompanying materials
@ -9,4 +11,5 @@
# Doug Schaefer
################################################################################
LaunchBarManager_0=Launch Bar Initialization
LocalTarget_name=Local Machine

View file

@ -15,6 +15,6 @@ public interface ILaunchBarUIConstants {
/**
* Parameter name for the edit target command.
*/
public static final String TARGET_NAME = "targetName";
public static final String TARGET_NAME = "targetName"; //$NON-NLS-1$
}

View file

@ -41,19 +41,19 @@ public class Activator extends AbstractUIPlugin {
public static final String PLUGIN_ID = "org.eclipse.launchbar.ui"; //$NON-NLS-1$
// Images
public static final String IMG_BUTTON_BUILD = "build";
public static final String IMG_BUTTON_LAUNCH = "launch";
public static final String IMG_BUTTON_STOP = "stop";
public static final String IMG_BUTTON_BUILD = "build"; //$NON-NLS-1$
public static final String IMG_BUTTON_LAUNCH = "launch"; //$NON-NLS-1$
public static final String IMG_BUTTON_STOP = "stop"; //$NON-NLS-1$
// Command ids
public static final String CMD_BUILD = PLUGIN_ID + ".command.buildActive";
public static final String CMD_LAUNCH = PLUGIN_ID + ".command.launchActive";
public static final String CMD_STOP = PLUGIN_ID + ".command.stop";
public static final String CMD_CONFIG = PLUGIN_ID + ".command.configureActiveLaunch";
public static final String CMD_BUILD = PLUGIN_ID + ".command.buildActive"; //$NON-NLS-1$
public static final String CMD_LAUNCH = PLUGIN_ID + ".command.launchActive"; //$NON-NLS-1$
public static final String CMD_STOP = PLUGIN_ID + ".command.stop"; //$NON-NLS-1$
public static final String CMD_CONFIG = PLUGIN_ID + ".command.configureActiveLaunch"; //$NON-NLS-1$
// Preference ids
public static final String PREF_ENABLE_LAUNCHBAR = "enableLaunchBar";
public static final String PREF_LAUNCH_HISTORY_SIZE = "launchHistorySize";
public static final String PREF_ENABLE_LAUNCHBAR = "enableLaunchBar"; //$NON-NLS-1$
public static final String PREF_LAUNCH_HISTORY_SIZE = "launchHistorySize"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
@ -72,9 +72,9 @@ public class Activator extends AbstractUIPlugin {
plugin = this;
ImageRegistry imageRegistry = getImageRegistry();
imageRegistry.put(IMG_BUTTON_BUILD, imageDescriptorFromPlugin(PLUGIN_ID, "icons/build.png"));
imageRegistry.put(IMG_BUTTON_LAUNCH, imageDescriptorFromPlugin(PLUGIN_ID, "icons/launch.png"));
imageRegistry.put(IMG_BUTTON_STOP, imageDescriptorFromPlugin(PLUGIN_ID, "icons/stop.png"));
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$
}
public void stop(BundleContext context) throws Exception {

View file

@ -15,12 +15,12 @@ public class LaunchBarPreferencePage extends FieldEditorPreferencePage implement
@Override
public void init(IWorkbench workbench) {
setPreferenceStore(Activator.getDefault().getPreferenceStore());
setDescription("Preferences for the Launch Bar.");
setDescription(Messages.LaunchBarPreferencePage_0);
}
@Override
protected void createFieldEditors() {
addField(new BooleanFieldEditor(Activator.PREF_ENABLE_LAUNCHBAR, "Enable the Launch Bar.", getFieldEditorParent()));
addField(new BooleanFieldEditor(Activator.PREF_ENABLE_LAUNCHBAR, Messages.LaunchBarPreferencePage_1, getFieldEditorParent()));
}
}

View file

@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.launchbar.ui.internal;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
@ -20,56 +18,28 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.launchbar.core.ILaunchDescriptor;
import org.eclipse.launchbar.core.internal.ExecutableExtension;
import org.eclipse.launchbar.core.internal.LaunchBarManager;
import org.eclipse.launchbar.ui.IHoverProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.INewWizard;
public class LaunchBarUIManager {
LaunchBarManager manager;
Map<String, ExecutableExtension<ILabelProvider>> descriptorLabelProviders = new HashMap<>();
Map<String, LaunchBarTargetContribution> targetContributions = new HashMap<>();
private final LaunchBarTargetContribution DEFAULT_CONTRIBUTION = new LaunchBarTargetContribution(null, null, null, null,
null, null);
private LaunchBarManager manager;
private Map<String, ExecutableExtension<ILabelProvider>> descriptorLabelProviders = new HashMap<>();
public LaunchBarUIManager(LaunchBarManager manager) {
this.manager = manager;
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Activator.PLUGIN_ID, "launchBarUIContributions");
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Activator.PLUGIN_ID, "launchBarUIContributions"); //$NON-NLS-1$
IExtension[] extensions = point.getExtensions();
for (IExtension extension : extensions) {
for (IConfigurationElement element : extension.getConfigurationElements()) {
String elementName = element.getName();
if (elementName.equals("descriptorUI")) {
String descriptorTypeId = element.getAttribute("descriptorTypeId");
ExecutableExtension<ILabelProvider> labelProvider = new ExecutableExtension<>(element, "labelProvider");
if (elementName.equals("descriptorUI")) { //$NON-NLS-1$
String descriptorTypeId = element.getAttribute("descriptorTypeId"); //$NON-NLS-1$
ExecutableExtension<ILabelProvider> labelProvider = new ExecutableExtension<>(element, "labelProvider"); //$NON-NLS-1$
descriptorLabelProviders.put(descriptorTypeId, labelProvider);
} else if (elementName.equals("targetUI")) {
String targetTypeId = element.getAttribute("targetTypeId");
String targetName = element.getAttribute("name");
String iconStr = element.getAttribute("icon");
ExecutableExtension<ILabelProvider> labelProvider = new ExecutableExtension<ILabelProvider>(element, "labelProvider");
ExecutableExtension<IHoverProvider> hoverProvider = null;
if (element.getAttribute("hoverProvider") != null) {
hoverProvider = new ExecutableExtension<IHoverProvider>(element, "hoverProvider");
}
String editCommandId = element.getAttribute("editCommandId");
ExecutableExtension<INewWizard> newWizard = null;
if (element.getAttribute("newWizard") != null) {
newWizard = new ExecutableExtension<INewWizard>(element, "newWizard");
}
targetContributions.put(targetTypeId, new LaunchBarTargetContribution(targetName, iconStr,
labelProvider, hoverProvider, editCommandId, newWizard));
}
}
}
@ -84,41 +54,4 @@ public class LaunchBarUIManager {
return provider != null ? provider.get() : null;
}
private class LaunchBarTargetContribution {
String name;
String iconStr;
Image icon;
ExecutableExtension<ILabelProvider> labelProvider;
ExecutableExtension<IHoverProvider> hoverProvider;
String editCommandId;
ExecutableExtension<INewWizard> newWizard;
LaunchBarTargetContribution(String name, String iconStr,
ExecutableExtension<ILabelProvider> labelProvider,
ExecutableExtension<IHoverProvider> hoverProvider,
String editCommand,
ExecutableExtension<INewWizard> newWizard) {
this.name = name;
this.iconStr = iconStr;
this.icon = null;
this.labelProvider = labelProvider;
this.hoverProvider = hoverProvider;
this.editCommandId = editCommand;
this.newWizard = newWizard;
}
Image getIcon() {
if (icon == null) {
if (iconStr != null && !iconStr.isEmpty()) {
try {
icon = ImageDescriptor.createFromURL(new URL(iconStr)).createImage();
} catch (MalformedURLException e) {
Activator.log(e);
}
}
}
return icon;
}
}
}

View file

@ -14,9 +14,46 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.launchbar.ui.internal.messages"; //$NON-NLS-1$
public static String ConfigSelector_0;
public static String ConfigSelector_1;
public static String ConfigSelector_2;
public static String ConfigSelector_3;
public static String CSelector_0;
public static String CSelector_1;
public static String EditButton_0;
public static String FilterControl_0;
public static String FilterControl_1;
public static String LaunchBarControl_0;
public static String LaunchBarControl_Build;
public static String LaunchBarControl_Launch;
public static String LaunchBarControl_Stop;
public static String LaunchBarListViewer_0;
public static String LaunchBarPreferencePage_0;
public static String LaunchBarPreferencePage_1;
public static String LaunchConfigurationEditDialog_0;
public static String LaunchConfigurationEditDialog_1;
public static String LaunchConfigurationEditDialog_2;
public static String LaunchConfigurationEditDialog_3;
public static String LaunchConfigurationEditDialog_4;
public static String LaunchConfigurationEditDialog_5;
public static String LaunchConfigurationEditDialog_6;
public static String ModeSelector_0;
public static String NewLaunchConfigEditPage_0;
public static String NewLaunchConfigEditPage_1;
public static String NewLaunchConfigEditPage_2;
public static String NewLaunchConfigEditPage_3;
public static String NewLaunchConfigEditPage_4;
public static String NewLaunchConfigEditPage_5;
public static String NewLaunchConfigEditPage_6;
public static String NewLaunchConfigModePage_0;
public static String NewLaunchConfigModePage_1;
public static String NewLaunchConfigModePage_2;
public static String NewLaunchConfigTypePage_0;
public static String NewLaunchConfigTypePage_1;
public static String NewLaunchConfigTypePage_2;
public static String NewLaunchConfigWizard_0;
public static String StopActiveCommandHandler_0;
public static String StopActiveCommandHandler_1;
public static String TargetSelector_CreateNewTarget;
static {
// initialize resource bundle

View file

@ -20,13 +20,13 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.launchbar.core.internal.LaunchBarManager;
import org.eclipse.launchbar.ui.internal.Activator;
import org.eclipse.launchbar.ui.internal.Messages;
public class StopActiveCommandHandler extends AbstractHandler {
private LaunchBarManager launchBarManager;
@ -49,7 +49,7 @@ public class StopActiveCommandHandler extends AbstractHandler {
protected void stopActiveLaunches() {
final ILaunch[] activeLaunches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
if (activeLaunches != null && activeLaunches.length > 0) {
new Job("Stopping launches") {
new Job(Messages.StopActiveCommandHandler_0) {
protected IStatus run(IProgressMonitor monitor) {
try {
ILaunchConfiguration activeConfig = launchBarManager.getActiveLaunchConfiguration();
@ -74,7 +74,7 @@ public class StopActiveCommandHandler extends AbstractHandler {
}
protected void stopBuild() {
Job job = new Job("Stopping build") {
Job job = new Job(Messages.StopActiveCommandHandler_1) {
@Override
protected IStatus run(IProgressMonitor progress) {
// stops all builds

View file

@ -24,6 +24,7 @@ import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.launchbar.ui.IHoverProvider;
import org.eclipse.launchbar.ui.internal.Messages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
@ -98,12 +99,12 @@ public abstract class CSelector extends Composite {
final Object eventSource = e.getSource();
if ((eventSource == currentLabel || eventSource == buttonComposite || eventSource == currentIcon)) {
if (hoverProvider.displayHover(selection)) {
buttonComposite.setToolTipText("");
buttonComposite.setToolTipText(""); //$NON-NLS-1$
if (currentLabel != null) {
currentLabel.setToolTipText("");
currentLabel.setToolTipText(""); //$NON-NLS-1$
}
if (currentIcon != null) {
currentIcon.setToolTipText("");
currentIcon.setToolTipText(""); //$NON-NLS-1$
}
toolTipWasModified = true;
}
@ -131,12 +132,13 @@ public abstract class CSelector extends Composite {
}
};
protected boolean isFocusAncestor(Control control) {
protected boolean myIsFocusAncestor(Control control) {
while (control != null && control != this && !(control instanceof Shell)) {
control = control.getParent();
}
return control == this;
}
private Listener focusOutListener = new Listener() {
private Job closingJob;
@ -146,7 +148,7 @@ public abstract class CSelector extends Composite {
case SWT.FocusIn:
if (closingJob != null)
closingJob.cancel();
if (event.widget instanceof Control && isFocusAncestor((Control) event.widget)) {
if (event.widget instanceof Control && myIsFocusAncestor((Control) event.widget)) {
break; // not closing
}
if (!isPopUpInFocus()) {
@ -159,7 +161,7 @@ public abstract class CSelector extends Composite {
// to another child, lets schedule a job to wait before we close
if (closingJob != null)
closingJob.cancel();
closingJob = new Job("Closing popup") {
closingJob = new Job(Messages.CSelector_0) {
@Override
protected IStatus run(IProgressMonitor monitor) {
if (monitor.isCanceled())
@ -246,7 +248,7 @@ public abstract class CSelector extends Composite {
public void setDelayedSelection(final Object element, long millis) {
if (delayJob != null)
delayJob.cancel();
delayJob = new Job("Updating launch bar selection") {
delayJob = new Job(Messages.CSelector_1) {
@Override
protected IStatus run(final IProgressMonitor monitor) {
if (monitor.isCanceled())

View file

@ -28,6 +28,7 @@ import org.eclipse.launchbar.core.internal.LaunchBarManager;
import org.eclipse.launchbar.ui.internal.Activator;
import org.eclipse.launchbar.ui.internal.DefaultDescriptorLabelProvider;
import org.eclipse.launchbar.ui.internal.LaunchBarUIManager;
import org.eclipse.launchbar.ui.internal.Messages;
import org.eclipse.launchbar.ui.internal.commands.ConfigureActiveLaunchHandler;
import org.eclipse.launchbar.ui.internal.dialogs.NewLaunchConfigWizard;
import org.eclipse.swt.SWT;
@ -46,17 +47,16 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
@SuppressWarnings("restriction")
public class ConfigSelector extends CSelector {
private LaunchBarUIManager uiManager = Activator.getDefault().getLaunchBarUIManager();
private DefaultDescriptorLabelProvider defaultProvider;
private static final String[] noConfigs = new String[] { "No Launch Configurations" };
private static final String[] noConfigs = new String[] { Messages.ConfigSelector_0 };
public ConfigSelector(Composite parent, int style) {
super(parent, style);
setToolTipText("Launch configuration");
setToolTipText(Messages.ConfigSelector_1);
defaultProvider = new DefaultDescriptorLabelProvider();
setContentProvider(new IStructuredContentProvider() {
@ -187,7 +187,7 @@ public class ConfigSelector extends CSelector {
final Label createLabel = new Label(createButton, SWT.None);
createLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
createLabel.setText("Create New Configuration...");
createLabel.setText(Messages.ConfigSelector_2);
createLabel.setBackground(backgroundColor);
MouseListener mouseListener = new MouseAdapter() {
@ -195,7 +195,7 @@ public class ConfigSelector extends CSelector {
final NewLaunchConfigWizard wizard = new NewLaunchConfigWizard();
WizardDialog dialog = new WizardDialog(getShell(), wizard);
if (dialog.open() == Window.OK) {
new Job("Create Launch Configuration") {
new Job(Messages.ConfigSelector_3) {
protected IStatus run(IProgressMonitor monitor) {
try {
final LaunchBarManager barManager = uiManager.getManager();

View file

@ -1,13 +1,14 @@
package org.eclipse.launchbar.ui.internal.controls;
import org.eclipse.launchbar.ui.internal.Activator;
import org.eclipse.launchbar.ui.internal.Messages;
import org.eclipse.swt.widgets.Composite;
public class EditButton extends CButton {
public EditButton(Composite parent, int style) {
super(parent, style);
setHotImage(Activator.getDefault().getImage("icons/config_config.png"));
setColdImage(Activator.getDefault().getImage("icons/edit_cold.png"));
setToolTipText("Edit");
setHotImage(Activator.getDefault().getImage("icons/config_config.png")); //$NON-NLS-1$
setColdImage(Activator.getDefault().getImage("icons/edit_cold.png")); //$NON-NLS-1$
setToolTipText(Messages.EditButton_0);
}
}

View file

@ -10,6 +10,7 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.launchbar.ui.internal.Messages;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter;
@ -33,7 +34,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.internal.WorkbenchMessages;
import org.eclipse.ui.progress.WorkbenchJob;
/**
@ -101,7 +101,7 @@ public class FilterControl extends Composite {
protected void init() {
createControl(this, SWT.NONE);
createRefreshJob();
setInitialText(WorkbenchMessages.FilteredTree_FilterMessage);
setInitialText(Messages.FilterControl_0);
setFont(parent.getFont());
}
@ -224,7 +224,7 @@ public class FilterControl extends Composite {
e.result = initialText;
} else {
e.result = NLS.bind(
WorkbenchMessages.FilteredTree_AccessibleListenerFiltered,
Messages.FilterControl_1,
new String[] {
filterTextString,
String.valueOf(getFilteredItemsCount()) });

View file

@ -73,7 +73,7 @@ public class LaunchBarControl implements Listener {
Label label = new Label(container, SWT.NONE);
label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
label.setText("on" + ":");
label.setText(Messages.LaunchBarControl_0 + ":"); //$NON-NLS-1$
targetSelector = new TargetSelector(container, SWT.NONE);
targetSelector.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));

View file

@ -7,12 +7,10 @@ import java.util.List;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.IFontProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
@ -20,6 +18,7 @@ import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.launchbar.core.ILaunchDescriptor;
import org.eclipse.launchbar.ui.internal.Activator;
import org.eclipse.launchbar.ui.internal.Messages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.DisposeEvent;
@ -44,15 +43,12 @@ import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Sash;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Widget;
public class LaunchBarListViewer extends StructuredViewer {
@ -78,11 +74,13 @@ public class LaunchBarListViewer extends StructuredViewer {
}
// have to override it because standard ViewerComparator compares by labels only
@SuppressWarnings("unchecked")
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
return getComparator().compare(e1, e2);
}
}
private TraverseListener listItemTraverseListener = new TraverseListener() {
@Override
public void keyTraversed(TraverseEvent e) {
@ -152,7 +150,7 @@ public class LaunchBarListViewer extends StructuredViewer {
filterControl.setVisible(true);
filterControl.setFocus();
filterControl.getParent().layout(true);
filterControl.getFilterText().setText(e.character + "");
filterControl.getFilterText().setText(e.character + ""); //$NON-NLS-1$
filterControl.getFilterText().setSelection(1);
} else if (e.character == SWT.ESC) {
setDefaultSelection(new StructuredSelection());
@ -175,7 +173,7 @@ public class LaunchBarListViewer extends StructuredViewer {
@Override
public String toString() {
return "[" + index + "] " + labelProvider.getText(element);
return "[" + index + "] " + labelProvider.getText(element); //$NON-NLS-1$ //$NON-NLS-2$
}
public ListItem(Composite parent, int style, Object element, int index, ILabelProvider labelProvider,
ICellModifier modifier) {
@ -427,7 +425,7 @@ public class LaunchBarListViewer extends StructuredViewer {
// ignore
}
});
sash.setToolTipText("Increase/Decrease size of recently used elements pane");
sash.setToolTipText(Messages.LaunchBarListViewer_0);
}
@Override
@ -504,6 +502,7 @@ public class LaunchBarListViewer extends StructuredViewer {
}
}
@SuppressWarnings("rawtypes")
@Override
protected List getSelectionFromWidget() {
ArrayList<Object> arrayList = new ArrayList<>();
@ -569,7 +568,7 @@ public class LaunchBarListViewer extends StructuredViewer {
}
@Override
protected void setSelectionToWidget(List l, boolean reveal) {
protected void setSelectionToWidget(@SuppressWarnings("rawtypes") List l, boolean reveal) {
if (l.size() == 0) {
return;
}
@ -682,29 +681,6 @@ public class LaunchBarListViewer extends StructuredViewer {
this.finalSelection = finalSelection;
}
public static void main(String[] args) {
Display display = Display.getDefault();
Shell shell = new Shell();
RowLayout rowLayout = new RowLayout();
shell.setLayout(rowLayout);
(new Label(shell, SWT.NULL)).setText("Hello");
LaunchBarListViewer v = new LaunchBarListViewer(shell);
v.setContentProvider(new ArrayContentProvider());
v.setLabelProvider(new LabelProvider());
v.setInput(new String[] { "aaa", "bbb", "ccc" });
shell.pack();
shell.open();
// textUser.forceFocus();
// Set up the event loop.
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
// If no more entries in event queue
display.sleep();
}
}
display.dispose();
}
public void setFocus() {
if (selIndex >= 0 && listItems != null && listItems.length < selIndex)
listItems[selIndex].setFocus();

View file

@ -25,6 +25,7 @@ import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.launchbar.core.internal.LaunchBarManager;
import org.eclipse.launchbar.ui.internal.Activator;
import org.eclipse.launchbar.ui.internal.Messages;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
@ -32,14 +33,14 @@ import org.eclipse.swt.widgets.Composite;
@SuppressWarnings("restriction")
public class ModeSelector extends CSelector {
private static final String[] noModes = new String[] { "---" };
private static final String[] noModes = new String[] { "---" }; //$NON-NLS-1$
private final LaunchBarManager manager = Activator.getDefault().getLaunchBarUIManager().getManager();
public ModeSelector(Composite parent, int style) {
super(parent, style);
setToolTipText("Launch configuration");
setToolTipText(Messages.ModeSelector_0);
setContentProvider(new IStructuredContentProvider() {
@Override
@ -98,7 +99,7 @@ public class ModeSelector extends CSelector {
try {
ILaunchGroup group = getLaunchGroup(mode.getIdentifier());
if (group != null) {
return group.getLabel().replace("&", "");
return group.getLabel().replace("&", ""); //$NON-NLS-1$ //$NON-NLS-2$
}
} catch (CoreException e) {
Activator.log(e.getStatus());
@ -115,21 +116,21 @@ public class ModeSelector extends CSelector {
String mode1 = ((ILaunchMode)o1).getIdentifier();
String mode2 = ((ILaunchMode)o2).getIdentifier();
// run comes first, then debug, then the rest
if (mode1.equals("run")) {
if (mode2.equals("run"))
if (mode1.equals("run")) { //$NON-NLS-1$
if (mode2.equals("run")) //$NON-NLS-1$
return 0;
else
return -1;
}
if (mode2.equals("run"))
if (mode2.equals("run")) //$NON-NLS-1$
return 1;
if (mode1.equals("debug")) {
if (mode2.equals("debug"))
if (mode1.equals("debug")) { //$NON-NLS-1$
if (mode2.equals("debug")) //$NON-NLS-1$
return 0;
else
return -1;
}
if (mode2.equals("debug"))
if (mode2.equals("debug")) //$NON-NLS-1$
return 1;
}
return 0;

View file

@ -26,6 +26,7 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.launchbar.ui.internal.Activator;
import org.eclipse.launchbar.ui.internal.Messages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
@ -82,9 +83,9 @@ public class LaunchConfigurationEditDialog extends LaunchConfigurationProperties
leftButtonComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
leftButtonComp.setFont(parent.getFont());
createButton(leftButtonComp, DELETE_ID, "Delete", false);
createButton(leftButtonComp, DUPLICATE_ID, "Duplicate", false);
createButton(leftButtonComp, LAUNCH_ID, "Launch", false);
createButton(leftButtonComp, DELETE_ID, Messages.LaunchConfigurationEditDialog_0, false);
createButton(leftButtonComp, DUPLICATE_ID, Messages.LaunchConfigurationEditDialog_1, false);
createButton(leftButtonComp, LAUNCH_ID, Messages.LaunchConfigurationEditDialog_2, false);
Composite mainButtonComp = new Composite(composite, SWT.NONE);
layout = new GridLayout();
@ -121,9 +122,9 @@ public class LaunchConfigurationEditDialog extends LaunchConfigurationProperties
if (c.isWorkingCopy())
c = ((ILaunchConfigurationWorkingCopy)c).getOriginal();
final ILaunchConfiguration config = c;
if (MessageDialog.openConfirm(getShell(), "Confirm Delete",
"Are you sure you want to delete " + config.getName())) {
new Job("Deleting launch configuration") {
if (MessageDialog.openConfirm(getShell(), Messages.LaunchConfigurationEditDialog_3,
Messages.LaunchConfigurationEditDialog_4 + config.getName())) {
new Job(Messages.LaunchConfigurationEditDialog_5) {
protected IStatus run(IProgressMonitor monitor) {
try {
config.delete();
@ -139,7 +140,7 @@ public class LaunchConfigurationEditDialog extends LaunchConfigurationProperties
case DUPLICATE_ID:
final ILaunchConfiguration original = getLaunchConfiguration();
final String newName = DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(original.getName());
new Job("Duplicating launch configuration") {
new Job(Messages.LaunchConfigurationEditDialog_6) {
protected IStatus run(IProgressMonitor monitor) {
try {
ILaunchConfigurationWorkingCopy newWorkingCopy = original.copy(newName);

View file

@ -30,6 +30,7 @@ import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.launchbar.ui.internal.Activator;
import org.eclipse.launchbar.ui.internal.Messages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
@ -42,6 +43,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
@SuppressWarnings("restriction")
public class NewLaunchConfigEditPage extends WizardPage {
ILaunchConfigurationWorkingCopy workingCopy;
ILaunchConfigurationTabGroup tabGroup;
@ -51,9 +53,9 @@ public class NewLaunchConfigEditPage extends WizardPage {
private LaunchConfigurationManager launchConfigurationMgr = DebugUIPlugin.getDefault().getLaunchConfigurationManager();
public NewLaunchConfigEditPage() {
super("NewLaunchConfigEditPage");
setTitle("Launch Configuration Properties");
setDescription("Edit the new launch configuration properties");
super(Messages.NewLaunchConfigEditPage_0);
setTitle(Messages.NewLaunchConfigEditPage_1);
setDescription(Messages.NewLaunchConfigEditPage_2);
}
@Override
@ -62,7 +64,7 @@ public class NewLaunchConfigEditPage extends WizardPage {
comp.setLayout(new GridLayout(2, false));
Label label = new Label(comp, SWT.NONE);
label.setLayoutData(new GridData());
label.setText("Name:");
label.setText(Messages.NewLaunchConfigEditPage_3 + ":"); //$NON-NLS-1$
nameText = new Text(comp, SWT.BORDER);
nameText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
ColorRegistry reg = JFaceResources.getColorRegistry();
@ -97,14 +99,14 @@ public class NewLaunchConfigEditPage extends WizardPage {
private String checkName(String name) {
try {
if (name.isEmpty()) {
return "Name can not be empty";
return Messages.NewLaunchConfigEditPage_4;
}
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
if (manager.isExistingLaunchConfigurationName(name)) {
ILaunchConfiguration config = ((LaunchManager) manager).findLaunchConfiguration(name);
if (config != workingCopy.getOriginal()) {
return ("A configuration with this name already exists");
return (Messages.NewLaunchConfigEditPage_5);
}
}
} catch (Exception e) {
@ -120,7 +122,7 @@ public class NewLaunchConfigEditPage extends WizardPage {
return;
try {
String initialMode = ((NewLaunchConfigWizard) getWizard()).modePage.selectedGroup.getMode();
workingCopy = type.newInstance(null, "New Configuration");
workingCopy = type.newInstance(null, Messages.NewLaunchConfigEditPage_6);
tabGroup = LaunchConfigurationPresentationManager.getDefault().getTabGroup(workingCopy, initialMode);
for (CTabItem item : tabFolder.getItems())
item.dispose();
@ -236,7 +238,7 @@ public class NewLaunchConfigEditPage extends WizardPage {
@Override
public String generateName(String name) {
if (name == null)
return "";
return ""; //$NON-NLS-1$
return DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(name);
}

View file

@ -17,6 +17,7 @@ import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.ILaunchGroup;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.launchbar.ui.internal.Messages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@ -32,9 +33,9 @@ public class NewLaunchConfigModePage extends WizardPage {
ILaunchGroup selectedGroup;
public NewLaunchConfigModePage() {
super("Select Initial Launch Mode");
setTitle("Initial Launch Mode");
setDescription("Select initial launch mode.");
super(Messages.NewLaunchConfigModePage_0);
setTitle(Messages.NewLaunchConfigModePage_1);
setDescription(Messages.NewLaunchConfigModePage_2);
}
@Override
@ -49,14 +50,14 @@ public class NewLaunchConfigModePage extends WizardPage {
Set<ILaunchGroup> done = new HashSet<>();
for (ILaunchGroup group : DebugUITools.getLaunchGroups()) {
if (group.getMode().equals("run")) {
if (group.getMode().equals("run")) { //$NON-NLS-1$
createModeItem(group);
done.add(group);
}
}
for (ILaunchGroup group : DebugUITools.getLaunchGroups()) {
if (group.getMode().equals("debug")) {
if (group.getMode().equals("debug")) { //$NON-NLS-1$
createModeItem(group);
done.add(group);
}
@ -73,7 +74,7 @@ public class NewLaunchConfigModePage extends WizardPage {
int i = 0;
boolean hasDebug = false;
for (TableItem item : table.getItems()) {
if ("debug".equals(((ILaunchGroup) item.getData()).getMode())) {
if ("debug".equals(((ILaunchGroup) item.getData()).getMode())) { //$NON-NLS-1$
hasDebug = true;
table.select(i);
break;
@ -103,7 +104,7 @@ public class NewLaunchConfigModePage extends WizardPage {
return;
TableItem item = new TableItem(table, SWT.NONE);
item.setText(group.getLabel().replace("&", ""));
item.setText(group.getLabel().replace("&", "")); //$NON-NLS-1$ //$NON-NLS-2$
ImageDescriptor imageDesc = group.getImageDescriptor();
if (imageDesc != null) {
item.setImage(imageDesc.createImage());

View file

@ -17,6 +17,7 @@ import org.eclipse.debug.ui.ILaunchGroup;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.launchbar.ui.internal.Messages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@ -29,9 +30,9 @@ public class NewLaunchConfigTypePage extends WizardPage {
private Table table;
public NewLaunchConfigTypePage() {
super("Select Launch Configuration Type");
setTitle("Launch Configuration Type");
setDescription("Select the type of launch configuration to create.");
super(Messages.NewLaunchConfigTypePage_0);
setTitle(Messages.NewLaunchConfigTypePage_1);
setDescription(Messages.NewLaunchConfigTypePage_2);
}
@Override

View file

@ -21,6 +21,7 @@ import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchMode;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.launchbar.ui.internal.Activator;
import org.eclipse.launchbar.ui.internal.Messages;
public class NewLaunchConfigWizard extends Wizard implements ILaunchConfigurationListener {
@ -31,7 +32,7 @@ public class NewLaunchConfigWizard extends Wizard implements ILaunchConfiguratio
private List<ILaunchConfiguration> configsToDelete = new ArrayList<>();
public NewLaunchConfigWizard() {
setWindowTitle("Create Launch Configuration");
setWindowTitle(Messages.NewLaunchConfigWizard_0);
initListeners();
}

View file

@ -1,4 +1,41 @@
ConfigSelector_0=No Launch Configurations
ConfigSelector_1=Launch configuration
ConfigSelector_2=Create New Configuration...
ConfigSelector_3=Create Launch Configuration
CSelector_0=Closing popup
CSelector_1=Updating launch bar selection
EditButton_0=Edit
FilterControl_0=type filter text
FilterControl_1={0} {1} matches.
LaunchBarControl_0=on
LaunchBarControl_Build=Build
LaunchBarControl_Launch=Launch
LaunchBarControl_Stop=Stop
LaunchBarListViewer_0=Increase/Decrease size of recently used elements pane
LaunchBarPreferencePage_0=Preferences for the Launch Bar.
LaunchBarPreferencePage_1=Enable the Launch Bar.
LaunchConfigurationEditDialog_0=Delete
LaunchConfigurationEditDialog_1=Duplicate
LaunchConfigurationEditDialog_2=Launch
LaunchConfigurationEditDialog_3=Confirm Delete
LaunchConfigurationEditDialog_4=Are you sure you want to delete
LaunchConfigurationEditDialog_5=Deleting launch configuration
LaunchConfigurationEditDialog_6=Duplicating launch configuration
ModeSelector_0=Launch configuration
NewLaunchConfigEditPage_0=NewLaunchConfigEditPage
NewLaunchConfigEditPage_1=Launch Configuration Properties
NewLaunchConfigEditPage_2=Edit the new launch configuration properties
NewLaunchConfigEditPage_3=Name
NewLaunchConfigEditPage_4=Name can not be empty
NewLaunchConfigEditPage_5=A configuration with this name already exists
NewLaunchConfigEditPage_6=New Configuration
NewLaunchConfigModePage_0=Select Initial Launch Mode
NewLaunchConfigModePage_1=Initial Launch Mode
NewLaunchConfigModePage_2=Select initial launch mode.
NewLaunchConfigTypePage_0=Select Launch Configuration Type
NewLaunchConfigTypePage_1=Launch Configuration Type
NewLaunchConfigTypePage_2=Select the type of launch configuration to create.
NewLaunchConfigWizard_0=Create Launch Configuration
StopActiveCommandHandler_0=Stopping launches
StopActiveCommandHandler_1=Stopping build
TargetSelector_CreateNewTarget=Create New Connection...

View file

@ -53,6 +53,7 @@ import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
@SuppressWarnings("restriction")
@FixMethodOrder(MethodSorters.JVM)
public class LaunchBarManager2Test {
private LaunchBarManager manager;

View file

@ -27,7 +27,7 @@ import org.eclipse.remote.core.IRemoteServicesManager;
import org.eclipse.remote.core.launch.IRemoteLaunchConfigService;
import org.junit.Test;
@SuppressWarnings("nls")
public class LaunchBarManagerTest {
@Test