mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 02:36:01 +02:00
The method ICElement.getResource() do not throw an Exception.
This commit is contained in:
parent
ee5e73d5fe
commit
0dfb3bd0ef
3 changed files with 22 additions and 32 deletions
|
@ -102,10 +102,7 @@ class CViewDragAdapter extends DragSourceAdapter {
|
||||||
IResource res = null;
|
IResource res = null;
|
||||||
if (next instanceof ICElement) {
|
if (next instanceof ICElement) {
|
||||||
ICElement celement = (ICElement)next;
|
ICElement celement = (ICElement)next;
|
||||||
try {
|
res = celement.getResource();
|
||||||
res = celement.getResource();
|
|
||||||
} catch (CModelException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
event.doit = false;
|
event.doit = false;
|
||||||
|
|
|
@ -112,34 +112,30 @@ public class CDocumentProvider extends FileDocumentProvider implements IWorkingC
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBuffer createBuffer(IOpenable owner) {
|
public IBuffer createBuffer(IOpenable owner) {
|
||||||
try {
|
if (owner instanceof IWorkingCopy) {
|
||||||
if (owner instanceof IWorkingCopy) {
|
|
||||||
|
|
||||||
IWorkingCopy unit= (IWorkingCopy) owner;
|
IWorkingCopy unit= (IWorkingCopy) owner;
|
||||||
ITranslationUnit original= (ITranslationUnit) unit.getOriginalElement();
|
ITranslationUnit original= (ITranslationUnit) unit.getOriginalElement();
|
||||||
IResource resource= original.getResource();
|
IResource resource= original.getResource();
|
||||||
if (resource instanceof IFile) {
|
if (resource instanceof IFile) {
|
||||||
IFileEditorInput providerKey= new FileEditorInput((IFile) resource);
|
IFileEditorInput providerKey= new FileEditorInput((IFile) resource);
|
||||||
|
|
||||||
IDocument document= null;
|
IDocument document= null;
|
||||||
IStatus status= null;
|
IStatus status= null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
document= internalGetDocument(providerKey);
|
document= internalGetDocument(providerKey);
|
||||||
} catch (CoreException x) {
|
} catch (CoreException x) {
|
||||||
status= x.getStatus();
|
status= x.getStatus();
|
||||||
document= new Document();
|
document= new Document();
|
||||||
initializeDocument(document);
|
initializeDocument(document);
|
||||||
}
|
|
||||||
|
|
||||||
DocumentAdapter adapter= new DocumentAdapter(unit, document, new DefaultLineTracker(), CDocumentProvider.this, providerKey);
|
|
||||||
adapter.setStatus(status);
|
|
||||||
return adapter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DocumentAdapter adapter= new DocumentAdapter(unit, document, new DefaultLineTracker(), CDocumentProvider.this, providerKey);
|
||||||
|
adapter.setStatus(status);
|
||||||
|
return adapter;
|
||||||
}
|
}
|
||||||
} catch (CModelException e) {
|
|
||||||
return DocumentAdapter.NULL;
|
|
||||||
}
|
}
|
||||||
return DocumentAdapter.NULL;
|
return DocumentAdapter.NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,10 +125,7 @@ public class EditorUtility {
|
||||||
Process objdump = null;
|
Process objdump = null;
|
||||||
IPath path;
|
IPath path;
|
||||||
IResource file = null;
|
IResource file = null;
|
||||||
try {
|
file = bin.getResource();
|
||||||
file = bin.getResource();
|
|
||||||
} catch (CModelException e1) {
|
|
||||||
}
|
|
||||||
if (file == null)
|
if (file == null)
|
||||||
return store;
|
return store;
|
||||||
path = file.getLocation();
|
path = file.getLocation();
|
||||||
|
|
Loading…
Add table
Reference in a new issue