1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 08:55:25 +02:00

Improvements to the import executable wizard.

This commit is contained in:
Ken Ryall 2006-12-07 16:59:28 +00:00
parent 79b98179f3
commit d5061c1162
3 changed files with 196 additions and 218 deletions

View file

@ -11,19 +11,12 @@
package org.eclipse.cdt.debug.ui.importexecutable;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.ICDescriptorOperation;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector;
import org.eclipse.cdt.internal.core.model.ExternalTranslationUnit;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@ -36,16 +29,12 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.ISourceLocator;
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
@ -70,13 +59,45 @@ public abstract class AbstractImportExecutableWizard extends Wizard implements I
protected ImportExecutablePageOne pageOne;
protected ImportExecutablePageTwo pageTwo;
private String parserID;
/**
* Override this method to add the correct binary parsers to the project.
* @param newProject - the project created by the wizard
* @throws CoreException
*/
public abstract void addBinaryParsers(IProject newProject) throws CoreException;
private void waitForJob(String name)
{
IJobManager jobMan = Platform.getJobManager();
Job[] jobs = jobMan.find(null);
for (int i = 0; i < jobs.length; i++) {
if (jobs[i].getName().equals(name)) {
try {
jobs[i].join();
} catch (InterruptedException e) {
}
}
}
}
private void waitForDescSave() {
String taskName = CCorePlugin.getResourceString("CDescriptorManager.async_updater"); //$NON-NLS-1$
waitForJob(taskName);
}
public void addBinaryParsers(IProject newProject) throws CoreException {
ICDescriptorOperation op = new ICDescriptorOperation() {
public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
descriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, parserID);
}
};
String[] parserIDs = pageOne.getSupportedBinaryParserIds();
for (int i = 0; i < parserIDs.length; i++) {
parserID = parserIDs[i];
CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(newProject.getProject(), op, null);
waitForDescSave();
}
}
/**
* Adds the executables to a new or existing project. The executables are
@ -108,82 +129,6 @@ public abstract class AbstractImportExecutableWizard extends Wizard implements I
addPage(pageTwo);
}
private void addSourceLocation(ISourceLocator locator, AbstractSourceLookupDirector director, IPath unitLocation)
{
if (unitLocation.toFile().exists()) {
boolean found = false;
String unitLocationPathString = unitLocation.toOSString();
if (locator instanceof ICSourceLocator)
found = (((ICSourceLocator) locator).findSourceElement(unitLocationPathString) != null);
else if (locator instanceof CSourceLookupDirector)
found = ((CSourceLookupDirector) locator).contains(unitLocationPathString);
if (!found) {
DirectorySourceContainer directoryContainer = new DirectorySourceContainer(
unitLocation.removeLastSegments(1), false);
ArrayList containerList = new ArrayList(Arrays.asList(director
.getSourceContainers()));
containerList.add(directoryContainer);
director.setSourceContainers((ISourceContainer[]) containerList
.toArray(new ISourceContainer[containerList.size()]));
}
}
}
protected void addSourceLocations(IBinary[] binaries, ILaunchConfigurationWorkingCopy configuration) {
String memento = null;
String type = null;
try {
memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String) null);
type = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, (String) null);
if (type == null) {
type = configuration.getType().getSourceLocatorId();
}
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ISourceLocator locator = launchManager.newSourceLocator(type);
if (locator instanceof AbstractSourceLookupDirector) {
AbstractSourceLookupDirector director = (AbstractSourceLookupDirector) locator;
if (memento == null) {
director.initializeDefaults(configuration);
} else {
director.initializeFromMemento(memento, configuration);
}
for (int i = 0; i < binaries.length; i++) {
IBinary binary = binaries[i];
if (!binary.getPath().lastSegment().startsWith(".")) {
addSourceLocation(locator, director, binary.getUnderlyingResource().getLocation());
List sourceFiles;
sourceFiles = binary.getChildrenOfType(ICElement.C_UNIT);
if (sourceFiles.size() == 0)
{
sourceFiles = binary.getChildrenOfType(ICElement.C_UNIT);
}
for (Iterator iter = sourceFiles.iterator(); iter.hasNext();) {
Object element = (Object) iter.next();
if (element instanceof ExternalTranslationUnit) {
ExternalTranslationUnit unit = (ExternalTranslationUnit) element;
IPath unitLocation = unit.getLocation();
addSourceLocation(locator, director, unitLocation);
}
}
}
}
configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, director.getMemento());
configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, director.getId());
}
} catch (CoreException e) {
return;
}
}
public IProject createCProjectForExecutable(String projectName) throws OperationCanceledException, CoreException {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
@ -203,12 +148,7 @@ public abstract class AbstractImportExecutableWizard extends Wizard implements I
ILaunchConfigurationWorkingCopy wc = this.getSelectedLaunchConfigurationType().newInstance(null,
this.getImportExecutablePage2().getNewConfigurationName());
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, targetProject.getProject().getName());
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, new File(getImportExecutablePage()
.getSelectedExecutables()[0]).getName());
addSourceLocations(targetProject.getBinaryContainer().getBinaries(), wc);
setConfigurationDefaults(wc);
setConfigurationDefaults(wc, targetProject);
final IStructuredSelection selection = new StructuredSelection(wc.doSave());
final String identifier = new String("org.eclipse.debug.ui.launchGroup.debug");
@ -256,8 +196,6 @@ public abstract class AbstractImportExecutableWizard extends Wizard implements I
setWindowTitle(getDefaultWindowTitle());
setNeedsProgressMonitor(true);
}
public abstract boolean isExecutableFile(File file);
public boolean performFinish() {
@ -291,10 +229,16 @@ public abstract class AbstractImportExecutableWizard extends Wizard implements I
/**
* Subclasses should override this method to modify the launch configuration
* created by the wizard. The default implementation does nothing.
* created by the wizard. The default implementation sets up the project
* and program names.
* @param config the launch configuration created by the wizard
* @param targetProject
*/
public void setConfigurationDefaults(ILaunchConfigurationWorkingCopy config) {
public void setConfigurationDefaults(ILaunchConfigurationWorkingCopy config, ICProject project) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getProject().getName());
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, new File(getImportExecutablePage()
.getSelectedExecutables()[0]).getName());
}
@ -314,4 +258,28 @@ public abstract class AbstractImportExecutableWizard extends Wizard implements I
public abstract boolean supportsConfigurationType(
ILaunchConfigurationType type);
/**
* Return true if you want the wizard to ask the user to select
* the binary parser. Otherwise it will only use the default one.
* A subclass can specify the default parser by overriding
* getDefaultBinaryParserID.
* @return - If the binary parser selection combo should be displayed.
*/
public boolean userSelectsBinaryParser() {
return true;
}
/** Get the default binary parser the wizard will use to determine if
* single file selections are valid and to filter the list for multi
* file selection.
* @return
*/
public String[] getDefaultBinaryParserIDs() {
String defaultBinaryParserId = CCorePlugin.getDefault().getPluginPreferences().getDefaultString(CCorePlugin.PREF_BINARY_PARSER);
if (defaultBinaryParserId == null || defaultBinaryParserId.length() == 0) {
defaultBinaryParserId = CCorePlugin.DEFAULT_BINARY_PARSER_UNIQ_ID;
}
return new String[] { defaultBinaryParserId };
}
}

View file

@ -15,7 +15,6 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.IBinaryParser;
@ -27,6 +26,7 @@ import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
@ -88,8 +88,12 @@ public class ImportExecutablePageOne extends WizardPage {
private AbstractImportExecutableWizard wizard;
private String selectedBinaryParserId;
private IBinaryParser selectedBinaryParser;
private String[] supportedBinaryParserIds;
private IBinaryParser[] supportedBinaryParsers;
private IExtension[] binaryParserExtensions;
private Combo binaryParserCombo;
public ImportExecutablePageOne(AbstractImportExecutableWizard wizard) {
super("ImportApplicationPageOne");
@ -98,21 +102,33 @@ public class ImportExecutablePageOne extends WizardPage {
setTitle(wizard.getPageOneTitle());
setDescription(wizard.getPageOneDescription());
selectedBinaryParserId = CCorePlugin.getDefault().getPluginPreferences().getDefaultString(CCorePlugin.PREF_BINARY_PARSER);
if (selectedBinaryParserId == null || selectedBinaryParserId.length() == 0) {
selectedBinaryParserId = CCorePlugin.DEFAULT_BINARY_PARSER_UNIQ_ID;
supportedBinaryParserIds = wizard.getDefaultBinaryParserIDs();
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, CCorePlugin.BINARY_PARSER_SIMPLE_ID);
if (point != null)
{
IExtension[] exts = point.getExtensions();
ArrayList extensionsInUse = new ArrayList();
for (int i = 0; i < exts.length; i++) {
if (isExtensionVisible(exts[i])) {
extensionsInUse.add(exts[i]);
}
}
binaryParserExtensions = (IExtension[]) extensionsInUse.toArray(new IExtension[extensionsInUse.size()]);
}
try {
// should return the parser for the above id
selectedBinaryParser = CCorePlugin.getDefault().getDefaultBinaryParser();
} catch (CoreException e) {
CDebugUIPlugin.log(e);
supportedBinaryParsers = new IBinaryParser[supportedBinaryParserIds.length];
for (int i = 0; i < supportedBinaryParserIds.length; i++) {
for (int j = 0; j < binaryParserExtensions.length; j++) {
if (binaryParserExtensions[j].getUniqueIdentifier().equals(supportedBinaryParserIds[i]))
supportedBinaryParsers[i] = instantiateBinaryParser(binaryParserExtensions[j]);
}
}
}
public String getSelectedBinaryParserId() {
return selectedBinaryParserId;
public String[] getSupportedBinaryParserIds() {
return supportedBinaryParserIds;
}
private void checkControlState() {
@ -132,21 +148,22 @@ public class ImportExecutablePageOne extends WizardPage {
if (monitor.isCanceled())
return false;
monitor.subTask(directory.getPath());
File[] contents = directory.listFiles();
// first look for project description files
monitor.subTask(directory.getPath());
SubProgressMonitor sm = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
sm.beginTask(directory.getPath(), contents.length);
for (int i = 0; i < contents.length; i++) {
if (monitor.isCanceled())
return false;
File file = contents[i];
if (file.isFile() && isBinary(file)) {
sm.worked(1);
if (contents[i].isDirectory())
collectExecutableFiles(files, contents[i], monitor);
else if (file.isFile() && isBinary(file, false)) {
files.add(file);
}
}
// no project description found, so recurse into sub-directories
for (int i = 0; i < contents.length; i++) {
if (contents[i].isDirectory())
collectExecutableFiles(files, contents[i], monitor);
}
sm.done();
return true;
}
@ -170,7 +187,8 @@ public class ImportExecutablePageOne extends WizardPage {
selectExecutableGroup.setLayoutData(new GridData(
GridData.FILL_HORIZONTAL));
createSelectBinaryParser(selectExecutableGroup);
if (wizard.userSelectsBinaryParser())
createSelectBinaryParser(selectExecutableGroup);
createSelectExecutable(selectExecutableGroup);
createExecutablesRoot(selectExecutableGroup);
createExecutablesList(workArea);
@ -253,12 +271,14 @@ public class ImportExecutablePageOne extends WizardPage {
public void widgetSelected(SelectionEvent e) {
checkControlState();
String selectedDirectory = multipleExecutablePathField
.getText().trim();
setErrorMessage(null);
if (!selectSingleFile) {
singleExecutablePathField.setText("");
if (selectedDirectory.length() == 0) {
noFilesSelected();
}
} else
updateExecutablesList(selectedDirectory);
}
});
@ -289,44 +309,38 @@ public class ImportExecutablePageOne extends WizardPage {
}
private void createSelectBinaryParser(Composite workArea) {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, CCorePlugin.BINARY_PARSER_SIMPLE_ID);
if (point == null)
if (binaryParserExtensions.length == 0)
return;
Label label = new Label(workArea, SWT.NONE);
label.setText(Messages.ImportExecutablePageOne_SelectBinaryParser);
final Combo combo = new Combo(workArea, SWT.READ_ONLY);
final IExtension[] exts = point.getExtensions();
for (int i = 0, j = 0; i < exts.length; i++) {
if (isExtensionVisible(exts[i])) {
exts[j] = exts[i];
combo.add(exts[j].getLabel());
if (selectedBinaryParserId.equals(exts[j].getUniqueIdentifier()))
combo.select(j);
++j;
binaryParserCombo = new Combo(workArea, SWT.READ_ONLY);
final IExtension[] exts = binaryParserExtensions;
for (int i = 0; i < exts.length; i++) {
binaryParserCombo.add(exts[i].getLabel());
if (supportedBinaryParserIds[0].equals(exts[i].getUniqueIdentifier()))
binaryParserCombo.select(i);
}
}
combo.addSelectionListener(new SelectionListener() {
binaryParserCombo.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
instantiateBinaryParser(exts[combo.getSelectionIndex()]);
supportedBinaryParsers[0] = instantiateBinaryParser(exts[binaryParserCombo.getSelectionIndex()]);
if (selectSingleFile) {
String path = singleExecutablePathField.getText();
if (path.length() > 0)
validateExe(path);
} else {
previouslySearchedDirectory = null;
updateExecutablesList(multipleExecutablePathField.getText());
updateExecutablesList(multipleExecutablePathField.getText().trim());
}
}
});
combo.select(0);
// Dummy to fill out the third column
new Label(workArea, SWT.NONE);
}
@ -349,20 +363,20 @@ public class ImportExecutablePageOne extends WizardPage {
return false; // invalid extension definition (must have at least cextension elements)
}
private void instantiateBinaryParser(IExtension ext) {
private IBinaryParser instantiateBinaryParser(IExtension ext) {
IBinaryParser parser = null;
IConfigurationElement[] elements = ext.getConfigurationElements();
for (int i = 0; i < elements.length; i++) {
IConfigurationElement[] children = elements[i].getChildren("run"); //$NON-NLS-1$
for (int j = 0; j < children.length; j++) {
try {
selectedBinaryParser = (IBinaryParser)children[j].createExecutableExtension("class");
parser = (IBinaryParser)children[j].createExecutableExtension("class");
} catch (CoreException e) {
CDebugUIPlugin.log(e);
}
if (selectedBinaryParser != null)
return;
}
}
return parser;
}
private void createSelectExecutable(Composite workArea) {
@ -374,8 +388,10 @@ public class ImportExecutablePageOne extends WizardPage {
public void widgetSelected(SelectionEvent e) {
checkControlState();
if (selectSingleFile) {
multipleExecutablePathField.setText("");
noFilesSelected();
if (singleExecutablePathField.getText().trim().length() == 0)
noFilesSelected();
else
validateExe(singleExecutablePathField.getText());
}
}
});
@ -433,7 +449,7 @@ public class ImportExecutablePageOne extends WizardPage {
selectAll.setText(Messages.ImportExecutablePageOne_SelectAll);
selectAll.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
executablesViewer.setCheckedElements(executables);
executablesViewer.setAllChecked(true);
setPageComplete(executables.length > 0);
}
});
@ -445,7 +461,7 @@ public class ImportExecutablePageOne extends WizardPage {
deselectAll.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
executablesViewer.setCheckedElements(new Object[0]);
executablesViewer.setAllChecked(false);
setPageComplete(false);
}
});
@ -502,7 +518,7 @@ public class ImportExecutablePageOne extends WizardPage {
protected void noFilesSelected() {
executables = new File[0];
executablesViewer.refresh(true);
executablesViewer.setCheckedElements(executables);
executablesViewer.setAllChecked(false);
previouslySearchedDirectory = "";
setPageComplete(false);
}
@ -521,27 +537,16 @@ public class ImportExecutablePageOne extends WizardPage {
getContainer().run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
monitor.beginTask(Messages.ImportExecutablePageOne_Searching, 100);
monitor.beginTask(Messages.ImportExecutablePageOne_Searching, IProgressMonitor.UNKNOWN);
File directory = new File(path);
executables = new File[0];
monitor.worked(10);
if (directory.isDirectory()) {
Collection files = new ArrayList();
if (!collectExecutableFiles(files, directory, monitor))
return;
Iterator filesIterator = files.iterator();
executables = new File[files.size()];
int index = 0;
monitor.worked(50);
monitor.subTask(Messages.ImportExecutablePageOne_ProcessingResults);
while (filesIterator.hasNext()) {
File file = (File) filesIterator.next();
executables[index] = file;
index++;
}
} else
monitor.worked(60);
executables = (File[]) files.toArray(new File[files.size()]);
}
monitor.done();
}
@ -552,22 +557,61 @@ public class ImportExecutablePageOne extends WizardPage {
}
executablesViewer.refresh(true);
executablesViewer.setCheckedElements(executables);
executablesViewer.setAllChecked(true);
setPageComplete(executables.length > 0);
}
private boolean isBinary(File file) {
if (selectedBinaryParser != null) {
private boolean isBinary(File file, IBinaryParser parser) {
if (parser != null) {
try {
IBinaryParser.IBinaryFile bin = selectedBinaryParser.getBinary(new Path(file.getAbsolutePath()));
return bin.getType() == IBinaryParser.IBinaryFile.EXECUTABLE
|| bin.getType() == IBinaryParser.IBinaryFile.SHARED;
IBinaryParser.IBinaryFile bin = parser.getBinary(new Path(file
.getAbsolutePath()));
return bin != null
&& (bin.getType() == IBinaryParser.IBinaryFile.EXECUTABLE || bin
.getType() == IBinaryParser.IBinaryFile.SHARED);
} catch (IOException e) {
return false;
}
} else
return false;
}
/**
* Checks to see if the file is a valid binary recognized by any of the
* available binary parsers. If the currently selected parser doesn't work
* it checks the other parsers. If another recognizes the file then the
* selected binary parser is changed accordingly.
* The effect is to allow the user's file choice to trump the binary
* parser selection since most people will have a better idea of what
* file they want to select and may not know which binary parser to try.
* @param file - the executable file.
* @return - is it recognized by any of the binary parsers?
*/
private boolean isBinary(File file, boolean checkOthers) {
for (int i = 0; i < supportedBinaryParsers.length; i++) {
if (isBinary(file, supportedBinaryParsers[i]))
return true;
}
// See if any of the other parsers will work with this file.
// If so, pick the first one that will. Only do this if the user
// is picking the binary parser.
if (checkOthers && binaryParserCombo != null)
{
for (int i = 0; i < binaryParserExtensions.length; i++) {
IBinaryParser parser = instantiateBinaryParser(binaryParserExtensions[i]);
if (isBinary(file, parser))
{
supportedBinaryParserIds[0] = binaryParserExtensions[i].getUniqueIdentifier();
supportedBinaryParsers[0] = parser;
binaryParserCombo.select(i);
return true;
}
}
}
return false;
}
private void validateExe(String path) {
setErrorMessage(null);
@ -575,7 +619,7 @@ public class ImportExecutablePageOne extends WizardPage {
if (path.length() > 0) {
File testFile = new File(path);
if (testFile.exists()) {
if (isBinary(testFile))
if (isBinary(testFile, true))
{
executables = new File[1];
executables[0] = testFile;

View file

@ -10,15 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.debug.ui.importexecutable;
import java.io.File;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.ICDescriptorOperation;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.swt.widgets.FileDialog;
@ -49,17 +40,6 @@ public class ImportExecutableWizard extends AbstractImportExecutableWizard {
dialog.setFilterNames(new String[] { Messages.ImportExecutableWizard_AllFiles, Messages.ImportExecutableWizard_Applications, Messages.ImportExecutableWizard_LIbaries });
}
public void addBinaryParsers(IProject newProject) throws CoreException {
ICDescriptorOperation op = new ICDescriptorOperation() {
public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
descriptor.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID);
descriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, pageOne.getSelectedBinaryParserId());
}
};
CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(newProject.getProject(), op, null);
}
public boolean supportsConfigurationType(ILaunchConfigurationType type) {
return type.getIdentifier().startsWith("org.eclipse.cdt.launch")
// Just for fun, lets support QNX launches too.
@ -67,18 +47,4 @@ public class ImportExecutableWizard extends AbstractImportExecutableWizard {
|| type.getIdentifier().startsWith("com.qnx");
}
/**
* @deprecated this has been replaced by a check of the binary
* parser down in the Wizard page.
*/
public boolean isExecutableFile(File file) {
String filename = file.getName().toLowerCase();
if (Platform.getOS().equals(Platform.OS_MACOSX))
return true; // File extension not needed on Mac OS.
if (filename.endsWith(".exe") || filename.endsWith(".dll")
|| filename.endsWith(".elf"))
return true;
return false;
}
}