GP-6034 - Version Tracking - Fixed Function Comparison view not being

resizable
This commit is contained in:
dragonmacher
2025-09-30 16:11:56 -04:00
parent fc3debd7f7
commit 3b14dcf58b
6 changed files with 28 additions and 70 deletions

View File

@@ -97,6 +97,14 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
help.registerHelp(this, new HelpLocation(HELP_TOPIC, "Function Comparison"));
}
@Override
public Dimension getMinimumSize() {
// If we don't specify a minimum size, the some layouts will use the preferred size when
// calculating the minimum size. When this happens while this panel is inside of a split
// pane, the split pane can become un-resizable. By specify a value here, we prevent this.
return new Dimension(50, 50);
}
private void comparisonStateUpdated() {
readPanelState();
readViewState();

View File

@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,7 +15,8 @@
*/
package ghidra.feature.vt.gui.provider.impliedmatches;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
@@ -299,15 +300,8 @@ public class VTImpliedMatchesTableProvider extends ComponentProviderAdapter
TableColumn statusColumn = columnModel.getColumn(statusColumnIndex);
statusColumn.setCellRenderer(new MatchStatusRenderer());
// override the default behavior so we see our columns in their preferred size
Dimension size = impliedMatchesTable.getPreferredScrollableViewportSize();
Dimension preferredSize = impliedMatchesTable.getPreferredSize();
// ...account for the scroll bar width
JScrollBar scrollBar = new JScrollBar(Adjustable.VERTICAL);
Dimension scrollBarSize = scrollBar.getMinimumSize();
size.width = preferredSize.width + scrollBarSize.width;
impliedMatchesTable.setPreferredScrollableViewportSize(size);
// a reasonable starting size picked by trial-and-error
impliedMatchesTable.setPreferredScrollableViewportSize(new Dimension(1100, 600));
return impliedMatchTablePanel;
}

View File

@@ -320,16 +320,8 @@ public class VTMarkupItemsTableProvider extends ComponentProviderAdapter
TableColumn column = columnModel.getColumn(columnIndex);
column.setCellEditor(new AddressInputDialog(controller));
// override the default behavior so we see our columns in their preferred size
Dimension size = table.getPreferredScrollableViewportSize();
Dimension preferredSize = table.getPreferredSize();
// ...account for the scroll bar width
JScrollBar scrollBar = new JScrollBar(Adjustable.VERTICAL);
scrollBar.getAccessibleContext().setAccessibleName("Markup Item Table");
Dimension scrollBarSize = scrollBar.getMinimumSize();
size.width = preferredSize.width + scrollBarSize.width;
table.setPreferredScrollableViewportSize(size);
// a reasonable starting size picked by trial-and-error
table.setPreferredScrollableViewportSize(new Dimension(1100, 600));
table.getAccessibleContext().setAccessibleName("Markup Item");
return table;
}

View File

@@ -373,15 +373,9 @@ public class VTMatchTableProvider extends ComponentProviderAdapter
TableColumn statusColumn = columnModel.getColumn(statusColumnIndex);
statusColumn.setCellRenderer(new MatchStatusRenderer());
// override the default behavior so we see our columns in their preferred size
Dimension size = table.getPreferredScrollableViewportSize();
Dimension preferredSize = table.getPreferredSize();
// a reasonable starting size picked by trial-and-error
table.setPreferredScrollableViewportSize(new Dimension(1100, 600));
// ...account for the scroll bar width
JScrollBar scrollBar = new JScrollBar(Adjustable.VERTICAL);
Dimension scrollBarSize = scrollBar.getMinimumSize();
size.width = preferredSize.width + scrollBarSize.width;
table.setPreferredScrollableViewportSize(size);
return table;
}

View File

@@ -257,15 +257,8 @@ public abstract class VTMatchOneToManyTableProvider extends ComponentProviderAda
TableColumn statusColumn = columnModel.getColumn(statusColumnIndex);
statusColumn.setCellRenderer(new MatchStatusRenderer());
// override the default behavior so we see our columns in their preferred size
Dimension size = table.getPreferredScrollableViewportSize();
Dimension preferredSize = table.getPreferredSize();
// ...account for the scroll bar width
JScrollBar scrollBar = new JScrollBar(Adjustable.VERTICAL);
Dimension scrollBarSize = scrollBar.getMinimumSize();
size.width = preferredSize.width + scrollBarSize.width;
table.setPreferredScrollableViewportSize(size);
// a reasonable starting size picked by trial-and-error
table.setPreferredScrollableViewportSize(new Dimension(1100, 600));
return table;
}

View File

@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,10 +15,11 @@
*/
package ghidra.feature.vt.gui.provider.relatedMatches;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.MouseEvent;
import java.util.*;
import java.util.List;
import java.util.HashSet;
import java.util.Set;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
@@ -62,7 +63,6 @@ public class VTRelatedMatchesTableProvider extends ComponentProviderAdapter {
setWindowGroup(VTPlugin.WINDOW_GROUP);
setIcon(ICON);
createActions();
addToTool();
}
@@ -109,44 +109,21 @@ public class VTRelatedMatchesTableProvider extends ComponentProviderAdapter {
ListSelectionModel selectionModel = table.getSelectionModel();
selectionModel.addListSelectionListener(matchSelectionListener);
// override the default behavior so we see our columns in their preferred size
Dimension size = table.getPreferredScrollableViewportSize();
Dimension preferredSize = table.getPreferredSize();
// ...account for the scroll bar width
JScrollBar scrollBar = new JScrollBar(Adjustable.VERTICAL);
Dimension scrollBarSize = scrollBar.getMinimumSize();
size.width = preferredSize.width + scrollBarSize.width;
table.setPreferredScrollableViewportSize(size);
// a reasonable starting size picked by trial-and-error
table.setPreferredScrollableViewportSize(new Dimension(1100, 600));
return table;
}
private void createActions() {
// addLocalAction( new AddMarkupItemAction( this ) );
// addLocalAction( new IgnoreMarkupItemAction( this ) );
}
private void notifyContextChanged() {
tool.contextChanged(this);
}
@Override
public ActionContext getActionContext(MouseEvent event) {
// List<VTRelatedMatch> selectedItems = getSelectedMatches();
// return new MarkupItemContext( this, selectedItems );
return null;
}
private List<VTRelatedMatch> getSelectedMatches() {
List<VTRelatedMatch> list = new ArrayList<VTRelatedMatch>();
int[] selectedRows = relatedMatchesTable.getSelectedRows();
for (int row : selectedRows) {
list.add(relatedMatchesTableModel.getRowObject(row));
}
return list;
}
public void refresh() {
relatedMatchesTableModel.reload();
}