1 11 package org.eclipse.team.internal.ui.mapping; 12 13 import org.eclipse.core.resources.IFolder; 14 import org.eclipse.core.resources.IResource; 15 import org.eclipse.team.internal.ui.IPreferenceIds; 16 import org.eclipse.team.internal.ui.TeamUIPlugin; 17 import org.eclipse.ui.views.navigator.ResourceSorter; 18 19 22 public class ResourceModelSorter extends ResourceSorter { 23 24 public ResourceModelSorter() { 25 super(NAME); 26 } 27 28 protected int compareNames(IResource r1, IResource r2) { 29 if (getLayout().equals(IPreferenceIds.COMPRESSED_LAYOUT) 30 && r1 instanceof IFolder 31 && r2 instanceof IFolder) { 32 return collator.compare(r1.getProjectRelativePath().toString(), r2.getProjectRelativePath().toString()); 33 } 34 return super.compareNames(r1, r2); 35 } 36 37 protected String getLayout() { 38 return TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCVIEW_DEFAULT_LAYOUT); 39 } 40 } 41 | Popular Tags |