1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 09:16:02 +02:00

ICElement.getResource() no longer throw an exception.

This commit is contained in:
Alain Magloire 2003-03-27 19:32:04 +00:00
parent 5d93fce5e0
commit d750e21df8
3 changed files with 16 additions and 32 deletions

View file

@ -267,11 +267,8 @@ public class IndexManager implements IElementChangedListener {
}
if (kind == ICElementDelta.REMOVED) {
try {
IResource resource = element.getResource();
removeResource(resource);
} catch (CModelException e) {
}
IResource resource = element.getResource();
removeResource(resource);
}
// if (kind == ICElementDelta.ADDED) {

View file

@ -93,15 +93,11 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
}
ICElement ce = (ICElement) obj;
IProject project;
try {
project = (IProject) ce.getCProject().getResource();
IPath programFile = project.getFile(programName).getLocation();
ce = CCorePlugin.getDefault().getCoreModel().create(programFile);
if (ce != null && ce.exists()) {
return ce;
}
}
catch (CModelException e) {
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;
}

View file

@ -204,11 +204,7 @@ public class CMainTab extends CLaunchConfigurationTab {
dialog.setTitle("Program Selection");
if (dialog.open() == ElementListSelectionDialog.OK) {
IBinary binary = (IBinary) dialog.getFirstResult();
try {
fProgText.setText(binary.getResource().getProjectRelativePath().toString());
}
catch (CModelException e) {
}
fProgText.setText(binary.getResource().getProjectRelativePath().toString());
}
}
@ -369,20 +365,15 @@ public class CMainTab extends CLaunchConfigurationTab {
if (binary != null) {
String path;
try {
path = binary.getResource().getProjectRelativePath().toOSString();
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, path);
String name = binary.getElementName();
int index = name.lastIndexOf('.');
if (index > 0) {
name = name.substring(index + 1);
}
name = getLaunchConfigurationDialog().generateName(name);
config.rename(name);
path = binary.getResource().getProjectRelativePath().toOSString();
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, path);
String name = binary.getElementName();
int index = name.lastIndexOf('.');
if (index > 0) {
name = name.substring(index + 1);
}
catch (CModelException e) {
}
name = getLaunchConfigurationDialog().generateName(name);
config.rename(name);
}
}
/**