Skip to content

Commit 91f65bb

Browse files
committed
removing tdp tab if plugin is not loaded
1 parent c688431 commit 91f65bb

File tree

2 files changed

+26
-74
lines changed

2 files changed

+26
-74
lines changed

src/main/java/com/pega/gcs/logviewer/ThreadDumpPanel.java

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import com.pega.gcs.logviewer.model.Log4jLogThreadDumpEntry;
5454
import com.pega.gcs.logviewer.model.ThreadDumpThreadInfo;
5555
import com.pega.gcs.logviewer.parser.LogThreadDumpParser;
56+
import com.pega.gcs.logviewer.pegatdp.PegaThreadDumpParser;
5657
import com.pega.gcs.logviewer.pegatdp.PegaThreadDumpParserPanel;
5758

5859
public class ThreadDumpPanel extends JPanel {
@@ -170,30 +171,35 @@ public ThreadDumpPanel(Log4jLogThreadDumpEntry log4jLogThreadDumpEntry, LogTable
170171
tabCounter++;
171172

172173
// Pega 7 Thread Dump Parser
173-
tabText = "Thread Dump Report";
174-
tabLabel = new JLabel(tabText);
175-
tabLabel.setFont(tabFont);
176-
tabLabel.setSize(dim);
177-
tabLabel.setPreferredSize(dim);
178-
tabLabel.setHorizontalAlignment(SwingConstants.CENTER);
174+
PegaThreadDumpParser pegaThreadDumpParser = PegaThreadDumpParser.getInstance();
179175

180-
ThreadDumpTable threadDumpTable = getThreadDumpTable();
176+
if (pegaThreadDumpParser.isInitialised()) {
177+
178+
tabText = "Thread Dump Report";
179+
tabLabel = new JLabel(tabText);
180+
tabLabel.setFont(tabFont);
181+
tabLabel.setSize(dim);
182+
tabLabel.setPreferredSize(dim);
183+
tabLabel.setHorizontalAlignment(SwingConstants.CENTER);
181184

182-
boolean v7ThreadDump = threadDumpTableModel.isV7ThreadDump();
185+
ThreadDumpTable threadDumpTable = getThreadDumpTable();
183186

184-
List<Integer> threadColumnList = new ArrayList<>();
185-
threadColumnList.add(0);
187+
boolean v7ThreadDump = threadDumpTableModel.isV7ThreadDump();
186188

187-
ThreadDumpRequestorLockTableMouseListener threadDumpRequestorLockTableMouseListener;
188-
threadDumpRequestorLockTableMouseListener = new ThreadDumpRequestorLockTableMouseListener(threadDumpTable,
189-
threadDumpTabbedPane, threadColumnList);
189+
List<Integer> threadColumnList = new ArrayList<>();
190+
threadColumnList.add(0);
190191

191-
JPanel pegaThreadDumpParserPanel = new PegaThreadDumpParserPanel(logEntryText, log4jLogThreadDumpEntry,
192-
v7ThreadDump, logTableModel, threadDumpRequestorLockTableMouseListener);
192+
ThreadDumpRequestorLockTableMouseListener threadDumpRequestorLockTableMouseListener;
193+
threadDumpRequestorLockTableMouseListener = new ThreadDumpRequestorLockTableMouseListener(threadDumpTable,
194+
threadDumpTabbedPane, threadColumnList);
193195

194-
threadDumpTabbedPane.addTab(tabText, pegaThreadDumpParserPanel);
195-
threadDumpTabbedPane.setTabComponentAt(tabCounter, tabLabel);
196-
tabCounter++;
196+
JPanel pegaThreadDumpParserPanel = new PegaThreadDumpParserPanel(logEntryText, log4jLogThreadDumpEntry,
197+
v7ThreadDump, logTableModel, threadDumpRequestorLockTableMouseListener);
198+
199+
threadDumpTabbedPane.addTab(tabText, pegaThreadDumpParserPanel);
200+
threadDumpTabbedPane.setTabComponentAt(tabCounter, tabLabel);
201+
tabCounter++;
202+
}
197203

198204
int defaultSelectedTab = threadDumpSelectedTab.get();
199205
int tabCount = threadDumpTabbedPane.getTabCount();

src/main/java/com/pega/gcs/logviewer/pegatdp/PegaThreadDumpParserPanel.java

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
import org.apache.commons.io.FileUtils;
5151

5252
import com.pega.gcs.fringecommon.guiutilities.ClickableFilePathPanel;
53-
import com.pega.gcs.fringecommon.guiutilities.ClickablePathPanel;
5453
import com.pega.gcs.fringecommon.guiutilities.MyColor;
5554
import com.pega.gcs.fringecommon.guiutilities.RecentFile;
5655
import com.pega.gcs.fringecommon.log4j2.Log4j2Helper;
@@ -452,66 +451,13 @@ private JPanel getDefaultThreadDumpReportJPanel() {
452451
gbc1.gridx = 0;
453452
gbc1.gridy = 0;
454453
gbc1.weightx = 1.0D;
455-
gbc1.weighty = 0.0D;
454+
gbc1.weighty = 1.0D;
456455
gbc1.fill = GridBagConstraints.BOTH;
457456
gbc1.anchor = GridBagConstraints.NORTHWEST;
458457
gbc1.insets = new Insets(10, 5, 2, 2);
459458
gbc1.gridwidth = GridBagConstraints.REMAINDER;
460459

461-
GridBagConstraints gbc2 = new GridBagConstraints();
462-
gbc2.gridx = 0;
463-
gbc2.gridy = 1;
464-
gbc2.weightx = 0.0D;
465-
gbc2.weighty = 0.0D;
466-
gbc2.fill = GridBagConstraints.BOTH;
467-
gbc2.anchor = GridBagConstraints.NORTHWEST;
468-
gbc2.insets = new Insets(2, 5, 2, 2);
469-
470-
GridBagConstraints gbc3 = new GridBagConstraints();
471-
gbc3.gridx = 1;
472-
gbc3.gridy = 1;
473-
gbc3.weightx = 1.0D;
474-
gbc3.weighty = 0.0D;
475-
gbc3.fill = GridBagConstraints.BOTH;
476-
gbc3.anchor = GridBagConstraints.NORTHWEST;
477-
gbc3.insets = new Insets(2, 2, 2, 2);
478-
479-
GridBagConstraints gbc4 = new GridBagConstraints();
480-
gbc4.gridx = 0;
481-
gbc4.gridy = 2;
482-
gbc4.weightx = 1.0D;
483-
gbc4.weighty = 0.0D;
484-
gbc4.fill = GridBagConstraints.BOTH;
485-
gbc4.anchor = GridBagConstraints.NORTHWEST;
486-
gbc4.insets = new Insets(2, 5, 2, 2);
487-
gbc4.gridwidth = GridBagConstraints.REMAINDER;
488-
489-
GridBagConstraints gbc5 = new GridBagConstraints();
490-
gbc5.gridx = 0;
491-
gbc5.gridy = 3;
492-
gbc5.weightx = 1.0D;
493-
gbc5.weighty = 1.0D;
494-
gbc5.fill = GridBagConstraints.BOTH;
495-
gbc5.anchor = GridBagConstraints.NORTHWEST;
496-
gbc5.insets = new Insets(2, 5, 2, 2);
497-
gbc5.gridwidth = GridBagConstraints.REMAINDER;
498-
499-
JLabel label1 = new JLabel(
500-
"This tab is loaded from 'Pega 7 Thread Dump Parser' tool built by Domenico Giffone");
501-
JLabel label2 = new JLabel("Please download the tool from Pega Mesh.");
502-
ClickablePathPanel meshClickablePathPanel = new ClickablePathPanel();
503-
504-
String meshLink = "https://mesh.pega.com/docs/DOC-110737";
505-
506-
meshClickablePathPanel.setUrl(meshLink);
507-
508-
JLabel label3 = new JLabel("Put pegatdp.jar to 'plugins' directory and restart Pega-Logviewer.");
509-
510-
defaultThreadDumpReportJPanel.add(label1, gbc1);
511-
defaultThreadDumpReportJPanel.add(label2, gbc2);
512-
defaultThreadDumpReportJPanel.add(meshClickablePathPanel, gbc3);
513-
defaultThreadDumpReportJPanel.add(label3, gbc4);
514-
defaultThreadDumpReportJPanel.add(new JPanel(), gbc5);
460+
defaultThreadDumpReportJPanel.add(new JPanel(), gbc1);
515461

516462
return defaultThreadDumpReportJPanel;
517463
}

0 commit comments

Comments
 (0)