diff options
author | kmoore | 2010-04-05 20:41:50 +0000 |
---|---|---|
committer | kmoore | 2010-04-05 20:41:50 +0000 |
commit | e5e856827aa522da5aac2ea19694edf931ef5e1a (patch) | |
tree | 2ca5a1c3261edfed4364b6387ebb19fe05ae9b0a /jpa/tests/org.eclipse.jpt.ui.tests | |
parent | 05ad76eb2a832eeb91b03baf598b6b4c82a35269 (diff) | |
download | webtools.dali-e5e856827aa522da5aac2ea19694edf931ef5e1a.tar.gz webtools.dali-e5e856827aa522da5aac2ea19694edf931ef5e1a.tar.xz webtools.dali-e5e856827aa522da5aac2ea19694edf931ef5e1a.zip |
switch from CCombo to Combo
Diffstat (limited to 'jpa/tests/org.eclipse.jpt.ui.tests')
3 files changed, 32 insertions, 121 deletions
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/CComboModelAdapterTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/CComboModelAdapterTest.java deleted file mode 100644 index 4cf143eb90..0000000000 --- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/CComboModelAdapterTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.ui.tests.internal.swt; - -import org.eclipse.jpt.ui.internal.swt.AbstractComboModelAdapter; -import org.eclipse.jpt.ui.internal.swt.CComboModelAdapter; -import org.eclipse.jpt.utility.internal.swing.SimpleDisplayable; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.junit.After; - -public class CComboModelAdapterTest extends AbstractComboModelAdapterTest { - - private CCombo combo; - - @Override - protected AbstractComboModelAdapter<SimpleDisplayable> buildEditableComboModelAdapter() { - - combo = new CCombo(shell(), SWT.NULL); - - return CComboModelAdapter.adapt( - buildListHolder(), - selectedItemHolder(), - combo, - buildStringConverter() - ); - } - - @Override - protected AbstractComboModelAdapter<SimpleDisplayable> buildReadOnlyComboModelAdapter() { - - combo = new CCombo(shell(), SWT.READ_ONLY); - - return CComboModelAdapter.adapt( - buildListHolder(), - selectedItemHolder(), - combo, - buildStringConverter() - ); - } - - @Override - public String comboSelectedItem() { - return combo.getText(); - } - - @Override - protected boolean emptyComboCanHaveSelectedValue() { - return true; - } - - @Override - protected String itemAt(int index) { - return this.combo.getItem(index); - } - - @Override - protected int itemCounts() { - return combo.getItemCount(); - } - - @After - @Override - public void tearDown() throws Exception { - super.tearDown(); - combo = null; - } -} diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/JptUiSWTTests.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/JptUiSWTTests.java index 12a8c2fbce..79dc602321 100644 --- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/JptUiSWTTests.java +++ b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/swt/JptUiSWTTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. + * Copyright (c) 2008, 2010 Oracle. 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. @@ -18,7 +18,6 @@ import org.junit.runners.Suite.SuiteClasses; @SuiteClasses ({ - CComboModelAdapterTest.class, ComboModelAdapterTest.class, SpinnerModelAdapterTest.class, TableModelAdapterTest.class diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/utility/swt/DropDownListBoxModelBindingUITest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/utility/swt/DropDownListBoxModelBindingUITest.java index 15f31aa182..65499c2cb3 100644 --- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/utility/swt/DropDownListBoxModelBindingUITest.java +++ b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/utility/swt/DropDownListBoxModelBindingUITest.java @@ -31,7 +31,6 @@ import org.eclipse.jpt.utility.model.Model; import org.eclipse.jpt.utility.model.value.ListValueModel; import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; @@ -97,30 +96,29 @@ public class DropDownListBoxModelBindingUITest panel.setLayoutData(fd); panel.setLayout(new FormLayout()); - this.buildTaskListPanel(panel, false); // false = native (Combo) - this.buildTaskListPanel(panel, true); // true = custom (CCombo) + this.buildTaskListPanel_(panel); // false = native (Combo) return panel; } - private Control buildTaskListPanel(Composite parent, boolean custom) { + private Control buildTaskListPanel_(Composite parent) { Composite panel = new Composite(parent, SWT.NONE); FormData fd = new FormData(); - fd.top = new FormAttachment(custom ? 50 : 0); - fd.bottom = new FormAttachment(custom ? 100 : 50); + fd.top = new FormAttachment(0); + fd.bottom = new FormAttachment(50); fd.left = new FormAttachment(0); fd.right = new FormAttachment(100); panel.setLayoutData(fd); panel.setLayout(new FormLayout()); - this.buildPrimitiveTaskListPanel(panel, custom); - this.buildObjectTaskListPanel(panel, custom); + this.buildPrimitiveTaskListPanel(panel); + this.buildObjectTaskListPanel(panel); return panel; } - private void buildPrimitiveTaskListPanel(Composite parent, boolean custom) { + private void buildPrimitiveTaskListPanel(Composite parent) { Composite panel = new Composite(parent, SWT.NONE); FormData fd = new FormData(); @@ -131,12 +129,12 @@ public class DropDownListBoxModelBindingUITest panel.setLayoutData(fd); panel.setLayout(new FillLayout()); - this.buildUnsortedPrimitiveListPanel(panel, custom); - this.buildStandardSortedPrimitiveListPanel(panel, custom); - this.buildCustomSortedPrimitiveListPanel(panel, custom); + this.buildUnsortedPrimitiveListPanel(panel); + this.buildStandardSortedPrimitiveListPanel(panel); + this.buildCustomSortedPrimitiveListPanel(panel); } - private void buildObjectTaskListPanel(Composite parent, boolean custom) { + private void buildObjectTaskListPanel(Composite parent) { Composite panel = new Composite(parent, SWT.NONE); FormData fd = new FormData(); @@ -147,45 +145,39 @@ public class DropDownListBoxModelBindingUITest panel.setLayoutData(fd); panel.setLayout(new FillLayout()); - this.buildUnsortedObjectListPanel(panel, custom); - this.buildStandardSortedObjectListPanel(panel, custom); - this.buildCustomSortedObjectListPanel(panel, custom); + this.buildUnsortedObjectListPanel(panel); + this.buildStandardSortedObjectListPanel(panel); + this.buildCustomSortedObjectListPanel(panel); } - private void buildUnsortedPrimitiveListPanel(Composite parent, boolean custom) { + private void buildUnsortedPrimitiveListPanel(Composite parent) { String label = "primitive unsorted"; - if (custom) label += " (custom)"; - this.buildComboBoxPanel(parent, label, this.buildUnsortedPrimitiveListModel(), this.buildPriorityTaskNameAdapter(), custom); + this.buildComboBoxPanel(parent, label, this.buildUnsortedPrimitiveListModel(), this.buildPriorityTaskNameAdapter()); } - private void buildStandardSortedPrimitiveListPanel(Composite parent, boolean custom) { + private void buildStandardSortedPrimitiveListPanel(Composite parent) { String label = "primitive sorted"; - if (custom) label += " (custom)"; - this.buildComboBoxPanel(parent, label, this.buildStandardSortedPrimitiveListModel(), this.buildPriorityTaskNameAdapter(), custom); + this.buildComboBoxPanel(parent, label, this.buildStandardSortedPrimitiveListModel(), this.buildPriorityTaskNameAdapter()); } - private void buildCustomSortedPrimitiveListPanel(Composite parent, boolean custom) { + private void buildCustomSortedPrimitiveListPanel(Composite parent) { String label = "primitive reverse sorted"; - if (custom) label += " (custom)"; - this.buildComboBoxPanel(parent, label, this.buildCustomSortedPrimitiveListModel(), this.buildPriorityTaskNameAdapter(), custom); + this.buildComboBoxPanel(parent, label, this.buildCustomSortedPrimitiveListModel(), this.buildPriorityTaskNameAdapter()); } - private void buildUnsortedObjectListPanel(Composite parent, boolean custom) { + private void buildUnsortedObjectListPanel(Composite parent) { String label = "object unsorted"; - if (custom) label += " (custom)"; - this.buildComboBoxPanel(parent, label, this.buildUnsortedObjectListModel(), this.buildPriorityTaskAdapter(), custom); + this.buildComboBoxPanel(parent, label, this.buildUnsortedObjectListModel(), this.buildPriorityTaskAdapter()); } - private void buildStandardSortedObjectListPanel(Composite parent, boolean custom) { + private void buildStandardSortedObjectListPanel(Composite parent) { String label = "object sorted"; - if (custom) label += " (custom)"; - this.buildComboBoxPanel(parent, label, this.buildStandardSortedObjectListModel(), this.buildPriorityTaskAdapter(), custom); + this.buildComboBoxPanel(parent, label, this.buildStandardSortedObjectListModel(), this.buildPriorityTaskAdapter()); } - private void buildCustomSortedObjectListPanel(Composite parent, boolean custom) { + private void buildCustomSortedObjectListPanel(Composite parent) { String label = "object reverse sorted"; - if (custom) label += " (custom)"; - this.buildComboBoxPanel(parent, label, this.buildCustomSortedObjectListModel(), this.buildPriorityTaskAdapter(), custom); + this.buildComboBoxPanel(parent, label, this.buildCustomSortedObjectListModel(), this.buildPriorityTaskAdapter()); } private ListValueModel<String> buildUnsortedPrimitiveListModel() { @@ -212,7 +204,7 @@ public class DropDownListBoxModelBindingUITest return new SortedListValueModelWrapper<Task>(this.buildObjectTaskListAdapter(), this.buildCustomTaskComparator()); } - private <E> void buildComboBoxPanel(Composite parent, String label, ListValueModel<E> model, WritablePropertyValueModel<E> selectedItemModel, boolean custom) { + private <E> void buildComboBoxPanel(Composite parent, String label, ListValueModel<E> model, WritablePropertyValueModel<E> selectedItemModel) { Composite panel = new Composite(parent, SWT.NONE); panel.setLayout(new FormLayout()); @@ -225,23 +217,18 @@ public class DropDownListBoxModelBindingUITest fd.right = new FormAttachment(100); comboBoxLabel.setLayoutData(fd); - Control comboBox = this.buildComboBox(panel, custom); + Combo comboBox = this.buildComboBox(panel); fd = new FormData(); fd.top = new FormAttachment(comboBoxLabel); fd.bottom = new FormAttachment(100); fd.left = new FormAttachment(0); fd.right = new FormAttachment(100); comboBox.setLayoutData(fd); - if (custom) { - SWTTools.bind(model, selectedItemModel, (CCombo) comboBox); // use #toString() - } else { - SWTTools.bind(model, selectedItemModel, (Combo) comboBox); // use #toString() - } + SWTTools.bind(model, selectedItemModel, comboBox); // use #toString() } - private Control buildComboBox(Composite parent, boolean custom) { - int style = SWT.READ_ONLY; - return custom ? new CCombo(parent, style) : new Combo(parent, style); + private Combo buildComboBox(Composite parent) { + return new Combo(parent, SWT.READ_ONLY); } private Comparator<String> buildCustomStringComparator() { |