Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
289,700
boolean (@NotNull Project project, @NotNull String line) { return shouldFoldLine(line); }
shouldFoldLine
289,701
boolean () { return true; }
shouldBeAttachedToThePreviousLine
289,702
boolean (@NotNull ConsoleView consoleView) { return true; }
isEnabledForConsole
289,703
RunManagerEx (@NotNull Project project) { return (RunManagerEx)RunManager.getInstance(project); }
getInstanceEx
289,704
void (@Nullable RunnerAndConfigurationSettings configuration) { setSelectedConfiguration(configuration); }
setActiveConfiguration
289,705
void (RunnerAndConfigurationSettings settings, boolean storeInDotIdeaFolder, List<BeforeRunTask> tasks, boolean addTemplateTasksIfAbsent) { if (storeInDotIdeaFolder) { settings.storeInDotIdeaFolder(); } else { settings.storeInLocalWorkspace(); } setBeforeRunTasks(settings.getConfiguration(), tasks, addTemplateTasksIfAbsent); addConfiguration(settings); }
addConfiguration
289,706
Icon (@NotNull RunnerAndConfigurationSettings settings) { return getConfigurationIcon(settings, false); }
getConfigurationIcon
289,707
Collection<RunnerAndConfigurationSettings> () { return getAllSettings(); }
getSortedConfigurations
289,708
void (Project project, RunConfiguration settings, Key<? extends BeforeRunTask> @NotNull ... keys) { for (Key<? extends BeforeRunTask> key : keys) { List<? extends BeforeRunTask> tasks = getInstanceEx(project).getBeforeRunTasks(settings, key); for (BeforeRunTask task : tasks) { task.setEnabled(false); } } }
disableTasks
289,709
int (Project project, RunConfiguration settings, Key<? extends BeforeRunTask> @NotNull ... keys) { return Arrays.stream(keys).mapToInt(key -> getInstanceEx(project).getBeforeRunTasks(settings, key).size()).sum(); }
getTasksCount
289,710
void (@NotNull Element element) { myRedirectInput = Boolean.parseBoolean(JDOMExternalizerUtil.readField(element, REDIRECT_INPUT, "false")); myInputFile = JDOMExternalizerUtil.readField(element, INPUT_FILE); }
readExternal
289,711
void (Element element) { if (myRedirectInput) { JDOMExternalizerUtil.writeField(element, REDIRECT_INPUT, "true"); } if (myInputFile != null) { JDOMExternalizerUtil.writeField(element, INPUT_FILE, myInputFile); } }
writeExternal
289,712
InputRedirectOptionsImpl () { InputRedirectOptionsImpl options = new InputRedirectOptionsImpl(); options.myRedirectInput = myRedirectInput; options.myInputFile = myInputFile; return options; }
copy
289,713
boolean () { return myRedirectInput; }
isRedirectInput
289,714
void (boolean value) { myRedirectInput = value; }
setRedirectInput
289,715
void (String value) { myInputFile = value; }
setRedirectInputPath
289,716
void (@NotNull Executor extension, @NotNull PluginDescriptor pluginDescriptor) { //noinspection TestOnlyProblems initExecutorActions(extension, ActionManager.getInstance()); }
extensionAdded
289,717
void (@NotNull Executor extension, @NotNull PluginDescriptor pluginDescriptor) { deinitExecutor(extension); }
extensionRemoved
289,718
void (@NotNull ActionManager manager) { if (Executor.EXECUTOR_EXTENSION_NAME.hasAnyExtensions()) { ((ExecutorRegistryImpl)getInstance()).init(manager); } }
customize
289,719
boolean (@NotNull Executor executor) { String id = executor.getId(); return id.equals(ToolWindowId.RUN) || id.equals(ToolWindowId.DEBUG) || !Registry.is("executor.actions.submenu", true); }
isExecutorInMainGroup
289,720
void (@NotNull ActionManager actionManager, @NotNull String actionId, @NotNull AnAction anAction, @NotNull String groupId, @NotNull Map<String, AnAction> map) { AnAction action = registerAction(actionManager, actionId, anAction, map); AnAction group = actionManager.getAction(groupId); if (group != null) { ((ActionManagerImpl) actionManager).addToGroup((DefaultActionGroup) group, action, Constraints.LAST); } }
registerActionInGroup
289,721
AnAction (@NotNull ActionManager actionManager, @NotNull String actionId, @NotNull AnAction anAction, @NotNull Map<String, AnAction> map) { AnAction action = actionManager.getAction(actionId); if (action == null) { actionManager.registerAction(actionId, anAction); map.put(actionId, anAction); action = anAction; } return action; }
registerAction
289,722
void (@NotNull String actionId, @NotNull String groupId, @NotNull Map<String, AnAction> map) { ActionManager actionManager = ActionManager.getInstance(); DefaultActionGroup group = (DefaultActionGroup)actionManager.getAction(groupId); if (group == null) { return; } AnAction action = map.get(actionId); if (action != null) { actionManager.unregisterAction(actionId); map.remove(actionId); } else { action = ActionManager.getInstance().getAction(actionId); if (action != null) { group.remove(action, actionManager); } } }
unregisterAction
289,723
Executor (@NotNull String executorId) { // even IJ Ultimate with all plugins has ~7 executors - linear search is ok here for (Executor executor : Executor.EXECUTOR_EXTENSION_NAME.getExtensionList()) { if (executorId.equals(executor.getId())) { return executor; } else if (executor instanceof ExecutorGroup<?> && executorId.startsWith(executor.getId())) { for (Executor child : ((ExecutorGroup<?>)executor).childExecutors()) { if (executorId.equals(child.getId())) { return child; } } } } return null; }
getExecutorById
289,724
void (@NotNull ActionManager actionManager) { for (Executor executor : Executor.EXECUTOR_EXTENSION_NAME.getExtensionList()) { try { //noinspection TestOnlyProblems initExecutorActions(executor, actionManager); } catch (Throwable t) { LOG.error("executor initialization failed: " + executor.getClass().getName(), t); } } }
init
289,725
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
289,726
void (@NotNull AnActionEvent e) { Presentation presentation = e.getPresentation(); Project project = e.getProject(); if (project == null || !project.isInitialized() || project.isDisposed()) { presentation.setEnabled(false); return; } RunnerAndConfigurationSettings selectedSettings = getSelectedConfiguration(e); boolean enabled = false; boolean isLoading = false; boolean runConfigAsksToHideDisabledExecutorButtons = false; String text; if (selectedSettings != null) { if (DumbService.isDumb(project) && !selectedSettings.getType().isDumbAware()) { presentation.setEnabled(false); return; } // We can consider to add spinning to the inlined run actions. But there is a problem with redrawing if (ActionPlaces.NEW_UI_RUN_TOOLBAR.equals(e.getPlace())) { RunStatusHistory startHistory = RunStatusHistory.getInstance(project); isLoading = startHistory.firstOrNull(selectedSettings, it -> (it.getExecutorId().equals(myExecutor.getId()) && it.getState() == RunState.SCHEDULED) ) != null; if (isLoading) { presentation.putClientProperty(ExecutorActionStatus.KEY, ExecutorActionStatus.LOADING); SpinningProgressIcon spinningIcon = presentation.getClientProperty(spinningIconKey); if (spinningIcon == null) { spinningIcon = new SpinningProgressIcon(); spinningIcon.setIconColor(JBUI.CurrentTheme.RunWidget.ICON_COLOR); presentation.putClientProperty(spinningIconKey, spinningIcon); } presentation.setDisabledIcon(spinningIcon); } else { if (!getRunningDescriptors(project, selectedSettings).isEmpty()) { presentation.putClientProperty(ExecutorActionStatus.KEY, ExecutorActionStatus.RUNNING); } else { presentation.putClientProperty(ExecutorActionStatus.KEY, ExecutorActionStatus.NORMAL); } presentation.putClientProperty(spinningIconKey, null); presentation.setDisabledIcon(null); } } presentation.setIcon(getInformativeIcon(project, selectedSettings, e)); RunConfiguration configuration = selectedSettings.getConfiguration(); if (!isSuppressed(project)) { enabled = RunnerHelper.canRun(project, myExecutor, configuration); } if (!(configuration instanceof CompoundRunConfiguration)) { runConfigAsksToHideDisabledExecutorButtons = configuration.hideDisabledExecutorButtons(); } if (enabled) { presentation.setDescription(myExecutor.getDescription()); } if (ExperimentalUI.isNewUI() && needRerunPresentation(selectedSettings.getConfiguration(), getRunningDescriptors(project, selectedSettings))) { if (myExecutor.getId().equals(DefaultRunExecutor.EXECUTOR_ID)) { text = ExecutionBundle.message("run.toolbar.widget.rerun.text", configuration); } else { text = ExecutionBundle.message("run.toolbar.widget.restart.text", myExecutor.getActionName(), configuration.getName()); } } else { text = myExecutor.getStartActionText(configuration.getName()); } } else { if (RunConfigurationsComboBoxAction.hasRunCurrentFileItem(project)) { RunCurrentFileActionStatus status = getRunCurrentFileActionStatus(e, false); enabled = status.myEnabled; text = status.myTooltip; presentation.setIcon(status.myIcon); } else { text = getTemplatePresentation().getTextWithMnemonic(); } } if (!isLoading && (runConfigAsksToHideDisabledExecutorButtons || hideDisabledExecutorButtons())) { presentation.setEnabledAndVisible(enabled); } else { presentation.setEnabled(enabled); } if (presentation.isVisible()) { presentation.setVisible(myExecutor.isApplicable(project)); } presentation.setText(text); }
update
289,727
boolean () { return false; }
hideDisabledExecutorButtons
289,728
RunCurrentFileActionStatus (@NotNull AnActionEvent e, boolean resetCache) { Project project = Objects.requireNonNull(e.getProject()); VirtualFile[] files = FileEditorManager.getInstance(project).getSelectedFiles(); if (files.length == 1) { // There's only one visible editor, let's use the file from this editor, even if the editor is not in focus. PsiFile psiFile = PsiManager.getInstance(project).findFile(files[0]); if (psiFile == null) { String tooltip = ExecutionBundle.message("run.button.on.toolbar.tooltip.current.file.not.runnable"); return RunCurrentFileActionStatus.createDisabled(tooltip, myExecutor.getIcon()); } return getRunCurrentFileActionStatus(psiFile, resetCache, e); } Editor editor = e.getData(CommonDataKeys.EDITOR); if (editor == null) { String tooltip = ExecutionBundle.message("run.button.on.toolbar.tooltip.current.file.no.focused.editor"); return RunCurrentFileActionStatus.createDisabled(tooltip, myExecutor.getIcon()); } PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); VirtualFile vFile = psiFile != null ? psiFile.getVirtualFile() : null; if (psiFile == null || vFile == null || !ArrayUtil.contains(vFile, files)) { // This is probably a special editor, like Python Console, which we don't want to use for the 'Run Current File' feature. String tooltip = ExecutionBundle.message("run.button.on.toolbar.tooltip.current.file.no.focused.editor"); return RunCurrentFileActionStatus.createDisabled(tooltip, myExecutor.getIcon()); } return getRunCurrentFileActionStatus(psiFile, resetCache, e); }
getRunCurrentFileActionStatus
289,729
RunCurrentFileActionStatus (@NotNull PsiFile psiFile, boolean resetCache, @NotNull AnActionEvent e) { List<RunnerAndConfigurationSettings> runConfigs = getRunConfigsForCurrentFile(psiFile, resetCache); if (runConfigs.isEmpty()) { String tooltip = ExecutionBundle.message("run.button.on.toolbar.tooltip.current.file.not.runnable"); return RunCurrentFileActionStatus.createDisabled(tooltip, myExecutor.getIcon()); } List<RunnerAndConfigurationSettings> runnableConfigs = filterConfigsThatHaveRunner(runConfigs); if (runnableConfigs.isEmpty()) { return RunCurrentFileActionStatus.createDisabled(myExecutor.getStartActionText(psiFile.getName()), myExecutor.getIcon()); } Icon icon = myExecutor.getIcon(); if (runnableConfigs.size() == 1) { icon = getInformativeIcon(psiFile.getProject(), runnableConfigs.get(0), e); } else { // myExecutor.getIcon() is the least preferred icon // AllIcons.Actions.Restart is more preferred // Other icons are the most preferred ones (like ExecutionUtil.getLiveIndicator()) for (RunnerAndConfigurationSettings config : runnableConfigs) { Icon anotherIcon = getInformativeIcon(psiFile.getProject(), config, e); if (icon == myExecutor.getIcon() || (anotherIcon != myExecutor.getIcon() && anotherIcon != AllIcons.Actions.Restart)) { icon = anotherIcon; } } } return RunCurrentFileActionStatus.createEnabled(myExecutor.getStartActionText(psiFile.getName()), icon, runnableConfigs); }
getRunCurrentFileActionStatus
289,730
List<RunnerAndConfigurationSettings> (@NotNull PsiFile psiFile, boolean resetCache) { if (resetCache) { psiFile.putUserData(CURRENT_FILE_RUN_CONFIGS_KEY, null); } // Without this cache, an expensive method `ConfigurationContext.getConfigurationsFromContext()` is called too often for 2 reasons: // - there are several buttons on the toolbar (Run, Debug, Profile, etc.), each runs ExecutorAction.update() during each action update session // - the state of the buttons on the toolbar is updated several times a second, even if no files are being edited // The following few lines do pretty much the same as CachedValuesManager.getCachedValue(), but it's implemented without calling that // method because it appeared to be too hard to satisfy both IdempotenceChecker.checkEquivalence() and CachedValueStabilityChecker.checkProvidersEquivalent(). // The reason is that RunnerAndConfigurationSettings class doesn't implement equals(), and that CachedValueProvider would need to capture // ConfigurationContext, which doesn't implement equals() either. // Effectively, we need only one boolean value: whether the action is enabled or not, so it shouldn't be a problem that // RunnerAndConfigurationSettings and ConfigurationContext don't implement equals() and this code doesn't pass CachedValuesManager checks. long psiModCount = PsiModificationTracker.getInstance(psiFile.getProject()).getModificationCount(); RunCurrentFileInfo cache = psiFile.getUserData(CURRENT_FILE_RUN_CONFIGS_KEY); if (cache == null || cache.myPsiModCount != psiModCount) { // The 'Run current file' feature doesn't depend on the caret position in the file, that's why ConfigurationContext is created like this. ConfigurationContext configurationContext = new ConfigurationContext(psiFile); // The 'Run current file' feature doesn't reuse existing run configurations (by design). List<ConfigurationFromContext> configurationsFromContext = configurationContext.createConfigurationsFromContext(); List<RunnerAndConfigurationSettings> runConfigs = configurationsFromContext != null ? ContainerUtil.map(configurationsFromContext, ConfigurationFromContext::getConfigurationSettings) : emptyList(); VirtualFile vFile = psiFile.getVirtualFile(); String filePath = vFile != null ? vFile.getPath() : null; for (RunnerAndConfigurationSettings config : runConfigs) { ((RunnerAndConfigurationSettingsImpl)config).setFilePathIfRunningCurrentFile(filePath); } cache = new RunCurrentFileInfo(psiModCount, runConfigs); psiFile.putUserData(CURRENT_FILE_RUN_CONFIGS_KEY, cache); } return cache.myRunConfigs; }
getRunConfigsForCurrentFile
289,731
List<RunnerAndConfigurationSettings> (@NotNull List<? extends RunnerAndConfigurationSettings> runConfigs) { return ContainerUtil.filter(runConfigs, config -> ProgramRunner.getRunner(myExecutor.getId(), config.getConfiguration()) != null); }
filterConfigsThatHaveRunner
289,732
boolean (Project project) { for (ExecutionActionSuppressor suppressor : ExecutionActionSuppressor.EP_NAME.getExtensionList()) { if (suppressor.isSuppressed(project)) return true; } return false; }
isSuppressed
289,733
Icon (@NotNull Project project, @NotNull RunnerAndConfigurationSettings selectedConfiguration, @NotNull AnActionEvent e) { RunConfiguration configuration = selectedConfiguration.getConfiguration(); if (configuration instanceof RunnerIconProvider provider) { Icon icon = provider.getExecutorIcon(configuration, myExecutor); if (icon != null) { return icon; } } List<RunContentDescriptor> runningDescriptors = getRunningDescriptors(project, selectedConfiguration); if (needRerunPresentation(configuration, runningDescriptors)) { if (ExperimentalUI.isNewUI() && myExecutor.getIcon() != myExecutor.getRerunIcon()) { return myExecutor.getRerunIcon(); } if (DefaultRunExecutor.EXECUTOR_ID.equals(myExecutor.getId())) { return AllIcons.Actions.Restart; } } if (runningDescriptors.isEmpty()) { return myExecutor.getIcon(); } if (runningDescriptors.size() == 1) { return ExecutionUtil.getLiveIndicator(myExecutor.getIcon()); } else { return IconUtil.addText(myExecutor.getIcon(), RunToolbarPopupKt.runCounterToString(e, runningDescriptors.size())); } }
getInformativeIcon
289,734
boolean (RunConfiguration configuration, List<RunContentDescriptor> runningDescriptors) { return !configuration.isAllowRunningInParallel() && !runningDescriptors.isEmpty(); }
needRerunPresentation
289,735
List<RunContentDescriptor> (@NotNull Project project, @NotNull RunnerAndConfigurationSettings selectedConfiguration) { ExecutionManagerImpl executionManager = ExecutionManagerImpl.getInstanceIfCreated(project); if (executionManager == null) return emptyList(); List<RunContentDescriptor> runningDescriptors = executionManager.getRunningDescriptors(s -> ExecutionManagerImplKt.isOfSameType(s, selectedConfiguration)); runningDescriptors = ContainerUtil.filter(runningDescriptors, descriptor -> executionManager.getExecutors(descriptor).contains(myExecutor)); return runningDescriptors; }
getRunningDescriptors
289,736
void (@NotNull Project project, @NotNull RunnerAndConfigurationSettings settings, @NotNull DataContext dataContext) { RunnerHelper.run(project, settings.getConfiguration(), settings, dataContext, myExecutor); }
run
289,737
void (@NotNull AnActionEvent e) { final Project project = e.getProject(); if (project == null || project.isDisposed()) { return; } RunnerAndConfigurationSettings selectedConfiguration = getSelectedConfiguration(e); if (selectedConfiguration != null) { run(project, selectedConfiguration, e.getDataContext()); } else if (RunConfigurationsComboBoxAction.hasRunCurrentFileItem(project)) { runCurrentFile(e); } }
actionPerformed
289,738
void (@NotNull AnActionEvent e) { Project project = Objects.requireNonNull(e.getProject()); List<RunnerAndConfigurationSettings> runConfigs = getRunCurrentFileActionStatus(e, true).myRunConfigs; if (runConfigs.isEmpty()) { return; } if (runConfigs.size() == 1) { doRunCurrentFile(project, runConfigs.get(0), e.getDataContext()); return; } IPopupChooserBuilder<RunnerAndConfigurationSettings> builder = JBPopupFactory.getInstance() .createPopupChooserBuilder(runConfigs) .setRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { RunnerAndConfigurationSettings runConfig = (RunnerAndConfigurationSettings)value; JLabel result = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); result.setIcon(runConfig.getConfiguration().getIcon()); result.setText(runConfig.getName()); return result; } }) .setItemChosenCallback(runConfig -> doRunCurrentFile(project, runConfig, e.getDataContext())); InputEvent inputEvent = e.getInputEvent(); if (inputEvent instanceof MouseEvent) { builder.createPopup().showUnderneathOf(inputEvent.getComponent()); } else { Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor(); if (editor == null) { // Not expected to happen because we are running a file from the current editor. LOG.warn("Run Current File (" + runConfigs + "): getSelectedTextEditor() == null"); return; } builder .setTitle(myExecutor.getActionName()) .createPopup() .showInBestPositionFor(editor); } }
runCurrentFile
289,739
Component (JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { RunnerAndConfigurationSettings runConfig = (RunnerAndConfigurationSettings)value; JLabel result = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); result.setIcon(runConfig.getConfiguration().getIcon()); result.setText(runConfig.getName()); return result; }
getListCellRendererComponent
289,740
void (@NotNull Project project, @NotNull RunnerAndConfigurationSettings runConfig, @NotNull DataContext dataContext) { ExecutionUtil.doRunConfiguration(runConfig, myExecutor, null, null, dataContext); }
doRunCurrentFile
289,741
RunnerAndConfigurationSettings (@NotNull AnActionEvent e) { return myRunConfig; }
getSelectedConfiguration
289,742
boolean () { // no need in a list of disabled actions in the secondary menu of the Run Configuration item in the combo box drop-down menu. return true; }
hideDisabledExecutorButtons
289,743
void (@NotNull AnActionEvent e) { super.update(e); if (myEditConfigBeforeRun) { Presentation presentation = e.getPresentation(); presentation.setText(ExecutionBundle.message("choose.run.popup.edit")); presentation.setDescription(ExecutionBundle.message("choose.run.popup.edit.description")); presentation.setIcon(!ExperimentalUI.isNewUI() ? AllIcons.Actions.EditSource : null); } }
update
289,744
void (@NotNull Project project, @NotNull RunnerAndConfigurationSettings settings, @NotNull DataContext dataContext) { LOG.assertTrue(myRunConfig == settings); if (myEditConfigBeforeRun) { String dialogTitle = ExecutionBundle.message("dialog.title.edit.configuration.settings"); if (!RunDialog.editConfiguration(project, myRunConfig, dialogTitle, myExecutor)) { return; } } super.run(project, myRunConfig, dataContext); RunManager.getInstance(project).setSelectedConfiguration(myRunConfig); }
run
289,745
boolean () { // no need in a list of disabled actions in the secondary menu of the 'Current File' item in the combo box drop-down menu. return true; }
hideDisabledExecutorButtons
289,746
void (@NotNull AnActionEvent e) { Presentation presentation = e.getPresentation(); if (e.getProject() == null || !RunConfigurationsComboBoxAction.hasRunCurrentFileItem(e.getProject())) { presentation.setEnabledAndVisible(false); return; } super.update(e); }
update
289,747
void (@NotNull AnActionEvent e) { super.update(e); Presentation presentation = e.getPresentation(); presentation.setText(ExecutionBundle.message("run.configurations.popup.edit.run.config.and.run.current.file")); presentation.setDescription(ExecutionBundle.message("run.configurations.popup.edit.run.config.and.run.current.file.description")); presentation.setIcon(AllIcons.Actions.EditSource); }
update
289,748
void (@NotNull Project project, @NotNull RunnerAndConfigurationSettings runConfig, @NotNull DataContext dataContext) { String suggestedName = StringUtil.notNullize(((LocatableConfiguration)runConfig.getConfiguration()).suggestedName(), runConfig.getName()); List<String> usedNames = ContainerUtil.map(RunManager.getInstance(project).getAllSettings(), RunnerAndConfigurationSettings::getName); String uniqueName = UniqueNameGenerator.generateUniqueName(suggestedName, "", "", " (", ")", s -> !usedNames.contains(s)); runConfig.setName(uniqueName); String dialogTitle = ExecutionBundle.message("dialog.title.edit.configuration.settings"); if (RunDialog.editConfiguration(project, runConfig, dialogTitle, myExecutor)) { RunManager.getInstance(project).setTemporaryConfiguration(runConfig); super.doRunCurrentFile(project, runConfig, dataContext); } }
doRunCurrentFile
289,749
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
289,750
void (@NotNull AnActionEvent e) { final Project project = e.getProject(); if (project == null || !project.isInitialized() || project.isDisposed()) { e.getPresentation().setEnabled(false); return; } e.getPresentation().setEnabledAndVisible(myExecutorGroup.isApplicable(project)); }
update
289,751
void (@NotNull Project project, @Nullable RunConfiguration configuration, @Nullable RunnerAndConfigurationSettings settings, @NotNull DataContext dataContext, @NotNull Executor executor) { if (settings != null) { RunConfigurationStartHistory.getInstance(project).register(settings); } runSubProcess(project, configuration, settings, dataContext, executor, RunToolbarProcessData.prepareBaseSettingCustomization(settings, null)); }
run
289,752
void (@NotNull Project project, @Nullable RunConfiguration configuration, @Nullable RunnerAndConfigurationSettings settings, @NotNull DataContext dataContext, @NotNull Executor executor, @Nullable Consumer<? super ExecutionEnvironment> environmentCustomization) { if (configuration instanceof CompoundRunConfiguration) { RunManager runManager = RunManager.getInstance(project); for (SettingsAndEffectiveTarget settingsAndEffectiveTarget : ((CompoundRunConfiguration)configuration) .getConfigurationsWithEffectiveRunTargets()) { RunConfiguration subConfiguration = settingsAndEffectiveTarget.getConfiguration(); runSubProcess(project, subConfiguration, runManager.findSettings(subConfiguration), dataContext, executor, environmentCustomization); } } else { ExecutionEnvironmentBuilder builder = settings == null ? null : ExecutionEnvironmentBuilder.createOrNull(executor, settings); if (builder == null) { return; } RunToolbarData rtData = dataContext.getData(RunToolbarData.RUN_TOOLBAR_DATA_KEY); if(rtData != null) { ExecutionTarget target = rtData.getExecutionTarget(); builder = target == null ? builder.activeTarget() : builder.target(target); } else { builder = builder.activeTarget(); } ExecutionEnvironment environment = builder.dataContext(dataContext).build(); if(environmentCustomization != null) environmentCustomization.accept(environment); ExecutionManager.getInstance(project).restartRunProfile(environment); } }
runSubProcess
289,753
boolean (@NotNull Project project, @NotNull Executor executor, RunConfiguration configuration) { List<SettingsAndEffectiveTarget> pairs; if (configuration instanceof CompoundRunConfiguration) { pairs = ((CompoundRunConfiguration)configuration).getConfigurationsWithEffectiveRunTargets(); } else { ExecutionTarget target = ExecutionTargetManager.getActiveTarget(project); pairs = Collections.singletonList(new SettingsAndEffectiveTarget(configuration, target)); } return canRun(project, pairs, executor); }
canRun
289,754
boolean (@NotNull Project project, @NotNull List<SettingsAndEffectiveTarget> pairs, @NotNull Executor executor) { if (pairs.isEmpty()) { return false; } for (SettingsAndEffectiveTarget pair : pairs) { RunConfiguration configuration = pair.getConfiguration(); if (configuration instanceof CompoundRunConfiguration) { if (!canRun(project, ((CompoundRunConfiguration)configuration).getConfigurationsWithEffectiveRunTargets(), executor)) { return false; } continue; } ProgramRunner<?> runner = ProgramRunner.getRunner(executor.getId(), configuration); if (runner == null || !ExecutionTargetManager.canRun(configuration, pair.getTarget()) || ExecutionManager.getInstance(project).isStarting(executor.getId(), runner.getRunnerId())) { return false; } } return true; }
canRun
289,755
RunCurrentFileActionStatus (@Nls @NotNull String tooltip, @NotNull Icon icon) { return new RunCurrentFileActionStatus(false, tooltip, icon, emptyList()); }
createDisabled
289,756
RunCurrentFileActionStatus (@Nls @NotNull String tooltip, @NotNull Icon icon, @NotNull List<RunnerAndConfigurationSettings> runConfigs) { return new RunCurrentFileActionStatus(true, tooltip, icon, runConfigs); }
createEnabled
289,757
void (final Element element) { element.setAttribute(VALUE_ATTRIBUTE, myUrl); }
writeExternal
289,758
String () { return localPathValue(myUrl); }
getLocalPath
289,759
String (String localPath) { return StringUtil.isEmptyOrSpaces(localPath) ? "" : VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, FileUtilRt.toSystemIndependentName(localPath.trim())); }
urlValue
289,760
String (@Nullable String url) { return StringUtil.isEmptyOrSpaces(url) ? "" : FileUtilRt.toSystemDependentName(VirtualFileManager.extractPath(url.trim())); }
localPathValue
289,761
void () { myRenderer.setProjectDefaultTarget(TargetEnvironmentsManager.getInstance(myProject).getDefaultTarget()); hasSavedTargets = false; MyModel model = (MyModel)getModel(); model.removeAllElements(); model.addElement(null); Collection<Type<?>> types = new ArrayList<>(); for (TargetEnvironmentType<?> type : TargetEnvironmentType.getTargetTypesForRunConfigurations()) { if (type.isSystemCompatible() && type.providesNewWizard(myProject, myDefaultRuntimeType)) { types.add(new Type<>(type)); } } if (!types.isEmpty()) { model.addElement(new Separator(ExecutionBundle.message("run.on.targets.label.new.targets"))); for (Type<?> type : types) { model.addElement(type); } } }
initModel
289,762
void (@Nullable LanguageRuntimeType<?> defaultLanguageRuntimeType) { myDefaultRuntimeType = defaultLanguageRuntimeType; }
setDefaultLanguageRuntimeType
289,763
void (@NotNull TargetEnvironmentConfiguration config, int index) { if (!hasSavedTargets) { hasSavedTargets = true; ((MyModel)getModel()).insertElementAt(new Separator(ExecutionBundle.message("run.on.targets.label.saved.targets")), 1); ((MyModel)getModel()).insertElementAt(new LocalTarget(), 2); } ((MyModel)getModel()).insertElementAt(new SavedTarget(config), index); }
addTarget
289,764
void (List<? extends TargetEnvironmentConfiguration> configs) { int index = 3; for (TargetEnvironmentConfiguration config : configs) { addTarget(config, index); index++; } }
addTargets
289,765
void (String configName) { if (configName == null) { setSelectedItem(null); return; } for (int i = 0; i < getModel().getSize(); i++) { Item at = getModel().getElementAt(i); if (at instanceof Target && configName.equals(((Target)at).getTargetName())) { setSelectedItem(at); } } //todo[remoteServers]: add invalid value }
selectTarget
289,766
void () { Object selected = getSelectedItem(); boolean hasErrors = false; if (selected instanceof SavedTarget target) { target.revalidateConfiguration(); hasErrors = target.hasErrors(); } putClientProperty("JComponent.outline", hasErrors ? "error" : null); }
validateSelectedTarget
289,767
Icon () { return icon; }
getIcon
289,768
String () { return myTargetName; }
getTargetName
289,769
void () { try { myConfig.validateConfiguration(); myValidationInfo = null; } catch (RuntimeConfigurationException e) { myValidationInfo = new ValidationInfo(e.getLocalizedMessage()); } }
revalidateConfiguration
289,770
boolean () { return getValidationInfo() != null; }
hasErrors
289,771
Icon () { Icon rawIcon = super.getIcon(); return rawIcon != null && hasErrors() ? new InvalidRunConfigurationIcon(rawIcon) : rawIcon; }
getIcon
289,772
void (Object anObject) { if (anObject instanceof Separator) { return; } if (anObject instanceof Type) { hidePopup(); //noinspection unchecked,rawtypes TargetEnvironmentWizard wizard = ((Type)anObject).createWizard(myProject, myDefaultRuntimeType); if (wizard != null && wizard.showAndGet()) { TargetEnvironmentConfiguration newTarget = wizard.getSubject(); TargetEnvironmentsManager.getInstance(myProject).addTarget(newTarget); addTarget(newTarget, 2); setSelectedIndex(2); } return; } super.setSelectedItem(anObject); }
setSelectedItem
289,773
void (@Nullable TargetEnvironmentConfiguration projectDefaultTarget) { myProjectDefaultTargetItem = projectDefaultTarget != null ? new SavedTarget(projectDefaultTarget) : null; }
setProjectDefaultTarget
289,774
Component (JList<? extends Item> list, Item value, int index, boolean selected, boolean hasFocus) { if (value instanceof Separator) { SeparatorWithText separator = new SeparatorWithText(); separator.setCaption(value.getDisplayName()); return separator; } return super.getListCellRendererComponent(list, value, index, selected, hasFocus); }
getListCellRendererComponent
289,775
void (@NotNull JList<? extends Item> list, Item value, int index, boolean selected, boolean hasFocus) { if (value == null && !myHasSavedTargetsSupplier.get()) { /* `value` is expected to be `null` here */ append(ExecutionBundle.message("local.machine")); setIcon(AllIcons.Nodes.HomeFolder); } else if (value == null) { // this is the project default target append(ExecutionBundle.message("targets.details.project.default")).append(" "); if (myProjectDefaultTargetItem == null) { append(ExecutionBundle.message("local.machine"), SimpleTextAttributes.GRAYED_ATTRIBUTES); setIcon(AllIcons.Nodes.HomeFolder); } else { append(myProjectDefaultTargetItem.getDisplayName(), SimpleTextAttributes.GRAYED_ATTRIBUTES); setIcon(myProjectDefaultTargetItem.icon); } } else { append(value.getDisplayName()); setIcon(value.getIcon()); } }
customizeCellRenderer
289,776
int () { return AdvancedSettings.getInt(RECENTS_LIMIT_KEY); }
getRecentsLimit
289,777
void (int recentsLimit) { AdvancedSettings.setInt(RECENTS_LIMIT_KEY, Math.max(MIN_RECENT_LIMIT, recentsLimit)); }
setRecentsLimit
289,778
void () { if (propertyService != null) { if (propertyService.isValueSet(RECENTS_LIMIT)) { setRecentsLimit(Math.max(MIN_RECENT_LIMIT, StringUtil.parseInt(propertyService.getValue(RECENTS_LIMIT), DEFAULT_RECENT_LIMIT))); propertyService.unsetValue(RECENTS_LIMIT); } if (propertyService.isValueSet(RESTART_REQUIRES_CONFIRMATION)) { setRestartRequiresConfirmation(propertyService.getBoolean(RESTART_REQUIRES_CONFIRMATION)); propertyService.unsetValue(RESTART_REQUIRES_CONFIRMATION); } } }
migrateToAdvancedSettings
289,779
boolean () { return AdvancedSettings.getBoolean(CONFIRM_RERUN_KEY); }
isRestartRequiresConfirmation
289,780
void (boolean restartRequiresConfirmation) { AdvancedSettings.setBoolean(CONFIRM_RERUN_KEY, restartRequiresConfirmation); }
setRestartRequiresConfirmation
289,781
boolean () { return propertyService == null || propertyService.getBoolean(DELETION_FROM_POPUP_REQUIRES_CONFIRMATION, true); }
isDeletionFromPopupRequiresConfirmation
289,782
void (boolean deletionFromPopupRequiresConfirmation) { if (propertyService != null) { propertyService.setValue(DELETION_FROM_POPUP_REQUIRES_CONFIRMATION, deletionFromPopupRequiresConfirmation, true); } }
setDeletionFromPopupRequiresConfirmation
289,783
boolean () { return propertyService == null || propertyService.getBoolean(STOP_INCOMPATIBLE_REQUIRES_CONFIRMATION, true); }
isStopIncompatibleRequiresConfirmation
289,784
void (boolean stopIncompatibleRequiresConfirmation) { if (propertyService != null) { propertyService.setValue(STOP_INCOMPATIBLE_REQUIRES_CONFIRMATION, stopIncompatibleRequiresConfirmation, true); } }
setStopIncompatibleRequiresConfirmation
289,785
void ( final @NotNull Project myProject, final @NotNull List<? extends Exception> errors, final @NotNull @NlsContexts.TabTitle String tabDisplayName, final @Nullable VirtualFile file) { showExceptions(myProject, errors, Collections.emptyList(), tabDisplayName, file); }
showErrors
289,786
void ( final @NotNull Project myProject, final @NotNull List<? extends Exception> errors, final @NotNull List<? extends Exception> warnings, final @NotNull @NlsContexts.TabTitle String tabDisplayName, final @Nullable VirtualFile file) { errors.forEach(it -> { LOG.warn(tabDisplayName + " error: " + it.getMessage()); }); warnings.forEach(it -> { LOG.warn(tabDisplayName + " warning: " + it.getMessage()); }); ApplicationManager.getApplication().invokeLater(() -> { if (myProject.isDisposed()) return; if (errors.isEmpty() && warnings.isEmpty()) { ContentManagerUtil.cleanupContents(null, myProject, tabDisplayName); return; } final ErrorViewPanel errorTreeView = new ErrorViewPanel(myProject); try { openMessagesView(errorTreeView, myProject, tabDisplayName); } catch (NullPointerException e) { String errorText = ""; if (!errors.isEmpty()) { StringBuilder builder = new StringBuilder(); for (final Exception exception : errors) { builder.append("\n"); builder.append(exception.getMessage()); } errorText = ExecutionBundle.message("exception.error.text") + builder; } String warningText = ""; if (!warnings.isEmpty()) { StringBuilder builder = new StringBuilder(); for (final Exception exception : warnings) { builder.append("\n"); builder.append(exception.getMessage()); } warningText = ExecutionBundle.message("warning.error.text") + builder; } Messages.showErrorDialog(errorText + (errorText.isEmpty() || warningText.isEmpty() ? "" : "\n") + warningText, ExecutionBundle.message("execution.error")); return; } addMessages(MessageCategory.ERROR, errors, errorTreeView, file, "Unknown Error"); addMessages(MessageCategory.WARNING, warnings, errorTreeView, file, "Unknown Warning"); ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW).activate(null); }); }
showExceptions
289,787
void ( final int messageCategory, final @NotNull List<? extends Exception> exceptions, @NotNull ErrorViewPanel errorTreeView, final @Nullable VirtualFile file, final @NotNull String defaultMessage) { for (final Exception exception : exceptions) { String message = exception.getMessage(); String[] messages = StringUtil.isNotEmpty(message) ? StringUtil.splitByLines(message) : ArrayUtilRt.EMPTY_STRING_ARRAY; if (messages.length == 0) { messages = new String[]{defaultMessage}; } errorTreeView.addMessage(messageCategory, messages, file, -1, -1, null); } }
addMessages
289,788
void (final @NotNull Project myProject, final @NotNull ProcessOutput output, final @NotNull @NlsContexts.TabTitle String tabDisplayName, final @Nullable VirtualFile file, final boolean activateWindow) { final String stdout = output.getStdout(); final String stderr = output.getStderr(); if (ApplicationManager.getApplication().isUnitTestMode() && !(stdout.isEmpty() || stderr.isEmpty())) { throw new RuntimeException("STDOUT:\n" + stdout + "\nSTDERR:\n" + stderr); } ApplicationManager.getApplication().invokeLater(() -> { if (myProject.isDisposed()) return; final String stdOutTitle = "[Stdout]:"; final String stderrTitle = "[Stderr]:"; final ErrorViewPanel errorTreeView = new ErrorViewPanel(myProject); try { openMessagesView(errorTreeView, myProject, tabDisplayName); } catch (NullPointerException e) { Messages.showErrorDialog(stdOutTitle + "\n" + stdout + "\n" + stderrTitle + "\n" + stderr, ExecutionBundle.message("process.output")); return; } if (!StringUtil.isEmpty(stdout)) { final String[] stdoutLines = StringUtil.splitByLines(stdout); if (stdoutLines.length > 0) { if (StringUtil.isEmpty(stderr)) { // Only stdout available errorTreeView.addMessage(MessageCategory.SIMPLE, stdoutLines, file, -1, -1, null); } else { // both stdout and stderr available, show as groups if (file == null) { errorTreeView.addMessage(MessageCategory.SIMPLE, stdoutLines, stdOutTitle, NonNavigatable.INSTANCE, null, null, null); } else { errorTreeView.addMessage(MessageCategory.SIMPLE, new String[]{stdOutTitle}, file, -1, -1, null); errorTreeView.addMessage(MessageCategory.SIMPLE, new String[]{""}, file, -1, -1, null); errorTreeView.addMessage(MessageCategory.SIMPLE, stdoutLines, file, -1, -1, null); } } } } if (!StringUtil.isEmpty(stderr)) { final String[] stderrLines = StringUtil.splitByLines(stderr); if (stderrLines.length > 0) { if (file == null) { errorTreeView.addMessage(MessageCategory.SIMPLE, stderrLines, stderrTitle, NonNavigatable.INSTANCE, null, null, null); } else { errorTreeView.addMessage(MessageCategory.SIMPLE, new String[]{stderrTitle}, file, -1, -1, null); errorTreeView.addMessage(MessageCategory.SIMPLE, ArrayUtilRt.EMPTY_STRING_ARRAY, file, -1, -1, null); errorTreeView.addMessage(MessageCategory.SIMPLE, stderrLines, file, -1, -1, null); } } } errorTreeView .addMessage(MessageCategory.SIMPLE, new String[]{"Process finished with exit code " + output.getExitCode()}, null, -1, -1, null); if (activateWindow) { ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW).activate(null); } }); }
showOutput
289,789
void (final @NotNull ErrorViewPanel errorTreeView, final @NotNull Project myProject, final @NotNull @NlsContexts.TabTitle String tabDisplayName) { CommandProcessor commandProcessor = CommandProcessor.getInstance(); commandProcessor.executeCommand(myProject, () -> { final MessageView messageView = MessageView.getInstance(myProject); final Content content = ContentFactory.getInstance().createContent(errorTreeView, tabDisplayName, true); messageView.getContentManager().addContent(content); Disposer.register(content, errorTreeView); messageView.getContentManager().setSelectedContent(content); ContentManagerUtil.cleanupContents(content, myProject, tabDisplayName); }, ExecutionBundle.message("open.message.view"), null); }
openMessagesView
289,790
Collection<RunContentDescriptor> (final Project project, final @NotNull NotNullFunction<? super String, Boolean> titleMatcher) { return findRunningConsole(project, selectedContent -> titleMatcher.fun(selectedContent.getDisplayName())); }
findRunningConsoleByTitle
289,791
Collection<RunContentDescriptor> (@NotNull Project project, @NotNull NotNullFunction<? super RunContentDescriptor, Boolean> descriptorMatcher) { return ReadAction.compute(() -> { RunContentManager contentManager = RunContentManager.getInstance(project); final RunContentDescriptor selectedContent = contentManager.getSelectedContent(); if (selectedContent != null) { final ToolWindow toolWindow = contentManager.getToolWindowByDescriptor(selectedContent); if (toolWindow != null && toolWindow.isVisible()) { if (descriptorMatcher.fun(selectedContent)) { return Collections.singletonList(selectedContent); } } } final List<RunContentDescriptor> result = new SmartList<>(); for (RunContentDescriptor runContentDescriptor : contentManager.getAllDescriptors()) { if (descriptorMatcher.fun(runContentDescriptor)) { result.add(runContentDescriptor); } } return result; }); }
findRunningConsole
289,792
List<RunContentDescriptor> (@NotNull Project project, @NotNull NotNullFunction<? super String, Boolean> titleMatcher) { List<RunContentDescriptor> result = new SmartList<>(); for (RunContentDescriptor runContentDescriptor : ExecutionManagerImpl.getAllDescriptors(project)) { if (titleMatcher.fun(runContentDescriptor.getDisplayName())) { result.add(runContentDescriptor); } } return result; }
collectConsolesByDisplayName
289,793
void (final @NotNull DataContext dataContext, final @NotNull Project project, @NotNull Collection<? extends RunContentDescriptor> contentDescriptors, @NlsContexts.PopupTitle String selectDialogTitle, final Consumer<? super RunContentDescriptor> descriptorConsumer) { if (contentDescriptors.size() == 1) { RunContentDescriptor descriptor = contentDescriptors.iterator().next(); descriptorConsumer.consume(descriptor); descriptorToFront(project, descriptor); } else if (ApplicationManager.getApplication().isUnitTestMode()) { LOG.error("Expected a single content descriptor, got " + contentDescriptors); } else if (contentDescriptors.size() > 1) { final Icon icon = DefaultRunExecutor.getRunExecutorInstance().getIcon(); JBPopupFactory.getInstance() .createPopupChooserBuilder(new ArrayList<>(contentDescriptors)) .setRenderer(SimpleListCellRenderer.<RunContentDescriptor>create((label, value, index) -> { label.setText(value.getDisplayName()); label.setIcon(icon); })) .setTitle(selectDialogTitle) .setItemChosenCallback(descriptor -> { descriptorConsumer.consume(descriptor); descriptorToFront(project, descriptor); }) .createPopup() .showInBestPositionFor(dataContext); } }
selectContentDescriptor
289,794
void (final @NotNull Project project, final @NotNull RunContentDescriptor descriptor) { ApplicationManager.getApplication().invokeLater(() -> { RunContentManager manager = RunContentManager.getInstance(project); ToolWindow toolWindow = manager.getToolWindowByDescriptor(descriptor); if (toolWindow != null) { toolWindow.show(null); manager.selectRunContent(descriptor); } }, project.getDisposed()); }
descriptorToFront
289,795
boolean () { return false; }
canHideWarnings
289,796
void (final @Nullable Project myProject, final @NotNull ProcessHandler processHandler, final @NotNull ExecutionMode mode, final @NotNull GeneralCommandLine cmdline) { executeExternalProcess(myProject, processHandler, mode, cmdline.getCommandLineString()); }
executeExternalProcess
289,797
void (final @Nullable Project myProject, final @NotNull ProcessHandler processHandler, final @NotNull ExecutionMode mode, final @NotNull String presentableCmdline) { if (ApplicationManager.getApplication().isUnitTestMode()) { LOG.debug("Running " + presentableCmdline); processHandler.waitFor(); return; } final String title = mode.getTitle() != null ? mode.getTitle() : ExecutionBundle.message("progress.title.please.wait"); final Runnable process; if (mode.cancelable()) { process = createCancelableExecutionProcess(processHandler, mode.shouldCancelFun()); } else { if (mode.getTimeout() <= 0) { process = () -> processHandler.waitFor(); } else { process = createTimeLimitedExecutionProcess(processHandler, mode, presentableCmdline); } } if (mode.withModalProgress() || !mode.inBackGround() && ApplicationManager.getApplication().isDispatchThread()) { ProgressManager.getInstance().runProcessWithProgressSynchronously(process, title, mode.cancelable(), myProject, mode.getProgressParentComponent()); } else if (mode.inBackGround()) { final Task task = new Task.Backgroundable(myProject, title, mode.cancelable()) { @Override public void run(final @NotNull ProgressIndicator indicator) { process.run(); } }; ProgressManager.getInstance().run(task); } else { final String title2 = mode.getTitle2(); final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); if (indicator != null && title2 != null) { indicator.setText2(title2); } process.run(); } }
executeExternalProcess
289,798
void (final @NotNull ProgressIndicator indicator) { process.run(); }
run
289,799
Runnable (@NotNull ProcessHandler processHandler, @Nullable BooleanSupplier cancelableFun) { return new Runnable() { private ProgressIndicator myProgressIndicator; private final Semaphore mySemaphore = new Semaphore(); private final Runnable myWaitThread = () -> { try { processHandler.waitFor(); } finally { mySemaphore.up(); } }; private final Runnable myCancelListener = new Runnable() { @Override public void run() { while (true) { if (myProgressIndicator != null && (myProgressIndicator.isCanceled() || !myProgressIndicator.isRunning()) || cancelableFun != null && cancelableFun.getAsBoolean() || processHandler.isProcessTerminated()) { if (!processHandler.isProcessTerminated()) { try { processHandler.destroyProcess(); } finally { mySemaphore.up(); } } break; } try { synchronized (this) { wait(1000); } } catch (InterruptedException e) { //Do nothing } } } }; @Override public void run() { myProgressIndicator = ProgressManager.getInstance().getProgressIndicator(); if (myProgressIndicator != null && StringUtil.isEmpty(myProgressIndicator.getText())) { myProgressIndicator.setText(ExecutionBundle.message("please.wait")); } LOG.assertTrue(myProgressIndicator != null || cancelableFun != null, "Cancelable process must have an opportunity to be canceled!"); mySemaphore.down(); ApplicationManager.getApplication().executeOnPooledThread(myWaitThread); ApplicationManager.getApplication().executeOnPooledThread(myCancelListener); OSProcessHandler.checkEdtAndReadAction(processHandler); mySemaphore.waitFor(); } }; }
createCancelableExecutionProcess