Removed Unused Tab Code

This commit is contained in:
Konloch 2024-09-25 19:58:24 -06:00
parent 13a35b12a9
commit 02749d6913

AI 샘플 코드 생성 중입니다

Loading...
8 changed files with 7 additions and 305 deletions

View File

@ -43,7 +43,6 @@ import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialog;
import the.bytecode.club.bytecodeviewer.gui.components.SearchableJTextArea;
import the.bytecode.club.bytecodeviewer.gui.components.SearchableRSyntaxTextArea;
import the.bytecode.club.bytecodeviewer.gui.resourcelist.ResourceListIconRenderer;
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.TabbedPane;
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ClassViewer;
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ResourceViewer;
import the.bytecode.club.bytecodeviewer.obfuscators.mapping.Refactorer;
@ -668,8 +667,9 @@ public class BytecodeViewer
{
for(int i = 0; i < BytecodeViewer.viewer.workPane.tabs.getTabCount(); i++)
{
ResourceViewer viewer = ((TabbedPane) BytecodeViewer.viewer.workPane.tabs.getTabComponentAt(i)).resource;
viewer.refreshTitle();
//ResourceViewer viewer = ((TabbedPane) BytecodeViewer.viewer.workPane.tabs.getTabComponentAt(i)).resource;
//viewer.refreshTitle();
//TODO
}
}

View File

@ -1,53 +0,0 @@
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Konloch - Konloch.com / BytecodeViewer.com *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
package the.bytecode.club.bytecodeviewer.gui.components;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.AbstractButton;
/**
* @author Konloch
* @since 6/25/2021
*/
public class ButtonHoverAnimation extends MouseAdapter
{
@Override
public void mouseEntered(MouseEvent e)
{
final Component component = e.getComponent();
if (component instanceof AbstractButton)
{
final AbstractButton button = (AbstractButton) component;
button.setBorderPainted(true);
}
}
@Override
public void mouseExited(MouseEvent e)
{
final Component component = e.getComponent();
if (component instanceof AbstractButton)
{
final AbstractButton button = (AbstractButton) component;
button.setBorderPainted(false);
}
}
}

View File

@ -1,119 +0,0 @@
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Konloch - Konloch.com / BytecodeViewer.com *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
package the.bytecode.club.bytecodeviewer.gui.resourceviewer;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.plaf.basic.BasicButtonUI;
/**
* @author Konloch
* @since 6/25/2021
* Using CloseButton of darklaf instead. 4/17/2022
*/
@Deprecated
public class TabExitButton extends JButton implements ActionListener {
private final TabbedPane tabbedPane;
private final int tabIndex;
private final String tabWorkingName;
public TabExitButton(TabbedPane tabbedPane, int tabIndex, String tabWorkingName) {
this.tabbedPane = tabbedPane;
this.tabIndex = tabIndex;
this.tabWorkingName = tabWorkingName;
final int size = 17;
setPreferredSize(new Dimension(size, size));
setToolTipText("Close this tab");
// Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
// Make it transparent
setContentAreaFilled(false);
// No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
// Making nice rollover effect
// we use the same listener for all buttons
addMouseListener(TabbedPane.buttonHoverAnimation);
setRolloverEnabled(true);
// Close the proper tab by clicking the button
addActionListener(this);
}
public int getTabIndex() {
return tabIndex;
}
@Override
public void actionPerformed(ActionEvent e) {
final int i = tabbedPane.tabs.indexOfTabComponent(tabbedPane);
if (i != -1) {
tabbedPane.tabs.remove(i);
}
}
// we don't want to update UI for this button
@Override
public void updateUI() {
}
// paint the cross
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
final Graphics2D g2 = (Graphics2D) g.create();
// shift the image for pressed buttons
if (getModel().isPressed())
g2.translate(1, 1);
g2.setStroke(new BasicStroke(2));
g2.setColor(Color.BLACK);
if (getModel().isRollover()) {
g2.setColor(Color.MAGENTA);
}
final int delta = 6;
g2.drawLine(delta, delta, getWidth() - delta - 1, getHeight() - delta - 1);
g2.drawLine(getWidth() - delta - 1, delta, delta, getHeight() - delta - 1);
g2.dispose();
}
public TabbedPane getTabbedPane() {
return tabbedPane;
}
public String getTabWorkingName() {
return tabWorkingName;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
private static final long serialVersionUID = -4492967978286454159L;
}

View File

@ -1,50 +0,0 @@
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Konloch - Konloch.com / BytecodeViewer.com *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
package the.bytecode.club.bytecodeviewer.gui.resourceviewer;
import java.awt.Component;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ResourceViewer;
/**
* @author Konloch
* @since 6/24/2021
* @deprecated Removal pending. <br>
* Disabled due to a bug when dragging a component, it got "removed" resulting in another
* tab being opened when clicking the same class in the file resource rather than opening the already opened file.
*/
public class TabRemovalEvent implements ContainerListener
{
@Override
public void componentAdded(ContainerEvent e) { }
@Override
public void componentRemoved(ContainerEvent e)
{
final Component c = e.getChild();
if(!(c instanceof ResourceViewer))
return;
String workingName = ((ResourceViewer) c).resource.workingName;
BytecodeViewer.viewer.workPane.openedTabs.remove(workingName);
}
}

View File

@ -1,73 +0,0 @@
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Konloch - Konloch.com / BytecodeViewer.com *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
package the.bytecode.club.bytecodeviewer.gui.resourceviewer;
import the.bytecode.club.bytecodeviewer.gui.components.ButtonHoverAnimation;
import the.bytecode.club.bytecodeviewer.gui.components.MaxWidthJLabel;
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ResourceViewer;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseListener;
/**
* Component to be used as tabComponent; Contains a JLabel to show the text and a JButton to close the tab it belongs to
*
* @author Konloch
* @author WaterWolf
* @since 09/26/2011
*/
public class TabbedPane extends JPanel {
public final JTabbedPane tabs;
public final JLabel label;
private long startedDragging = 0;
public final String tabName;
public final String fileContainerName;
public final ResourceViewer resource;
private static long lastMouseClick = System.currentTimeMillis();
public final static MouseListener buttonHoverAnimation = new ButtonHoverAnimation();
public static final Color BLANK_COLOR = new Color(0, 0, 0, 0);
public TabbedPane(int tabIndex, String tabWorkingName, String fileContainerName, String name, JTabbedPane existingTabs, ResourceViewer resource) {
// unset default FlowLayout' gaps
super(new FlowLayout(FlowLayout.LEFT, 0, 0));
this.tabName = name;
this.fileContainerName = fileContainerName;
this.resource = resource;
if (existingTabs == null)
throw new NullPointerException("TabbedPane is null");
this.tabs = existingTabs;
setOpaque(false);
// make JLabel read titles from JTabbedPane
label = new MaxWidthJLabel(tabName, 400, 20);
this.add(label);
// add more space between the label and the button
label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
// add more space to the top of the component
setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
}
private static final long serialVersionUID = -4774885688297538774L;
}

View File

@ -142,7 +142,6 @@ public class Workspace extends TranslatedVisibleComponent {
final int tabIndex = tabs.indexOfComponent(resourceView);
//create a new tabbed pane
resourceView.tabbedPane = new TabbedPane(tabIndex, workingName, containerName, name, tabs, resourceView);
resourceView.resource.workingName = workingName;
//set the tabs index

View File

@ -21,7 +21,6 @@ package the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer;
import javax.swing.JButton;
import javax.swing.JPanel;
import the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.TabbedPane;
import the.bytecode.club.bytecodeviewer.resources.Resource;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
@ -34,7 +33,6 @@ import the.bytecode.club.bytecodeviewer.util.MiscUtils;
public abstract class ResourceViewer extends JPanel
{
public final Resource resource;
public TabbedPane tabbedPane;
protected ResourceViewer(Resource resource) {this.resource = resource;}
@ -69,8 +67,9 @@ public abstract class ResourceViewer extends JPanel
*/
public void refreshTitle()
{
if(tabbedPane != null)
tabbedPane.label.setText(getTabName());
//TODO
//if(tabbedPane != null)
// tabbedPane.label.setText(getTabName());
}
private static final long serialVersionUID = -2965538493489119191L;

View File

@ -50,7 +50,6 @@ import java.awt.event.*;
import java.util.Objects;
import java.util.regex.Matcher;
import static the.bytecode.club.bytecodeviewer.gui.resourceviewer.TabbedPane.BLANK_COLOR;
import static the.bytecode.club.bytecodeviewer.translation.TranslatedStrings.EDITABLE;
/**
@ -376,7 +375,7 @@ public class BytecodeViewPanelUpdater implements Runnable
JPanel panel = new JPanel(new BorderLayout());
panel.add(updateUpdaterTextArea.getScrollPane().getColumnHeader().getComponent(0), BorderLayout.NORTH);
panel.add(methodsList, BorderLayout.SOUTH);
methodsList.setBackground(BLANK_COLOR);
methodsList.setBackground(new Color(0, 0, 0, 0));
SwingUtilities.invokeLater(() ->
{