Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 158682 Details for
Bug 300347
[Sync View][Apply Patch] Fix hunks sorting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch_v02
300347_v02.txt (text/plain), 6.14 KB, created by
Pawel Pogorzelski
on 2010-02-10 05:41:22 EST
(
hide
)
Description:
Patch_v02
Filename:
MIME Type:
Creator:
Pawel Pogorzelski
Created:
2010-02-10 05:41:22 EST
Size:
6.14 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.compare >Index: compare/org/eclipse/compare/internal/patch/DiffViewerComparator.java >=================================================================== >RCS file: compare/org/eclipse/compare/internal/patch/DiffViewerComparator.java >diff -N compare/org/eclipse/compare/internal/patch/DiffViewerComparator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ compare/org/eclipse/compare/internal/patch/DiffViewerComparator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,56 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.compare.internal.patch; >+ >+import java.util.Comparator; >+import java.util.regex.Pattern; >+ >+import org.eclipse.compare.structuremergeviewer.DiffNode; >+import org.eclipse.compare.structuremergeviewer.DocumentRangeNode; >+import org.eclipse.jface.util.Policy; >+import org.eclipse.jface.viewers.ViewerSorter; >+ >+public class DiffViewerComparator extends ViewerSorter { >+ >+ public boolean isSorterProperty(Object element, Object property) { >+ return false; >+ } >+ >+ public int category(Object node) { >+ if (node instanceof DiffNode) { >+ Object o= ((DiffNode) node).getId(); >+ if (o instanceof DocumentRangeNode) >+ return ((DocumentRangeNode) o).getTypeCode(); >+ } >+ return 0; >+ } >+ >+ protected Comparator getComparator() { >+ return new Comparator() { >+ public int compare(Object arg0, Object arg1) { >+ String label0 = arg0 == null ? "" : arg0.toString(); //$NON-NLS-1$ >+ String label1 = arg1 == null ? "" : arg1.toString(); //$NON-NLS-1$ >+ >+ // see org.eclipse.compare.internal.patch.Hunk.getDescription() >+ String pattern = "\\d+,\\d+ -> \\d+,\\d+.*"; //$NON-NLS-1$ >+ >+ if (Pattern.matches(pattern, label0) >+ && Pattern.matches(pattern, label1)) { >+ int oldStart0 = Integer.parseInt(label0.split(",")[0]); //$NON-NLS-1$ >+ int oldStart1 = Integer.parseInt(label1.split(",")[0]); //$NON-NLS-1$ >+ >+ return oldStart0 - oldStart1; >+ } >+ return Policy.getComparator().compare(arg0, arg1); >+ } >+ }; >+ } >+} >\ No newline at end of file >Index: compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java,v >retrieving revision 1.50 >diff -u -r1.50 DiffTreeViewer.java >--- compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java 18 Mar 2009 14:37:17 -0000 1.50 >+++ compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java 10 Feb 2010 10:39:40 -0000 >@@ -10,16 +10,14 @@ > *******************************************************************************/ > package org.eclipse.compare.structuremergeviewer; > >-import java.util.Comparator; > import java.util.Iterator; > import java.util.ResourceBundle; >-import java.util.regex.Pattern; > > import org.eclipse.compare.*; > import org.eclipse.compare.internal.Utilities; >+import org.eclipse.compare.internal.patch.DiffViewerComparator; > import org.eclipse.jface.action.*; > import org.eclipse.jface.util.IPropertyChangeListener; >-import org.eclipse.jface.util.Policy; > import org.eclipse.jface.util.PropertyChangeEvent; > import org.eclipse.jface.viewers.*; > import org.eclipse.swt.SWT; >@@ -41,43 +39,6 @@ > */ > public class DiffTreeViewer extends TreeViewer { > >- static class DiffViewerComparator extends ViewerComparator { >- >- public boolean isSorterProperty(Object element, Object property) { >- return false; >- } >- >- public int category(Object node) { >- if (node instanceof DiffNode) { >- Object o= ((DiffNode) node).getId(); >- if (o instanceof DocumentRangeNode) >- return ((DocumentRangeNode) o).getTypeCode(); >- } >- return 0; >- } >- >- protected Comparator getComparator() { >- return new Comparator() { >- public int compare(Object arg0, Object arg1) { >- String label0 = arg0 == null ? "" : arg0.toString(); //$NON-NLS-1$ >- String label1 = arg1 == null ? "" : arg1.toString(); //$NON-NLS-1$ >- >- // see org.eclipse.compare.internal.patch.Hunk.getDescription() >- String pattern = "\\d+,\\d+ -> \\d+,\\d+.*"; //$NON-NLS-1$ >- >- if (Pattern.matches(pattern, label0) >- && Pattern.matches(pattern, label1)) { >- int oldStart0 = Integer.parseInt(label0.split(",")[0]); //$NON-NLS-1$ >- int oldStart1 = Integer.parseInt(label1.split(",")[0]); //$NON-NLS-1$ >- >- return oldStart0 - oldStart1; >- } >- return Policy.getComparator().compare(arg0, arg1); >- } >- }; >- } >- } >- > class DiffViewerContentProvider implements ITreeContentProvider { > > public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >#P org.eclipse.team.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.ui/plugin.xml,v >retrieving revision 1.204 >diff -u -r1.204 plugin.xml >--- plugin.xml 26 Jan 2010 12:35:05 -0000 1.204 >+++ plugin.xml 10 Feb 2010 10:39:42 -0000 >@@ -632,6 +632,14 @@ > <actionProvider > class="org.eclipse.team.internal.ui.synchronize.patch.ApplyPatchSynchronizationActionProvider"> > </actionProvider> >+ <commonSorter >+ class="org.eclipse.compare.internal.patch.DiffViewerComparator"> >+ <parentExpression> >+ <instanceof >+ value="org.eclipse.compare.internal.patch.PatchFileDiffNode"> >+ </instanceof> >+ </parentExpression> >+ </commonSorter> > </navigatorContent> > </extension> > <extension
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 300347
:
158576
| 158682