diff options
author | Tomasz Zarna | 2008-12-05 11:36:16 +0000 |
---|---|---|
committer | Tomasz Zarna | 2008-12-05 11:36:16 +0000 |
commit | 08c50fb44fa0c4b53554b8cde93acdbf19e217d3 (patch) | |
tree | 8f99c0aefe6638ec315463b9c9c199aa1a016836 /bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history | |
parent | a16c67b29f3d68a3b29d70131303d6e9c17803f5 (diff) | |
download | eclipse.platform.team-08c50fb44fa0c4b53554b8cde93acdbf19e217d3.tar.gz eclipse.platform.team-08c50fb44fa0c4b53554b8cde93acdbf19e217d3.tar.xz eclipse.platform.team-08c50fb44fa0c4b53554b8cde93acdbf19e217d3.zip |
bug 257696: IEncodedStorage#getFullPath() in org.eclipse.team.internal.ui.history.FileRevisionEditorInput should better handle revisions
Diffstat (limited to 'bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history')
-rw-r--r-- | bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/FileRevisionEditorInput.java | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/FileRevisionEditorInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/FileRevisionEditorInput.java index 6df698bb5..8e960cdde 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/FileRevisionEditorInput.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/FileRevisionEditorInput.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. + * Copyright (c) 2005, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,7 +21,8 @@ import org.eclipse.osgi.util.NLS; import org.eclipse.team.core.history.IFileRevision; import org.eclipse.team.internal.ui.TeamUIMessages; import org.eclipse.team.internal.ui.Utils; -import org.eclipse.ui.*; +import org.eclipse.ui.IPersistableElement; +import org.eclipse.ui.IStorageEditorInput; import org.eclipse.ui.model.IWorkbenchAdapter; import com.ibm.icu.text.DateFormat; @@ -43,25 +44,67 @@ public class FileRevisionEditorInput extends PlatformObject implements IWorkbenc return new FileRevisionEditorInput(revision, storage); } - private static IStorage wrapStorage(final IStorage storage, final String charset) { + private static IStorage wrapStorage(final IStorage storage, + final String charset) { if (charset == null) return storage; + if (storage instanceof IFileState) { + return new IFileState() { + public Object getAdapter(Class adapter) { + return storage.getAdapter(adapter); + } + + public boolean isReadOnly() { + return storage.isReadOnly(); + } + + public String getName() { + return storage.getName(); + } + + public IPath getFullPath() { + return storage.getFullPath(); + } + + public InputStream getContents() throws CoreException { + return storage.getContents(); + } + + public String getCharset() throws CoreException { + return charset; + } + + public boolean exists() { + return ((IFileState) storage).exists(); + } + + public long getModificationTime() { + return ((IFileState) storage).getModificationTime(); + } + }; + } + return new IEncodedStorage() { public Object getAdapter(Class adapter) { return storage.getAdapter(adapter); } + public boolean isReadOnly() { return storage.isReadOnly(); } + public String getName() { return storage.getName(); } + public IPath getFullPath() { return storage.getFullPath(); } + public InputStream getContents() throws CoreException { return storage.getContents(); } + public String getCharset() throws CoreException { return charset; } |