mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+1
-1
@@ -60,7 +60,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
private static final TooltipGroup ERROR_STRIPE_TOOLTIP_GROUP = new TooltipGroup("ERROR_STRIPE_TOOLTIP_GROUP", 0);
|
||||
private static final int EDITOR_FRAGMENT_POPUP_BORDER = 1;
|
||||
|
||||
public int getMinMarkHeight() {
|
||||
private int getMinMarkHeight() {
|
||||
return JBUI.scale(myMinMarkHeight);
|
||||
}
|
||||
|
||||
|
||||
+8
-6
@@ -405,12 +405,14 @@ public class VirtualFilePointerManagerImpl extends VirtualFilePointerManager imp
|
||||
|
||||
myEvents = eventList = new ArrayList<>();
|
||||
toFirePointers = toPointers(toFireEvents);
|
||||
for (final VirtualFilePointerListener listener : myPointers.keySet()) {
|
||||
if (listener == NULL_LISTENER) continue;
|
||||
List<VirtualFilePointer> filtered =
|
||||
ContainerUtil.filter(toFirePointers, pointer -> ((VirtualFilePointerImpl)pointer).getListener() == listener);
|
||||
if (!filtered.isEmpty()) {
|
||||
eventList.add(new EventDescriptor(listener, filtered.toArray(VirtualFilePointer.EMPTY_ARRAY)));
|
||||
if (toFirePointers.length != 0) {
|
||||
for (final VirtualFilePointerListener listener : myPointers.keySet()) {
|
||||
if (listener == NULL_LISTENER) continue;
|
||||
List<VirtualFilePointer> filtered =
|
||||
ContainerUtil.filter(toFirePointers, pointer -> ((VirtualFilePointerImpl)pointer).getListener() == listener);
|
||||
if (!filtered.isEmpty()) {
|
||||
eventList.add(new EventDescriptor(listener, filtered.toArray(VirtualFilePointer.EMPTY_ARRAY)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -778,6 +778,7 @@ public class StringUtil extends StringUtilRt {
|
||||
case '2':
|
||||
case '3':
|
||||
octalEscapeMaxLength = 3;
|
||||
//noinspection fallthrough
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.lang.ant.config.execution;
|
||||
|
||||
import com.intellij.execution.testframework.Printable;
|
||||
import com.intellij.execution.testframework.Printer;
|
||||
import com.intellij.ide.CommonActionsManager;
|
||||
import com.intellij.ide.OccurenceNavigator;
|
||||
import com.intellij.ide.TreeExpander;
|
||||
@@ -18,7 +16,6 @@ import com.intellij.lang.ant.config.impl.AntBuildFileImpl;
|
||||
import com.intellij.lang.ant.config.impl.BuildFileProperty;
|
||||
import com.intellij.lang.ant.config.impl.HelpID;
|
||||
import com.intellij.lang.ant.segments.OutputPacketProcessor;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
@@ -55,8 +52,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.openapi.wm.IdeFocusManager.getGlobalInstance;
|
||||
|
||||
public final class AntBuildMessageView extends JPanel implements DataProvider, OccurenceNavigator {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.ant.execution.AntBuildMessageView");
|
||||
|
||||
@@ -89,7 +84,7 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
private int myPriorityThreshold = PRIORITY_INFO;
|
||||
private volatile int myErrorCount;
|
||||
private volatile int myWarningCount;
|
||||
private volatile boolean myIsOutputPaused = false;
|
||||
private volatile boolean myIsOutputPaused;
|
||||
|
||||
@NotNull
|
||||
private volatile AntOutputView myCurrentView;
|
||||
@@ -97,8 +92,8 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
private final PlainTextView myPlainTextView;
|
||||
private final TreeView myTreeView;
|
||||
|
||||
private final java.util.List<LogCommand> myLog = Collections.synchronizedList(new ArrayList<LogCommand>(1024));
|
||||
private volatile int myCommandsProcessedCount = 0;
|
||||
private final java.util.List<LogCommand> myLog = Collections.synchronizedList(new ArrayList<>(1024));
|
||||
private volatile int myCommandsProcessedCount;
|
||||
|
||||
private final AntMessageCustomizer[] myMessageCustomizers = AntMessageCustomizer.EP_NAME.getExtensions();
|
||||
|
||||
@@ -133,7 +128,8 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
AntBuildMessageView.this.expandAll();
|
||||
}
|
||||
};
|
||||
@NonNls public static final String FILE_PREFIX = "file:";
|
||||
@NonNls
|
||||
private static final String FILE_PREFIX = "file:";
|
||||
|
||||
private AntBuildMessageView(Project project, AntBuildFileBase buildFile, List<String> targets, List<BuildFileProperty> additionalProperties) {
|
||||
super(new BorderLayout(2, 0));
|
||||
@@ -213,9 +209,8 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
myCardLayout.show(myContentPanel, newView.getId());
|
||||
|
||||
JComponent component = IdeFocusTraversalPolicy.getPreferredFocusedComponent(myMessagePanel);
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
getGlobalInstance().requestFocus(component, true);
|
||||
});
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() ->
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(component, true));
|
||||
repaint();
|
||||
}
|
||||
|
||||
@@ -231,7 +226,10 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
* @return can be null if user cancelled operation
|
||||
*/
|
||||
@Nullable
|
||||
public static AntBuildMessageView openBuildMessageView(Project project, AntBuildFileBase buildFile, List<String> targets, List<BuildFileProperty> additionalProperties) {
|
||||
static AntBuildMessageView openBuildMessageView(Project project,
|
||||
AntBuildFileBase buildFile,
|
||||
List<String> targets,
|
||||
List<BuildFileProperty> additionalProperties) {
|
||||
final VirtualFile antFile = buildFile.getVirtualFile();
|
||||
if (!LOG.assertTrue(antFile != null)) {
|
||||
return null;
|
||||
@@ -282,12 +280,7 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
content.putUserData(KEY, messageView);
|
||||
ijMessageView.getContentManager().addContent(content);
|
||||
ijMessageView.getContentManager().setSelectedContent(content);
|
||||
content.setDisposer(new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
Disposer.dispose(messageView.myAlarm);
|
||||
}
|
||||
});
|
||||
content.setDisposer(() -> Disposer.dispose(messageView.myAlarm));
|
||||
new CloseListener(content, ijMessageView.getContentManager(), project);
|
||||
|
||||
if (!buildFile.isRunInBackground()) {
|
||||
@@ -300,7 +293,7 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
return messageView;
|
||||
}
|
||||
|
||||
public void setParsingThread(OutputParser parsingThread) {
|
||||
void setParsingThread(OutputParser parsingThread) {
|
||||
myParsingThread = parsingThread;
|
||||
myIsAborted = false;
|
||||
}
|
||||
@@ -318,7 +311,7 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
return myParsingThread == null || myParsingThread.isStopped();
|
||||
}
|
||||
|
||||
public boolean isStoppedOrTerminateRequested() {
|
||||
private boolean isStoppedOrTerminateRequested() {
|
||||
return myParsingThread == null || myParsingThread.isTerminateInvoked() || isStopped();
|
||||
}
|
||||
|
||||
@@ -378,23 +371,23 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
}
|
||||
}
|
||||
|
||||
public void startBuild(String buildName) {
|
||||
void startBuild(String buildName) {
|
||||
addCommand(new StartBuildCommand(buildName));
|
||||
}
|
||||
|
||||
public void buildFailed(String buildName) {
|
||||
void buildFailed(String buildName) {
|
||||
addCommand(new BuildFailedCommand(buildName));
|
||||
}
|
||||
|
||||
public void startTarget(String targetName) {
|
||||
void startTarget(String targetName) {
|
||||
addCommand(new StartTargetCommand(targetName));
|
||||
}
|
||||
|
||||
public void startTask(String taskName) {
|
||||
void startTask(String taskName) {
|
||||
addCommand(new StartTaskCommand(taskName));
|
||||
}
|
||||
|
||||
public void outputMessage(final String text, @AntMessage.Priority int priority) {
|
||||
void outputMessage(final String text, @AntMessage.Priority int priority) {
|
||||
final AntMessage customizedMessage = getCustomizedMessage(text, priority);
|
||||
final AntMessage message = customizedMessage != null
|
||||
? customizedMessage
|
||||
@@ -417,7 +410,7 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
return customizedMessage;
|
||||
}
|
||||
|
||||
public void outputError(String error, @AntMessage.Priority int priority) {
|
||||
void outputError(String error, @AntMessage.Priority int priority) {
|
||||
updateErrorAndWarningCounters(priority);
|
||||
final AntMessage message = createErrorMessage(priority, error);
|
||||
addCommand(new AddMessageCommand(message));
|
||||
@@ -425,7 +418,7 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
wolf.queue(message.getFile());
|
||||
}
|
||||
|
||||
public void outputException(String exception) {
|
||||
void outputException(String exception) {
|
||||
updateErrorAndWarningCounters(PRIORITY_ERR);
|
||||
AntMessage message = createErrorMessage(PRIORITY_ERR, exception);
|
||||
addCommand(new AddExceptionCommand(message));
|
||||
@@ -443,11 +436,11 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
}
|
||||
}
|
||||
|
||||
public void finishTarget() {
|
||||
void finishTarget() {
|
||||
addCommand(new FinishTargetCommand());
|
||||
}
|
||||
|
||||
public void finishTask() {
|
||||
void finishTask() {
|
||||
addCommand(new FinishTaskCommand());
|
||||
}
|
||||
|
||||
@@ -460,7 +453,7 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
if (PlatformDataKeys.HELP_ID.is(dataId)) {
|
||||
return HelpID.ANT;
|
||||
}
|
||||
else if (PlatformDataKeys.TREE_EXPANDER.is(dataId)) {
|
||||
if (PlatformDataKeys.TREE_EXPANDER.is(dataId)) {
|
||||
return myTreeExpander;
|
||||
}
|
||||
return null;
|
||||
@@ -474,11 +467,11 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
String fileAndLineNumber = text.substring(0, afterLineNumberIndex);
|
||||
int index = fileAndLineNumber.lastIndexOf(':');
|
||||
if (index != -1) {
|
||||
String fileName = fileAndLineNumber.substring(0, index);
|
||||
String lineNumberStr = fileAndLineNumber.substring(index + 1).trim();
|
||||
try {
|
||||
String lineNumberStr = fileAndLineNumber.substring(index + 1).trim();
|
||||
int line = Integer.parseInt(lineNumberStr);
|
||||
|
||||
String fileName = fileAndLineNumber.substring(0, index);
|
||||
final File file = new File(fileName);
|
||||
final VirtualFile result = ReadAction.compute(() -> {
|
||||
String url =
|
||||
@@ -499,7 +492,7 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
return new AntMessage(MessageType.ERROR, priority, text, null, 0, 0);
|
||||
}
|
||||
|
||||
public void outputJavacMessage(MessageType type, String[] text, VirtualFile file, String url, int line, int column) {
|
||||
void outputJavacMessage(MessageType type, String[] text, VirtualFile file, String url, int line, int column) {
|
||||
int priority = type == MessageType.ERROR ? PRIORITY_ERR : PRIORITY_VERBOSE;
|
||||
updateErrorAndWarningCounters(priority);
|
||||
final AntMessage message = new AntMessage(type, priority, text, file, line, column);
|
||||
@@ -514,7 +507,7 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
return this;
|
||||
}
|
||||
|
||||
public void emptyAll() {
|
||||
void emptyAll() {
|
||||
myLog.clear();
|
||||
myCommandsProcessedCount = 0;
|
||||
myErrorCount = 0;
|
||||
@@ -533,7 +526,7 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
|
||||
private static final class CloseListener extends ContentManagerAdapter implements VetoableProjectManagerListener {
|
||||
private Content myContent;
|
||||
private boolean myCloseAllowed = false;
|
||||
private boolean myCloseAllowed;
|
||||
private final ContentManager myContentManager;
|
||||
private final Project myProject;
|
||||
|
||||
@@ -642,7 +635,7 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
private abstract static class MessageCommand extends LogCommand {
|
||||
private final AntMessage myMessage;
|
||||
|
||||
protected MessageCommand(@NotNull AntMessage message) {
|
||||
MessageCommand(@NotNull AntMessage message) {
|
||||
super(message.getPriority());
|
||||
myMessage = message;
|
||||
}
|
||||
@@ -788,58 +781,55 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
void buildFinished(boolean isProgressAborted, final long buildTimeInMilliseconds, @NotNull final AntBuildListener antBuildListener, OutputPacketProcessor dispatcher) {
|
||||
final boolean aborted = isProgressAborted || myIsAborted;
|
||||
|
||||
dispatcher.processOutput(new Printable() {
|
||||
@Override
|
||||
public void printOn(Printer printer) {
|
||||
if (!myProject.isDisposed()) { // if not disposed
|
||||
final String message = getFinishStatusText(aborted, buildTimeInMilliseconds);
|
||||
addCommand(new FinishBuildCommand(message));
|
||||
final StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject);
|
||||
if (statusBar != null) {
|
||||
statusBar.setInfo(message);
|
||||
}
|
||||
final AntBuildFileBase buildFile = myBuildFile;
|
||||
final boolean isBackground = buildFile != null && buildFile.isRunInBackground();
|
||||
final boolean shouldActivate = !isBackground || getErrorCount() > 0;
|
||||
UIUtil.invokeLaterIfNeeded(() -> {
|
||||
final Runnable finishRunnable = () -> {
|
||||
final int errorCount = getErrorCount();
|
||||
try {
|
||||
final AntBuildFileBase buildFile1 = myBuildFile;
|
||||
if (buildFile1 != null) {
|
||||
if (errorCount == 0 && buildFile1.isViewClosedWhenNoErrors()) {
|
||||
close();
|
||||
}
|
||||
else if (errorCount > 0) {
|
||||
myTreeView.scrollToFirstError();
|
||||
}
|
||||
else {
|
||||
myTreeView.scrollToStatus();
|
||||
}
|
||||
dispatcher.processOutput(__ -> {
|
||||
if (!myProject.isDisposed()) { // if not disposed
|
||||
final String message = getFinishStatusText(aborted, buildTimeInMilliseconds);
|
||||
addCommand(new FinishBuildCommand(message));
|
||||
final StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject);
|
||||
if (statusBar != null) {
|
||||
statusBar.setInfo(message);
|
||||
}
|
||||
final AntBuildFileBase buildFile = myBuildFile;
|
||||
final boolean isBackground = buildFile != null && buildFile.isRunInBackground();
|
||||
final boolean shouldActivate = !isBackground || getErrorCount() > 0;
|
||||
UIUtil.invokeLaterIfNeeded(() -> {
|
||||
final Runnable finishRunnable = () -> {
|
||||
final int errorCount = getErrorCount();
|
||||
try {
|
||||
final AntBuildFileBase buildFile1 = myBuildFile;
|
||||
if (buildFile1 != null) {
|
||||
if (errorCount == 0 && buildFile1.isViewClosedWhenNoErrors()) {
|
||||
close();
|
||||
}
|
||||
else if (errorCount > 0) {
|
||||
myTreeView.scrollToFirstError();
|
||||
}
|
||||
else {
|
||||
myTreeView.scrollToLastMessage();
|
||||
myTreeView.scrollToStatus();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
VirtualFileManager.getInstance().asyncRefresh(
|
||||
() -> antBuildListener.buildFinished(aborted ? AntBuildListener.ABORTED : AntBuildListener.FINISHED_SUCCESSFULLY, errorCount));
|
||||
}
|
||||
};
|
||||
if (shouldActivate) {
|
||||
final ToolWindow toolWindow = !myProject.isDisposed() ? ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW) : null;
|
||||
if (toolWindow != null) { // can be null if project is closed
|
||||
toolWindow.activate(finishRunnable, false);
|
||||
}
|
||||
else {
|
||||
finishRunnable.run();
|
||||
myTreeView.scrollToLastMessage();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
VirtualFileManager.getInstance().asyncRefresh(
|
||||
() -> antBuildListener.buildFinished(aborted ? AntBuildListener.ABORTED : AntBuildListener.FINISHED_SUCCESSFULLY, errorCount));
|
||||
}
|
||||
};
|
||||
if (shouldActivate) {
|
||||
final ToolWindow toolWindow = !myProject.isDisposed() ? ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW) : null;
|
||||
if (toolWindow != null) { // can be null if project is closed
|
||||
toolWindow.activate(finishRunnable, false);
|
||||
}
|
||||
else {
|
||||
finishRunnable.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
finishRunnable.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
ApplicationManager.getApplication().invokeLater(() -> flushWhenSmart(false), ModalityState.any(), myProject.getDisposed());
|
||||
@@ -917,7 +907,7 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
flushDelayedMessages();
|
||||
}
|
||||
|
||||
protected final void proceedOneCommand(LogCommand command) {
|
||||
final void proceedOneCommand(LogCommand command) {
|
||||
if (command.getPriority() > myPriorityThreshold) {
|
||||
return;
|
||||
}
|
||||
@@ -935,7 +925,7 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
}
|
||||
}
|
||||
|
||||
protected final void flushDelayedMessages() {
|
||||
final void flushDelayedMessages() {
|
||||
if (!myDelayedMessages.isEmpty()) {
|
||||
final AntMessage[] messages = myDelayedMessages.toArray(new AntMessage[0]);
|
||||
myDelayedMessages.clear();
|
||||
@@ -977,8 +967,7 @@ public final class AntBuildMessageView extends JPanel implements DataProvider, O
|
||||
return isTreeView() && myTreeView.hasPreviousOccurence();
|
||||
}
|
||||
|
||||
public void setBuildCommandLine(String commandLine) {
|
||||
void setBuildCommandLine(String commandLine) {
|
||||
myPlainTextView.setBuildCommandLine(commandLine);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user