mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Fix for PR 62064
This commit is contained in:
parent
b1b1ec1458
commit
1549ba8899
3 changed files with 47 additions and 36 deletions
|
@ -1,3 +1,9 @@
|
|||
2004-05-13 Alain Magloire
|
||||
|
||||
Fix for PR 62064
|
||||
* src/org/eclipse/cdt/internal/ui/util/EditorUtility.java
|
||||
* src/org/eclipse/cdt/internal/ui/util/ExternalEditorInput.java
|
||||
|
||||
2004-05-12 Bogdan Gheorghe
|
||||
|
||||
Removed FileSearchAction, FileSearchActionInWorkingSet + related properties
|
||||
|
|
|
@ -163,8 +163,7 @@ public class EditorUtility {
|
|||
}
|
||||
|
||||
if (element instanceof IBinary) {
|
||||
//return new InternalClassFileEditorInput((IBinary) element);
|
||||
return new ExternalEditorInput(getStorage((IBinary)element));
|
||||
return new ExternalEditorInput(getStorage((IBinary)element), null);
|
||||
}
|
||||
|
||||
element= element.getParent();
|
||||
|
@ -183,8 +182,7 @@ public class EditorUtility {
|
|||
}
|
||||
|
||||
if (input instanceof IStorage) {
|
||||
//return new JarEntryEditorInput((IStorage)input);
|
||||
return new ExternalEditorInput((IStorage)input);
|
||||
return new ExternalEditorInput((IStorage)input, null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -224,28 +222,28 @@ public class EditorUtility {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the translation unit for the given c element.
|
||||
* @param element the c element whose compilation unit is searched for
|
||||
* @return the compilation unit of the given java element
|
||||
*/
|
||||
private static ITranslationUnit getTranslationUnit(ICElement element) {
|
||||
|
||||
if (element == null)
|
||||
return null;
|
||||
|
||||
int type= element.getElementType();
|
||||
if (ICElement.C_UNIT == type) {
|
||||
return (ITranslationUnit) element;
|
||||
}
|
||||
if (ICElement.C_BINARY == type) {
|
||||
return null;
|
||||
}
|
||||
if (element instanceof ISourceReference) {
|
||||
return ((ISourceReference) element).getTranslationUnit();
|
||||
}
|
||||
return getTranslationUnit(element.getParent());
|
||||
}
|
||||
// /**
|
||||
// * Returns the translation unit for the given c element.
|
||||
// * @param element the c element whose compilation unit is searched for
|
||||
// * @return the compilation unit of the given java element
|
||||
// */
|
||||
// private static ITranslationUnit getTranslationUnit(ICElement element) {
|
||||
//
|
||||
// if (element == null)
|
||||
// return null;
|
||||
//
|
||||
// int type= element.getElementType();
|
||||
// if (ICElement.C_UNIT == type) {
|
||||
// return (ITranslationUnit) element;
|
||||
// }
|
||||
// if (ICElement.C_BINARY == type) {
|
||||
// return null;
|
||||
// }
|
||||
// if (element instanceof ISourceReference) {
|
||||
// return ((ISourceReference) element).getTranslationUnit();
|
||||
// }
|
||||
// return getTranslationUnit(element.getParent());
|
||||
// }
|
||||
|
||||
|
||||
// public static IEditorPart openInEditor (IFile file) throws PartInitException {
|
||||
|
|
|
@ -26,6 +26,7 @@ public class ExternalEditorInput implements ITranslationUnitEditorInput {
|
|||
|
||||
private IStorage externalFile;
|
||||
private ITranslationUnit unit;
|
||||
private IPath location;
|
||||
|
||||
/*
|
||||
*/
|
||||
|
@ -105,15 +106,6 @@ public class ExternalEditorInput implements ITranslationUnitEditorInput {
|
|||
return externalFile.getFullPath().toString();
|
||||
}
|
||||
|
||||
public ExternalEditorInput(IStorage exFile) {
|
||||
externalFile = exFile;
|
||||
}
|
||||
|
||||
public ExternalEditorInput(ITranslationUnit unit, IStorage exFile) {
|
||||
this(exFile);
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.ui.editor.ITranslationUnitEditorInput#getTranslationUnit()
|
||||
*/
|
||||
|
@ -125,6 +117,21 @@ public class ExternalEditorInput implements ITranslationUnitEditorInput {
|
|||
* @see org.eclipse.ui.editors.text.ILocationProvider#getPath(java.lang.Object)
|
||||
*/
|
||||
public IPath getPath(Object element) {
|
||||
return externalFile.getFullPath();
|
||||
return location;
|
||||
}
|
||||
|
||||
public ExternalEditorInput(ITranslationUnit unit, IStorage exFile) {
|
||||
this(exFile, exFile.getFullPath());
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
public ExternalEditorInput(IStorage exFile) {
|
||||
this(exFile, exFile.getFullPath());
|
||||
}
|
||||
|
||||
public ExternalEditorInput(IStorage exFile, IPath location) {
|
||||
externalFile = exFile;
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue