Skip to content

Commit

Permalink
7441: JVM System information tables do not scroll horizontally
Browse files Browse the repository at this point in the history
Reviewed-by: hirt
  • Loading branch information
aptmac committed Jul 14, 2023
1 parent 9f430af commit eceb279
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -75,8 +75,7 @@ public SystemPropertiesSectionPart(Composite parent, FormToolkit toolkit, ISubsc
Composite body = createSectionBody(MCLayoutFactory.createMarginFreeFormPageLayout());
Composite filterComposite = toolkit.createComposite(body);
filterComposite.setLayoutData(MCLayoutFactory.createFormPageLayoutData(SWT.DEFAULT, SWT.DEFAULT, true, false));
Table table = toolkit.createTable(body,
SWT.FULL_SELECTION | SWT.MULTI | SWT.VIRTUAL | SWT.H_SCROLL | SWT.V_SCROLL);
Table table = toolkit.createTable(body, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
table.setLayoutData(MCLayoutFactory.createFormPageLayoutData());
TableViewer viewer = new TableViewer(table);
viewer.setContentProvider(new TreeStructureContentProvider());
Expand Down Expand Up @@ -122,6 +121,7 @@ private void setInputAndSort(final MRIValueEvent event) {
Object v = event.getValue();
if (v instanceof TabularData) {
columnManager.getViewer().setInput(((TabularData) v).values());
columnManager.packColumns();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -65,8 +65,7 @@ public TableInformationSectionPart(Composite parent, FormToolkit toolkit, IConne
super(parent, toolkit, Messages.SECTION_SERVER_INFORMATION_TITLE);

Composite body = createSectionBody(MCLayoutFactory.createMarginFreeFormPageLayout());
Table table = toolkit.createTable(body,
SWT.FULL_SELECTION | SWT.MULTI | SWT.VIRTUAL | SWT.H_SCROLL | SWT.V_SCROLL);
Table table = toolkit.createTable(body, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
table.setLayoutData(MCLayoutFactory.createFormPageLayoutData());
TableViewer viewer = new TableViewer(table);
viewer.setContentProvider(new TreeStructureContentProvider());
Expand All @@ -81,6 +80,7 @@ public TableInformationSectionPart(Composite parent, FormToolkit toolkit, IConne
ColumnMenusFactory.addDefaultMenus(columnManager, MCContextMenuManager.create(table));

viewer.setInput(ServerInformationModelBuilder.build(connection));
columnManager.packColumns();
}

public void saveState(IMemento state) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -65,6 +65,7 @@
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.Widget;

Expand Down Expand Up @@ -600,4 +601,9 @@ public void setSelectionState(SelectionState state) {
table.setTopIndex(state.getScrollIndex());
}

public void packColumns() {
for (TableColumn column : ((Table) getViewer().getControl()).getColumns()) {
column.pack();
}
}
}

0 comments on commit eceb279

Please sign in to comment.