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

Fix for PR 62064

This commit is contained in:
Alain Magloire 2004-05-13 18:50:33 +00:00
parent b1b1ec1458
commit 1549ba8899
3 changed files with 47 additions and 36 deletions

View file

@ -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 2004-05-12 Bogdan Gheorghe
Removed FileSearchAction, FileSearchActionInWorkingSet + related properties Removed FileSearchAction, FileSearchActionInWorkingSet + related properties

View file

@ -163,8 +163,7 @@ public class EditorUtility {
} }
if (element instanceof IBinary) { if (element instanceof IBinary) {
//return new InternalClassFileEditorInput((IBinary) element); return new ExternalEditorInput(getStorage((IBinary)element), null);
return new ExternalEditorInput(getStorage((IBinary)element));
} }
element= element.getParent(); element= element.getParent();
@ -183,8 +182,7 @@ public class EditorUtility {
} }
if (input instanceof IStorage) { if (input instanceof IStorage) {
//return new JarEntryEditorInput((IStorage)input); return new ExternalEditorInput((IStorage)input, null);
return new ExternalEditorInput((IStorage)input);
} }
return null; return null;
} }
@ -224,28 +222,28 @@ public class EditorUtility {
} }
/** // /**
* Returns the translation unit for the given c element. // * Returns the translation unit for the given c element.
* @param element the c element whose compilation unit is searched for // * @param element the c element whose compilation unit is searched for
* @return the compilation unit of the given java element // * @return the compilation unit of the given java element
*/ // */
private static ITranslationUnit getTranslationUnit(ICElement element) { // private static ITranslationUnit getTranslationUnit(ICElement element) {
//
if (element == null) // if (element == null)
return null; // return null;
//
int type= element.getElementType(); // int type= element.getElementType();
if (ICElement.C_UNIT == type) { // if (ICElement.C_UNIT == type) {
return (ITranslationUnit) element; // return (ITranslationUnit) element;
} // }
if (ICElement.C_BINARY == type) { // if (ICElement.C_BINARY == type) {
return null; // return null;
} // }
if (element instanceof ISourceReference) { // if (element instanceof ISourceReference) {
return ((ISourceReference) element).getTranslationUnit(); // return ((ISourceReference) element).getTranslationUnit();
} // }
return getTranslationUnit(element.getParent()); // return getTranslationUnit(element.getParent());
} // }
// public static IEditorPart openInEditor (IFile file) throws PartInitException { // public static IEditorPart openInEditor (IFile file) throws PartInitException {

View file

@ -26,6 +26,7 @@ public class ExternalEditorInput implements ITranslationUnitEditorInput {
private IStorage externalFile; private IStorage externalFile;
private ITranslationUnit unit; private ITranslationUnit unit;
private IPath location;
/* /*
*/ */
@ -105,15 +106,6 @@ public class ExternalEditorInput implements ITranslationUnitEditorInput {
return externalFile.getFullPath().toString(); return externalFile.getFullPath().toString();
} }
public ExternalEditorInput(IStorage exFile) {
externalFile = exFile;
}
public ExternalEditorInput(ITranslationUnit unit, IStorage exFile) {
this(exFile);
this.unit = unit;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.internal.ui.editor.ITranslationUnitEditorInput#getTranslationUnit() * @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) * @see org.eclipse.ui.editors.text.ILocationProvider#getPath(java.lang.Object)
*/ */
public IPath getPath(Object element) { 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;
}
} }