1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

added missing copyright

This commit is contained in:
David Inglis 2004-06-10 15:15:51 +00:00
parent 6ffa80bd87
commit e661886b30
20 changed files with 405 additions and 258 deletions

View file

@ -1,9 +1,9 @@
######################################################################
# Copyright (c) 2002 QNX Software Systems Ltd. and others.
# Copyright (c) 2002 - 2004 QNX Software Systems Ltd. and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Common Public License v0.5
# are made available under the terms of the Common Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/cpl-v05.html
# http://www.eclipse.org/legal/cpl-v10.html
#
# Contributors:
# QNX Software Systems Ltd. - Initial implementation

View file

@ -1,6 +1,13 @@
/*
* (c) Copyright QNX Software System Ltd. 2002. All Rights Reserved.
*/
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch;
import java.io.File;
@ -64,13 +71,14 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
throws CoreException;
/**
* Return the save environment variables in the configuration. The array does not include the default environment of the target.
* array[n] : name=value
* Return the save environment variables in the configuration. The array
* does not include the default environment of the target. array[n] :
* name=value
*/
protected String[] getEnvironmentArray(ILaunchConfiguration config) {
Map env = null;
try {
env = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, (Map) null);
env = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, (Map)null);
} catch (CoreException e) {
}
if (env == null) {
@ -80,21 +88,21 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
Iterator entries = env.entrySet().iterator();
Entry entry;
for (int i = 0; entries.hasNext() && i < array.length; i++) {
entry = (Entry) entries.next();
array[i] = ((String) entry.getKey()) + "=" + ((String) entry.getValue()); //$NON-NLS-1$
entry = (Entry)entries.next();
array[i] = ((String)entry.getKey()) + "=" + ((String)entry.getValue()); //$NON-NLS-1$
}
return array;
}
/**
* Return the save environment variables of this configuration. The array does not include the default environment of the
* target.
* Return the save environment variables of this configuration. The array
* does not include the default environment of the target.
*/
protected Properties getEnvironmentProperty(ILaunchConfiguration config) {
Properties prop = new Properties();
Map env = null;
try {
env = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, (Map) null);
env = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, (Map)null);
} catch (CoreException e) {
}
if (env == null)
@ -102,8 +110,8 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
Iterator entries = env.entrySet().iterator();
Entry entry;
while (entries.hasNext()) {
entry = (Entry) entries.next();
prop.setProperty((String) entry.getKey(), (String) entry.getValue());
entry = (Entry)entries.next();
prop.setProperty((String)entry.getKey(), (String)entry.getValue());
}
return prop;
}
@ -116,22 +124,22 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
}
/**
* Expand the variable with the format ${key}. example: HOME=/foobar NEWHOME = ${HOME}/project The environement NEWHOME will be
* /foobar/project.
* Expand the variable with the format ${key}. example: HOME=/foobar NEWHOME =
* ${HOME}/project The environement NEWHOME will be /foobar/project.
*/
protected Properties expandEnvironment(ILaunchConfiguration config) {
return expandEnvironment(getEnvironmentProperty(config));
}
/**
* Expand the variable with the format ${key}. example: HOME=/foobar NEWHOME = ${HOME}/project The environement NEWHOME will be
* /foobar/project.
* Expand the variable with the format ${key}. example: HOME=/foobar NEWHOME =
* ${HOME}/project The environement NEWHOME will be /foobar/project.
*/
protected Properties expandEnvironment(Properties props) {
Enumeration names = props.propertyNames();
if (names != null) {
while (names.hasMoreElements()) {
String key = (String) names.nextElement();
String key = (String)names.nextElement();
String value = props.getProperty(key);
if (value != null && value.indexOf('$') != -1) {
StringBuffer sb = new StringBuffer();
@ -170,7 +178,8 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
String v = null;
String p = param.toString();
/*
* Search in the current property only if it is not the same name.
* Search in the current property only if it
* is not the same name.
*/
if (!p.equals(key)) {
v = props.getProperty(p);
@ -197,7 +206,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
sb.append(ch);
} else {
/* Do not had the '{' */
if (!(ch == '{' && prev == '$')) {
if (! (ch == '{' && prev == '$')) {
param.append(ch);
}
}
@ -211,12 +220,14 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
}
/**
* Returns the working directory specified by the given launch configuration, or <code>null</code> if none.
* Returns the working directory specified by the given launch
* configuration, or <code>null</code> if none.
*
* @deprecated Should use getWorkingDirectory()
* @param configuration
* launch configuration
* @return the working directory specified by the given launch configuration, or <code>null</code> if none
* @return the working directory specified by the given launch
* configuration, or <code>null</code> if none
* @exception CoreException
* if unable to retrieve the attribute
*/
@ -225,11 +236,13 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
}
/**
* Returns the working directory specified by the given launch configuration, or <code>null</code> if none.
* Returns the working directory specified by the given launch
* configuration, or <code>null</code> if none.
*
* @param configuration
* launch configuration
* @return the working directory specified by the given launch configuration, or <code>null</code> if none
* @return the working directory specified by the given launch
* configuration, or <code>null</code> if none
* @exception CoreException
* if unable to retrieve the attribute
*/
@ -238,7 +251,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
}
protected IPath getWorkingDirectoryPath(ILaunchConfiguration config) throws CoreException {
String path = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null);
String path = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String)null);
if (path != null) {
return new Path(path);
}
@ -246,12 +259,14 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
}
/**
* Throws a core exception with an error status object built from the given message, lower level exception, and error code.
* Throws a core exception with an error status object built from the given
* message, lower level exception, and error code.
*
* @param message
* the status message
* @param exception
* lower level exception associated with the error, or <code>null</code> if none
* lower level exception associated with the error, or
* <code>null</code> if none
* @param code
* error code
*/
@ -284,16 +299,17 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
}
public static String getProjectName(ILaunchConfiguration configuration) throws CoreException {
return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String) null);
return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
}
public static String getProgramName(ILaunchConfiguration configuration) throws CoreException {
return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String) null);
return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
}
/**
* Assigns a default source locator to the given launch if a source locator has not yet been assigned to it, and the associated
* launch configuration does not specify a source locator.
* Assigns a default source locator to the given launch if a source locator
* has not yet been assigned to it, and the associated launch configuration
* does not specify a source locator.
*
* @param launch
* launch object
@ -306,7 +322,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
// set default source locator if none specified
if (launch.getSourceLocator() == null) {
IPersistableSourceLocator sourceLocator;
String id = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, (String) null);
String id = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, (String)null);
if (id == null) {
ICProject cProject = getCProject(configuration);
if (cProject == null) {
@ -317,7 +333,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
sourceLocator.initializeDefaults(configuration);
} else {
sourceLocator = DebugPlugin.getDefault().getLaunchManager().newSourceLocator(id);
String memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String) null);
String memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String)null);
if (memento == null) {
sourceLocator.initializeDefaults(configuration);
} else {
@ -334,7 +350,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
* @return the program arguments as a String
*/
public String getProgramArguments(ILaunchConfiguration config) throws CoreException {
return config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, (String) null);
return config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, (String)null);
}
/**
@ -394,7 +410,8 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
protected String renderDebuggerProcessLabel() {
String format = "{0} ({1})"; //$NON-NLS-1$
String timestamp = DateFormat.getInstance().format(new Date(System.currentTimeMillis()));
return MessageFormat.format(format, new String[]{LaunchUIPlugin.getResourceString("AbstractCLaunchDelegate.Debugger_Process"), timestamp}); //$NON-NLS-1$
return MessageFormat.format(format, new String[]{
LaunchUIPlugin.getResourceString("AbstractCLaunchDelegate.Debugger_Process"), timestamp}); //$NON-NLS-1$
}
protected ICProject verifyCProject(ILaunchConfiguration config) throws CoreException {
@ -427,7 +444,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROGRAM);
}
IFile programPath = ((IProject) cproject.getResource()).getFile(fileName);
IFile programPath = ((IProject)cproject.getResource()).getFile(fileName);
if (programPath == null || !programPath.exists() || !programPath.getLocation().toFile().exists()) {
abort(LaunchUIPlugin.getResourceString("AbstractCLaunchDelegate.Program_file_does_not_exist"), //$NON-NLS-1$
new FileNotFoundException(LaunchUIPlugin.getFormattedResourceString(
@ -442,12 +459,14 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
}
/**
* Verifies the working directory specified by the given launch configuration exists, and returns the working directory, or
* Verifies the working directory specified by the given launch
* configuration exists, and returns the working directory, or
* <code>null</code> if none is specified.
*
* @param configuration
* launch configuration
* @return the working directory specified by the given launch configuration, or <code>null</code> if none
* @return the working directory specified by the given launch
* configuration, or <code>null</code> if none
* @exception CoreException
* if unable to retrieve the attribute
*/
@ -469,7 +488,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
abort(LaunchUIPlugin.getResourceString("AbstractCLaunchDelegate.Working_directory_does_not_exist"), //$NON-NLS-1$
new FileNotFoundException(LaunchUIPlugin.getFormattedResourceString(
"AbstractCLaunchDelegate.PROGRAM_PATH_not_found", path.toOSString())), //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST);
ICDTLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST);
} else {
IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
if (res instanceof IContainer && res.exists()) {
@ -478,7 +497,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
abort(LaunchUIPlugin.getResourceString("AbstractCLaunchDelegate.Working_directory_does_not_exist"), //$NON-NLS-1$
new FileNotFoundException(LaunchUIPlugin.getFormattedResourceString(
"AbstractCLaunchDelegate.PROGRAM_PATH_does_not_exist", path.toOSString())), //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST);
ICDTLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST);
}
}
return null;
@ -499,7 +518,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
ch = getNext();
while (ch > 0) {
while (Character.isWhitespace((char) ch))
while (Character.isWhitespace((char)ch))
ch = getNext();
if (ch == '"') {
@ -531,7 +550,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
}
}
if (ch > 0) {
buf.append((char) ch);
buf.append((char)ch);
ch = getNext();
}
}
@ -544,14 +563,14 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
private String parseToken() {
StringBuffer buf = new StringBuffer();
while (ch > 0 && !Character.isWhitespace((char) ch)) {
while (ch > 0 && !Character.isWhitespace((char)ch)) {
if (ch == '\\') {
ch = getNext();
if (ch > 0) {
if (ch != '"') { // Only escape double quotes
buf.append('\\');
}
buf.append((char) ch);
buf.append((char)ch);
ch = getNext();
} else if (ch == -1) { // Don't lose a trailing backslash
buf.append('\\');
@ -559,7 +578,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
} else if (ch == '"') {
buf.append(parseString());
} else {
buf.append((char) ch);
buf.append((char)ch);
ch = getNext();
}
}
@ -575,7 +594,8 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
* @param referencedProjSet
* A set of referenced projects
* @throws CoreException
* if an error occurs while getting referenced projects from the current project
* if an error occurs while getting referenced projects from the
* current project
*/
private void getReferencedProjectSet(IProject project, HashSet referencedProjSet) throws CoreException {
IProject[] projects = project.getReferencedProjects();
@ -590,7 +610,8 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
}
/**
* creates a list of project ordered by their build order from an unordered list of projects.
* creates a list of project ordered by their build order from an unordered
* list of projects.
*
* @param resourceCollection
* The list of projects to sort.
@ -600,14 +621,15 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
String[] orderedNames = ResourcesPlugin.getWorkspace().getDescription().getBuildOrder();
if (orderedNames != null) {
List orderedProjects = new ArrayList(resourceCollection.size());
//Projects may not be in the build order but should be built if selected
//Projects may not be in the build order but should be built if
// selected
List unorderedProjects = new ArrayList(resourceCollection.size());
unorderedProjects.addAll(resourceCollection);
for (int i = 0; i < orderedNames.length; i++) {
String projectName = orderedNames[i];
for (int j = 0; j < resourceCollection.size(); j++) {
IProject project = (IProject) resourceCollection.get(j);
IProject project = (IProject)resourceCollection.get(j);
if (project.getName().equals(projectName)) {
orderedProjects.add(project);
unorderedProjects.remove(project);
@ -622,7 +644,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
// Try the project prerequisite order then
IProject[] projects = new IProject[resourceCollection.size()];
projects = (IProject[]) resourceCollection.toArray(projects);
projects = (IProject[])resourceCollection.toArray(projects);
IWorkspace.ProjectOrder po = ResourcesPlugin.getWorkspace().computeProjectOrder(projects);
ArrayList orderedProjects = new ArrayList();
orderedProjects.addAll(Arrays.asList(po.projects));
@ -630,7 +652,8 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
}
/**
* Builds the current project and all of it's prerequisite projects if necessary. Respects specified build order if any exists.
* Builds the current project and all of it's prerequisite projects if
* necessary. Respects specified build order if any exists.
*
* @param configuration
* the configuration being launched
@ -638,7 +661,8 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
* the mode the configuration is being launched in
* @param monitor
* progress monitor
* @return whether the debug platform should perform an incremental workspace build before the launch
* @return whether the debug platform should perform an incremental
* workspace build before the launch
* @throws CoreException
* if an exception occurrs while building
*/
@ -649,7 +673,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
orderedProjects.size() + 1);
for (Iterator i = orderedProjects.iterator(); i.hasNext();) {
IProject proj = (IProject) i.next();
IProject proj = (IProject)i.next();
monitor.subTask(LaunchUIPlugin.getResourceString("AbstractCLaunchConfigurationDelegate.building") + proj.getName()); //$NON-NLS-1$
proj.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
}
@ -662,8 +686,9 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
}
/**
* Searches for compile errors in the current project and any of its prerequisite projects. If any compile errors, give the user
* a chance to abort the launch and correct the errors.
* Searches for compile errors in the current project and any of its
* prerequisite projects. If any compile errors, give the user a chance to
* abort the launch and correct the errors.
*
* @param configuration
* @param mode
@ -683,7 +708,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
//check prerequisite projects for compile errors.
for (Iterator i = orderedProjects.iterator(); i.hasNext();) {
IProject proj = (IProject) i.next();
IProject proj = (IProject)i.next();
monitor.subTask(LaunchUIPlugin.getResourceString("AbstractCLaunchConfigurationDelegate.searching_for_errors_in") //$NON-NLS-1$
+ proj.getName());
compileErrorsInProjs = existsErrors(proj);
@ -703,7 +728,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
if (compileErrorsInProjs) {
IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(promptStatus);
if (prompter != null) {
continueLaunch = ((Boolean) prompter.handleStatus(complileErrorPromptStatus, null)).booleanValue();
continueLaunch = ((Boolean)prompter.handleStatus(complileErrorPromptStatus, null)).booleanValue();
}
}
}
@ -725,7 +750,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
if (markers.length > 0) {
for (int j = 0; j < markers.length; j++) {
if (((Integer) markers[j].getAttribute(IMarker.SEVERITY)).intValue() == IMarker.SEVERITY_ERROR) {
if ( ((Integer)markers[j].getAttribute(IMarker.SEVERITY)).intValue() == IMarker.SEVERITY_ERROR) {
return true;
}
}

View file

@ -1,3 +1,13 @@
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.internal;
import java.lang.reflect.InvocationTargetException;
@ -43,20 +53,12 @@ import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.eclipse.ui.dialogs.TwoPaneElementSelector;
/**
*/
public class CApplicationLaunchShortcut implements ILaunchShortcut {
/**
* @see org.eclipse.debug.ui.ILaunchShortcut#launch(IEditorPart, String)
*/
public void launch(IEditorPart editor, String mode) {
searchAndLaunch(new Object[] { editor.getEditorInput()}, mode);
}
/**
* @see org.eclipse.debug.ui.ILaunchShortcut#launch(ISelection, String)
*/
public void launch(ISelection selection, String mode) {
if (selection instanceof IStructuredSelection) {
searchAndLaunch(((IStructuredSelection) selection).toArray(), mode);

View file

@ -1,3 +1,13 @@
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.internal;
import org.eclipse.cdt.core.model.ICProject;
@ -24,10 +34,6 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
/**
* Insert the type's description here.
* @see ILaunchConfigurationDelegate
*/
public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {

View file

@ -1,16 +1,22 @@
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.internal;
/*
* (c) Copyright QNX Software System 2002.
* All Rights Reserved.
*/
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Properties;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.IProcessInfo;
import org.eclipse.cdt.core.IProcessList;
@ -38,7 +44,6 @@ import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.IStatusHandler;
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ILabelProvider;
@ -49,10 +54,6 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.TwoPaneElementSelector;
/**
* Insert the type's description here.
* @see ILaunchConfigurationDelegate
*/
public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {

View file

@ -1,7 +1,13 @@
/*
* (c) Copyright QNX Software System Ltd. 2002.
* All Rights Reserved.
*/
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.internal.ui;
import java.util.Map;

View file

@ -1,3 +1,13 @@
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.internal.ui;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
@ -10,15 +20,10 @@ import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
/**
* Insert the type's description here.
* @see AbstractLaunchConfigurationTabGroup
*/
public class CoreFileCLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
/**
* Insert the method's description here.
* @see AbstractLaunchConfigurationTabGroup#createTabs
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
*/
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
@ -30,6 +35,9 @@ public class CoreFileCLaunchConfigurationTabGroup extends AbstractLaunchConfigur
setTabs(tabs);
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
// This configuration should work for all platforms
configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PLATFORM, "*"); //$NON-NLS-1$

View file

@ -1,3 +1,13 @@
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.internal.ui;
import java.net.MalformedURLException;
@ -9,10 +19,6 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
/*
* (c) Copyright QN Software Systems Ltd. 2002.
* All Rights Reserved.
*/
public class LaunchImages {
private static final String NAME_PREFIX= LaunchUIPlugin.PLUGIN_ID + '.';
private static final int NAME_PREFIX_LENGTH= NAME_PREFIX.length();

View file

@ -1,3 +1,13 @@
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.internal.ui;
import java.text.MessageFormat;
@ -21,9 +31,6 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/*
* (c) Copyright QNX Software Systems Ltd. 2002. All Rights Reserved.
*/
public class LaunchUIPlugin extends AbstractUIPlugin
implements
IDebugEventSetListener {

View file

@ -1,3 +1,13 @@
#####################################################################
# Copyright (c) 2002 - 2004 QNX Software Systems and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Common Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/cpl-v10.html
#
# Contributors:
# QNX Software Systems - Initial API and implementation
#######################################################################
AbstractCLaunchDelegate.Debugger_not_installed=CDT Debugger not installed
AbstractCLaunchDelegate.C_Project_not_specified=C Project not specified

View file

@ -1,3 +1,13 @@
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.internal.ui;
import org.eclipse.cdt.launch.ui.CArgumentsTab;
@ -10,15 +20,10 @@ import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
/**
* Insert the type's description here.
* @see AbstractLaunchConfigurationTabGroup
*/
public class LocalCLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
/**
* Insert the method's description here.
* @see AbstractLaunchConfigurationTabGroup#createTabs
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
*/
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {

View file

@ -1,3 +1,13 @@
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.internal.ui;
import java.io.File;

View file

@ -1,10 +1,15 @@
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.ui;
/*
* (c) Copyright QNX Software System 2002.
* All Rights Reserved.
*/
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.launch.internal.ui.LaunchImages;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;

View file

@ -1,6 +1,13 @@
/*
* (c) Copyright QNX Software System Ltd. 2002. All Rights Reserved.
*/
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.ui;
import java.util.Arrays;

View file

@ -1,10 +1,15 @@
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.ui;
/*
* (c) Copyright QNX Software System 2002.
* All Rights Reserved.
*/
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;

View file

@ -1,3 +1,13 @@
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.ui;
import org.eclipse.cdt.core.CCorePlugin;
@ -22,17 +32,14 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
public abstract class CLaunchConfigurationTab extends AbstractLaunchConfigurationTab {
/**
* Returns the current C element context from which to initialize
* default settings, or <code>null</code> if none.
* Note, if possible we will return the IBinary based on config entry
* as this may be more usefull then just the project.
* Returns the current C element context from which to initialize default
* settings, or <code>null</code> if none. Note, if possible we will
* return the IBinary based on config entry as this may be more usefull then
* just the project.
*
* @return C element context.
*/
protected ICElement getContext(ILaunchConfiguration config, String platform) {
@ -41,10 +48,9 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
IWorkbenchPage page = LaunchUIPlugin.getActivePage();
Object obj = null;
try {
projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String) null);
programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String) null);
}
catch (CoreException e) {
projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
} catch (CoreException e) {
}
if (projectName != null && !projectName.equals("")) { //$NON-NLS-1$
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
@ -52,12 +58,11 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
if (cProject != null && cProject.exists()) {
obj = cProject;
}
}
else {
} else {
if (page != null) {
ISelection selection = page.getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
IStructuredSelection ss = (IStructuredSelection)selection;
if (!ss.isEmpty()) {
obj = ss.getFirstElement();
}
@ -65,9 +70,9 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
}
}
if (obj instanceof IResource) {
ICElement ce = CoreModel.getDefault().create((IResource) obj);
ICElement ce = CoreModel.getDefault().create((IResource)obj);
if (ce == null) {
IProject pro = ((IResource) obj).getProject();
IProject pro = ((IResource)obj).getProject();
ce = CoreModel.getDefault().create(pro);
}
obj = ce;
@ -76,34 +81,36 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
if (platform != null && !platform.equals("*")) { //$NON-NLS-1$
ICDescriptor descriptor;
try {
descriptor = CCorePlugin.getDefault().getCProjectDescription(((ICElement) obj).getCProject().getProject());
String projectPlatform = descriptor.getPlatform();
if (!projectPlatform.equals(platform) && !projectPlatform.equals("*")) { //$NON-NLS-1$
obj = null;
descriptor = CCorePlugin.getDefault().getCProjectDescription( ((ICElement)obj).getCProject().getProject(),
false);
if (descriptor != null) {
String projectPlatform = descriptor.getPlatform();
if (!projectPlatform.equals(platform) && !projectPlatform.equals("*")) { //$NON-NLS-1$
obj = null;
}
}
}
catch (CoreException e) {
} catch (CoreException e) {
}
}
if (obj != null) {
if (programName == null || programName.equals("")) { //$NON-NLS-1$
return (ICElement) obj;
return (ICElement)obj;
}
ICElement ce = (ICElement) obj;
ICElement ce = (ICElement)obj;
IProject project;
project = (IProject) ce.getCProject().getResource();
project = (IProject)ce.getCProject().getResource();
IPath programFile = project.getFile(programName).getLocation();
ce = CCorePlugin.getDefault().getCoreModel().create(programFile);
if (ce != null && ce.exists()) {
return ce;
}
return (ICElement) obj;
return (ICElement)obj;
}
}
IEditorPart part = page.getActiveEditor();
if (part != null) {
IEditorInput input = part.getEditorInput();
return (ICElement) input.getAdapter(ICElement.class);
return (ICElement)input.getAdapter(ICElement.class);
}
return null;
}
@ -125,8 +132,7 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
String platform = Platform.getOS();
try {
return config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PLATFORM, platform);
}
catch (CoreException e) {
} catch (CoreException e) {
return platform;
}
}

View file

@ -1,10 +1,15 @@
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.ui;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
import java.util.ArrayList;
import org.eclipse.cdt.core.CCorePlugin;
@ -31,7 +36,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.SWT;
@ -58,11 +62,12 @@ import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
/**
* A launch configuration tab that displays and edits project and
* main type name launch configuration attributes.
* A launch configuration tab that displays and edits project and main type name
* launch configuration attributes.
* <p>
* This class may be instantiated. This class is not intended to be subclassed.
* </p>
*
* @since 2.0
*/
@ -82,8 +87,8 @@ public class CMainTab extends CLaunchConfigurationTab {
private String filterPlatform = EMPTY_STRING;
/**
* @see ILaunchConfigurationTab#createControl(Composite)
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl(Composite parent) {
@ -95,7 +100,6 @@ public class CMainTab extends CLaunchConfigurationTab {
GridLayout topLayout = new GridLayout();
comp.setLayout(topLayout);
createVerticalSpacer(comp, 1);
Composite projComp = new Composite(comp, SWT.NONE);
@ -117,6 +121,7 @@ public class CMainTab extends CLaunchConfigurationTab {
gd = new GridData(GridData.FILL_HORIZONTAL);
fProjText.setLayoutData(gd);
fProjText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent evt) {
updateLaunchConfigurationDialog();
}
@ -124,6 +129,7 @@ public class CMainTab extends CLaunchConfigurationTab {
fProjButton = createPushButton(projComp, LaunchUIPlugin.getResourceString("Launch.common.B&rowse..."), null); //$NON-NLS-1$
fProjButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
handleProjectButtonSelected();
updateLaunchConfigurationDialog();
@ -149,6 +155,7 @@ public class CMainTab extends CLaunchConfigurationTab {
gd = new GridData(GridData.FILL_HORIZONTAL);
fProgText.setLayoutData(gd);
fProgText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent evt) {
updateLaunchConfigurationDialog();
}
@ -156,6 +163,7 @@ public class CMainTab extends CLaunchConfigurationTab {
fSearchButton = createPushButton(mainComp, LaunchUIPlugin.getResourceString("CMainTab.Search..."), null); //$NON-NLS-1$
fSearchButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
handleSearchButtonSelected();
updateLaunchConfigurationDialog();
@ -165,6 +173,7 @@ public class CMainTab extends CLaunchConfigurationTab {
Button fBrowseForBinaryButton;
fBrowseForBinaryButton = createPushButton(mainComp, LaunchUIPlugin.getResourceString("Launch.common.B&rowse..."), null); //$NON-NLS-1$
fBrowseForBinaryButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
handleBinaryBrowseButtonSelected();
updateLaunchConfigurationDialog();
@ -174,8 +183,8 @@ public class CMainTab extends CLaunchConfigurationTab {
LaunchUIPlugin.setDialogShell(parent.getShell());
}
/**
* @see ILaunchConfigurationTab#initializeFrom(ILaunchConfiguration)
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
*/
public void initializeFrom(ILaunchConfiguration config) {
filterPlatform = getPlatform(config);
@ -204,8 +213,8 @@ public class CMainTab extends CLaunchConfigurationTab {
fProgText.setText(programName);
}
/**
* @see ILaunchConfigurationTab#performApply(ILaunchConfigurationWorkingCopy)
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
public void performApply(ILaunchConfigurationWorkingCopy config) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, fProjText.getText());
@ -218,14 +227,13 @@ public class CMainTab extends CLaunchConfigurationTab {
protected void handleSearchButtonSelected() {
if (getCProject() == null) {
MessageDialog.openInformation(
getShell(),
LaunchUIPlugin.getResourceString("CMainTab.Project_required"), //$NON-NLS-1$
LaunchUIPlugin.getResourceString("CMainTab.Enter_project_before_searching_for_program")); //$NON-NLS-1$
MessageDialog.openInformation(getShell(), LaunchUIPlugin.getResourceString("CMainTab.Project_required"), //$NON-NLS-1$
LaunchUIPlugin.getResourceString("CMainTab.Enter_project_before_searching_for_program")); //$NON-NLS-1$
return;
}
ILabelProvider programLabelProvider = new CElementLabelProvider() {
CElementImageProvider imageProvider = new CElementImageProvider();
public String getText(Object element) {
@ -239,17 +247,18 @@ public class CMainTab extends CLaunchConfigurationTab {
}
public Image getImage(Object element) {
if(!(element instanceof ICElement)) {
if (! (element instanceof ICElement)) {
return super.getImage(element);
}
ICElement celement = (ICElement)element;
if(celement.getElementType() == ICElement.C_BINARY) {
if (celement.getElementType() == ICElement.C_BINARY) {
IBinary belement = (IBinary)celement;
if(belement.isExecutable()) {
if (belement.isExecutable()) {
Image image = super.getImage(element);
Point size= new Point(image.getBounds().width, image.getBounds().height);
return CUIPlugin.getImageDescriptorRegistry().get(new CElementImageDescriptor(CPluginImages.DESC_OBJS_CEXEC, 0, size));
Point size = new Point(image.getBounds().width, image.getBounds().height);
return CUIPlugin.getImageDescriptorRegistry().get(
new CElementImageDescriptor(CPluginImages.DESC_OBJS_CEXEC, 0, size));
}
}
@ -258,6 +267,7 @@ public class CMainTab extends CLaunchConfigurationTab {
};
ILabelProvider qualifierLabelProvider = new CElementLabelProvider() {
public String getText(Object element) {
if (element instanceof IBinary) {
IBinary bin = (IBinary)element;
@ -280,25 +290,22 @@ public class CMainTab extends CLaunchConfigurationTab {
dialog.setMultipleSelection(false);
//dialog.set
if (dialog.open() == ElementListSelectionDialog.OK) {
IBinary binary = (IBinary) dialog.getFirstResult();
IBinary binary = (IBinary)dialog.getFirstResult();
fProgText.setText(binary.getResource().getProjectRelativePath().toString());
}
}
/**
* Show a dialog that lets the user select a project. This in turn provides
* Show a dialog that lets the user select a project. This in turn provides
* context for the main type, allowing the user to key a main type name, or
* constraining the search for main types to the specified project.
*/
protected void handleBinaryBrowseButtonSelected() {
final ICProject cproject = getCProject();
if(cproject == null) {
MessageDialog.openInformation(
getShell(),
LaunchUIPlugin.getResourceString("CMainTab.Project_required"), //$NON-NLS-1$
LaunchUIPlugin.getResourceString("CMainTab.Enter_project_before_browsing_for_program")); //$NON-NLS-1$
if (cproject == null) {
MessageDialog.openInformation(getShell(), LaunchUIPlugin.getResourceString("CMainTab.Project_required"), //$NON-NLS-1$
LaunchUIPlugin.getResourceString("CMainTab.Enter_project_before_browsing_for_program")); //$NON-NLS-1$
return;
}
@ -307,57 +314,62 @@ public class CMainTab extends CLaunchConfigurationTab {
WorkbenchContentProvider contentProvider = new WorkbenchContentProvider();
dialog = new ElementTreeSelectionDialog(getShell(), labelProvider, contentProvider);
dialog.setTitle(LaunchUIPlugin.getResourceString("CMainTab.Program_selection")); //$NON-NLS-1$
dialog.setMessage(LaunchUIPlugin.getFormattedResourceString("CMainTab.Choose_program_to_run_from_NAME", cproject.getResource().getName())); //$NON-NLS-1$
dialog.setMessage(LaunchUIPlugin.getFormattedResourceString(
"CMainTab.Choose_program_to_run_from_NAME", cproject.getResource().getName())); //$NON-NLS-1$
dialog.setBlockOnOpen(true);
dialog.setAllowMultiple(false);
dialog.setInput(cproject.getResource());
dialog.setValidator(new ISelectionStatusValidator() {
public IStatus validate(Object [] selection) {
if(selection.length == 0 || !(selection[0] instanceof IFile)) {
return new Status(IStatus.ERROR, LaunchUIPlugin.getUniqueIdentifier(), 1, LaunchUIPlugin.getResourceString("CMainTab.Selection_must_be_file"), null); //$NON-NLS-1$
public IStatus validate(Object[] selection) {
if (selection.length == 0 || ! (selection[0] instanceof IFile)) {
return new Status(IStatus.ERROR, LaunchUIPlugin.getUniqueIdentifier(), 1,
LaunchUIPlugin.getResourceString("CMainTab.Selection_must_be_file"), null); //$NON-NLS-1$
}
try {
ICElement celement = cproject.findElement(((IFile)selection[0]).getProjectRelativePath());
if(celement == null ||
(celement.getElementType() != ICElement.C_BINARY && celement.getElementType() != ICElement.C_ARCHIVE)) {
return new Status(IStatus.ERROR, LaunchUIPlugin.getUniqueIdentifier(), 1, LaunchUIPlugin.getResourceString("CMainTab.Selection_must_be_binary_file"), null); //$NON-NLS-1$
ICElement celement = cproject.findElement( ((IFile)selection[0]).getProjectRelativePath());
if (celement == null
|| (celement.getElementType() != ICElement.C_BINARY && celement.getElementType() != ICElement.C_ARCHIVE)) {
return new Status(IStatus.ERROR, LaunchUIPlugin.getUniqueIdentifier(), 1,
LaunchUIPlugin.getResourceString("CMainTab.Selection_must_be_binary_file"), null); //$NON-NLS-1$
}
return new Status(IStatus.OK, LaunchUIPlugin.getUniqueIdentifier(), IStatus.OK, celement.getResource().getName(), null);
} catch(Exception ex) {
return new Status(IStatus.ERROR, LaunchUIPlugin.PLUGIN_ID, 1, LaunchUIPlugin.getResourceString("CMainTab.Selection_must_be_binary_file"), null); //$NON-NLS-1$
return new Status(IStatus.OK, LaunchUIPlugin.getUniqueIdentifier(), IStatus.OK,
celement.getResource().getName(), null);
} catch (Exception ex) {
return new Status(IStatus.ERROR, LaunchUIPlugin.PLUGIN_ID, 1,
LaunchUIPlugin.getResourceString("CMainTab.Selection_must_be_binary_file"), null); //$NON-NLS-1$
}
}
});
if(dialog.open() == ElementTreeSelectionDialog.CANCEL) {
if (dialog.open() == ElementTreeSelectionDialog.CANCEL) {
return;
}
Object [] results = dialog.getResult();
Object[] results = dialog.getResult();
try {
fProgText.setText(((IResource)results[0]).getProjectRelativePath().toString());
} catch(Exception ex) {
fProgText.setText( ((IResource)results[0]).getProjectRelativePath().toString());
} catch (Exception ex) {
/* Make sure it is a file */
}
}
/**
* Iterate through and suck up all of the executable files that
* we can find.
* Iterate through and suck up all of the executable files that we can find.
*/
protected IBinary[] getBinaryFiles(final ICProject cproject) {
final Display display;
if ( getShell() == null ) {
if (getShell() == null) {
display = LaunchUIPlugin.getShell().getDisplay();
} else {
display = getShell().getDisplay();
}
final Object[] ret = new Object[1];
BusyIndicator.showWhile(display, new Runnable() {
public void run() {
try {
ret[0] = cproject.getBinaryContainer().getBinaries();
@ -371,7 +383,7 @@ public class CMainTab extends CLaunchConfigurationTab {
}
/**
* Show a dialog that lets the user select a project. This in turn provides
* Show a dialog that lets the user select a project. This in turn provides
* context for the main type, allowing the user to key a main type name, or
* constraining the search for main types to the specified project.
*/
@ -386,8 +398,8 @@ public class CMainTab extends CLaunchConfigurationTab {
}
/**
* Realize a C Project selection dialog and return the first selected project,
* or null if there was none.
* Realize a C Project selection dialog and return the first selected
* project, or null if there was none.
*/
protected ICProject chooseCProject() {
try {
@ -401,10 +413,10 @@ public class CMainTab extends CLaunchConfigurationTab {
ICProject cProject = getCProject();
if (cProject != null) {
dialog.setInitialSelections(new Object[] { cProject });
dialog.setInitialSelections(new Object[]{cProject});
}
if (dialog.open() == ElementListSelectionDialog.OK) {
return (ICProject) dialog.getFirstResult();
return (ICProject)dialog.getFirstResult();
}
} catch (CModelException e) {
LaunchUIPlugin.errorDialog("Launch UI internal error", e); //$NON-NLS-1$
@ -414,7 +426,7 @@ public class CMainTab extends CLaunchConfigurationTab {
/**
* Return an array a ICProject whose platform match that of the runtime env.
**/
*/
protected ICProject[] getCProjects() throws CModelException {
ICProject cproject[] = CoreModel.getDefault().getCModel().getCProjects();
@ -423,22 +435,26 @@ public class CMainTab extends CLaunchConfigurationTab {
for (int i = 0; i < cproject.length; i++) {
ICDescriptor cdesciptor = null;
try {
cdesciptor = CCorePlugin.getDefault().getCProjectDescription((IProject) cproject[i].getResource());
String projectPlatform = cdesciptor.getPlatform();
if (filterPlatform.equals("*") //$NON-NLS-1$
|| projectPlatform.equals("*") //$NON-NLS-1$
|| filterPlatform.equalsIgnoreCase(projectPlatform) == true) {
cdesciptor = CCorePlugin.getDefault().getCProjectDescription((IProject)cproject[i].getResource(), false);
if (cdesciptor != null) {
String projectPlatform = cdesciptor.getPlatform();
if (filterPlatform.equals("*") //$NON-NLS-1$
|| projectPlatform.equals("*") //$NON-NLS-1$
|| filterPlatform.equalsIgnoreCase(projectPlatform) == true) {
list.add(cproject[i]);
}
} else {
list.add(cproject[i]);
}
} catch (CoreException e) {
list.add(cproject[i]);
}
}
return (ICProject[]) list.toArray(new ICProject[list.size()]);
return (ICProject[])list.toArray(new ICProject[list.size()]);
}
/**
* Return the ICProject corresponding to the project name in the project name
* text field, or null if the text does not match a project name.
* Return the ICProject corresponding to the project name in the project
* name text field, or null if the text does not match a project name.
*/
protected ICProject getCProject() {
String projectName = fProjText.getText().trim();
@ -448,8 +464,8 @@ public class CMainTab extends CLaunchConfigurationTab {
return CoreModel.getDefault().getCModel().getCProject(projectName);
}
/**
* @see ILaunchConfigurationTab#isValid(ILaunchConfiguration)
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
*/
public boolean isValid(ILaunchConfiguration config) {
@ -487,13 +503,16 @@ public class CMainTab extends CLaunchConfigurationTab {
return true;
}
/**
* @see ILaunchConfigurationTab#setDefaults(ILaunchConfigurationWorkingCopy)
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
// We set empty attributes for project & program so that when one config is
// compared to another, the existence of empty attributes doesn't cause an
// incorrect result (the performApply() method can result in empty values
// We set empty attributes for project & program so that when one config
// is
// compared to another, the existence of empty attributes doesn't cause
// an
// incorrect result (the performApply() method can result in empty
// values
// for these attributes being set on a config if there is nothing in the
// corresponding text boxes)
// plus getContext will use this to base context from if set.
@ -507,12 +526,13 @@ public class CMainTab extends CLaunchConfigurationTab {
}
/**
* Set the program name attributes on the working copy based on the ICElement
* Set the program name attributes on the working copy based on the
* ICElement
*/
protected void initializeProgramName(ICElement cElement, ILaunchConfigurationWorkingCopy config) {
IBinary binary = null;
if (cElement instanceof ICProject) {
IBinary[] bins = getBinaryFiles((ICProject) cElement);
IBinary[] bins = getBinaryFiles((ICProject)cElement);
if (bins.length == 1) {
binary = bins[0];
}
@ -534,21 +554,22 @@ public class CMainTab extends CLaunchConfigurationTab {
config.rename(name);
}
}
/**
* @see ILaunchConfigurationTab#getName()
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
*/
public String getName() {
return LaunchUIPlugin.getResourceString("CMainTab.Main"); //$NON-NLS-1$
}
/**
* @see ILaunchConfigurationTab#getImage()
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
*/
public Image getImage() {
return LaunchImages.get(LaunchImages.IMG_VIEW_MAIN_TAB);
}
/**
/* (non-Javadoc)
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog()
*/
protected void updateLaunchConfigurationDialog() {

View file

@ -1,8 +1,13 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
*/
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.ui;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;

View file

@ -1,7 +1,13 @@
/*
* (c) Copyright QNX Software System Ltd. 2002.
* All Rights Reserved.
*/
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.ui;
import org.eclipse.cdt.core.CCorePlugin;
@ -73,8 +79,10 @@ public class CorefileDebuggerTab extends AbstractCDebuggerTab {
String projectCPU = "*"; //$NON-NLS-1$
if (ce != null) {
try {
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(ce.getCProject().getProject());
projectPlatform = descriptor.getPlatform();
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(ce.getCProject().getProject(), false);
if (descriptor != null) {
projectPlatform = descriptor.getPlatform();
}
IBinary bin = (IBinary) ce;
projectCPU = bin.getCPU();
} catch (Exception e) {
@ -156,8 +164,10 @@ public class CorefileDebuggerTab extends AbstractCDebuggerTab {
String projectCPU = "*"; //$NON-NLS-1$
if (ce != null) {
try {
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(ce.getCProject().getProject());
projectPlatform = descriptor.getPlatform();
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(ce.getCProject().getProject(), false);
if (descriptor != null) {
projectPlatform = descriptor.getPlatform();
}
IBinary bin = (IBinary) ce;
projectCPU = bin.getCPU();
} catch (Exception e) {

View file

@ -1,7 +1,9 @@
/*
* Created on 22-Sep-2003
*
* Copyright (c) 2002,2003 QNX Software Systems Ltd.
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation