Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
5,700
boolean () { return true; }
isValidResult
5,701
String (final char symbol) { int position = myPosition; while (position < myChars.length && myChars[position] != symbol) position++; final String result = advanceTo(position); skip(1); return result; }
upTo
5,702
void (final int count) { myPosition = Math.min(myChars.length, myPosition + count); }
skip
5,703
String () { return advanceTo(myChars.length); }
upToEnd
5,704
String (final int position) { final String result = myString.substring(myPosition, position); myPosition = position; return result; }
advanceTo
5,705
int () { final String intString = upTo(PoolOfDelimiters.INTEGER_DELIMITER); return Integer.parseInt(intString); }
readInt
5,706
long () { final String longString = upTo(PoolOfDelimiters.INTEGER_DELIMITER); return Long.parseLong(longString); }
readLong
5,707
char () { myPosition++; return myChars[myPosition - 1]; }
readChar
5,708
boolean () { return myPosition == myChars.length; }
isAtEnd
5,709
String[] () { final int count = readInt(); if (count == 0) return ArrayUtilRt.EMPTY_STRING_ARRAY; final ArrayList<String> strings = new ArrayList<>(count); for (int i = 0; i < count; i++) { strings.add(readLimitedString()); } return strings.toArray(new String[count]); }
readStringArray
5,710
void (final char[] chars) { for (int i = chars.length - 1; i >= 0; i--) { final char aChar = chars[i]; myReadAhead.add(aChar); } }
pushBack
5,711
void (final int aChar) { myReadAhead.add(aChar); }
pushBack
5,712
void (final Runnable runnable) { checkIsDispatchThread(); myListener.onStarted(); try { runnable.run(); } finally{ myListener.onFinished(); } }
addLast
5,713
void () { myCounter++; if (myCounter > 127) { myCounter = 0; LOG.assertTrue(EventQueue.isDispatchThread()); } }
checkIsDispatchThread
5,714
void (final DispatchListener listener) { myListener = listener; }
setDispactchListener
5,715
void () { }
onStarted
5,716
void () { }
onFinished
5,717
void (final PacketProcessor eventsDispatcher) { myEventsDispatcher = eventsDispatcher; }
setEventsDispatcher
5,718
String (final char[] chars) { final StringBuilder buffer = new StringBuilder(); for (int i = 0; i < chars.length; i++) { char chr = chars[i]; final char decodedChar; if (chr == Packet.ourSpecialSymbol) { i++; chr = chars[i]; if (chr != Packet.ourSpecialSymbol) { final StringBuilder codeBuffer = new StringBuilder(Packet.CODE_LENGTH); codeBuffer.append(chr); for (int j = 1; j < Packet.CODE_LENGTH; j++) { codeBuffer.append(chars[i + j]); } i += Packet.CODE_LENGTH - 1; decodedChar = (char)Integer.parseInt(codeBuffer.toString()); } else decodedChar = chr; } else decodedChar = chr; buffer.append(decodedChar); } return buffer.toString(); }
decode
5,719
void (String text, ConsoleViewContentType contentType) {}
onOutput
5,720
void (final DispatchListener listener) { myFulfilledWorkGate.setDispactchListener(listener); }
setDispatchListener
5,721
void () { // wait until all our submitted tasks are executed try { myExecutor.submit(EmptyRunnable.getInstance()).get(); } catch (Exception ignored) { } }
dispose
5,722
void (@NotNull final PacketProcessor packetProcessor, final DeferredActionsQueue queue) { myFulfilledWorkGate = new DeferredActionsQueue() { //todo make it all later @Override public void addLast(final Runnable runnable) { scheduleTask(queue, runnable); } @Override public void setDispactchListener(final DispatchListener listener) { queue.setDispactchListener(listener); } }; myEventsDispatcher = new OutputPacketProcessor() { @Override public void processPacket(final String packet) { myFulfilledWorkGate.addLast(() -> packetProcessor.processPacket(packet)); } @Override public void processOutput(final Printable printable) { LOG.assertTrue(packetProcessor instanceof OutputPacketProcessor); myFulfilledWorkGate.addLast(() -> ((OutputPacketProcessor)packetProcessor).processOutput(printable)); } }; myStream.setEventsDispatcher(myEventsDispatcher); }
setPacketDispatcher
5,723
void (final Runnable runnable) { scheduleTask(queue, runnable); }
addLast
5,724
void (final DispatchListener listener) { queue.setDispactchListener(listener); }
setDispactchListener
5,725
void (final String packet) { myFulfilledWorkGate.addLast(() -> packetProcessor.processPacket(packet)); }
processPacket
5,726
void (final Printable printable) { LOG.assertTrue(packetProcessor instanceof OutputPacketProcessor); myFulfilledWorkGate.addLast(() -> ((OutputPacketProcessor)packetProcessor).processOutput(printable)); }
processOutput
5,727
void (final DeferredActionsQueue queue, final Runnable task) { myTaskQueue.add(task); myExecutor.execute(() -> { final List<Runnable> currentTasks = new ArrayList<>(MAX_TASKS_TO_PROCESS_AT_ONCE); if (myTaskQueue.drainTo(currentTasks, MAX_TASKS_TO_PROCESS_AT_ONCE) > 0) { // there is a requirement that these activities must be run from the swing thread // will be blocking one of pooled threads here, which is ok try { SwingUtilities.invokeAndWait(() -> { for (Runnable task1 : currentTasks) { try { queue.addLast(task1); } catch (Throwable e) { LOG.info(e); } } }); } catch (Throwable e) { LOG.info("Task rejected: " + currentTasks, e); } } }); }
scheduleTask
5,728
OutputPacketProcessor () { return myEventsDispatcher; }
getEventsDispatcher
5,729
Reader () { return new SegmentedInputStreamReader(myStream); }
createReader
5,730
void (final Runnable runnable, final DeferredActionsQueue queue) { scheduleTask(queue, runnable); }
addRequest
5,731
void (int state, int errorCount) { }
buildFinished
5,732
AntConfigurationBase (@NotNull Project project) { return (AntConfigurationBase)AntConfiguration.getInstance(project); }
getInstance
5,733
ExternalizablePropertyContainer () { return myProperties; }
getProperties
5,734
AntConfiguration (final Project project) { return project.getService(AntConfiguration.class); }
getInstance
5,735
void (final Project project) { if (!Boolean.TRUE.equals(project.getUserData(ANT_SUPPORT_INITIALIZED_KEY))) { getInstance(project); project.putUserData(ANT_SUPPORT_INITIALIZED_KEY, Boolean.TRUE); } }
initAntSupport
5,736
Project () { return myProject; }
getProject
5,737
String (Project project) { return ACTION_ID_PREFIX + project.getLocationHash(); }
getActionIdPrefix
5,738
VirtualFile () { return myFile; }
getFile
5,739
String (Element element, Project project) { return getTypeId(); }
writeExternal
5,740
void (@NotNull AnActionEvent e) { myAntBuildMessageView.changeView(); }
actionPerformed
5,741
void (@NotNull AnActionEvent e) { Pair<AntBuildFileBase, AntDomTarget> antTarget = findAntTarget(e); if (antTarget == null) return; ExecutionHandler.runBuild( antTarget.first, Collections.singletonList(antTarget.second.getName().getValue()), null, e.getDataContext(), Collections.emptyList(), AntBuildListener.NULL); }
actionPerformed
5,742
void (@NotNull AnActionEvent e) { final Presentation presentation = e.getPresentation(); Pair<AntBuildFileBase, AntDomTarget> antTarget = findAntTarget(e); if (antTarget == null) { presentation.setEnabled(false); presentation.setText(AntActionsBundle.messagePointer("action.RunTargetAction.text.template", "")); } else { presentation.setEnabled(true); presentation.setText(AntActionsBundle.messagePointer("action.RunTargetAction.text.template", "'" + antTarget.second.getName().getValue() + "'")); } }
update
5,743
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
5,744
void (@NotNull AnActionEvent e) { final Project project = e.getProject(); if (project == null) { return; } final VirtualFile[] contextFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY); if (contextFiles == null || contextFiles.length == 0) { return; } final AntConfiguration antConfiguration = AntConfiguration.getInstance(project); final Set<VirtualFile> files = new HashSet<>(List.of(contextFiles)); for (AntBuildFile buildFile : antConfiguration.getBuildFileList()) { VirtualFile virtualFile = buildFile.getVirtualFile(); if (virtualFile != null) { files.remove(virtualFile); } } int filesAdded = 0; @Nls final StringBuilder errors = new StringBuilder(); for (VirtualFile file : files) { try { if (antConfiguration.addBuildFile(file) != null) { filesAdded++; } } catch (AntNoFileException ex) { String message = ex.getMessage(); if (message == null || message.length() == 0) { message = AntBundle.message("cannot.add.build.files.from.excluded.directories.error.message", ex.getFile().getPresentableUrl()); } if (errors.length() > 0) { errors.append("\n"); } errors.append(message); } } if (errors.length() > 0) { Messages.showWarningDialog(project, errors.toString(), AntBundle.message("cannot.add.build.file.dialog.title")); } if (filesAdded > 0) { ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.ANT_BUILD); if (window == null) { window = ActivateAntToolWindowAction.Manager.createToolWindow(project); } window.activate(null); } }
actionPerformed
5,745
void (@NotNull AnActionEvent e) { final Presentation presentation = e.getPresentation(); final Project project = e.getProject(); if (project != null) { final VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY); if (files != null) { for (VirtualFile file : files) { final PsiFile psiFile = PsiManager.getInstance(project).findFile(file); if (!(psiFile instanceof XmlFile xmlFile)) { continue; } final XmlDocument document = xmlFile.getDocument(); if (document == null) { continue; } final XmlTag rootTag = document.getRootTag(); if (rootTag == null) { continue; } if (!"project".equals(rootTag.getName())) { continue; } if (AntConfigurationBase.getInstance(project).getAntBuildFile(psiFile) != null) { continue; } // found at least one candidate file enable(presentation); return; } } } disable(presentation); }
update
5,746
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
5,747
void (Presentation presentation) { presentation.setEnabledAndVisible(true); }
enable
5,748
void (Presentation presentation) { presentation.setEnabledAndVisible(false); }
disable
5,749
void (@NotNull AnActionEvent e) { myAntBuildMessageView.stopProcess(); }
actionPerformed
5,750
void (@NotNull AnActionEvent event) { Presentation presentation = event.getPresentation(); presentation.setEnabled(!myAntBuildMessageView.isStopped()); }
update
5,751
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
5,752
void (@NotNull AnActionEvent e) { Project project = e.getProject(); if (project == null) return; for (final AntBuildFileBase buildFile : AntConfiguration.getInstance(project).getBuildFileList()) { final String name = buildFile.getPresentableName(); if (name != null && myBuildName.equals(name)) { final List<String> targets = myTargets.size() == 1 && getDefaultTargetName().equals(myTargets.iterator().next()) ? Collections.emptyList() : myTargets; ExecutionHandler.runBuild(buildFile, targets, null, e.getDataContext(), Collections.emptyList(), AntBuildListener.NULL); return; } } }
actionPerformed
5,753
void () { ActionManager.getInstance().unregisterAction(myActionId); myProject = null; }
dispose
5,754
void (@NotNull final AnActionEvent e) { if (myProject == null) { return; } try { final AntConfiguration config = AntConfiguration.getInstance(myProject); // this call will also lead to ant configuration loading final AntConfigurationListener listener = new AntConfigurationListener() { @Override public void configurationLoaded() { config.removeAntConfigurationListener(this); invokeAction(e); } }; config.addAntConfigurationListener(listener); Disposer.register(AntDisposable.getInstance(myProject), new ListenerRemover(config, listener)); } finally { invokeAction(e); Disposer.dispose(this); } }
actionPerformed
5,755
void () { config.removeAntConfigurationListener(this); invokeAction(e); }
configurationLoaded
5,756
void (final AnActionEvent e) { final AnAction action = ActionManager.getInstance().getAction(myActionId); if (action == null || action instanceof TargetActionStub) { return; } if (!myActionInvoked.getAndSet(true)) { //final DataContext context = e.getDataContext(); //if (context instanceof DataManagerImpl.MyDataContext) { // // hack: macro.expand() can cause UI events such as showing dialogs ('Prompt' macro) which may 'invalidate' the datacontext // // since we know exactly that context is valid, we need to update its event count // ((DataManagerImpl.MyDataContext)context).setEventCount(IdeEventQueue.getInstance().getEventCount()); //} action.actionPerformed(e); } }
invokeAction
5,757
void () { final AntConfiguration configuration = myConfig; final AntConfigurationListener listener = myListener; myConfig = null; myListener = null; if (configuration != null && listener != null) { configuration.removeAntConfigurationListener(listener); } }
dispose
5,758
void (@NotNull AnActionEvent e) { myAntExplorer.removeSelectedBuildFiles(); }
actionPerformed
5,759
boolean (@NotNull AnActionEvent event) { return myAntBuildMessageView.isVerboseMode(); }
isSelected
5,760
void (@NotNull AnActionEvent event, boolean flag) { myAntBuildMessageView.setVerboseMode(flag); }
setSelected
5,761
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
5,762
void (@NotNull AnActionEvent e) { myAntExplorer.setBuildFileProperties(); }
actionPerformed
5,763
void (@NotNull AnActionEvent event) { Presentation presentation = event.getPresentation(); AntBuildFileBase selected = event.getUpdateSession() .compute(this, "getBuildFile", ActionUpdateThread.EDT, () -> myAntExplorer.getSelectedFile()); presentation.setEnabled(selected != null && selected.exists()); }
update
5,764
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
5,765
boolean (@NotNull AnActionEvent event) { return myAntBuildMessageView.isOutputPaused(); }
isSelected
5,766
void (@NotNull AnActionEvent event, boolean flag) { myAntBuildMessageView.setOutputPaused(flag); }
setSelected
5,767
void (@NotNull AnActionEvent event) { super.update(event); Presentation presentation = event.getPresentation(); presentation.setEnabled(!myAntBuildMessageView.isStopped() || isSelected(event)); }
update
5,768
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
5,769
void (@NotNull AnActionEvent e) { Project project = e.getProject(); Presentation presentation = e.getPresentation(); presentation.setEnabledAndVisible(project != null); }
update
5,770
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
5,771
void (final AntBuildFile buildFile, final DefaultActionGroup group, final AntConfiguration antConfiguration) { final AntBuildModelBase model = (AntBuildModelBase)buildFile.getModel(); if (model.getDefaultTargetName() != null) { DefaultActionGroup subgroup = new DefaultActionGroup(); subgroup.add(getOrCreateAction( buildFile, TargetAction.getDefaultTargetName(), Collections.singletonList(TargetAction.getDefaultTargetName()), null, model.getDefaultTargetActionId()) ); group.add(subgroup); } final Set<String> addedTargetNames = new HashSet<>(); addGroupOfTargets(buildFile, model.getFilteredTargets(), addedTargetNames, group); addGroupOfTargets(buildFile, antConfiguration.getMetaTargets(buildFile), addedTargetNames, group); }
fillGroup
5,772
void (final AntBuildFile buildFile, final AntBuildTarget[] targets, final Set<? super String> addedTargetNames, final DefaultActionGroup group) { final DefaultActionGroup subgroup = new DefaultActionGroup(); for (final AntBuildTarget target : targets) { final String displayName = target.getName(); if (addedTargetNames.contains(displayName)) { continue; } addedTargetNames.add(displayName); subgroup.add(getOrCreateAction( buildFile, displayName, target.getTargetNames(), target.getNotEmptyDescription(), ((AntBuildTargetBase)target).getActionId() )); } if (subgroup.getChildrenCount() > 0) { group.add(subgroup); } }
addGroupOfTargets
5,773
AnAction (final AntBuildFile buildFile, final @ActionText String displayName, final List<String> targets, final @ActionDescription String targetDescription, final String actionId) { AnAction action = null; if (actionId != null) { action = ActionManager.getInstance().getAction(actionId); } if (action == null) { action = new TargetAction(buildFile, displayName, targets, targetDescription); } return action; }
getOrCreateAction
5,774
String () { return AntBundle.message("action.ant.build.group.text"); }
getTemplateText
5,775
void (@NotNull AnActionEvent e) { ExecutionHandler.runBuild( myAntBuildMessageView.getBuildFile(), myAntBuildMessageView.getTargets(), myAntBuildMessageView, e.getDataContext(), myAntBuildMessageView.getAdditionalProperties(), AntBuildListener.NULL); }
actionPerformed
5,776
void (@NotNull AnActionEvent event) { Presentation presentation = event.getPresentation(); presentation.setEnabled(myAntBuildMessageView.isStopped()); }
update
5,777
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
5,778
void (@NlsSafe String targetName) { myTargets.add(targetName); }
addTarget
5,779
SimpleJavaParameters () { if (myDone) return myCommandLine; ParametersList programParameters = myCommandLine.getProgramParametersList(); for (final String property : myExpandedProperties) { if (property != null) { programParameters.add(property); } } programParameters.add("-buildfile"); programParameters.add(new CompositeParameterTargetedValue().addPathPart(myBuildFilePath)); for (final String target : myTargets) { if (target != null) { programParameters.add(target); } } myDone = true; return myCommandLine; }
getCommandLine
5,780
void (@NlsSafe String[] targets) { ContainerUtil.addAll(myTargets, targets); }
addTargets
5,781
void (Collection<@NlsSafe String> targets) { myTargets.addAll(targets); }
addTargets
5,782
AntMessage (@Nls String text, @AntMessage.Priority int priority) { return null; }
createCustomizedMessage
5,783
ProcessHandler (AntRunConfiguration antRunConfiguration, final DataContext dataContext, List<BuildFileProperty> additionalProperties, @NotNull final AntBuildListener antBuildListener) { AntBuildTarget target = antRunConfiguration.getTarget(); if (target == null) { return null; } Future<ProcessHandler> result = runBuildImpl( (AntBuildFileBase)target.getModel().getBuildFile(), target.getTargetNames(), null, dataContext, additionalProperties, antBuildListener, false ); if (result != null) { try { return result.get(); } catch (InterruptedException | java.util.concurrent.ExecutionException e) { LOG.warn(e); } } return null; }
executeRunConfiguration
5,784
void (final AntBuildFileBase buildFile, String[] targets, @Nullable final AntBuildMessageView buildMessageViewToReuse, final DataContext dataContext, List<BuildFileProperty> additionalProperties, @NotNull final AntBuildListener antBuildListener) { runBuild(buildFile, Arrays.asList(targets), buildMessageViewToReuse, dataContext, additionalProperties, antBuildListener); }
runBuild
5,785
void (final AntBuildFileBase buildFile, List<@NlsSafe String> targets, @Nullable final AntBuildMessageView buildMessageViewToReuse, final DataContext dataContext, List<BuildFileProperty> additionalProperties, @NotNull final AntBuildListener antBuildListener) { runBuildImpl(buildFile, targets, buildMessageViewToReuse, dataContext, additionalProperties, antBuildListener, true); }
runBuild
5,786
Future<ProcessHandler> (final AntBuildFileBase buildFile, List<@NlsSafe String> targets, @Nullable final AntBuildMessageView buildMessageViewToReuse, final DataContext dataContext, List<BuildFileProperty> additionalProperties, @NotNull final AntBuildListener antBuildListener, final boolean waitFor) { final AntBuildMessageView messageView; final TargetEnvironmentRequest request; final SimpleJavaParameters javaParameters; final AntBuildListenerWrapper listenerWrapper = new AntBuildListenerWrapper(buildFile, antBuildListener); final Project project = buildFile.getProject(); try { FileDocumentManager.getInstance().saveAllDocuments(); final AntCommandLineBuilder builder = new AntCommandLineBuilder(); builder.setBuildFile(buildFile.getAllOptions(), VfsUtilCore.virtualToIoFile(buildFile.getVirtualFile())); builder.calculateProperties(dataContext, buildFile.getProject(), additionalProperties); builder.addTargets(targets); builder.getCommandLine().setCharset(EncodingProjectManager.getInstance(buildFile.getProject()).getDefaultCharset()); messageView = prepareMessageView(buildMessageViewToReuse, buildFile, targets, additionalProperties); javaParameters = builder.getCommandLine(); WslTargetEnvironmentConfiguration wslConfiguration = JavaCommandLineState.checkCreateWslConfiguration(javaParameters.getJdk()); if (wslConfiguration != null) { request = new WslTargetEnvironmentRequest(wslConfiguration); } else { request = new LocalTargetEnvironmentRequest(); } project.getMessageBus().syncPublisher(AntExecutionListener.TOPIC).beforeExecution(new AntBeforeExecutionEvent(buildFile, messageView)); } catch (RunCanceledException e) { e.showMessage(project, AntBundle.message("run.ant.error.dialog.title")); listenerWrapper.buildFinished(AntBuildListener.FAILED_TO_RUN, 0); return null; } catch (CantRunException e) { ExecutionErrorDialog.show(e, AntBundle.message("cant.run.ant.error.dialog.title"), project); listenerWrapper.buildFinished(AntBuildListener.FAILED_TO_RUN, 0); return null; } catch (Macro.ExecutionCancelledException e) { listenerWrapper.buildFinished(AntBuildListener.ABORTED, 0); return null; } catch (Throwable e) { listenerWrapper.buildFinished(AntBuildListener.FAILED_TO_RUN, 0); LOG.error(e); return null; } CompletableFuture<ProcessHandler> future = new CompletableFuture<>(); new Task.Backgroundable(buildFile.getProject(), AntBundle.message("ant.build.progress.dialog.title"), true) { @Override public void onCancel() { listenerWrapper.buildFinished(AntBuildListener.ABORTED, 0); } @Override public void run(@NotNull final ProgressIndicator indicator) { try { TargetedCommandLineBuilder builder = javaParameters.toCommandLine(request); TargetEnvironment environment = request.prepareEnvironment(TargetProgressIndicator.EMPTY); TargetedCommandLine commandLine = builder.build(); messageView.setBuildCommandLine(commandLine.getCommandPresentation(environment)); ProcessHandler handler = runBuild(indicator, messageView, buildFile, listenerWrapper, commandLine, environment); future.complete(handler); if (waitFor && handler != null) { handler.waitFor(); } } catch (Throwable e) { LOG.error(e); listenerWrapper.buildFinished(AntBuildListener.FAILED_TO_RUN, 0); } } }.queue(); return future; }
runBuildImpl
5,787
void () { listenerWrapper.buildFinished(AntBuildListener.ABORTED, 0); }
onCancel
5,788
void (@NotNull final ProgressIndicator indicator) { try { TargetedCommandLineBuilder builder = javaParameters.toCommandLine(request); TargetEnvironment environment = request.prepareEnvironment(TargetProgressIndicator.EMPTY); TargetedCommandLine commandLine = builder.build(); messageView.setBuildCommandLine(commandLine.getCommandPresentation(environment)); ProcessHandler handler = runBuild(indicator, messageView, buildFile, listenerWrapper, commandLine, environment); future.complete(handler); if (waitFor && handler != null) { handler.waitFor(); } } catch (Throwable e) { LOG.error(e); listenerWrapper.buildFinished(AntBuildListener.FAILED_TO_RUN, 0); } }
run
5,789
ProcessHandler (@NotNull final ProgressIndicator progress, @NotNull final AntBuildMessageView errorView, @NotNull final AntBuildFileBase buildFile, @NotNull final AntBuildListener antBuildListener, @NotNull TargetedCommandLine commandLine, @NotNull TargetEnvironment targetEnvironment) { final Project project = buildFile.getProject(); final long startTime = System.currentTimeMillis(); LocalHistory.getInstance().putSystemLabel(project, AntBundle.message("ant.build.local.history.label", buildFile.getName())); final AntProcessHandler handler; try { handler = AntProcessHandler.runCommandLine(commandLine, targetEnvironment, progress); } catch (final ExecutionException e) { ApplicationManager.getApplication().invokeLater( () -> ExecutionErrorDialog.show(e, AntBundle.message("could.not.start.process.error.dialog.title"), project)); antBuildListener.buildFinished(AntBuildListener.FAILED_TO_RUN, 0); return null; } processRunningAnt(progress, handler, errorView, buildFile, startTime, antBuildListener); return handler; }
runBuild
5,790
void (final ProgressIndicator progress, final AntProcessHandler handler, final AntBuildMessageView errorView, final AntBuildFileBase buildFile, final long startTime, final AntBuildListener antBuildListener) { final Project project = buildFile.getProject(); final StatusBar statusbar = WindowManager.getInstance().getStatusBar(project); if (statusbar != null) { statusbar.setInfo(AntBundle.message("ant.build.started.status.message")); } final CheckCancelTask checkCancelTask = new CheckCancelTask(progress, handler); checkCancelTask.start(0); final OutputParser parser = OutputParser2.attachParser(project, handler, errorView, progress, buildFile); handler.putUserData(AntRunProfileState.MESSAGE_VIEW, errorView); handler.addProcessListener(new ProcessAdapter() { private final @NlsSafe StringBuilder myUnprocessedStdErr = new StringBuilder(); @Override public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) { if (outputType == ProcessOutputTypes.STDERR) { final String text = event.getText(); synchronized (myUnprocessedStdErr) { myUnprocessedStdErr.append(text); } } } @Override public void processTerminated(@NotNull ProcessEvent event) { final long buildTime = System.currentTimeMillis() - startTime; checkCancelTask.cancel(); parser.setStopped(true); final OutputPacketProcessor dispatcher = handler.getErr().getEventsDispatcher(); try { if (event.getExitCode() != 0) { // in case process exits abnormally, provide all unprocessed stderr content final String unprocessed; synchronized (myUnprocessedStdErr) { unprocessed = myUnprocessedStdErr.toString(); myUnprocessedStdErr.setLength(0); } if (!unprocessed.isEmpty()) { dispatcher.processOutput(new Printable() { @Override public void printOn(Printer printer) { errorView.outputError(unprocessed, AntBuildMessageView.PRIORITY_ERR); } }); } } else { synchronized (myUnprocessedStdErr) { myUnprocessedStdErr.setLength(0); } } } finally { errorView.buildFinished(progress != null && progress.isCanceled(), buildTime, antBuildListener, dispatcher); } } }); handler.startNotify(); }
processRunningAnt
5,791
void (@NotNull ProcessEvent event, @NotNull Key outputType) { if (outputType == ProcessOutputTypes.STDERR) { final String text = event.getText(); synchronized (myUnprocessedStdErr) { myUnprocessedStdErr.append(text); } } }
onTextAvailable
5,792
void (@NotNull ProcessEvent event) { final long buildTime = System.currentTimeMillis() - startTime; checkCancelTask.cancel(); parser.setStopped(true); final OutputPacketProcessor dispatcher = handler.getErr().getEventsDispatcher(); try { if (event.getExitCode() != 0) { // in case process exits abnormally, provide all unprocessed stderr content final String unprocessed; synchronized (myUnprocessedStdErr) { unprocessed = myUnprocessedStdErr.toString(); myUnprocessedStdErr.setLength(0); } if (!unprocessed.isEmpty()) { dispatcher.processOutput(new Printable() { @Override public void printOn(Printer printer) { errorView.outputError(unprocessed, AntBuildMessageView.PRIORITY_ERR); } }); } } else { synchronized (myUnprocessedStdErr) { myUnprocessedStdErr.setLength(0); } } } finally { errorView.buildFinished(progress != null && progress.isCanceled(), buildTime, antBuildListener, dispatcher); } }
processTerminated
5,793
void (Printer printer) { errorView.outputError(unprocessed, AntBuildMessageView.PRIORITY_ERR); }
printOn
5,794
void () { myCanceled = true; }
cancel
5,795
void () { if (!myCanceled) { try { myProgressIndicator.checkCanceled(); start(50); } catch (ProcessCanceledException e) { myProcessHandler.destroyProcess(); } } }
run
5,796
void (final long delay) { AppExecutorUtil.getAppScheduledExecutorService().schedule(this, delay, TimeUnit.MILLISECONDS); }
start
5,797
void (int state, int errorCount) { try { final AntFinishedExecutionEvent.Status status = state == AntBuildListener.ABORTED? AntFinishedExecutionEvent.Status.CANCELED : state == AntBuildListener.FAILED_TO_RUN? AntFinishedExecutionEvent.Status.FAILURE : AntFinishedExecutionEvent.Status.SUCCESS; myBuildFile.getProject().getMessageBus().syncPublisher(AntExecutionListener.TOPIC).buildFinished( new AntFinishedExecutionEvent(myBuildFile, status, errorCount) ); } finally { myDelegate.buildFinished(state, errorCount); } }
buildFinished
5,798
void (boolean useAnsiColor) { myUseAnsiColor = useAnsiColor; }
setUseAnsiColor
5,799
JScrollPane (JTree tree) { JScrollPane scrollPane = MultilineTreeCellRenderer.installRenderer(tree, new MessageTreeRenderer()); scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT)); return scrollPane; }
install