From 96e23ad28cc5a36f77ef315649b47db672837e73 Mon Sep 17 00:00:00 2001 From: Patrick Ziegler Date: Fri, 23 May 2025 19:39:35 +0200 Subject: [PATCH] Replace CCombo3 with native SWT CCombo Both widgets behave effectively the same so there is no need for out custom implementation when the functionality is already provided. Due to 50646774b2fd4a43867467b438a0db8eada56d03, the CCombo3 widget also doesn't work anymore, because unlike the CImageLabel, the CLabel always sets the SWT.NO_FOCUS bit which is causing issues with the drop-down table. Closes https://github.com/eclipse-windowbuilder/windowbuilder/issues/1090 --- .../editor/AbstractEnumPropertyEditor.java | 11 +- .../editor/AbstractListPropertyEditor.java | 13 +- .../ConstantSelectionPropertyEditor.java | 10 +- .../EnumerationValuesPropertyEditor.java | 9 +- .../editor/StaticFieldPropertyEditor.java | 9 +- .../editor/StringListPropertyEditor.java | 7 +- .../org/eclipse/wb/core/controls/CCombo3.java | 517 ------------------ .../AbstractComboBoxPropertyEditor.java | 5 +- .../editor/AbstractComboPropertyEditor.java | 25 +- .../editor/StringComboPropertyEditor.java | 11 +- .../model/property/CursorPropertyEditor.java | 10 +- .../layout/spring/SpringAttachmentInfo.java | 10 +- .../editor/beans/ComboPropertyEditor.java | 10 +- .../editor/cursor/CursorPropertyEditor.java | 11 +- .../form/ControlSelectionPropertyEditor.java | 11 +- .../parser/AbstractJavaInfoRelatedTest.java | 14 +- .../CursorPropertyEditorWithManagerTest.java | 4 +- 17 files changed, 88 insertions(+), 599 deletions(-) delete mode 100644 org.eclipse.wb.core/src/org/eclipse/wb/core/controls/CCombo3.java diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/AbstractEnumPropertyEditor.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/AbstractEnumPropertyEditor.java index f6e5eb95e..ceae3bfad 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/AbstractEnumPropertyEditor.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/AbstractEnumPropertyEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -12,12 +12,13 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.property.editor; -import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.internal.core.model.clipboard.IClipboardSourceProvider; import org.eclipse.wb.internal.core.model.property.GenericProperty; import org.eclipse.wb.internal.core.model.property.Property; import org.eclipse.wb.internal.core.utils.reflect.ReflectionUtils; +import org.eclipse.swt.custom.CCombo; + /** * The base {@link PropertyEditor} for selecting single value of type {@link Enum}. * @@ -62,7 +63,7 @@ public void setText(Property property, String text) throws Exception { // //////////////////////////////////////////////////////////////////////////// @Override - protected void addItems(Property property, CCombo3 combo) throws Exception { + protected void addItems(Property property, CCombo combo) throws Exception { Enum[] elements = getElements(property); for (Enum element : elements) { combo.add(element.toString()); @@ -70,12 +71,12 @@ protected void addItems(Property property, CCombo3 combo) throws Exception { } @Override - protected void selectItem(Property property, CCombo3 combo) throws Exception { + protected void selectItem(Property property, CCombo combo) throws Exception { combo.setText(getText(property)); } @Override - protected void toPropertyEx(Property property, CCombo3 combo, int index) throws Exception { + protected void toPropertyEx(Property property, CCombo combo, int index) throws Exception { Enum[] elements = getElements(property); Enum element = elements[index]; setPropertyValue(property, element); diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/AbstractListPropertyEditor.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/AbstractListPropertyEditor.java index 9a074b8fd..93247cda0 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/AbstractListPropertyEditor.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/AbstractListPropertyEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2024 Google, Inc. and others. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -12,7 +12,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.property.editor; -import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.internal.core.model.JavaInfoUtils; import org.eclipse.wb.internal.core.model.clipboard.IClipboardSourceProvider; @@ -23,6 +22,8 @@ import org.eclipse.wb.internal.core.utils.check.Assert; import org.eclipse.wb.internal.core.utils.execution.ExecutionUtils; +import org.eclipse.swt.custom.CCombo; + import java.util.List; import java.util.Map; @@ -95,19 +96,19 @@ public String getClipboardSource(GenericProperty property) throws Exception { // //////////////////////////////////////////////////////////////////////////// @Override - protected void addItems(Property property, CCombo3 combo) throws Exception { + protected void addItems(Property property, CCombo combo) throws Exception { for (int i = 0; i < getCount(); i++) { combo.add(getTitle(i)); } } @Override - protected void selectItem(Property property, CCombo3 combo) throws Exception { + protected void selectItem(Property property, CCombo combo) throws Exception { combo.setText(getText(property)); } @Override - protected void toPropertyEx(Property property, CCombo3 combo, int index) throws Exception { + protected void toPropertyEx(Property property, CCombo combo, int index) throws Exception { if (property instanceof GenericProperty genericProperty) { String expression = getExpression(index); Object evaluatedExpression = evaluateExpression(genericProperty, expression); @@ -130,7 +131,7 @@ private static Object evaluateExpression(final GenericProperty genericProperty, /** * Sets value of simple {@link Property}, not {@link GenericProperty}. */ - protected void toPropertyEx_simpleProperty(Property property, CCombo3 combo, int index) + protected void toPropertyEx_simpleProperty(Property property, CCombo combo, int index) throws Exception { } diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/ConstantSelectionPropertyEditor.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/ConstantSelectionPropertyEditor.java index baa16d34f..946e3e23f 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/ConstantSelectionPropertyEditor.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/ConstantSelectionPropertyEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2024 Google, Inc. and others. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -12,7 +12,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.property.editor; -import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.internal.core.DesignerPlugin; import org.eclipse.wb.internal.core.model.JavaInfoUtils; @@ -65,6 +64,7 @@ import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.jface.window.Window; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CCombo; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.widgets.Composite; @@ -127,7 +127,7 @@ protected String getText(Property _property) throws Exception { // //////////////////////////////////////////////////////////////////////////// @Override - protected void addItems(Property _property, CCombo3 combo) throws Exception { + protected void addItems(Property _property, CCombo combo) throws Exception { GenericProperty property = (GenericProperty) _property; IType type = getType(property); List fields = getFields(type); @@ -139,7 +139,7 @@ protected void addItems(Property _property, CCombo3 combo) throws Exception { } @Override - protected void selectItem(Property _property, CCombo3 combo) throws Exception { + protected void selectItem(Property _property, CCombo combo) throws Exception { GenericProperty property = (GenericProperty) _property; combo.select(-1); // try to find current field @@ -153,7 +153,7 @@ protected void selectItem(Property _property, CCombo3 combo) throws Exception { } @Override - protected void toPropertyEx(Property _property, CCombo3 combo, int index) throws Exception { + protected void toPropertyEx(Property _property, CCombo combo, int index) throws Exception { GenericProperty property = (GenericProperty) _property; IField field = (IField) combo.getData("" + index); setField(property, field); diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/EnumerationValuesPropertyEditor.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/EnumerationValuesPropertyEditor.java index 0457eaf4f..55832b180 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/EnumerationValuesPropertyEditor.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/EnumerationValuesPropertyEditor.java @@ -12,11 +12,12 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.property.editor; -import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.internal.core.model.clipboard.IClipboardSourceProvider; import org.eclipse.wb.internal.core.model.property.GenericProperty; import org.eclipse.wb.internal.core.model.property.Property; +import org.eclipse.swt.custom.CCombo; + import java.beans.PropertyDescriptor; import java.util.Objects; @@ -109,19 +110,19 @@ public String getClipboardSource(GenericProperty property) throws Exception { // //////////////////////////////////////////////////////////////////////////// @Override - protected void addItems(Property property, CCombo3 combo) throws Exception { + protected void addItems(Property property, CCombo combo) throws Exception { for (String title : m_names) { combo.add(title); } } @Override - protected void selectItem(Property property, CCombo3 combo) throws Exception { + protected void selectItem(Property property, CCombo combo) throws Exception { combo.setText(getText(property)); } @Override - protected void toPropertyEx(Property property, CCombo3 combo, int index) throws Exception { + protected void toPropertyEx(Property property, CCombo combo, int index) throws Exception { Object value = m_values[index]; if (property instanceof GenericProperty genericProperty) { String source = getValueSource(value); diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/StaticFieldPropertyEditor.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/StaticFieldPropertyEditor.java index 61037185b..fc6697506 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/StaticFieldPropertyEditor.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/StaticFieldPropertyEditor.java @@ -12,7 +12,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.property.editor; -import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.internal.core.model.clipboard.IClipboardSourceProvider; import org.eclipse.wb.internal.core.model.property.GenericProperty; import org.eclipse.wb.internal.core.model.property.IConfigurablePropertyObject; @@ -23,6 +22,8 @@ import org.eclipse.wb.internal.core.utils.state.EditorState; import org.eclipse.wb.internal.core.utils.state.EditorWarning; +import org.eclipse.swt.custom.CCombo; + import org.apache.commons.lang3.StringUtils; import java.lang.reflect.Field; @@ -129,19 +130,19 @@ public String getClipboardSource(GenericProperty property) throws Exception { // //////////////////////////////////////////////////////////////////////////// @Override - protected void addItems(Property property, CCombo3 combo) throws Exception { + protected void addItems(Property property, CCombo combo) throws Exception { for (String title : m_titles) { combo.add(title); } } @Override - protected void selectItem(Property property, CCombo3 combo) throws Exception { + protected void selectItem(Property property, CCombo combo) throws Exception { combo.setText(getText(property)); } @Override - protected void toPropertyEx(Property property, CCombo3 combo, int index) throws Exception { + protected void toPropertyEx(Property property, CCombo combo, int index) throws Exception { Object value = m_values[index]; if (property instanceof GenericProperty genericProperty) { String source = getValueSource(value); diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/StringListPropertyEditor.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/StringListPropertyEditor.java index a4e1b3dfd..39e5a1151 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/StringListPropertyEditor.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/StringListPropertyEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -12,11 +12,12 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.property.editor; -import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.internal.core.model.property.Property; import org.eclipse.wb.internal.core.model.property.converter.StringConverter; import org.eclipse.wb.internal.core.utils.state.EditorState; +import org.eclipse.swt.custom.CCombo; + import java.util.Map; /** @@ -35,7 +36,7 @@ public final class StringListPropertyEditor extends AbstractListPropertyEditor { // //////////////////////////////////////////////////////////////////////////// @Override - protected void toPropertyEx_simpleProperty(Property property, CCombo3 combo, int index) + protected void toPropertyEx_simpleProperty(Property property, CCombo combo, int index) throws Exception { property.setValue(m_strings[index]); } diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/core/controls/CCombo3.java b/org.eclipse.wb.core/src/org/eclipse/wb/core/controls/CCombo3.java deleted file mode 100644 index e35e2cca9..000000000 --- a/org.eclipse.wb.core/src/org/eclipse/wb/core/controls/CCombo3.java +++ /dev/null @@ -1,517 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2025 Google, Inc. and others. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * https://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Google, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.wb.core.controls; - -import org.eclipse.wb.internal.core.model.property.table.PropertyTable; -import org.eclipse.wb.internal.core.utils.binding.editors.controls.DefaultControlActionsManager; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.swt.widgets.Widget; - -/** - * Combo control for {@link PropertyTable} and combo property editors. - * - * @author scheglov_ke - * @coverage core.control - */ -public class CCombo3 extends Composite { - private final long m_createTime = System.currentTimeMillis(); - private final CLabel m_text; - private final Button m_arrow; - private final Shell m_popup; - private final Table m_table; - private boolean m_fullDropdownTableSize = false; - - //////////////////////////////////////////////////////////////////////////// - // - // Constructor - // - //////////////////////////////////////////////////////////////////////////// - public CCombo3(Composite parent, int style) { - super(parent, style); - addEvents(this, m_comboListener, new int[]{SWT.Dispose, SWT.Move, SWT.Resize}); - // create label - { - m_text = new CLabel(this, SWT.NONE); - new DefaultControlActionsManager(m_text); - addEvents(m_text, m_textListener, new int[]{ - SWT.KeyDown, - SWT.KeyUp, - SWT.MouseDown, - SWT.MouseUp, - SWT.MouseMove, - SWT.MouseDoubleClick, - SWT.Traverse, - SWT.FocusIn, - SWT.FocusOut}); - } - // create arrow - { - m_arrow = new Button(this, SWT.ARROW | SWT.DOWN); - addEvents(m_arrow, m_arrowListener, new int[]{SWT.Selection, SWT.FocusIn, SWT.FocusOut}); - } - // create popup Shell - { - Shell shell = getShell(); - m_popup = new Shell(shell, SWT.NONE); - m_popup.setLayout(new FillLayout()); - } - // create table for items - { - m_table = new Table(m_popup, SWT.FULL_SELECTION); - addEvents(m_table, m_tableListener, new int[]{SWT.Selection, SWT.FocusIn, SWT.FocusOut}); - // - new TableColumn(m_table, SWT.NONE); - } - // Focus tracking filter - { - final Listener filter = new Listener() { - private boolean hasFocus; - - @Override - public void handleEvent(Event event) { - boolean old_hasFocus = hasFocus; - hasFocus = - m_text.isFocusControl() - || m_arrow.isFocusControl() - || m_popup.isFocusControl() - || m_table.isFocusControl(); - // configure colors - if (hasFocus) { - m_text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_SELECTION)); - m_text.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT)); - } else { - m_text.setBackground(ColorConstants.listBackground); - m_text.setForeground(ColorConstants.listForeground); - } - // send FocusOut event - if (old_hasFocus && !hasFocus) { - Event e = new Event(); - e.widget = CCombo3.this; - e.time = event.time; - notifyListeners(SWT.FocusOut, e); - } - } - }; - getDisplay().addFilter(SWT.FocusIn, filter); - addListener(SWT.Dispose, new Listener() { - @Override - public void handleEvent(Event event) { - getDisplay().removeFilter(SWT.FocusIn, filter); - } - }); - } - } - - //////////////////////////////////////////////////////////////////////////// - // - // Events handling - // - //////////////////////////////////////////////////////////////////////////// - private final Listener m_comboListener = new Listener() { - @Override - public void handleEvent(Event event) { - switch (event.type) { - case SWT.Dispose : - if (!m_popup.isDisposed()) { - m_popup.dispose(); - } - break; - case SWT.Move : - doDropDown(false); - break; - case SWT.Resize : - doResize(); - break; - } - } - }; - private final Listener m_textListener = new Listener() { - @Override - public void handleEvent(final Event event) { - switch (event.type) { - case SWT.MouseDown : - if (System.currentTimeMillis() - m_createTime < 400) { - // send "logical" double click for case when we just activated combo - // and almost right away click second time (but first time on editor) - event.detail = -1; - notifyListeners(SWT.MouseDoubleClick, event); - // when we use "auto drop on editor activation" option, this click is - // is "logically" second one, so it should close combo - if (!isDisposed()) { - doDropDown(false); - } - } else { - m_text.setCapture(true); - doDropDown(!isDropped()); - } - break; - case SWT.MouseUp : { - m_text.setCapture(false); - TableItem item = getItemUnderCursor(event); - if (item != null) { - doDropDown(false); - sendSelectionEvent(event); - } - break; - } - case SWT.MouseDoubleClick : - // prevent resending MouseDoubleClick that we sent on fast MouseDown - if (event.detail != -1) { - notifyListeners(SWT.MouseDoubleClick, event); - } - break; - case SWT.MouseMove : { - TableItem item = getItemUnderCursor(event); - if (item != null) { - m_table.setSelection(new TableItem[]{item}); - } - break; - } - case SWT.KeyDown : { - // check for keyboard navigation and selection - { - int selectionIndex = m_table.getSelectionIndex(); - if (event.keyCode == SWT.ARROW_UP) { - selectionIndex--; - if (selectionIndex < 0) { - selectionIndex = m_table.getItemCount() - 1; - } - m_table.setSelection(selectionIndex); - return; - } else if (event.keyCode == SWT.ARROW_DOWN) { - m_table.setSelection((selectionIndex + 1) % m_table.getItemCount()); - return; - } else if (event.character == SWT.CR || event.character == ' ') { - sendSelectionEvent(event); - return; - } - } - // be default just resend event - resendKeyEvent(event); - break; - } - case SWT.KeyUp : - resendKeyEvent(event); - break; - } - } - - private TableItem getItemUnderCursor(Event event) { - Point displayLocation = m_text.toDisplay(new Point(event.x, event.y)); - Point tableLocation = m_table.toControl(displayLocation); - return m_table.getItem(tableLocation); - } - }; - private final Listener m_arrowListener = new Listener() { - @Override - public void handleEvent(Event event) { - switch (event.type) { - /*case SWT.FocusIn : { - resendFocusEvent(event); - break; - }*/ - case SWT.Selection : { - doDropDown(!isDropped()); - break; - } - } - } - }; - private final Listener m_tableListener = new Listener() { - @Override - public void handleEvent(Event event) { - switch (event.type) { - case SWT.Selection : { - doDropDown(false); - // show selected item in text - { - int index = m_table.getSelectionIndex(); - select(index); - } - // send selection event - sendSelectionEvent(event); - break; - } - } - } - }; - - //////////////////////////////////////////////////////////////////////////// - // - // Events utils - // - //////////////////////////////////////////////////////////////////////////// - /** - * Sends selection event. - */ - private void sendSelectionEvent(Event event) { - Event e = new Event(); - e.time = event.time; - e.stateMask = event.stateMask; - notifyListeners(SWT.Selection, e); - } - - /** - * Resends KeyDown/KeyUp events. - */ - private void resendKeyEvent(Event event) { - Event e = new Event(); - e.time = event.time; - e.character = event.character; - e.keyCode = event.keyCode; - e.stateMask = event.stateMask; - notifyListeners(event.type, e); - } - - /** - * Adds given listener as handler for events in given widget. - */ - private void addEvents(Widget widget, Listener listener, int[] events) { - for (int i = 0; i < events.length; i++) { - widget.addListener(events[i], listener); - } - } - - /** - * Adds the listener to receive events. - */ - public void addSelectionListener(SelectionListener listener) { - checkWidget(); - if (listener == null) { - SWT.error(SWT.ERROR_NULL_ARGUMENT); - } - addTypedListener(listener, SWT.Selection, SWT.DefaultSelection); - } - - //////////////////////////////////////////////////////////////////////////// - // - // Activity - // - //////////////////////////////////////////////////////////////////////////// - /** - * Sets drop state of combo. - */ - public void doDropDown(boolean drop) { - // check, may be we already in this drop state - if (drop == isDropped()) { - return; - } - // close combo - if (!drop) { - m_popup.setVisible(false); - m_text.setFocus(); - return; - } - // open combo - { - // prepare popup location - Point comboSize = getSize(); - Point popupLocation; - { - //popupLocation = getParent().toDisplay(getLocation()); - popupLocation = toDisplay(new Point(0, 0)); - popupLocation.y += comboSize.y; - } - // calculate and set popup location - { - TableColumn tableColumn = m_table.getColumn(0); - // pack everything - tableColumn.pack(); - m_table.pack(); - m_popup.pack(); - // calculate bounds - Rectangle tableBounds = m_table.getBounds(); - tableBounds.height = Math.min(tableBounds.height, m_table.getItemHeight() * 20); // max 20 items without scrolling - m_table.setBounds(tableBounds); - // calculate size - int remainingDisplayHeight = getDisplay().getClientArea().height - popupLocation.y - 10; - int preferredHeight = Math.min(tableBounds.height, remainingDisplayHeight); - int remainingDisplayWidth = getDisplay().getClientArea().width - popupLocation.x - 5; - int preferredWidth = - isFullDropdownTableWidth() - ? Math.min(tableBounds.width, remainingDisplayWidth) - : comboSize.x; - // set popup bounds calculated as computeTrim basing on combo width and table height paying attention on remaining display space - Rectangle popupBounds = - m_popup.computeTrim(popupLocation.x, popupLocation.y, preferredWidth, preferredHeight); - m_popup.setBounds(popupBounds); - // adjust column size - tableColumn.setWidth(m_table.getClientArea().width); - } - m_popup.setVisible(true); - // scroll to selection if needed - m_table.showSelection(); - } - } - - /** - * Initiates "press-hold-drag" sequence. - */ - public void startDrag() { - m_text.setCapture(true); - } - - //////////////////////////////////////////////////////////////////////////// - // - // Access - // - //////////////////////////////////////////////////////////////////////////// - public void setFullDropdownTableWidth(boolean freeTableSize) { - m_fullDropdownTableSize = freeTableSize; - } - - public boolean isFullDropdownTableWidth() { - return m_fullDropdownTableSize; - } - - public boolean isDropped() { - return m_popup.isVisible(); - } - - public void setQuickSearch(boolean value) { - // TODO - } - - //////////////////////////////////////////////////////////////////////////// - // - // Access: items - // - //////////////////////////////////////////////////////////////////////////// - /** - * Removes all items. - */ - public void removeAll() { - TableItem[] items = m_table.getItems(); - for (int index = 0; index < items.length; index++) { - TableItem item = items[index]; - item.dispose(); - } - } - - /** - * Adds new item with given text. - */ - public void add(String text) { - add(text, null); - } - - /** - * Adds new item with given text and image. - */ - public void add(String text, Image image) { - checkWidget(); - TableItem item = new TableItem(m_table, SWT.NONE); - item.setText(text); - item.setImage(image); - } - - /** - * @return an item at given index - */ - public String getItem(int index) { - checkWidget(); - return m_table.getItem(index).getText(); - } - - /** - * @return the number of items - */ - public int getItemCount() { - checkWidget(); - return m_table.getItemCount(); - } - - /** - * @return the index of the selected item - */ - public int getSelectionIndex() { - checkWidget(); - return m_table.getSelectionIndex(); - } - - /** - * Selects an item with given index. - */ - public void select(int index) { - checkWidget(); - if (index == -1) { - m_table.deselectAll(); - m_text.setText(null); - m_text.setImage(null); - return; - } else { - TableItem item = m_table.getItem(index); - m_text.setText(item.getText()); - m_text.setImage(item.getImage()); - m_table.select(index); - } - } - - //////////////////////////////////////////////////////////////////////////// - // - // Access: text and image - // - //////////////////////////////////////////////////////////////////////////// - /** - * Selects item with given text. - */ - public void setText(String text) { - // try to find item with given text - TableItem[] items = m_table.getItems(); - for (int index = 0; index < items.length; index++) { - TableItem item = items[index]; - if (item.getText().equals(text)) { - select(index); - return; - } - } - // not found, remove selection - select(-1); - } - - //////////////////////////////////////////////////////////////////////////// - // - // Resize support - // TODO: computeSize - // - //////////////////////////////////////////////////////////////////////////// - protected void doResize() { - Rectangle clientArea = getClientArea(); - int areaWidth = clientArea.width; - int areaHeight = clientArea.height; - // compute sizes of controls - Point buttonSize = m_arrow.computeSize(areaHeight, areaHeight); - Point textSize = m_text.computeSize(areaWidth - buttonSize.x, areaHeight); - // set controls location/size - m_arrow.setLocation(areaWidth - buttonSize.x, 0); - m_arrow.setSize(buttonSize); - m_text.setSize(areaWidth - buttonSize.x, Math.max(textSize.y, areaHeight)); - } -} diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/property/editor/AbstractComboBoxPropertyEditor.java b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/property/editor/AbstractComboBoxPropertyEditor.java index 13101b51a..f6d7d95ac 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/property/editor/AbstractComboBoxPropertyEditor.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/property/editor/AbstractComboBoxPropertyEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2024 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -12,7 +12,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.property.editor; -import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.core.controls.CComboBox; import org.eclipse.wb.internal.core.model.property.Property; import org.eclipse.wb.internal.core.model.property.table.PropertyTable; @@ -143,7 +142,7 @@ public void keyDown(PropertyTable propertyTable, Property property, KeyEvent eve protected abstract void addItems(Property property, CComboBox combo) throws Exception; /** - * Selects current item in given {@link CCombo3}. + * Selects current item in given {@link CComboBox}. */ protected void selectItem(Property property, CComboBox combo) throws Exception { } diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/property/editor/AbstractComboPropertyEditor.java b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/property/editor/AbstractComboPropertyEditor.java index 2711cd02a..4887efbfc 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/property/editor/AbstractComboPropertyEditor.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/property/editor/AbstractComboPropertyEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2024 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -12,12 +12,12 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.property.editor; -import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.internal.core.model.property.Property; import org.eclipse.wb.internal.core.model.property.table.PropertyTable; import org.eclipse.draw2d.geometry.Point; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CCombo; import org.eclipse.swt.events.FocusAdapter; import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.MouseAdapter; @@ -29,7 +29,7 @@ import org.eclipse.swt.widgets.Listener; /** - * The {@link PropertyEditor} for selecting single value using {@link CCombo3}. + * The {@link PropertyEditor} for selecting single value using {@link CCombo}. * * @author scheglov_ke * @coverage core.model.property.editor @@ -40,7 +40,7 @@ public abstract class AbstractComboPropertyEditor extends TextDisplayPropertyEdi // Editing // //////////////////////////////////////////////////////////////////////////// - private CCombo3 m_combo; + private CCombo m_combo; private boolean m_doDropDown; @Override @@ -48,7 +48,7 @@ public boolean activate(final PropertyTable propertyTable, final Property proper throws Exception { // create combo { - m_combo = new CCombo3(propertyTable.getControl(), SWT.NONE); + m_combo = new CCombo(propertyTable.getControl(), SWT.READ_ONLY); m_doDropDown = true; // add items addItems(property, m_combo); @@ -85,7 +85,7 @@ public void handleEvent(Event event) { propertyTable.handleException(e); propertyTable.deactivateEditor(false); } - m_combo.doDropDown(false); + m_combo.setListVisible(false); break; } } @@ -108,8 +108,7 @@ public final void setBounds(Rectangle bounds) { if (m_doDropDown) { m_doDropDown = false; m_combo.setFocus(); - m_combo.doDropDown(true); - m_combo.startDrag(); + m_combo.setListVisible(true); } } @@ -127,19 +126,19 @@ public final void deactivate(PropertyTable propertyTable, Property property, boo // //////////////////////////////////////////////////////////////////////////// /** - * Adds items to given {@link CCombo3}. + * Adds items to given {@link CCombo}. */ - protected abstract void addItems(Property property, CCombo3 combo) throws Exception; + protected abstract void addItems(Property property, CCombo combo) throws Exception; /** - * Selects current item in given {@link CCombo3}. + * Selects current item in given {@link CCombo}. */ - protected abstract void selectItem(Property property, CCombo3 combo) throws Exception; + protected abstract void selectItem(Property property, CCombo combo) throws Exception; /** * Transfers data from widget to {@link Property}. */ - protected abstract void toPropertyEx(Property property, CCombo3 combo, int index) + protected abstract void toPropertyEx(Property property, CCombo combo, int index) throws Exception; /** diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/property/editor/StringComboPropertyEditor.java b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/property/editor/StringComboPropertyEditor.java index 254d7519b..3e97167ce 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/property/editor/StringComboPropertyEditor.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/property/editor/StringComboPropertyEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -12,9 +12,10 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.property.editor; -import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.internal.core.model.property.Property; +import org.eclipse.swt.custom.CCombo; + /** * The {@link PropertyEditor} for selecting single {@link String} value from given array. * @@ -49,19 +50,19 @@ protected String getText(Property property) throws Exception { // //////////////////////////////////////////////////////////////////////////// @Override - protected void addItems(Property property, CCombo3 combo) throws Exception { + protected void addItems(Property property, CCombo combo) throws Exception { for (String item : m_items) { combo.add(item); } } @Override - protected void selectItem(Property property, CCombo3 combo) throws Exception { + protected void selectItem(Property property, CCombo combo) throws Exception { combo.setText(getText(property)); } @Override - protected void toPropertyEx(Property property, CCombo3 combo, int index) throws Exception { + protected void toPropertyEx(Property property, CCombo combo, int index) throws Exception { property.setValue(m_items[index]); } } \ No newline at end of file diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/property/CursorPropertyEditor.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/property/CursorPropertyEditor.java index 2a1a7aee9..abcfb8ea8 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/property/CursorPropertyEditor.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/property/CursorPropertyEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2024 Google, Inc. and others. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -12,7 +12,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.rcp.model.property; -import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.internal.core.model.clipboard.IClipboardSourceProvider; import org.eclipse.wb.internal.core.model.property.GenericProperty; import org.eclipse.wb.internal.core.model.property.Property; @@ -25,6 +24,7 @@ import org.eclipse.jdt.core.dom.Expression; import org.eclipse.jdt.core.dom.QualifiedName; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CCombo; import org.eclipse.swt.graphics.Cursor; import java.lang.reflect.Field; @@ -119,19 +119,19 @@ public String getClipboardSource(GenericProperty property) throws Exception { // //////////////////////////////////////////////////////////////////////////// @Override - protected void addItems(Property property, CCombo3 combo) throws Exception { + protected void addItems(Property property, CCombo combo) throws Exception { for (Field cursorField : getCursorFields()) { combo.add(cursorField.getName()); } } @Override - protected void selectItem(Property property, CCombo3 combo) throws Exception { + protected void selectItem(Property property, CCombo combo) throws Exception { combo.setText(getText(property)); } @Override - protected void toPropertyEx(Property property, CCombo3 combo, int index) throws Exception { + protected void toPropertyEx(Property property, CCombo combo, int index) throws Exception { if (property instanceof GenericProperty genericProperty) { ManagerUtils.ensure_SWTResourceManager(genericProperty.getJavaInfo()); // prepare source diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/spring/SpringAttachmentInfo.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/spring/SpringAttachmentInfo.java index 7aa9326ea..2cc39b08a 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/spring/SpringAttachmentInfo.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/spring/SpringAttachmentInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2024 Google, Inc. and others. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -12,7 +12,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.swing.model.layout.spring; -import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.internal.core.gef.policy.snapping.PlacementUtils; import org.eclipse.wb.internal.core.model.JavaInfoEvaluationHelper; import org.eclipse.wb.internal.core.model.JavaInfoUtils; @@ -35,6 +34,7 @@ import org.eclipse.jdt.core.dom.Expression; import org.eclipse.jdt.core.dom.MethodInvocation; import org.eclipse.jdt.core.dom.Statement; +import org.eclipse.swt.custom.CCombo; import org.apache.commons.lang3.StringUtils; @@ -579,7 +579,7 @@ protected String getText(Property property) throws Exception { // //////////////////////////////////////////////////////////////////////////// @Override - protected void addItems(Property property, CCombo3 combo) throws Exception { + protected void addItems(Property property, CCombo combo) throws Exception { m_components.clear(); // parent { @@ -598,12 +598,12 @@ protected void addItems(Property property, CCombo3 combo) throws Exception { } @Override - protected void selectItem(Property property, CCombo3 combo) throws Exception { + protected void selectItem(Property property, CCombo combo) throws Exception { combo.setText(getText(property)); } @Override - protected void toPropertyEx(Property property, CCombo3 combo, int index) throws Exception { + protected void toPropertyEx(Property property, CCombo combo, int index) throws Exception { ComponentInfo component = m_components.get(index); property.setValue(component); } diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/property/editor/beans/ComboPropertyEditor.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/property/editor/beans/ComboPropertyEditor.java index fc4c68110..aa76aa7ae 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/property/editor/beans/ComboPropertyEditor.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/property/editor/beans/ComboPropertyEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2024 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -12,7 +12,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.swing.model.property.editor.beans; -import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.internal.core.model.property.Property; import org.eclipse.wb.internal.core.model.property.editor.AbstractComboPropertyEditor; import org.eclipse.wb.internal.core.model.property.editor.IValueSourcePropertyEditor; @@ -20,6 +19,7 @@ import org.eclipse.wb.internal.core.model.property.editor.presentation.PropertyEditorPresentation; import org.eclipse.draw2d.Graphics; +import org.eclipse.swt.custom.CCombo; /** * The {@link PropertyEditor} wrapper for tag's based AWT {@link java.beans.PropertyEditor}. @@ -47,19 +47,19 @@ public ComboPropertyEditor(PropertyEditorWrapper editorWrapper) { // //////////////////////////////////////////////////////////////////////////// @Override - protected void addItems(Property property, CCombo3 combo) throws Exception { + protected void addItems(Property property, CCombo combo) throws Exception { for (String item : getTags(property)) { combo.add(item); } } @Override - protected void selectItem(Property property, CCombo3 combo) throws Exception { + protected void selectItem(Property property, CCombo combo) throws Exception { combo.setText(getText(property)); } @Override - protected void toPropertyEx(Property property, CCombo3 combo, int index) throws Exception { + protected void toPropertyEx(Property property, CCombo combo, int index) throws Exception { String[] items = getTags(property); m_editorWrapper.setText(property, items[index]); } diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/property/editor/cursor/CursorPropertyEditor.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/property/editor/cursor/CursorPropertyEditor.java index 161d82451..90db336ef 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/property/editor/cursor/CursorPropertyEditor.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/property/editor/cursor/CursorPropertyEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -12,12 +12,13 @@ *******************************************************************************/ package org.eclipse.wb.internal.swing.model.property.editor.cursor; -import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.internal.core.model.property.GenericProperty; import org.eclipse.wb.internal.core.model.property.Property; import org.eclipse.wb.internal.core.model.property.editor.AbstractComboPropertyEditor; import org.eclipse.wb.internal.core.model.property.editor.PropertyEditor; +import org.eclipse.swt.custom.CCombo; + import java.awt.Cursor; import java.lang.reflect.Field; import java.lang.reflect.Modifier; @@ -67,19 +68,19 @@ protected String getText(Property property) throws Exception { // //////////////////////////////////////////////////////////////////////////// @Override - protected void addItems(Property property, CCombo3 combo) throws Exception { + protected void addItems(Property property, CCombo combo) throws Exception { for (Field cursorField : getCursorFields()) { combo.add(cursorField.getName()); } } @Override - protected void selectItem(Property property, CCombo3 combo) throws Exception { + protected void selectItem(Property property, CCombo combo) throws Exception { combo.setText(getText(property)); } @Override - protected void toPropertyEx(Property property, CCombo3 combo, int index) throws Exception { + protected void toPropertyEx(Property property, CCombo combo, int index) throws Exception { if (property instanceof GenericProperty genericProperty) { // prepare source String source; diff --git a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/layout/form/ControlSelectionPropertyEditor.java b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/layout/form/ControlSelectionPropertyEditor.java index 0908186cd..877ce818a 100644 --- a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/layout/form/ControlSelectionPropertyEditor.java +++ b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/layout/form/ControlSelectionPropertyEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -12,7 +12,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.swt.model.layout.form; -import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.internal.core.model.property.GenericProperty; import org.eclipse.wb.internal.core.model.property.GenericPropertyImpl; @@ -21,6 +20,8 @@ import org.eclipse.wb.internal.swt.model.widgets.CompositeInfo; import org.eclipse.wb.internal.swt.model.widgets.ControlInfo; +import org.eclipse.swt.custom.CCombo; + import java.util.ArrayList; import java.util.List; @@ -35,7 +36,7 @@ public final class ControlSelectionPropertyEditor extends AbstractComboPropertyE private final List m_controls = new ArrayList<>(); @Override - protected void addItems(Property property, CCombo3 combo) throws Exception { + protected void addItems(Property property, CCombo combo) throws Exception { FormAttachmentInfo formAttachment = getAttachment(property); ControlInfo thisControl = (ControlInfo) formAttachment.getParent().getParent(); CompositeInfo compositeInfo = (CompositeInfo) thisControl.getParent(); @@ -49,12 +50,12 @@ protected void addItems(Property property, CCombo3 combo) throws Exception { } @Override - protected void selectItem(Property property, CCombo3 combo) throws Exception { + protected void selectItem(Property property, CCombo combo) throws Exception { combo.setText(getText(property)); } @Override - protected void toPropertyEx(Property property, CCombo3 combo, int index) throws Exception { + protected void toPropertyEx(Property property, CCombo combo, int index) throws Exception { ControlInfo controlInfo = m_controls.get(index); // set expression would further be caught in FormAttachment ((GenericPropertyImpl) property).setExpression("", controlInfo); diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/parser/AbstractJavaInfoRelatedTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/parser/AbstractJavaInfoRelatedTest.java index b7c15b8c5..7adecaa86 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/parser/AbstractJavaInfoRelatedTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/parser/AbstractJavaInfoRelatedTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2024 Google, Inc. and others. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -12,7 +12,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.model.parser; -import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.internal.core.model.JavaInfoUtils; @@ -58,6 +57,7 @@ import org.eclipse.jdt.core.dom.Statement; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CCombo; import org.eclipse.swt.widgets.Shell; import org.apache.commons.lang3.ArrayUtils; @@ -473,12 +473,12 @@ protected static void openPropertyDialog(Property property) throws Exception { // //////////////////////////////////////////////////////////////////////////// private static Shell TEST_COMBO_SHELL; - private static CCombo3 TEST_COMBO; + private static CCombo TEST_COMBO; @BeforeClass public static void setUpAll() { TEST_COMBO_SHELL = new Shell(); - TEST_COMBO = new CCombo3(TEST_COMBO_SHELL, SWT.NONE); + TEST_COMBO = new CCombo(TEST_COMBO_SHELL, SWT.NONE); } @AfterClass @@ -494,7 +494,7 @@ protected static void addComboPropertyItems(Property property) { String signature = "addItems(" + "org.eclipse.wb.internal.core.model.property.Property," - + "org.eclipse.wb.core.controls.CCombo3)"; + + "org.eclipse.swt.custom.CCombo)"; TEST_COMBO.removeAll(); ReflectionUtils.invokeMethodEx(propertyEditor, signature, property, TEST_COMBO); } @@ -535,7 +535,7 @@ protected static void setComboPropertySelection(Property property) { String signature = "selectItem(" + "org.eclipse.wb.internal.core.model.property.Property," - + "org.eclipse.wb.core.controls.CCombo3)"; + + "org.eclipse.swt.custom.CCombo)"; ReflectionUtils.invokeMethodEx(propertyEditor, signature, property, TEST_COMBO); } @@ -547,7 +547,7 @@ protected static void setComboPropertyValue(Property property, int index) { String signature = "toPropertyEx(" + "org.eclipse.wb.internal.core.model.property.Property," - + "org.eclipse.wb.core.controls.CCombo3," + + "org.eclipse.swt.custom.CCombo," + "int)"; ReflectionUtils.invokeMethodEx(propertyEditor, signature, property, TEST_COMBO, index); } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/property/CursorPropertyEditorWithManagerTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/property/CursorPropertyEditorWithManagerTest.java index be3d72ef7..3a832ff4c 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/property/CursorPropertyEditorWithManagerTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/property/CursorPropertyEditorWithManagerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2023 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -161,7 +161,7 @@ public void test_setValue_ensureManager() throws Exception { // set cursor ReflectionUtils.invokeMethod(propertyEditor, "toPropertyEx(" + "org.eclipse.wb.internal.core.model.property.Property," - + "org.eclipse.wb.core.controls.CCombo3," + + "org.eclipse.swt.custom.CCombo," + "int)", property, null, 0); assertEditor( "// filler filler filler",