From 59613f546d9e41f01898985257ed953bb37e166a Mon Sep 17 00:00:00 2001 From: Patrick Ziegler Date: Wed, 14 Jan 2026 06:43:13 +0100 Subject: [PATCH] Replace CCombo3 with native SWT CCombo #1092 Both widgets behave effectively the same so there is no need for out custom implementation when the functionality is already provided. Due to 5064677, 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 #1090 --- .../editor/AbstractEnumPropertyEditor.java | 11 ++++---- .../editor/AbstractListPropertyEditor.java | 13 +++++----- .../ConstantSelectionPropertyEditor.java | 10 ++++---- .../EnumerationValuesPropertyEditor.java | 11 ++++---- .../editor/StaticFieldPropertyEditor.java | 11 ++++---- .../editor/StringListPropertyEditor.java | 7 +++--- .../org/eclipse/wb/core/controls/CCombo3.java | 22 +++++++++++++++- .../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 ++++---- org.eclipse.wb.swt/META-INF/MANIFEST.MF | 2 +- .../form/ControlSelectionPropertyEditor.java | 11 ++++---- .../parser/AbstractJavaInfoRelatedTest.java | 14 +++++------ .../CursorPropertyEditorWithManagerTest.java | 4 +-- 17 files changed, 110 insertions(+), 83 deletions(-) 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..24a35302b 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, 2026 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..1abb87443 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, 2026 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..19b7136a0 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, 2026 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..40bef54c7 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2025 Google, Inc. and others. + * Copyright (c) 2011, 2026 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.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..72eefeda8 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2025 Google, Inc. and others. + * Copyright (c) 2011, 2026 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.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..d6c4ff1ac 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, 2026 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 index b636cd87a..e527ed0a2 100644 --- 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2025 Google, Inc. and others. + * Copyright (c) 2011, 2026 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 @@ -27,6 +27,7 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Spinner; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TableItem; @@ -40,7 +41,10 @@ * * @author scheglov_ke * @coverage core.control + * @deprecated Use the native SWT {@link Spinner} instead. This class will be + * removed after the 2028-03 release. */ +@Deprecated(since = "2026-03", forRemoval = true) public class CCombo3 extends Composite { private final long m_createTime = System.currentTimeMillis(); private final Text m_text; @@ -54,6 +58,7 @@ public class CCombo3 extends Composite { // Constructor // //////////////////////////////////////////////////////////////////////////// + @Deprecated public CCombo3(Composite parent, int style) { super(parent, style); addEvents(this, m_comboListener, new int[]{SWT.Dispose, SWT.Move, SWT.Resize}); @@ -303,6 +308,7 @@ private void addEvents(Widget widget, Listener listener, int[] events) { /** * Adds the listener to receive events. */ + @Deprecated public void addSelectionListener(SelectionListener listener) { checkWidget(); if (listener == null) { @@ -319,6 +325,7 @@ public void addSelectionListener(SelectionListener listener) { /** * Sets drop state of combo. */ + @Deprecated public void doDropDown(boolean drop) { // check, may be we already in this drop state if (drop == isDropped()) { @@ -375,6 +382,7 @@ public void doDropDown(boolean drop) { /** * Initiates "press-hold-drag" sequence. */ + @Deprecated public void startDrag() { m_text.setCapture(true); } @@ -384,18 +392,22 @@ public void startDrag() { // Access // //////////////////////////////////////////////////////////////////////////// + @Deprecated public void setFullDropdownTableWidth(boolean freeTableSize) { m_fullDropdownTableSize = freeTableSize; } + @Deprecated public boolean isFullDropdownTableWidth() { return m_fullDropdownTableSize; } + @Deprecated public boolean isDropped() { return m_popup.isVisible(); } + @Deprecated public void setQuickSearch(boolean value) { // TODO } @@ -408,6 +420,7 @@ public void setQuickSearch(boolean value) { /** * Removes all items. */ + @Deprecated public void removeAll() { TableItem[] items = m_table.getItems(); for (int index = 0; index < items.length; index++) { @@ -419,6 +432,7 @@ public void removeAll() { /** * Adds new item with given text. */ + @Deprecated public void add(String text) { checkWidget(); TableItem item = new TableItem(m_table, SWT.NONE); @@ -428,6 +442,7 @@ public void add(String text) { /** * @return an item at given index */ + @Deprecated public String getItem(int index) { checkWidget(); return m_table.getItem(index).getText(); @@ -436,6 +451,7 @@ public String getItem(int index) { /** * @return the number of items */ + @Deprecated public int getItemCount() { checkWidget(); return m_table.getItemCount(); @@ -444,6 +460,7 @@ public int getItemCount() { /** * @return the index of the selected item */ + @Deprecated public int getSelectionIndex() { checkWidget(); return m_table.getSelectionIndex(); @@ -452,6 +469,7 @@ public int getSelectionIndex() { /** * Selects an item with given index. */ + @Deprecated public void select(int index) { checkWidget(); if (index == -1) { @@ -473,6 +491,7 @@ public void select(int index) { /** * Selects item with given text. */ + @Deprecated public void setText(String text) { // try to find item with given text TableItem[] items = m_table.getItems(); @@ -493,6 +512,7 @@ public void setText(String text) { // TODO: computeSize // //////////////////////////////////////////////////////////////////////////// + @Deprecated protected void doResize() { Rectangle clientArea = getClientArea(); int areaWidth = clientArea.width; 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..bd7a56cb1 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, 2026 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.NONE); 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..285997f1e 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, 2026 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..e165f7b51 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, 2026 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..3b7a2e1e8 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, 2026 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..3691247f0 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, 2026 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..68f36898f 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, 2026 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/META-INF/MANIFEST.MF b/org.eclipse.wb.swt/META-INF/MANIFEST.MF index 94eb1d071..0c58cde46 100644 --- a/org.eclipse.wb.swt/META-INF/MANIFEST.MF +++ b/org.eclipse.wb.swt/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.wb.swt;singleton:=true -Bundle-Version: 1.10.300.qualifier +Bundle-Version: 1.11.0.qualifier Bundle-ClassPath: . Bundle-Activator: org.eclipse.wb.internal.swt.Activator Bundle-Vendor: %providerName 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..64088b9c0 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, 2026 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 5c1d98aa1..8d27dea1c 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, 2026 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; @BeforeAll public static void setUpAll() throws Exception { TEST_COMBO_SHELL = new Shell(); - TEST_COMBO = new CCombo3(TEST_COMBO_SHELL, SWT.NONE); + TEST_COMBO = new CCombo(TEST_COMBO_SHELL, SWT.NONE); } @AfterAll @@ -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 e3ba87236..33e44ce84 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, 2026 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",