1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2013-08-13 10:07:04 -07:00
parent f090b8cd41
commit 03669cfebe
6 changed files with 22 additions and 45 deletions

View file

@ -7,8 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Ken Ryall (Nokia) - bug 178731
* Ken Ryall (Nokia) - bug 246201
* Ken Ryall (Nokia) - bugs 178731, 246201
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.launch;
@ -70,7 +69,6 @@ import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.eclipse.ui.dialogs.TwoPaneElementSelector;
public class CApplicationLaunchShortcut implements ILaunchShortcut2 {
@Override
public void launch(IEditorPart editor, String mode) {
searchAndLaunch(new Object[] { editor.getEditorInput() }, mode);

View file

@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Contributors:
* IBM Corporation - initial implementation
* Ken Ryall (Nokia) - Modified to launch on a project context.
*******************************************************************************/
@ -21,38 +21,34 @@ import org.eclipse.core.resources.IResource;
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 {
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if ("isExecutable".equals(property)) //$NON-NLS-1$
return isExecutable(receiver);
else if ("isCProject".equals(property)) //$NON-NLS-1$
if ("isCProject".equals(property)) //$NON-NLS-1$
return isCProject(receiver);
else
return false;
return false;
}
private boolean isExecutable(Object receiver) {
ICElement celement = null;
if (receiver instanceof IAdaptable) {
IResource res = (IResource) ((IAdaptable)receiver).getAdapter(IResource.class);
IResource res = (IResource) ((IAdaptable) receiver).getAdapter(IResource.class);
if (res != null) {
celement = CoreModel.getDefault().create(res);
}
}
return (celement != null && celement instanceof IBinary);
return celement != null && celement instanceof IBinary;
}
private boolean isCProject(Object receiver) {
if (receiver instanceof IProject)
return CoreModel.hasCNature((IProject)receiver);
else if (receiver instanceof ICProject)
return CoreModel.hasCNature((IProject) receiver);
if (receiver instanceof ICProject)
return true;
else
return false;
return false;
}
}

View file

@ -24,15 +24,9 @@ import org.eclipse.debug.ui.actions.ILaunchable;
* the ILaunchable interface and Bugzilla : 396822.
*/
public class InvalidLaunchableAdapterFactory implements IAdapterFactory {
private static final Class<?>[] TYPES = { ILaunchable.class };
private static ArrayList<String> currentTraces = new ArrayList<String>();
/*
* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
*/
@Override
@SuppressWarnings("rawtypes")
public Object getAdapter(Object adaptableObject, Class adapterType) {
@ -42,23 +36,21 @@ public class InvalidLaunchableAdapterFactory implements IAdapterFactory {
*/
String trace = getStackTrace();
if ( ! currentTraces.contains( trace ) ) {
if (!currentTraces.contains(trace)) {
/*
* 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.
*/
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;
}
@ -76,9 +68,6 @@ public class InvalidLaunchableAdapterFactory implements IAdapterFactory {
/*
* Indicates that we are adapting ILaunchable.
*
* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
*/
@Override
@SuppressWarnings("rawtypes")

View file

@ -10,21 +10,20 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.launch;
import com.ibm.icu.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import com.ibm.icu.text.MessageFormat;
public class LaunchMessages {
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 LaunchMessages() {
}
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) {

View file

@ -12,7 +12,6 @@
# Carlos O'Donnel (CodeSourcery) - Bug 218366
# IBM Corporation
###############################################################################
CApplicationLaunchShortcut.Application_Launcher=Application Launcher
CApplicationLaunchShortcut.ChooseConfigToDebug=Choose a debug configuration to debug
CApplicationLaunchShortcut.ChooseConfigToRun=Choose a configuration to run

View file

@ -23,10 +23,6 @@ import org.eclipse.debug.ui.ILaunchConfigurationTab;
* @since 6.0
*/
public class PlaceHolderLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
*/
@Override
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
setTabs(new ILaunchConfigurationTab[0]);