Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
*
Expand Down Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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}.
*
Expand All @@ -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();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -132,29 +130,27 @@ public void addSelectionActions(List<ObjectInfo> objects, List<Object> 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(
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand All @@ -1147,7 +1144,6 @@ public void test_contextMenu_verticalBaselineAbove() throws Exception {
"NONE");
}

@Disabled
@Test
public void test_contextMenu_verticalBaselineBelow() throws Exception {
check_contextMenu_alignmentVertical(
Expand Down
Loading