mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Cosmetics.
This commit is contained in:
parent
f090b8cd41
commit
03669cfebe
6 changed files with 22 additions and 45 deletions
|
@ -7,8 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
* Ken Ryall (Nokia) - bug 178731
|
* Ken Ryall (Nokia) - bugs 178731, 246201
|
||||||
* Ken Ryall (Nokia) - bug 246201
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.ui.launch;
|
package org.eclipse.cdt.debug.internal.ui.launch;
|
||||||
|
|
||||||
|
@ -70,7 +69,6 @@ import org.eclipse.ui.dialogs.ElementListSelectionDialog;
|
||||||
import org.eclipse.ui.dialogs.TwoPaneElementSelector;
|
import org.eclipse.ui.dialogs.TwoPaneElementSelector;
|
||||||
|
|
||||||
public class CApplicationLaunchShortcut implements ILaunchShortcut2 {
|
public class CApplicationLaunchShortcut implements ILaunchShortcut2 {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void launch(IEditorPart editor, String mode) {
|
public void launch(IEditorPart editor, String mode) {
|
||||||
searchAndLaunch(new Object[] { editor.getEditorInput() }, mode);
|
searchAndLaunch(new Object[] { editor.getEditorInput() }, mode);
|
||||||
|
|
|
@ -21,38 +21,34 @@ import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A property tester that determines if a file is an executable.
|
* A property tester that determines if a file is an executable or a C/C++ project.
|
||||||
*/
|
*/
|
||||||
public class CPropertyTester extends PropertyTester {
|
public class CPropertyTester extends PropertyTester {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
|
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
|
||||||
if ("isExecutable".equals(property)) //$NON-NLS-1$
|
if ("isExecutable".equals(property)) //$NON-NLS-1$
|
||||||
return isExecutable(receiver);
|
return isExecutable(receiver);
|
||||||
else if ("isCProject".equals(property)) //$NON-NLS-1$
|
if ("isCProject".equals(property)) //$NON-NLS-1$
|
||||||
return isCProject(receiver);
|
return isCProject(receiver);
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isExecutable(Object receiver) {
|
private boolean isExecutable(Object receiver) {
|
||||||
ICElement celement = null;
|
ICElement celement = null;
|
||||||
if (receiver instanceof IAdaptable) {
|
if (receiver instanceof IAdaptable) {
|
||||||
IResource res = (IResource) ((IAdaptable)receiver).getAdapter(IResource.class);
|
IResource res = (IResource) ((IAdaptable) receiver).getAdapter(IResource.class);
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
celement = CoreModel.getDefault().create(res);
|
celement = CoreModel.getDefault().create(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (celement != null && celement instanceof IBinary);
|
return celement != null && celement instanceof IBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isCProject(Object receiver) {
|
private boolean isCProject(Object receiver) {
|
||||||
if (receiver instanceof IProject)
|
if (receiver instanceof IProject)
|
||||||
return CoreModel.hasCNature((IProject)receiver);
|
return CoreModel.hasCNature((IProject) receiver);
|
||||||
else if (receiver instanceof ICProject)
|
if (receiver instanceof ICProject)
|
||||||
return true;
|
return true;
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,15 +24,9 @@ import org.eclipse.debug.ui.actions.ILaunchable;
|
||||||
* the ILaunchable interface and Bugzilla : 396822.
|
* the ILaunchable interface and Bugzilla : 396822.
|
||||||
*/
|
*/
|
||||||
public class InvalidLaunchableAdapterFactory implements IAdapterFactory {
|
public class InvalidLaunchableAdapterFactory implements IAdapterFactory {
|
||||||
|
|
||||||
private static final Class<?>[] TYPES = { ILaunchable.class };
|
private static final Class<?>[] TYPES = { ILaunchable.class };
|
||||||
|
|
||||||
private static ArrayList<String> currentTraces = new ArrayList<String>();
|
private static ArrayList<String> currentTraces = new ArrayList<String>();
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public Object getAdapter(Object adaptableObject, Class adapterType) {
|
public Object getAdapter(Object adaptableObject, Class adapterType) {
|
||||||
|
@ -42,23 +36,21 @@ public class InvalidLaunchableAdapterFactory implements IAdapterFactory {
|
||||||
*/
|
*/
|
||||||
String trace = getStackTrace();
|
String trace = getStackTrace();
|
||||||
|
|
||||||
if ( ! currentTraces.contains( trace ) ) {
|
if (!currentTraces.contains(trace)) {
|
||||||
/*
|
/*
|
||||||
* Note we have seen this one for the first time.
|
* Note we have seen this one for the first time.
|
||||||
*/
|
*/
|
||||||
currentTraces.add( trace );
|
currentTraces.add(trace);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate a message for this in the log file.
|
* Generate a message for this in the log file.
|
||||||
*/
|
*/
|
||||||
String msg = LaunchMessages.getString("Launch.ILaunchable.Interface.Error"); //$NON-NLS-1$
|
String msg = LaunchMessages.getString("Launch.ILaunchable.Interface.Error"); //$NON-NLS-1$
|
||||||
|
|
||||||
CDebugUIPlugin.log( new Status( IStatus.INFO, CDebugUIPlugin.PLUGIN_ID, 0, msg, new Throwable( "" ) ) ); //$NON-NLS-1$
|
CDebugUIPlugin.log(new Status(IStatus.INFO, CDebugUIPlugin.PLUGIN_ID, 0, msg, new Throwable(""))); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// We do not actually provide an adapter factory for this.
|
||||||
* We do not actually provide an adapter factory for this.
|
|
||||||
*/
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,9 +68,6 @@ public class InvalidLaunchableAdapterFactory implements IAdapterFactory {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Indicates that we are adapting ILaunchable.
|
* Indicates that we are adapting ILaunchable.
|
||||||
*
|
|
||||||
* (non-Javadoc)
|
|
||||||
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
|
|
|
@ -10,21 +10,20 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.ui.launch;
|
package org.eclipse.cdt.debug.internal.ui.launch;
|
||||||
|
|
||||||
import com.ibm.icu.text.MessageFormat;
|
|
||||||
import java.util.MissingResourceException;
|
import java.util.MissingResourceException;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import com.ibm.icu.text.MessageFormat;
|
||||||
|
|
||||||
public class LaunchMessages {
|
public class LaunchMessages {
|
||||||
|
|
||||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.launch.LaunchMessages";//$NON-NLS-1$
|
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.launch.LaunchMessages";//$NON-NLS-1$
|
||||||
|
|
||||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
|
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
|
||||||
|
|
||||||
private LaunchMessages() {
|
private LaunchMessages() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFormattedString(String key, String arg) {
|
public static String getFormattedString(String key, String arg) {
|
||||||
return MessageFormat.format(getString(key), new String[]{arg});
|
return MessageFormat.format(getString(key), new String[] { arg });
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFormattedString(String key, String[] args) {
|
public static String getFormattedString(String key, String[] args) {
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
# Carlos O'Donnel (CodeSourcery) - Bug 218366
|
# Carlos O'Donnel (CodeSourcery) - Bug 218366
|
||||||
# IBM Corporation
|
# IBM Corporation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
CApplicationLaunchShortcut.Application_Launcher=Application Launcher
|
CApplicationLaunchShortcut.Application_Launcher=Application Launcher
|
||||||
CApplicationLaunchShortcut.ChooseConfigToDebug=Choose a debug configuration to debug
|
CApplicationLaunchShortcut.ChooseConfigToDebug=Choose a debug configuration to debug
|
||||||
CApplicationLaunchShortcut.ChooseConfigToRun=Choose a configuration to run
|
CApplicationLaunchShortcut.ChooseConfigToRun=Choose a configuration to run
|
||||||
|
|
|
@ -23,10 +23,6 @@ import org.eclipse.debug.ui.ILaunchConfigurationTab;
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
*/
|
*/
|
||||||
public class PlaceHolderLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
|
public class PlaceHolderLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
|
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
|
||||||
setTabs(new ILaunchConfigurationTab[0]);
|
setTabs(new ILaunchConfigurationTab[0]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue