diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/layout/gbl/header/edit/RowHeaderEditPart.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/layout/gbl/header/edit/RowHeaderEditPart.java index 843c99430..8eb433689 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/layout/gbl/header/edit/RowHeaderEditPart.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/layout/gbl/header/edit/RowHeaderEditPart.java @@ -39,8 +39,6 @@ import org.eclipse.jface.action.Separator; import org.eclipse.swt.graphics.Image; -import org.apache.commons.lang3.SystemUtils; - /** * {@link EditPart} for {@link RowInfo} header of {@link AbstractGridBagLayoutInfo}. * @@ -220,20 +218,18 @@ protected void run(RowInfo row) throws Exception { GefMessages.RowHeaderEditPart_vaFill, CoreImages.ALIGNMENT_V_MENU_FILL, RowInfo.Alignment.FILL)); - if (SystemUtils.IS_JAVA_1_6 || SystemUtils.IS_JAVA_1_7) { - manager.add(new SetAlignmentRowAction(this, - GefMessages.RowHeaderEditPart_vaBaseline, - SwingImages.ALIGNMENT_V_MENU_BASELINE, - RowInfo.Alignment.BASELINE)); - manager.add(new SetAlignmentRowAction(this, - GefMessages.RowHeaderEditPart_vaAboveBaseline, - SwingImages.ALIGNMENT_V_MENU_BASELINE_ABOVE, - RowInfo.Alignment.BASELINE_ABOVE)); - manager.add(new SetAlignmentRowAction(this, - GefMessages.RowHeaderEditPart_vaBelowBaseline, - SwingImages.ALIGNMENT_V_MENU_BASELINE_BELOW, - RowInfo.Alignment.BASELINE_BELOW)); - } + manager.add(new SetAlignmentRowAction(this, + GefMessages.RowHeaderEditPart_vaBaseline, + SwingImages.ALIGNMENT_V_MENU_BASELINE, + RowInfo.Alignment.BASELINE)); + manager.add(new SetAlignmentRowAction(this, + GefMessages.RowHeaderEditPart_vaAboveBaseline, + SwingImages.ALIGNMENT_V_MENU_BASELINE_ABOVE, + RowInfo.Alignment.BASELINE_ABOVE)); + manager.add(new SetAlignmentRowAction(this, + GefMessages.RowHeaderEditPart_vaBelowBaseline, + SwingImages.ALIGNMENT_V_MENU_BASELINE_BELOW, + RowInfo.Alignment.BASELINE_BELOW)); } // grow { diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/gbl/AbstractGridBagConstraintsInfo.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/gbl/AbstractGridBagConstraintsInfo.java index a26a821d8..d8af1a8f8 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/gbl/AbstractGridBagConstraintsInfo.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/gbl/AbstractGridBagConstraintsInfo.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 @@ -47,7 +47,6 @@ import org.eclipse.jface.action.Separator; import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.SystemUtils; import java.awt.GridBagConstraints; import java.util.List; @@ -622,20 +621,18 @@ public void fillVerticalAlignmentMenu(IMenuManager manager) { ModelMessages.AbstractGridBagConstraintsInfo_vaFill, CoreImages.ALIGNMENT_V_MENU_FILL, RowInfo.Alignment.FILL)); - if (SystemUtils.IS_JAVA_1_6 || SystemUtils.IS_JAVA_1_7) { - manager.add(new SetAlignmentVerticalAction(this, - ModelMessages.AbstractGridBagConstraintsInfo_vaBaseline, - SwingImages.ALIGNMENT_V_MENU_BASELINE, - RowInfo.Alignment.BASELINE)); - manager.add(new SetAlignmentVerticalAction(this, - ModelMessages.AbstractGridBagConstraintsInfo_vaAboveBaseline, - SwingImages.ALIGNMENT_V_MENU_BASELINE_ABOVE, - RowInfo.Alignment.BASELINE_ABOVE)); - manager.add(new SetAlignmentVerticalAction(this, - ModelMessages.AbstractGridBagConstraintsInfo_vaBelowBaseline, - SwingImages.ALIGNMENT_V_MENU_BASELINE_BELOW, - RowInfo.Alignment.BASELINE_BELOW)); - } + manager.add(new SetAlignmentVerticalAction(this, + ModelMessages.AbstractGridBagConstraintsInfo_vaBaseline, + SwingImages.ALIGNMENT_V_MENU_BASELINE, + RowInfo.Alignment.BASELINE)); + manager.add(new SetAlignmentVerticalAction(this, + ModelMessages.AbstractGridBagConstraintsInfo_vaAboveBaseline, + SwingImages.ALIGNMENT_V_MENU_BASELINE_ABOVE, + RowInfo.Alignment.BASELINE_ABOVE)); + manager.add(new SetAlignmentVerticalAction(this, + ModelMessages.AbstractGridBagConstraintsInfo_vaBelowBaseline, + SwingImages.ALIGNMENT_V_MENU_BASELINE_BELOW, + RowInfo.Alignment.BASELINE_BELOW)); manager.add(new Separator()); manager.add(new SetGrowAction(this, ModelMessages.AbstractGridBagConstraintsInfo_vaGrow, diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/gbl/GridBagConstraintsAssistantPage.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/gbl/GridBagConstraintsAssistantPage.java index 3ca5e5255..ebd60b46e 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/gbl/GridBagConstraintsAssistantPage.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/gbl/GridBagConstraintsAssistantPage.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 @@ -22,8 +22,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Group; -import org.apache.commons.lang3.SystemUtils; - /** * Layout assistant for {@link java.awt.GridBagConstraints}. * @@ -42,104 +40,60 @@ public class GridBagConstraintsAssistantPage extends AbstractAssistantPage { public GridBagConstraintsAssistantPage(Composite parent, Object selection) { super(parent, selection); GridLayoutFactory.create(this).columns(3); - // - if (SystemUtils.IS_JAVA_1_6 || SystemUtils.IS_JAVA_1_7) { - // horizontal alignments - { - Group horizontalGroup = createHorizontalAlignmentGroup(); - GridDataFactory.modify(horizontalGroup).fill(); - } - // vertical alignments - { - Group verticalGroup = - addChoiceProperty( - this, - "verticalAlignment", - ModelMessages.GridBagConstraintsAssistantPage_verticalAlignmentGroup, - new Object[][]{ - new Object[]{ - ModelMessages.GridBagConstraintsAssistantPage_vaTop, - RowInfo.Alignment.TOP}, - new Object[]{ - ModelMessages.GridBagConstraintsAssistantPage_vaCenter, - RowInfo.Alignment.CENTER}, - new Object[]{ - ModelMessages.GridBagConstraintsAssistantPage_vaBottom, - RowInfo.Alignment.BOTTOM}, - new Object[]{ - ModelMessages.GridBagConstraintsAssistantPage_vaFill, - RowInfo.Alignment.FILL}, - new Object[]{ - ModelMessages.GridBagConstraintsAssistantPage_vaBaseline, - RowInfo.Alignment.BASELINE}, - new Object[]{ - ModelMessages.GridBagConstraintsAssistantPage_vaAboveBaseline, - RowInfo.Alignment.BASELINE_ABOVE}, - new Object[]{ - ModelMessages.GridBagConstraintsAssistantPage_vaBelowBaseline, - RowInfo.Alignment.BASELINE_BELOW}}); - GridDataFactory.modify(verticalGroup).fillV(); - } - // insets - { - Group insetsGroup = createInsetsGroup(); - GridDataFactory.modify(insetsGroup).fillV(); - } - // weight - { - Group weightGroup = createWeightGroup(); - GridDataFactory.modify(weightGroup).fillV(); - } - // grow - { - createGrowGroup(); - } - // padding - { - Group paddingGroup = createPaddingGroup(); - GridDataFactory.create(paddingGroup).fill(); - } - } else { - // horizontal alignments - { - Group horizontalGroup = createHorizontalAlignmentGroup(); - GridDataFactory.modify(horizontalGroup).fillV(); - } - // vertical alignments - { - Group verticalGroup = - addChoiceProperty( - this, - "verticalAlignment", - ModelMessages.GridBagConstraintsAssistantPage_verticalAlignmentGroup, - new Object[][]{ - new Object[]{ - ModelMessages.GridBagConstraintsAssistantPage_vaTop, - RowInfo.Alignment.TOP}, - new Object[]{ - ModelMessages.GridBagConstraintsAssistantPage_vaCenter, - RowInfo.Alignment.CENTER}, - new Object[]{ - ModelMessages.GridBagConstraintsAssistantPage_vaBottom, - RowInfo.Alignment.BOTTOM}, - new Object[]{ - ModelMessages.GridBagConstraintsAssistantPage_vaFill, - RowInfo.Alignment.FILL}}); - GridDataFactory.modify(verticalGroup).fillV(); - } - // insets - { - createInsetsGroup(); - } - // padding - { - Group paddingGroup = createPaddingGroup(); - GridDataFactory.create(paddingGroup).fill().spanH(2); - } - // grow - { - createGrowGroup(); - } + // horizontal alignments + { + Group horizontalGroup = createHorizontalAlignmentGroup(); + GridDataFactory.modify(horizontalGroup).fill(); + } + // vertical alignments + { + Group verticalGroup = + addChoiceProperty( + this, + "verticalAlignment", + ModelMessages.GridBagConstraintsAssistantPage_verticalAlignmentGroup, + new Object[][]{ + new Object[]{ + ModelMessages.GridBagConstraintsAssistantPage_vaTop, + RowInfo.Alignment.TOP}, + new Object[]{ + ModelMessages.GridBagConstraintsAssistantPage_vaCenter, + RowInfo.Alignment.CENTER}, + new Object[]{ + ModelMessages.GridBagConstraintsAssistantPage_vaBottom, + RowInfo.Alignment.BOTTOM}, + new Object[]{ + ModelMessages.GridBagConstraintsAssistantPage_vaFill, + RowInfo.Alignment.FILL}, + new Object[]{ + ModelMessages.GridBagConstraintsAssistantPage_vaBaseline, + RowInfo.Alignment.BASELINE}, + new Object[]{ + ModelMessages.GridBagConstraintsAssistantPage_vaAboveBaseline, + RowInfo.Alignment.BASELINE_ABOVE}, + new Object[]{ + ModelMessages.GridBagConstraintsAssistantPage_vaBelowBaseline, + RowInfo.Alignment.BASELINE_BELOW}}); + GridDataFactory.modify(verticalGroup).fillV(); + } + // insets + { + Group insetsGroup = createInsetsGroup(); + GridDataFactory.modify(insetsGroup).fillV(); + } + // weight + { + Group weightGroup = createWeightGroup(); + GridDataFactory.modify(weightGroup).fillV(); + } + // grow + { + createGrowGroup(); + } + // padding + { + Group paddingGroup = createPaddingGroup(); + GridDataFactory.create(paddingGroup).fill(); } } diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/gbl/actions/SelectionActionsSupport.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/gbl/actions/SelectionActionsSupport.java index f70448294..7eb640447 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/gbl/actions/SelectionActionsSupport.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/gbl/actions/SelectionActionsSupport.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 @@ -27,8 +27,6 @@ import org.eclipse.jface.action.Separator; import org.eclipse.jface.resource.ImageDescriptor; -import org.apache.commons.lang3.SystemUtils; - import java.util.ArrayList; import java.util.List; @@ -132,29 +130,27 @@ public void addSelectionActions(List objects, List actions) CoreImages.ALIGNMENT_V_MENU_FILL, ModelMessages.SelectionActionsSupport_vaFill, RowInfo.Alignment.FILL); - if (SystemUtils.IS_JAVA_1_6 || SystemUtils.IS_JAVA_1_7) { - addAlignmentAction( - actions, - constraints, - false, - SwingImages.ALIGNMENT_V_MENU_BASELINE, - ModelMessages.SelectionActionsSupport_vaBaseline, - RowInfo.Alignment.BASELINE); - addAlignmentAction( - actions, - constraints, - false, - SwingImages.ALIGNMENT_V_MENU_BASELINE_ABOVE, - ModelMessages.SelectionActionsSupport_vaAboveBaseline, - RowInfo.Alignment.BASELINE_ABOVE); - addAlignmentAction( - actions, - constraints, - false, - SwingImages.ALIGNMENT_V_MENU_BASELINE_BELOW, - ModelMessages.SelectionActionsSupport_vaBelowBaseline, - RowInfo.Alignment.BASELINE_BELOW); - } + addAlignmentAction( + actions, + constraints, + false, + SwingImages.ALIGNMENT_V_MENU_BASELINE, + ModelMessages.SelectionActionsSupport_vaBaseline, + RowInfo.Alignment.BASELINE); + addAlignmentAction( + actions, + constraints, + false, + SwingImages.ALIGNMENT_V_MENU_BASELINE_ABOVE, + ModelMessages.SelectionActionsSupport_vaAboveBaseline, + RowInfo.Alignment.BASELINE_ABOVE); + addAlignmentAction( + actions, + constraints, + false, + SwingImages.ALIGNMENT_V_MENU_BASELINE_BELOW, + ModelMessages.SelectionActionsSupport_vaBelowBaseline, + RowInfo.Alignment.BASELINE_BELOW); // create grow actions actions.add(new Separator()); addGrowAction( diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/gbl/GridBagConstraintsTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/gbl/GridBagConstraintsTest.java index 093720b27..abe06ff46 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/gbl/GridBagConstraintsTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/gbl/GridBagConstraintsTest.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 @@ -47,7 +47,6 @@ import org.eclipse.jface.action.MenuManager; import org.apache.commons.lang3.StringUtils; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import java.awt.GridBagConstraints; @@ -1131,13 +1130,11 @@ public void test_contextMenu_verticalFill() throws Exception { check_contextMenu_alignmentVertical("&Fill", RowInfo.Alignment.FILL, "CENTER", "VERTICAL"); } - @Disabled @Test public void test_contextMenu_verticalBaseline() throws Exception { check_contextMenu_alignmentVertical("Baseline", RowInfo.Alignment.BASELINE, "BASELINE", "NONE"); } - @Disabled @Test public void test_contextMenu_verticalBaselineAbove() throws Exception { check_contextMenu_alignmentVertical( @@ -1147,7 +1144,6 @@ public void test_contextMenu_verticalBaselineAbove() throws Exception { "NONE"); } - @Disabled @Test public void test_contextMenu_verticalBaselineBelow() throws Exception { check_contextMenu_alignmentVertical(