Author: xavier Date: Fri Feb 1 08:14:31 2008 New Revision: 617542 URL: http://svn.apache.org/viewvc?rev=617542&view=rev Log: NEW: Order alphabetically the entries in the class path container (IVYDE-69) (thanks to Nicolas Lalevée)
Modified: ant/ivy/ivyde/trunk/CHANGES.txt ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/IvyPlugin.java ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/properties/IvyProjectPropertyPage.java Modified: ant/ivy/ivyde/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/CHANGES.txt?rev=617542&r1=617541&r2=617542&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/CHANGES.txt (original) +++ ant/ivy/ivyde/trunk/CHANGES.txt Fri Feb 1 08:14:31 2008 @@ -4,6 +4,7 @@ version in svn (not yet released) =========================== - NEW: [build] Use the latest ivy to resolve dependencies (IVYDE-62) (thanks to Nicolas Lalevée) +- NEW: Order alphabetically the entries in the class path container (IVYDE-69) (thanks to Nicolas Lalevée) - IMPROVE: Recognize more source and javadoc artifacts names (IVYDE-66) (thanks to Nicolas Lalevée) - IMPROVE: Use Ivy Bundle instead of packaging ivy.jar in IvyDE bundle (IVYDE-67) Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/IvyPlugin.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/IvyPlugin.java?rev=617542&r1=617541&r2=617542&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/IvyPlugin.java (original) +++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/IvyPlugin.java Fri Feb 1 08:14:31 2008 @@ -640,6 +640,16 @@ return !"".equals(getRetrievePatternHerited(project)); } + public static boolean isAlphaOrder(IJavaProject javaProject) { + return IvyPlugin.getDefault().getProjectPreferences(javaProject).getBoolean( + PreferenceConstants.APHABETICAL_ORDER, false); + } + + public static void setAlphaOrder(IJavaProject project, boolean alphaOrder) { + IvyPlugin.getDefault().getProjectPreferences(project).putBoolean( + PreferenceConstants.APHABETICAL_ORDER, alphaOrder); + } + public static boolean shouldTestNonDeclaredSources(IJavaProject project) { return true; // TODO: add settings for that } Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java?rev=617542&r1=617541&r2=617542&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java (original) +++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java Fri Feb 1 08:14:31 2008 @@ -8,6 +8,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -699,6 +700,13 @@ private void setClasspathEntries(final IClasspathEntry[] entries, final boolean notify) { Display.getDefault().asyncExec(new Runnable() { public void run() { + if (IvyPlugin.isAlphaOrder(_javaProject)) { + Arrays.sort(entries, new Comparator() { + public int compare(Object o1, Object o2) { + return ((IClasspathEntry) o1).getPath().lastSegment().compareTo(((IClasspathEntry) o2).getPath().lastSegment()); + } + }); + } _classpathEntries = entries; if (notify) { notifyUpdateClasspathEntries(); Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java?rev=617542&r1=617541&r2=617542&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java (original) +++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java Fri Feb 1 08:14:31 2008 @@ -31,4 +31,6 @@ public static final String RETRIEVE_PATTERN = "retreive.pattern"; + public static final String APHABETICAL_ORDER = "order.alphabetical"; + } Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/properties/IvyProjectPropertyPage.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/properties/IvyProjectPropertyPage.java?rev=617542&r1=617541&r2=617542&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/properties/IvyProjectPropertyPage.java (original) +++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/properties/IvyProjectPropertyPage.java Fri Feb 1 08:14:31 2008 @@ -52,6 +52,8 @@ private Text _javadocSuffixesText; + private Button _alphaOrder; + public IvyProjectPropertyPage() { super(); } @@ -200,6 +202,16 @@ 1)); explanation .setText("Example: lib/[conf]/[artifact].[ext]\nTo copy artifacts in folder named lib without revision by folder named like configurations\nUse [inherited] to use your general eclipse setting."); + + new Label(composite, SWT.NONE).setLayoutData(new GridData(GridData.FILL, + GridData.BEGINNING, false, false, 4, 1)); // space + + _alphaOrder = new Button(composite, SWT.CHECK); + _alphaOrder.setText("Order alphabetically the artifacts in the classpath container"); + _alphaOrder + .setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 4, 1)); + _alphaOrder.setSelection(IvyPlugin.isAlphaOrder(getJavaProject())); + new Label(composite, SWT.NONE).setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 4, 1)); // space } @@ -280,6 +292,7 @@ protected void performDefaults() { _pathValueText.setText(getDefaultIvyconfURLForDisplay()); _retreiveB.setSelection(false); + _alphaOrder.setSelection(false); _patternT.setText(""); _acceptedTypesText.setText("[inherited]"); _sourcesTypesText.setText("[inherited]"); @@ -309,6 +322,7 @@ IvyPlugin.setRetreivePattern(getJavaProject(), ""); } + IvyPlugin.setAlphaOrder(getJavaProject(), _alphaOrder.getSelection()); IvyPlugin.setAcceptedTypes(getJavaProject(), _acceptedTypesText.getText()); IvyPlugin.setSourcesTypes(getJavaProject(), _sourcesTypesText.getText()); IvyPlugin.setSourcesSuffixes(getJavaProject(), _sourcesSuffixesText.getText());