Author: vyemialyanchyk
Date: 2010-08-02 13:16:22 -0400 (Mon, 02 Aug 2010)
New Revision: 23870
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizardPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/LaunchHelper.java
Log:
https://jira.jboss.org/browse/JBIDE-6762 - fixed
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizardPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizardPage.java 2010-08-02
16:29:10 UTC (rev 23869)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizardPage.java 2010-08-02
17:16:22 UTC (rev 23870)
@@ -86,7 +86,7 @@
.setLabelText(HibernateConsoleMessages.ExportAntCodeGenWizardPage_hibernate_code_generation_configurations);
ILaunchConfiguration[] launchCfgs;
try {
- launchCfgs = LaunchHelper.findFilteredCodeGenerationConfigs();
+ launchCfgs = LaunchHelper.findFilteredCodeGenerationConfigsSorted();
} catch (CoreException e) {
launchCfgs = new ILaunchConfiguration[0];
}
@@ -122,7 +122,7 @@
public ILaunchConfiguration getSelectedLaunchConfig() {
ILaunchConfiguration[] launchCfgs;
try {
- launchCfgs = LaunchHelper.findFilteredCodeGenerationConfigs();
+ launchCfgs = LaunchHelper.findFilteredCodeGenerationConfigsSorted();
} catch (CoreException e) {
launchCfgs = new ILaunchConfiguration[0];
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/LaunchHelper.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/LaunchHelper.java 2010-08-02
16:29:10 UTC (rev 23869)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/LaunchHelper.java 2010-08-02
17:16:22 UTC (rev 23870)
@@ -1,6 +1,8 @@
package org.hibernate.eclipse.console.utils;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
import java.util.List;
import org.eclipse.core.runtime.Assert;
@@ -160,20 +162,40 @@
//***************************** Hibernate Code Generation Launch Configurations
************
- public static ILaunchConfiguration[] findFilteredCodeGenerationConfigs() throws
CoreException{
- ILaunchConfiguration[] allHibernateLaunchConfigurations = findCodeGenerationConfigs();
- List<ILaunchConfiguration> launchConfigurations = new
ArrayList<ILaunchConfiguration>();
- for (ILaunchConfiguration config : allHibernateLaunchConfigurations) {
- if (DebugUIPlugin.doLaunchConfigurationFiltering(config))
launchConfigurations.add(config);
+ public static ILaunchConfiguration[] filterCodeGenerationConfigs(ILaunchConfiguration[]
launchConfigs) throws CoreException{
+ List<ILaunchConfiguration> res = new ArrayList<ILaunchConfiguration>();
+ for (ILaunchConfiguration config : launchConfigs) {
+ if (DebugUIPlugin.doLaunchConfigurationFiltering(config)) {
+ res.add(config);
+ }
}
- return launchConfigurations.toArray(new
ILaunchConfiguration[launchConfigurations.size()]);
+ return res.toArray(new ILaunchConfiguration[res.size()]);
}
+ public static ILaunchConfiguration[] findFilteredCodeGenerationConfigs() throws
CoreException{
+ return filterCodeGenerationConfigs(findCodeGenerationConfigs());
+ }
+
+ public static ILaunchConfiguration[] findFilteredCodeGenerationConfigsSorted() throws
CoreException{
+ return filterCodeGenerationConfigs(findCodeGenerationConfigsSortedByName());
+ }
+
public static ILaunchConfiguration[] findCodeGenerationConfigs() throws CoreException {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
return launchManager.getLaunchConfigurations(getCodeGenerationType());
}
+ public static ILaunchConfiguration[] findCodeGenerationConfigsSortedByName() throws
CoreException {
+ ILaunchConfiguration[] launchConfigs = findCodeGenerationConfigs();
+ Comparator<ILaunchConfiguration> comparator = new
Comparator<ILaunchConfiguration>() {
+ public int compare(ILaunchConfiguration o1, ILaunchConfiguration o2) {
+ return o1.getName().compareToIgnoreCase(o2.getName());
+ }
+ };
+ Arrays.sort(launchConfigs, comparator);
+ return launchConfigs;
+ }
+
public static ILaunchConfigurationType getCodeGenerationType(){
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
return launchManager.getLaunchConfigurationType(