### Eclipse Workspace Patch 1.0 #P org.eclipse.team.cvs.ui Index: src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java,v retrieving revision 1.19 diff -u -r1.19 ResourceEditionNode.java --- src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java 6 Jan 2009 16:49:54 -0000 1.19 +++ src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java 16 Jan 2009 11:20:55 -0000 @@ -37,6 +37,7 @@ private ICVSRemoteResource resource; private ResourceEditionNode[] children; private ISharedDocumentAdapter sharedDocumentAdapter; + private IEditorInput editorInput; /** * Creates a new ResourceEditionNode on the given resource edition. @@ -208,8 +209,11 @@ private IEditorInput getDocumentKey(Object element) { try { if (element == this && getStorage() != null) { - return new FileRevisionEditorInput(resource - .getAdapter(IFileRevision.class), getStorage()); + if (editorInput == null) { + editorInput = new FileRevisionEditorInput(resource + .getAdapter(IFileRevision.class), getStorage()); + } + return editorInput; } } catch (TeamException e) { TeamUIPlugin.log(e); #P org.eclipse.compare Index: compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java,v retrieving revision 1.48 diff -u -r1.48 StructureDiffViewer.java --- compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java 3 Jun 2008 13:35:49 -0000 1.48 +++ compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java 16 Jan 2009 11:21:00 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 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 @@ -631,8 +631,18 @@ */ protected void propertyChange(PropertyChangeEvent event) { String key= event.getProperty(); - if (key.equals(CompareConfiguration.IGNORE_WHITESPACE)) + if (key.equals(CompareConfiguration.IGNORE_WHITESPACE)) { diff(); + } else if (key.equals("ANCESTOR_ENCODING")) { //$NON-NLS-1$ + fAncestorStructure.refresh(new NullProgressMonitor()); + diff(); + } else if (key.equals("LEFT_ENCODING")) { //$NON-NLS-1$ + fLeftStructure.refresh(new NullProgressMonitor()); + diff(); + } else if (key.equals("RIGHT_ENCODING")) { //$NON-NLS-1$ + fRightStructure.refresh(new NullProgressMonitor()); + diff(); + } else super.propertyChange(event); } Index: compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java,v retrieving revision 1.241 diff -u -r1.241 TextMergeViewer.java --- compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java 12 Jan 2009 12:33:00 -0000 1.241 +++ compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java 16 Jan 2009 11:21:00 -0000 @@ -536,6 +536,9 @@ } } + /* (non-Javadoc) + * @see org.eclipse.ui.editors.text.IEncodingSupport#setEncoding(java.lang.String) + */ public void setEncoding(String encoding) { if (fDocumentKey == null || fDocumentProvider == null) { return; @@ -553,13 +556,16 @@ } catch (CoreException e) { CompareUIPlugin.log(e); } finally { - update(true); + encodingChanged(fLeg); } } } } } + /* (non-Javadoc) + * @see org.eclipse.ui.editors.text.IEncodingSupport#getEncoding() + */ public String getEncoding() { if (fDocumentProvider != null && fDocumentKey != null && fDocumentProvider instanceof IStorageDocumentProvider) { @@ -569,6 +575,9 @@ return null; } + /* (non-Javadoc) + * @see org.eclipse.ui.editors.text.IEncodingSupport#getDefaultEncoding() + */ public String getDefaultEncoding() { if (fDocumentProvider != null && fDocumentKey != null && fDocumentProvider instanceof IStorageDocumentProvider) { @@ -579,6 +588,14 @@ } private String internalGetEncoding() { + if (fElement instanceof IEncodedStreamContentAccessor) { + try { + fEncoding = ((IEncodedStreamContentAccessor) fElement) + .getCharset(); + } catch (CoreException e) { + // silently ignored + } + } if (fEncoding != null) { return fEncoding; } @@ -1007,7 +1024,7 @@ // recalculate diffs and update controls new UIJob(CompareMessages.DocumentMerger_0) { public IStatus runInUIThread(IProgressMonitor monitor) { - update(true); + encodingChanged(fLeg); return Status.OK_STATUS; } }.schedule(); @@ -4972,8 +4989,16 @@ return false; } + /** + * This method returns {@link ITextEditor} used in the + * {@link ChangeEncodingAction}. It provides implementation of methods that + * are used by the action by delegating them to {@link ContributorInfo} that + * corresponds to the side that has focus. + * + * @return + */ private ITextEditor getTextEditorAdapter() { - return new ITextEditor () { + return new ITextEditor() { public void close(boolean save) { // Implementing interface method } @@ -5176,4 +5201,22 @@ } }; } + + private void encodingChanged(char leg) { + update(true); + String key = null; + switch (leg) { + case ANCESTOR_CONTRIBUTOR: + key = "ANCESTOR_ENCODING"; //$NON-NLS-1$ + break; + case LEFT_CONTRIBUTOR: + key = "LEFT_ENCODING"; //$NON-NLS-1$ + break; + case RIGHT_CONTRIBUTOR: + key = "RIGHT_ENCODING"; //$NON-NLS-1$ + break; + } + getCompareConfiguration().setProperty(key, null); + } + }