mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-12-11 13:42:04 +00:00
Merge remote-tracking branch 'origin/GP-5152-dragonmacher-diff-resize-bug'
This commit is contained in:
commit
46ceac4f5c
@ -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.
|
||||
@ -337,7 +337,7 @@ public abstract class AbstractCodeBrowserPlugin<P extends CodeViewerProvider> ex
|
||||
|
||||
@Override
|
||||
public void setListingPanel(ListingPanel lp) {
|
||||
connectedProvider.setPanel(lp);
|
||||
connectedProvider.setOtherPanel(lp);
|
||||
viewChanged(currentView);
|
||||
}
|
||||
|
||||
|
@ -727,7 +727,7 @@ public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
||||
return panelProgram.getDomainFile().toString();
|
||||
}
|
||||
|
||||
public void setPanel(ListingPanel lp) {
|
||||
public void setOtherPanel(ListingPanel lp) {
|
||||
Program myProgram = listingPanel.getListingModel().getProgram();
|
||||
Program otherProgram = lp.getListingModel().getProgram();
|
||||
String myName = "<EMPTY>";
|
||||
|
@ -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,16 +15,11 @@
|
||||
*/
|
||||
package docking.widgets;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.widgets.label.GDHtmlLabel;
|
||||
import docking.widgets.label.GDLabel;
|
||||
@ -34,42 +29,36 @@ import docking.widgets.label.GDLabel;
|
||||
* components (usually icon buttons)
|
||||
*/
|
||||
public class TitledPanel extends JPanel {
|
||||
private JLabel title; // GDLabel or GHtmlLabel
|
||||
private JLabel titleLabel;
|
||||
private JPanel titlePanel;
|
||||
private JPanel iconPanel;
|
||||
private JComponent bottomComp;
|
||||
private List<JComponent> titleComps = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Creates a new TitlePanel
|
||||
* @param name the name of the panel
|
||||
* @param panel the component to wrap
|
||||
* @param margin the size of the margin to use
|
||||
*/
|
||||
public TitledPanel(String name, JComponent panel, int margin) {
|
||||
this(new GDHtmlLabel(name), panel, margin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new TitlePanel
|
||||
*
|
||||
* @param titleLabel the title label for the panel; this allow clients to provide HTML-based
|
||||
* @param title the title; this allow clients to provide HTML-based
|
||||
* title text. Note: it is up to the client to escape this text as needed for safety
|
||||
* @param panel the component to wrap
|
||||
* @param margin the size of the margin to use
|
||||
*/
|
||||
public TitledPanel(JLabel titleLabel, JComponent panel, int margin) {
|
||||
public TitledPanel(String title, JComponent panel, int margin) {
|
||||
super(new BorderLayout());
|
||||
titlePanel = new JPanel(new BorderLayout());
|
||||
iconPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 1));
|
||||
iconPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
|
||||
title = titleLabel;
|
||||
titleLabel = new GDHtmlLabel(title);
|
||||
|
||||
titleLabel.setMinimumSize(new Dimension(16, 20));
|
||||
titleLabel.setToolTipText(title);
|
||||
|
||||
JLabel filler = new GDLabel();
|
||||
filler.setPreferredSize(new Dimension(margin, filler.getPreferredSize().height));
|
||||
titlePanel.add(filler, BorderLayout.WEST);
|
||||
|
||||
titlePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
|
||||
titlePanel.add(title, BorderLayout.CENTER);
|
||||
titlePanel.add(titleLabel, BorderLayout.CENTER);
|
||||
titlePanel.add(iconPanel, BorderLayout.EAST);
|
||||
|
||||
add(titlePanel, BorderLayout.NORTH);
|
||||
@ -77,8 +66,8 @@ public class TitledPanel extends JPanel {
|
||||
}
|
||||
|
||||
public void setTitleName(String name) {
|
||||
title.setText(name);
|
||||
title.setToolTipText(name);
|
||||
titleLabel.setText(name);
|
||||
titleLabel.setToolTipText(name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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.
|
||||
@ -16,6 +16,7 @@
|
||||
package ghidra.framework.model;
|
||||
|
||||
import ghidra.framework.store.FileSystem;
|
||||
import ghidra.util.StringUtilities;
|
||||
|
||||
public class DomainObjectDisplayUtils {
|
||||
private static final String VERSION_SEP = "@";
|
||||
@ -24,13 +25,16 @@ public class DomainObjectDisplayUtils {
|
||||
private static final String PROJECT_SEP_ELLIPSES =
|
||||
":" + FileSystem.SEPARATOR + "..." + FileSystem.SEPARATOR;
|
||||
|
||||
private static final int TOOLTIP_PATH_LENGTH_LIMIT = 100;
|
||||
private static final int TAB_NAME_LENGTH_LIMIT = 40;
|
||||
|
||||
private DomainObjectDisplayUtils() {
|
||||
}
|
||||
|
||||
public static String getShortPath(DomainFile df) {
|
||||
String pathString = df.toString();
|
||||
int length = pathString.length();
|
||||
if (length < 100) {
|
||||
if (length < TOOLTIP_PATH_LENGTH_LIMIT) {
|
||||
return pathString;
|
||||
}
|
||||
|
||||
@ -60,14 +64,16 @@ public class DomainObjectDisplayUtils {
|
||||
|
||||
public static String getTabText(DomainFile df) {
|
||||
String tabName = df.getName();
|
||||
if (df.isReadOnly()) {
|
||||
int version = df.getVersion();
|
||||
if (!df.canSave() && version != DomainFile.DEFAULT_VERSION) {
|
||||
tabName += VERSION_SEP + version;
|
||||
}
|
||||
tabName = tabName + READ_ONLY;
|
||||
String trimmedName = StringUtilities.trimMiddle(tabName, TAB_NAME_LENGTH_LIMIT);
|
||||
if (!df.isReadOnly()) {
|
||||
return trimmedName;
|
||||
}
|
||||
return tabName;
|
||||
|
||||
int version = df.getVersion();
|
||||
if (!df.canSave() && version != DomainFile.DEFAULT_VERSION) {
|
||||
trimmedName += VERSION_SEP + version;
|
||||
}
|
||||
return trimmedName + READ_ONLY;
|
||||
}
|
||||
|
||||
public static String getTabText(DomainObject object) {
|
||||
|
Loading…
Reference in New Issue
Block a user