Skip to content

Restrict preferences page height #251

@laurentmuller

Description

@laurentmuller

Expected Behavior

The Command Preferences Page layout must be updated to set the height of, for example, 20 commands.

Actual Behavior

When open the Command Preferences Page, the dialog is resized to display all the commands.

Steps to Reproduce the Problem

Select the menu Window | Preferences....
Select the entry EasyShell | (2) Command.
The Preferences Dialog is resized to show all commands.

Environment

  • Plugin version: 2.3.0
  • Eclipse Version: 2021-12
  • Java Version: 11
  • Operating System Version: Windows 11

Resolution

This is only a matter of update the viewer layout in the CommandPage class. When creating the table viewer in function createTableViewer, set the gridData.heightHint as follow:

private void createTableViewer(Composite parent) {
    ...
    GridData gridData = new GridData();
    gridData.heightHint = table.getItemHeight() * 20;
    ...
}

You can also simplify the creation of the layout with the following code:

private void createTableViewer(Composite parent) {
    ...
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.heightHint = table.getItemHeight() * 20;
    gridData.horizontalSpan = 2;
    table.setLayoutData(gridData);
    ...
}

This can be also apply to the MenuPage class.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions