private IFileState getMatchingFileState(IFileState[] states) { for (int i = 0; i < states.length; i++) { if (localTimeStamp == states[i].getModificationTime()) { return states[i]; } } return states[0]; }
@Override public boolean exists() { return state.exists(); }
@Override public InputStream getContents() throws CoreException { return state.getContents(); }
private boolean statesEqual(IFileState s1, IFileState s2) { return (s1.getFullPath().equals(s2.getFullPath()) && s1 .getModificationTime() == s2.getModificationTime()); }
@Override public void run() { try { IStructuredSelection structSel = getStructuredSelection(); Object[] objArray = structSel.toArray(); for (int i = 0; i < objArray.length; i++) { IFileState state = (IFileState) objArray[i]; if (!state.exists()) { MessageDialog.openError(TeamUIPlugin.getActivePage().getActivePart().getSite().getShell(), TeamUIMessages.OpenRevisionAction_DeletedRevisionTitle, TeamUIMessages.OpenRevisionAction_DeletedRevisionMessage); } else { String id = getEditorID(state.getName(), state.getContents()); IWorkbenchPage page = TeamUIPlugin.getActivePage(); if (page != null) { page.openEditor(new FileRevisionEditorInput(state), id); } } } } catch (Exception e) { } }
@Override public InputStream getContents(IFileState target) throws CoreException { if (!target.exists()) { String message = Messages.history_notValid; throw new ResourceException(IResourceStatus.FAILED_READ_LOCAL, target.getFullPath(), message, null); } return blobStore.getBlob(((FileState) target).getUUID()); }
public String getName() { IFileRevision rev = (IFileRevision) getAdapter(IFileRevision.class); if (rev != null) return NLS.bind( UIText.FileRevisionEditorInput_NameAndRevisionTitle, new String[] { rev.getName(), rev.getContentIdentifier() }); IFileState state = (IFileState) getAdapter(IFileState.class); if (state != null) return state.getName() + " " + DateFormat.getInstance().format(new Date(state.getModificationTime())); //$NON-NLS-1$ return storage.getName(); }
@Override public String getCharset() throws CoreException { return state.getCharset(); } };
@Override public IResource getResource() { IPath fullPath= fFileState.getFullPath(); return ResourcesPlugin.getWorkspace().getRoot().findMember(fullPath); } }
@Override public String getName() { if (file != null) { return file.getName(); } return state.getName(); }
public void run() { try { IStructuredSelection structSel = getStructuredSelection(); Object[] objArray = structSel.toArray(); for (int i = 0; i < objArray.length; i++) { IFileState state = (IFileState) objArray[i]; if (!state.exists()) { MessageDialog.openError(TeamUIPlugin.getActivePage().getActivePart().getSite().getShell(), TeamUIMessages.OpenRevisionAction_DeletedRevisionTitle, TeamUIMessages.OpenRevisionAction_DeletedRevisionMessage); } else { String id = getEditorID(state.getName(), state.getContents()); IWorkbenchPage page = TeamUIPlugin.getActivePage(); if (page != null) { page.openEditor(new FileRevisionEditorInput(state), id); } } } } catch (Exception e) { } }
@Override public InputStream getContents(IFileState target) throws CoreException { if (!target.exists()) { String message = Messages.history_notValid; throw new ResourceException(IResourceStatus.FAILED_READ_LOCAL, target.getFullPath(), message, null); } return blobStore.getBlob(((FileState) target).getUUID()); }
public String getName() { IFileRevision rev = (IFileRevision)getAdapter(IFileRevision.class); if (rev != null) return NLS.bind(TeamUIMessages.nameAndRevision, new String[] { rev.getName(), rev.getContentIdentifier()}); IFileState state = (IFileState)getAdapter(IFileState.class); if (state != null) return state.getName() + " " + DateFormat.getInstance().format(new Date(state.getModificationTime())) ; //$NON-NLS-1$ return storage.getName(); }
private boolean statesEqual(IFileState s1, IFileState s2) { return (s1.getFullPath().equals(s2.getFullPath()) && s1.getModificationTime() == s2.getModificationTime()); }
@Override public String getCharset() throws CoreException { return state.getCharset(); } };
public IResource getResource() { IPath fullPath= fFileState.getFullPath(); return ResourcesPlugin.getWorkspace().getRoot().findMember(fullPath); } }
public String getName() { if (file != null) { return file.getName(); } return state.getName(); }
@Override public long getModificationDate() { return fFileState.getModificationTime(); } }
@Override public InputStream getContents() throws CoreException { return state.getContents(); }
@Override public InputStream getContents(IFileState target) throws CoreException { if (!target.exists()) { String message = Messages.history_notValid; throw new ResourceException(IResourceStatus.FAILED_READ_LOCAL, target.getFullPath(), message, null); } return blobStore.getBlob(((FileState) target).getUUID()); }