Author: xcoulon
Date: 2012-05-18 09:35:37 -0400 (Fri, 18 May 2012)
New Revision: 41152
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialog.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPage.java
Log:
Fixed - JBIDE-11221
wizards: Order cartridges and application types alphabetically
Applied Daniel's patch
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-05-18
13:21:32 UTC (rev 41151)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-05-18
13:35:37 UTC (rev 41152)
@@ -12,6 +12,7 @@
import java.lang.reflect.InvocationTargetException;
import java.net.SocketTimeoutException;
+import java.util.Arrays;
import java.util.Collection;
import org.eclipse.core.databinding.DataBindingContext;
@@ -54,7 +55,9 @@
import org.eclipse.jface.viewers.IElementComparer;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.WizardDialog;
@@ -109,6 +112,7 @@
private Group newAppEmbeddableCartridgesGroup;
private Button checkAllButton;
private Button uncheckAllButton;
+ //private ModifyListener modifyListener;
public ApplicationConfigurationWizardPage(IWizard wizard,
OpenShiftExpressApplicationWizardModel wizardModel) {
super("Setup OpenShift Application",
@@ -244,7 +248,6 @@
.grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(newAppConfigurationGroup);
IObservableValue useExistingApplication =
WidgetProperties.selection().observe(useExistingAppBtn);
-
useExistingApplication.addValueChangeListener(
onUseExistingApplication(
newAppConfigurationGroup, existingAppNameText, browseAppsButton));
@@ -279,7 +282,7 @@
.to(selectedCartridgeModelObservable)
.converting(new CartridgeToStringConverter())
.in(dbc);
-
+
final ISWTObservableValue useExistingAppBtnSelection =
WidgetProperties.selection().observe(useExistingAppBtn);
final NewApplicationNameValidator newApplicationNameValidator =
new NewApplicationNameValidator(useExistingAppBtnSelection,
applicationNameTextObservable);
@@ -430,6 +433,16 @@
TableColumnLayout tableLayout = new TableColumnLayout();
tableContainer.setLayout(tableLayout);
CheckboxTableViewer viewer = new CheckboxTableViewer(table);
+ viewer.setSorter(new ViewerSorter(){
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if(e1 instanceof IEmbeddableCartridge && e2 instanceof
IEmbeddableCartridge){
+ return
((IEmbeddableCartridge)e1).getName().compareTo(((IEmbeddableCartridge)e2).getName());
+ }
+ return super.compare(viewer, e1, e2);
+ }
+ });
+
viewer.setComparer(new EqualityComparer());
viewer.setContentProvider(new ArrayContentProvider());
createTableColumn("Embeddable Cartridge", 1, new CellLabelProvider() {
@@ -627,6 +640,10 @@
// reacting to model changes while wizard runnable is
// run. We force another update
dbc.updateModels();
+ // sort
+ String[] items = newAppCartridgeCombo.getItems();
+ Arrays.sort(items);
+ newAppCartridgeCombo.setItems(items);
}
});
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialog.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialog.java 2012-05-18
13:21:32 UTC (rev 41151)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialog.java 2012-05-18
13:35:37 UTC (rev 41152)
@@ -37,6 +37,7 @@
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerCell;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jface.wizard.IWizard;
@@ -136,7 +137,18 @@
}
}
}), null);
+
+ tableViewer.setSorter(new ViewerSorter(){
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if(e1 instanceof IApplication && e2 instanceof IApplication){
+ return ((IApplication)e1).getName().compareTo(((IApplication)e2).getName());
+ }
+ return super.compare(viewer, e1, e2);
+ }
+
+ });
/*Button refreshButton = new Button(dialogArea, SWT.PUSH);
refreshButton.setText("R&efresh");
GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.TOP).grab(false, false).hint(80,
SWT.DEFAULT)
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPage.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPage.java 2012-05-18
13:21:32 UTC (rev 41151)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPage.java 2012-05-18
13:35:37 UTC (rev 41152)
@@ -35,7 +35,9 @@
import org.eclipse.jface.viewers.IElementComparer;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
@@ -110,7 +112,19 @@
CheckboxTableViewer viewer = new CheckboxTableViewer(table);
viewer.setComparer(new EqualityComparer());
viewer.setContentProvider(new ArrayContentProvider());
+
+ viewer.setSorter(new ViewerSorter(){
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if(e1 instanceof IEmbeddableCartridge && e2 instanceof
IEmbeddableCartridge){
+ return
((IEmbeddableCartridge)e1).getName().compareTo(((IEmbeddableCartridge)e2).getName());
+ }
+ return super.compare(viewer, e1, e2);
+ }
+
+ });
+
createTableColumn("Embeddable Cartridge", 1, new CellLabelProvider() {
@Override