Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/compare/contentmergeviewer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13295/compare/org/eclipse/compare/contentmergeviewer Modified Files: IDocumentRange.java ITokenComparator.java IMergeViewerContentProvider.java TextMergeViewer.java Log Message: Updated to Eclipse 3.2 M6 Index: IMergeViewerContentProvider.java =================================================================== RCS file: /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IMergeViewerContentProvider.java 28 Mar 2006 13:49:15 -0000 1.1 --- IMergeViewerContentProvider.java 5 Apr 2006 16:12:49 -0000 1.2 *************** *** 1,4 **** /******************************************************************************* ! * Copyright (c) 2000, 2004 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 --- 1,4 ---- /******************************************************************************* ! * Copyright (c) 2000, 2005 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 Index: TextMergeViewer.java =================================================================== RCS file: /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TextMergeViewer.java 28 Mar 2006 13:49:15 -0000 1.1 --- TextMergeViewer.java 5 Apr 2006 16:12:49 -0000 1.2 *************** *** 1,4 **** /******************************************************************************* ! * Copyright (c) 2000, 2005 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 --- 1,4 ---- /******************************************************************************* ! * Copyright (c) 2000, 2006 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 *************** *** 9,12 **** --- 9,13 ---- * IBM Corporation - initial API and implementation * cha...@ma... - curved line code + * gil...@fr... - fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=72995 *******************************************************************************/ package org.eclipse.compare.contentmergeviewer; *************** *** 1666,1680 **** mcp.setRightError(null); } // set new documents ! setDocument(fLeft, 'L', left); fLeftLineCount= fLeft.getLineCount(); ! fLeftEncoding= getEncoding(left); ! ! setDocument(fRight, 'R', right); fRightLineCount= fRight.getLineCount(); - fRightEncoding= getEncoding(right); ! setDocument(fAncestor, 'A', ancestor); updateHeader(); --- 1667,1691 ---- mcp.setRightError(null); } + + // Get encodings from streams. If an encoding is null, abide by the other one + // Defaults to workbench encoding only if both encodings are null + fLeftEncoding= getEncoding(left); + fRightEncoding= getEncoding(right); + if (fLeftEncoding == null && fRightEncoding == null) { + fLeftEncoding= fRightEncoding= ResourcesPlugin.getEncoding(); + } else if (fLeftEncoding == null) { + fLeftEncoding= fRightEncoding; + } else if (fRightEncoding == null) { + fRightEncoding= fLeftEncoding; + } // set new documents ! setDocument(fLeft, 'L', left, fLeftEncoding); fLeftLineCount= fLeft.getLineCount(); ! ! setDocument(fRight, 'R', right, fRightEncoding); fRightLineCount= fRight.getLineCount(); ! setDocument(fAncestor, 'A', ancestor, fLeftEncoding); updateHeader(); *************** *** 1733,1747 **** private static String getEncoding(Object o) { - String encoding= null; if (o instanceof IEncodedStreamContentAccessor) { try { ! encoding= ((IEncodedStreamContentAccessor)o).getCharset(); } catch (CoreException e) { ! // ignored } } ! if (encoding == null) ! encoding= ResourcesPlugin.getEncoding(); ! return encoding; } --- 1744,1755 ---- private static String getEncoding(Object o) { if (o instanceof IEncodedStreamContentAccessor) { try { ! return ((IEncodedStreamContentAccessor)o).getCharset(); } catch (CoreException e) { ! // silently ignored } } ! return null; } *************** *** 1900,1904 **** * Returns true if a new Document could be installed. */ ! private boolean setDocument(MergeSourceViewer tp, char type, Object o) { if (tp == null) --- 1908,1912 ---- * Returns true if a new Document could be installed. */ ! private boolean setDocument(MergeSourceViewer tp, char type, Object o, String encoding) { if (tp == null) *************** *** 1921,1927 **** IStreamContentAccessor sca= (IStreamContentAccessor) o; String s= null; ! try { ! s= Utilities.readString(sca); } catch (CoreException ex) { setError(type, ex.getMessage()); --- 1929,1937 ---- IStreamContentAccessor sca= (IStreamContentAccessor) o; String s= null; ! if (encoding == null) ! encoding= ResourcesPlugin.getEncoding(); ! try { ! s= Utilities.readString(sca.getContents(), encoding); } catch (CoreException ex) { setError(type, ex.getMessage()); Index: IDocumentRange.java =================================================================== RCS file: /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IDocumentRange.java 28 Mar 2006 13:49:15 -0000 1.1 --- IDocumentRange.java 5 Apr 2006 16:12:49 -0000 1.2 *************** *** 1,4 **** /******************************************************************************* ! * Copyright (c) 2000, 2004 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 --- 1,4 ---- /******************************************************************************* ! * Copyright (c) 2000, 2005 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 Index: ITokenComparator.java =================================================================== RCS file: /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ITokenComparator.java 28 Mar 2006 13:49:15 -0000 1.1 --- ITokenComparator.java 5 Apr 2006 16:12:49 -0000 1.2 *************** *** 1,4 **** /******************************************************************************* ! * Copyright (c) 2000, 2004 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 --- 1,4 ---- /******************************************************************************* ! * Copyright (c) 2000, 2005 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 |