mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
annotate stacktrace only in "analyze stacktrace" and thread dump console.
recent changes annotation setting also put into "analyze stacktrace" dialog
This commit is contained in:
@@ -505,6 +505,7 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
}
|
||||
final ConsoleView consoleView = consoleBuilder.getConsole();
|
||||
final DefaultActionGroup toolbarActions = new DefaultActionGroup();
|
||||
consoleView.allowHeavyFilters();
|
||||
final ThreadDumpPanel panel = new ThreadDumpPanel(project, consoleView, toolbarActions, threads);
|
||||
|
||||
final Icon icon = null;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.unscramble.UnscrambleDialog">
|
||||
<grid id="5ad95" binding="myPanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="5ad95" binding="myPanel" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="82" y="81" width="482" height="165"/>
|
||||
<xy x="82" y="81" width="527" height="199"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -84,6 +84,15 @@
|
||||
<text value="Automatically detect and analyze thread dumps copied to the clipboard outside of IntelliJ IDEA"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="28646" binding="myBottomPanel" custom-create="true" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
|
||||
@@ -25,11 +25,14 @@ import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
import com.intellij.openapi.help.HelpManager;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
|
||||
import com.intellij.openapi.vcs.configurable.VcsContentAnnotationConfigurable;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.GuiUtils;
|
||||
import com.intellij.ui.TextFieldWithHistory;
|
||||
@@ -64,7 +67,9 @@ public class UnscrambleDialog extends DialogWrapper {
|
||||
private JCheckBox myUseUnscrambler;
|
||||
private JPanel myUnscramblePanel;
|
||||
private JCheckBox myOnTheFly;
|
||||
private JPanel myBottomPanel;
|
||||
protected AnalyzeStacktraceUtil.StacktraceEditorPanel myStacktraceEditorPanel;
|
||||
private VcsContentAnnotationConfigurable myConfigurable;
|
||||
|
||||
public UnscrambleDialog(Project project) {
|
||||
super(false);
|
||||
@@ -140,6 +145,15 @@ public class UnscrambleDialog extends DialogWrapper {
|
||||
myStacktraceEditorPanel.pasteTextFromClipboard();
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
myBottomPanel = new JPanel(new BorderLayout());
|
||||
if (ProjectLevelVcsManager.getInstance(myProject).hasActiveVcss()) {
|
||||
myConfigurable = new VcsContentAnnotationConfigurable(myProject);
|
||||
myBottomPanel.add(myConfigurable.createComponent(), BorderLayout.CENTER);
|
||||
myConfigurable.reset();
|
||||
}
|
||||
}
|
||||
|
||||
public static String getLastUsedLogUrl() {
|
||||
return PropertiesComponent.getInstance().getValue(PROPERTY_LOG_FILE_LAST_URL);
|
||||
}
|
||||
@@ -325,6 +339,15 @@ public class UnscrambleDialog extends DialogWrapper {
|
||||
}
|
||||
|
||||
protected void doOKAction() {
|
||||
if (myConfigurable != null && myConfigurable.isModified()) {
|
||||
try {
|
||||
myConfigurable.apply();
|
||||
}
|
||||
catch (ConfigurationException e) {
|
||||
setText(e.getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (performUnscramble()) {
|
||||
myLogFile.addCurrentTextToHistory();
|
||||
close(OK_EXIT_CODE);
|
||||
@@ -345,6 +368,7 @@ public class UnscrambleDialog extends DialogWrapper {
|
||||
if (unscrambledTrace == null) return false;
|
||||
List<ThreadState> threadStates = ThreadDumpParser.parse(unscrambledTrace);
|
||||
final ConsoleView consoleView = addConsole(project, threadStates);
|
||||
consoleView.allowHeavyFilters();
|
||||
AnalyzeStacktraceUtil.printStacktrace(consoleView, unscrambledTrace);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -47,4 +47,6 @@ public interface ConsoleView extends ExecutionConsole{
|
||||
|
||||
@NotNull
|
||||
AnAction[] createConsoleActions();
|
||||
|
||||
void allowHeavyFilters();
|
||||
}
|
||||
@@ -125,6 +125,7 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
private MyDiffContainer myJLayeredPane;
|
||||
private JPanel myMainPanel;
|
||||
private final Runnable myFinishProgress;
|
||||
private boolean myAllowHeavyFilters = false;
|
||||
|
||||
@TestOnly
|
||||
public Editor getEditor() {
|
||||
@@ -820,51 +821,55 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
myHyperlinks.highlightHyperlinks(myCustomFilter, myPredefinedMessageFilter, line1, endLine);
|
||||
}
|
||||
|
||||
if (myPredefinedMessageFilter.isAnyHeavy() && myPredefinedMessageFilter.shouldRunHeavy()) {
|
||||
final int startLine = Math.max(0, line1);
|
||||
|
||||
final Document document = getEditor().getDocument();
|
||||
final Document documentCopy = new DocumentImpl(true);
|
||||
final int startOffset = document.getLineStartOffset(startLine);
|
||||
documentCopy.setText(new String(document.getText(new TextRange(startOffset, document.getLineEndOffset(endLine)))));
|
||||
documentCopy.setReadOnly(true);
|
||||
|
||||
myJLayeredPane.startUpdating();
|
||||
final int currentValue = myHeavyUpdateTicket;
|
||||
myHeavyAlarm.addRequest(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (! myPredefinedMessageFilter.shouldRunHeavy()) return;
|
||||
myPredefinedMessageFilter.applyHeavyFilter(documentCopy, startOffset, startLine, new Consumer<FilterMixin.AdditionalHighlight>() {
|
||||
@Override
|
||||
public void consume(final FilterMixin.AdditionalHighlight additionalHighlight) {
|
||||
SwingUtilities.invokeLater(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (myFlushAlarm.isDisposed()) return;
|
||||
myFlushAlarm.addRequest(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (myHeavyUpdateTicket != currentValue) return;
|
||||
myHyperlinks.adjustHighlighters(Collections.singletonList(additionalHighlight));
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if (myHeavyAlarm.getActiveRequestCount() == 0) {
|
||||
SwingUtilities.invokeLater(myFinishProgress);
|
||||
}
|
||||
}
|
||||
}, 0);
|
||||
if (myAllowHeavyFilters && myPredefinedMessageFilter.isAnyHeavy() && myPredefinedMessageFilter.shouldRunHeavy()) {
|
||||
runHeavyFilters(line1, endLine);
|
||||
}
|
||||
if (myUpdateFoldingsEnabled) {
|
||||
updateFoldings(line1, endLine, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void runHeavyFilters(int line1, int endLine) {
|
||||
final int startLine = Math.max(0, line1);
|
||||
|
||||
final Document document = getEditor().getDocument();
|
||||
final Document documentCopy = new DocumentImpl(true);
|
||||
final int startOffset = document.getLineStartOffset(startLine);
|
||||
documentCopy.setText(new String(document.getText(new TextRange(startOffset, document.getLineEndOffset(endLine)))));
|
||||
documentCopy.setReadOnly(true);
|
||||
|
||||
myJLayeredPane.startUpdating();
|
||||
final int currentValue = myHeavyUpdateTicket;
|
||||
myHeavyAlarm.addRequest(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (! myPredefinedMessageFilter.shouldRunHeavy()) return;
|
||||
myPredefinedMessageFilter.applyHeavyFilter(documentCopy, startOffset, startLine, new Consumer<FilterMixin.AdditionalHighlight>() {
|
||||
@Override
|
||||
public void consume(final FilterMixin.AdditionalHighlight additionalHighlight) {
|
||||
SwingUtilities.invokeLater(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (myFlushAlarm.isDisposed()) return;
|
||||
myFlushAlarm.addRequest(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (myHeavyUpdateTicket != currentValue) return;
|
||||
myHyperlinks.adjustHighlighters(Collections.singletonList(additionalHighlight));
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if (myHeavyAlarm.getActiveRequestCount() == 0) {
|
||||
SwingUtilities.invokeLater(myFinishProgress);
|
||||
}
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
private void updateFoldings(final int line1, final int endLine, boolean immediately) {
|
||||
final Document document = myEditor.getDocument();
|
||||
final CharSequence chars = document.getCharsSequence();
|
||||
@@ -1364,6 +1369,11 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowHeavyFilters() {
|
||||
myAllowHeavyFilters = true;
|
||||
}
|
||||
|
||||
protected void scrollToTheEnd() {
|
||||
myEditor.getCaretModel().moveToOffset(myEditor.getDocument().getTextLength());
|
||||
myEditor.getSelectionModel().removeSelection();
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
package com.intellij.unscramble;
|
||||
|
||||
import com.intellij.execution.ui.ConsoleView;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.execution.ui.ConsoleView;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -50,6 +50,7 @@ public class AnalyzeStacktraceDialog extends DialogWrapper {
|
||||
@Override
|
||||
protected void doOKAction() {
|
||||
final ConsoleView consoleView = AnalyzeStacktraceUtil.addConsole(myProject, null, "<Stacktrace>");
|
||||
consoleView.allowHeavyFilters();
|
||||
AnalyzeStacktraceUtil.printStacktrace(consoleView, myEditorPanel.getText());
|
||||
super.doOKAction();
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ public class AnalyzeStacktraceOnErrorAction extends AnAction {
|
||||
final String message = IdeErrorsDialog.CURRENT_TRACE_KEY.getData(dataContext);
|
||||
if (message != null) {
|
||||
final ConsoleView consoleView = AnalyzeStacktraceUtil.addConsole(project, null, "<Stacktrace>");
|
||||
consoleView.allowHeavyFilters();
|
||||
AnalyzeStacktraceUtil.printStacktrace(consoleView, message);
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -68,6 +68,10 @@ public abstract class BaseTestsOutputConsoleView implements ConsoleView, Observa
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowHeavyFilters() {
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
myConsole.clear();
|
||||
}
|
||||
|
||||
+1
@@ -50,6 +50,7 @@ public class AnalyzeTaskStacktraceAction extends BaseTaskAction {
|
||||
Comment[] comments = stacktraceDialog.getTraces();
|
||||
for (Comment comment : comments) {
|
||||
ConsoleView consoleView = AnalyzeStacktraceUtil.addConsole(project, null, task.getId());
|
||||
consoleView.allowHeavyFilters();
|
||||
AnalyzeStacktraceUtil.printStacktrace(consoleView, comment.getText());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user