diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index 09c4038afb9..8a08e3f2225 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -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 diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java index 424216bbb9d..2c6174d9c93 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java @@ -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 { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ExternalEditorInput.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ExternalEditorInput.java index c4ef4a12657..745adf32d46 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ExternalEditorInput.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ExternalEditorInput.java @@ -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; + } + }