mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 01:36:01 +02:00
ICElement.getResource() no longer throw an exception.
This commit is contained in:
parent
5d93fce5e0
commit
d750e21df8
3 changed files with 16 additions and 32 deletions
|
@ -267,11 +267,8 @@ public class IndexManager implements IElementChangedListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kind == ICElementDelta.REMOVED) {
|
if (kind == ICElementDelta.REMOVED) {
|
||||||
try {
|
IResource resource = element.getResource();
|
||||||
IResource resource = element.getResource();
|
removeResource(resource);
|
||||||
removeResource(resource);
|
|
||||||
} catch (CModelException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (kind == ICElementDelta.ADDED) {
|
// if (kind == ICElementDelta.ADDED) {
|
||||||
|
|
|
@ -93,15 +93,11 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
|
||||||
}
|
}
|
||||||
ICElement ce = (ICElement) obj;
|
ICElement ce = (ICElement) obj;
|
||||||
IProject project;
|
IProject project;
|
||||||
try {
|
project = (IProject) ce.getCProject().getResource();
|
||||||
project = (IProject) ce.getCProject().getResource();
|
IPath programFile = project.getFile(programName).getLocation();
|
||||||
IPath programFile = project.getFile(programName).getLocation();
|
ce = CCorePlugin.getDefault().getCoreModel().create(programFile);
|
||||||
ce = CCorePlugin.getDefault().getCoreModel().create(programFile);
|
if (ce != null && ce.exists()) {
|
||||||
if (ce != null && ce.exists()) {
|
return ce;
|
||||||
return ce;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (CModelException e) {
|
|
||||||
}
|
}
|
||||||
return (ICElement) obj;
|
return (ICElement) obj;
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,11 +204,7 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
dialog.setTitle("Program Selection");
|
dialog.setTitle("Program Selection");
|
||||||
if (dialog.open() == ElementListSelectionDialog.OK) {
|
if (dialog.open() == ElementListSelectionDialog.OK) {
|
||||||
IBinary binary = (IBinary) dialog.getFirstResult();
|
IBinary binary = (IBinary) dialog.getFirstResult();
|
||||||
try {
|
fProgText.setText(binary.getResource().getProjectRelativePath().toString());
|
||||||
fProgText.setText(binary.getResource().getProjectRelativePath().toString());
|
|
||||||
}
|
|
||||||
catch (CModelException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,20 +365,15 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
|
|
||||||
if (binary != null) {
|
if (binary != null) {
|
||||||
String path;
|
String path;
|
||||||
try {
|
path = binary.getResource().getProjectRelativePath().toOSString();
|
||||||
path = binary.getResource().getProjectRelativePath().toOSString();
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, path);
|
||||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, path);
|
String name = binary.getElementName();
|
||||||
String name = binary.getElementName();
|
int index = name.lastIndexOf('.');
|
||||||
int index = name.lastIndexOf('.');
|
if (index > 0) {
|
||||||
if (index > 0) {
|
name = name.substring(index + 1);
|
||||||
name = name.substring(index + 1);
|
|
||||||
}
|
|
||||||
name = getLaunchConfigurationDialog().generateName(name);
|
|
||||||
config.rename(name);
|
|
||||||
}
|
}
|
||||||
catch (CModelException e) {
|
name = getLaunchConfigurationDialog().generateName(name);
|
||||||
}
|
config.rename(name);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue