Skip to content

Commit

Permalink
removing tdp tab if plugin is not loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
vargm committed Jan 20, 2022
1 parent c688431 commit 91f65bb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 74 deletions.
42 changes: 24 additions & 18 deletions src/main/java/com/pega/gcs/logviewer/ThreadDumpPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import com.pega.gcs.logviewer.model.Log4jLogThreadDumpEntry;
import com.pega.gcs.logviewer.model.ThreadDumpThreadInfo;
import com.pega.gcs.logviewer.parser.LogThreadDumpParser;
import com.pega.gcs.logviewer.pegatdp.PegaThreadDumpParser;
import com.pega.gcs.logviewer.pegatdp.PegaThreadDumpParserPanel;

public class ThreadDumpPanel extends JPanel {
Expand Down Expand Up @@ -170,30 +171,35 @@ public ThreadDumpPanel(Log4jLogThreadDumpEntry log4jLogThreadDumpEntry, LogTable
tabCounter++;

// Pega 7 Thread Dump Parser
tabText = "Thread Dump Report";
tabLabel = new JLabel(tabText);
tabLabel.setFont(tabFont);
tabLabel.setSize(dim);
tabLabel.setPreferredSize(dim);
tabLabel.setHorizontalAlignment(SwingConstants.CENTER);
PegaThreadDumpParser pegaThreadDumpParser = PegaThreadDumpParser.getInstance();

ThreadDumpTable threadDumpTable = getThreadDumpTable();
if (pegaThreadDumpParser.isInitialised()) {

tabText = "Thread Dump Report";
tabLabel = new JLabel(tabText);
tabLabel.setFont(tabFont);
tabLabel.setSize(dim);
tabLabel.setPreferredSize(dim);
tabLabel.setHorizontalAlignment(SwingConstants.CENTER);

boolean v7ThreadDump = threadDumpTableModel.isV7ThreadDump();
ThreadDumpTable threadDumpTable = getThreadDumpTable();

List<Integer> threadColumnList = new ArrayList<>();
threadColumnList.add(0);
boolean v7ThreadDump = threadDumpTableModel.isV7ThreadDump();

ThreadDumpRequestorLockTableMouseListener threadDumpRequestorLockTableMouseListener;
threadDumpRequestorLockTableMouseListener = new ThreadDumpRequestorLockTableMouseListener(threadDumpTable,
threadDumpTabbedPane, threadColumnList);
List<Integer> threadColumnList = new ArrayList<>();
threadColumnList.add(0);

JPanel pegaThreadDumpParserPanel = new PegaThreadDumpParserPanel(logEntryText, log4jLogThreadDumpEntry,
v7ThreadDump, logTableModel, threadDumpRequestorLockTableMouseListener);
ThreadDumpRequestorLockTableMouseListener threadDumpRequestorLockTableMouseListener;
threadDumpRequestorLockTableMouseListener = new ThreadDumpRequestorLockTableMouseListener(threadDumpTable,
threadDumpTabbedPane, threadColumnList);

threadDumpTabbedPane.addTab(tabText, pegaThreadDumpParserPanel);
threadDumpTabbedPane.setTabComponentAt(tabCounter, tabLabel);
tabCounter++;
JPanel pegaThreadDumpParserPanel = new PegaThreadDumpParserPanel(logEntryText, log4jLogThreadDumpEntry,
v7ThreadDump, logTableModel, threadDumpRequestorLockTableMouseListener);

threadDumpTabbedPane.addTab(tabText, pegaThreadDumpParserPanel);
threadDumpTabbedPane.setTabComponentAt(tabCounter, tabLabel);
tabCounter++;
}

int defaultSelectedTab = threadDumpSelectedTab.get();
int tabCount = threadDumpTabbedPane.getTabCount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import org.apache.commons.io.FileUtils;

import com.pega.gcs.fringecommon.guiutilities.ClickableFilePathPanel;
import com.pega.gcs.fringecommon.guiutilities.ClickablePathPanel;
import com.pega.gcs.fringecommon.guiutilities.MyColor;
import com.pega.gcs.fringecommon.guiutilities.RecentFile;
import com.pega.gcs.fringecommon.log4j2.Log4j2Helper;
Expand Down Expand Up @@ -452,66 +451,13 @@ private JPanel getDefaultThreadDumpReportJPanel() {
gbc1.gridx = 0;
gbc1.gridy = 0;
gbc1.weightx = 1.0D;
gbc1.weighty = 0.0D;
gbc1.weighty = 1.0D;
gbc1.fill = GridBagConstraints.BOTH;
gbc1.anchor = GridBagConstraints.NORTHWEST;
gbc1.insets = new Insets(10, 5, 2, 2);
gbc1.gridwidth = GridBagConstraints.REMAINDER;

GridBagConstraints gbc2 = new GridBagConstraints();
gbc2.gridx = 0;
gbc2.gridy = 1;
gbc2.weightx = 0.0D;
gbc2.weighty = 0.0D;
gbc2.fill = GridBagConstraints.BOTH;
gbc2.anchor = GridBagConstraints.NORTHWEST;
gbc2.insets = new Insets(2, 5, 2, 2);

GridBagConstraints gbc3 = new GridBagConstraints();
gbc3.gridx = 1;
gbc3.gridy = 1;
gbc3.weightx = 1.0D;
gbc3.weighty = 0.0D;
gbc3.fill = GridBagConstraints.BOTH;
gbc3.anchor = GridBagConstraints.NORTHWEST;
gbc3.insets = new Insets(2, 2, 2, 2);

GridBagConstraints gbc4 = new GridBagConstraints();
gbc4.gridx = 0;
gbc4.gridy = 2;
gbc4.weightx = 1.0D;
gbc4.weighty = 0.0D;
gbc4.fill = GridBagConstraints.BOTH;
gbc4.anchor = GridBagConstraints.NORTHWEST;
gbc4.insets = new Insets(2, 5, 2, 2);
gbc4.gridwidth = GridBagConstraints.REMAINDER;

GridBagConstraints gbc5 = new GridBagConstraints();
gbc5.gridx = 0;
gbc5.gridy = 3;
gbc5.weightx = 1.0D;
gbc5.weighty = 1.0D;
gbc5.fill = GridBagConstraints.BOTH;
gbc5.anchor = GridBagConstraints.NORTHWEST;
gbc5.insets = new Insets(2, 5, 2, 2);
gbc5.gridwidth = GridBagConstraints.REMAINDER;

JLabel label1 = new JLabel(
"This tab is loaded from 'Pega 7 Thread Dump Parser' tool built by Domenico Giffone");
JLabel label2 = new JLabel("Please download the tool from Pega Mesh.");
ClickablePathPanel meshClickablePathPanel = new ClickablePathPanel();

String meshLink = "https://mesh.pega.com/docs/DOC-110737";

meshClickablePathPanel.setUrl(meshLink);

JLabel label3 = new JLabel("Put pegatdp.jar to 'plugins' directory and restart Pega-Logviewer.");

defaultThreadDumpReportJPanel.add(label1, gbc1);
defaultThreadDumpReportJPanel.add(label2, gbc2);
defaultThreadDumpReportJPanel.add(meshClickablePathPanel, gbc3);
defaultThreadDumpReportJPanel.add(label3, gbc4);
defaultThreadDumpReportJPanel.add(new JPanel(), gbc5);
defaultThreadDumpReportJPanel.add(new JPanel(), gbc1);

return defaultThreadDumpReportJPanel;
}
Expand Down

0 comments on commit 91f65bb

Please sign in to comment.