Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
289,800
void () { 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 } } }
run
289,801
void () { 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(); }
run
289,802
Runnable (@NotNull ProcessHandler processHandler, @NotNull ExecutionMode mode, final @NotNull String presentableCmdline) { ProcessOutput outputCollected = new ProcessOutput(); processHandler.addProcessListener(new ProcessAdapter() { @Override public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) { String eventText = event.getText(); if (StringUtil.isNotEmpty(eventText)) { if (ProcessOutputType.isStdout(outputType)) { outputCollected.appendStdout(eventText); } else if (ProcessOutputType.isStderr(outputType)) { outputCollected.appendStderr(eventText); } } } }); Throwable invocatorStack = new Throwable(); return new Runnable() { private final Semaphore mySemaphore = new Semaphore(); private final Runnable myProcessRunnable = () -> { try { final boolean finished = processHandler.waitFor(1000L * mode.getTimeout()); if (!finished) { mode.onTimeout(processHandler, presentableCmdline, outputCollected, invocatorStack); processHandler.destroyProcess(); } } finally { mySemaphore.up(); } }; @Override public void run() { mySemaphore.down(); ApplicationManager.getApplication().executeOnPooledThread(myProcessRunnable); OSProcessHandler.checkEdtAndReadAction(processHandler); mySemaphore.waitFor(); } }; }
createTimeLimitedExecutionProcess
289,803
void (@NotNull ProcessEvent event, @NotNull Key outputType) { String eventText = event.getText(); if (StringUtil.isNotEmpty(eventText)) { if (ProcessOutputType.isStdout(outputType)) { outputCollected.appendStdout(eventText); } else if (ProcessOutputType.isStderr(outputType)) { outputCollected.appendStderr(eventText); } } }
onTextAvailable
289,804
void () { mySemaphore.down(); ApplicationManager.getApplication().executeOnPooledThread(myProcessRunnable); OSProcessHandler.checkEdtAndReadAction(processHandler); mySemaphore.waitFor(); }
run
289,805
File (@NotNull Project project) { return new File(TEST_HISTORY_PATH, project.getLocationHash()); }
getTestHistoryRoot
289,806
TestStateStorage (@NotNull Project project) { return project.getService(TestStateStorage.class); }
getInstance
289,807
void (IOException e, String message) { try { if (myMap != null) { try { myMap.close(); } catch (IOException ignore) { } IOUtil.deleteAllFilesStartingWith(myFile); } myMap = initializeMap(); LOG.warn(message, e); } catch (IOException e1) { LOG.error("Cannot repair", e1); myMap = null; } }
thingsWentWrongLetsReinitialize
289,808
int () { // it is ignored return -1; }
getTimeout
289,809
void (@NotNull ProcessHandler processHandler, @NotNull String commandLineString, @NotNull ProcessOutput outputCollected, @Nullable Throwable invocatorStack) { }
onTimeout
289,810
boolean () { return myCancelable; }
cancelable
289,811
boolean () { return myRunInBG; }
inBackGround
289,812
boolean () { return myRunWithModal; }
withModalProgress
289,813
JComponent () { return myProgressParentComponent; }
getProgressParentComponent
289,814
void (final BooleanSupplier shouldCancelFun) { synchronized (CANCEL_FUN_LOCK) { myShouldCancelFun = shouldCancelFun; } }
setShouldCancelFun
289,815
void (final @NotNull ProcessListener listener) { myListeners.add(listener); }
addProcessListener
289,816
List<ProcessListener> () { return myListeners; }
getProcessListeners
289,817
void (boolean isSelected, int exitCode) { if (isSelected) { ProcessCloseConfirmation confirmation = getConfirmation(exitCode, canDisconnect); if (confirmation != null) { GeneralSettings.getInstance().setProcessCloseConfirmation(confirmation); } } }
rememberChoice
289,818
void (@NotNull ProcessEvent event, boolean willBeDestroyed) { alreadyGone.set(true); dialogRemover.run(); }
processWillTerminate
289,819
ProcessCloseConfirmation (int button, boolean withDisconnect) { if (button == 0) return ProcessCloseConfirmation.TERMINATE; if (button == 1 && withDisconnect) return ProcessCloseConfirmation.DISCONNECT; return null; }
getConfirmation
289,820
String () { return stdout; }
getStdout
289,821
String () { return stderr; }
getStderr
289,822
int () { return exitCode; }
getExitCode
289,823
void (@NotNull ProcessEvent event, @NotNull Key outputType) { if (outputType == ProcessOutputTypes.STDERR) { err.append(event.getText()); } else if (outputType == ProcessOutputTypes.SYSTEM) { // skip } else { out.append(event.getText()); } }
onTextAvailable
289,824
void (@NotNull ProcessEvent event) { myExitCode = event.getExitCode(); }
processTerminated
289,825
Output () { return new Output(out.toString(), err.toString(), myExitCode); }
getOutput
289,826
void (@NotNull ExecutionEnvironment environment, boolean showSettings, boolean assignNewId) { executeConfigurationAsync(environment, showSettings, assignNewId, null); }
executeConfiguration
289,827
void (@NotNull ExecutionEnvironment environment, boolean showSettings, boolean assignNewId, @Nullable ProgramRunner.Callback callback) { ExecutionManagerImpl manager = (ExecutionManagerImpl)ExecutionManager.getInstance(environment.getProject()); if (!manager.isStarting(environment)) { if (callback != null) { environment.setCallback(callback); } manager.executeConfiguration(environment, showSettings, assignNewId); } }
executeConfigurationAsync
289,828
void (Project project, @NotNull ExecutionEnvironment environment, Throwable e, RunProfile configuration) { String name = configuration != null ? configuration.getName() : environment.getRunProfile().getName(); String windowId = RunContentManager.getInstance(project).getToolWindowIdByEnvironment(environment); if (configuration instanceof ConfigurationWithCommandLineShortener && ExecutionUtil.isProcessNotCreated(e)) { handleProcessNotStartedError((ConfigurationWithCommandLineShortener)configuration, (ProcessNotCreatedException)e, name, windowId, environment); } else { ExecutionUtil.handleExecutionError(project, windowId, name, e); } }
handleExecutionError
289,829
void (@NotNull ConfigurationWithCommandLineShortener configuration, @NotNull ProcessNotCreatedException e, String name, String windowId, @NotNull ExecutionEnvironment environment) { String description = e.getMessage(); HyperlinkListener listener = null; Project project = configuration.getProject(); RunManager runManager = RunManager.getInstance(project); RunnerAndConfigurationSettings runnerAndConfigurationSettings = ContainerUtil.find(runManager.getAllSettings(), settings -> settings.getConfiguration() == configuration); if (runnerAndConfigurationSettings != null && noShortenerConfigured(configuration)) { ConfigurationFactory factory = runnerAndConfigurationSettings.getFactory(); RunnerAndConfigurationSettings configurationTemplate = runManager.getConfigurationTemplate(factory); ConfigurationWithCommandLineShortener templateConfiguration = (ConfigurationWithCommandLineShortener)configurationTemplate.getConfiguration(); description = ExecutionBundle.message("dialog.message.command.line.too.long", name); String exePath = e.getCommandLine().getExePath(); JdkVersionDetector.JdkVersionInfo jdkVersionInfo = JdkVersionDetector.getInstance().detectJdkVersionInfo(new File(exePath).getParentFile().getParent()); if (jdkVersionInfo != null) { description += "<br/>"; description += ExecutionBundle.message(jdkVersionInfo.version.feature >= 9 ? "dialog.message.command.line.too.long.java9" : "dialog.message.command.line.too.long.java8"); } listener = event -> { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { String eventDescription = event.getDescription(); if ("edit".equals(eventDescription)) { RunDialog.editConfiguration(project, runnerAndConfigurationSettings, ExecutionBundle.message("edit.run.configuration.for.item.dialog.title", name)); } else if (eventDescription != null) { ShortenCommandLine shortener = getShortenerFromLink(eventDescription); if (shortener != null) { configuration.setShortenCommandLine(shortener); if (noShortenerConfigured(templateConfiguration)) { templateConfiguration.setShortenCommandLine(shortener); } } ExecutionUtil.restart(environment); } } }; } ExecutionUtil.handleExecutionError(project, windowId, e, ExecutionBundle.message("error.running.configuration.message", name), description, Function.identity(), listener); }
handleProcessNotStartedError
289,830
ShortenCommandLine (@NotNull String eventDescription) { return switch (eventDescription) { case "args" -> ShortenCommandLine.ARGS_FILE; case "jar" -> ShortenCommandLine.MANIFEST; case "classpath" -> ShortenCommandLine.CLASSPATH_FILE; default -> null; }; }
getShortenerFromLink
289,831
boolean (ConfigurationWithCommandLineShortener configuration) { return configuration.getShortenCommandLine() == null || configuration.getShortenCommandLine() == ShortenCommandLine.NONE; }
noShortenerConfigured
289,832
void (@NotNull RunnerAndConfigurationSettings configuration, @NotNull Executor executor) { ExecutionEnvironmentBuilder builder; try { builder = ExecutionEnvironmentBuilder.create(executor, configuration); } catch (ExecutionException e) { LOG.error(e); return; } executeConfiguration(builder.contentToReuse(null).dataContext(null).activeTarget().build(), true, true); }
executeConfiguration
289,833
Icon (@NotNull RunnerAndConfigurationSettings settings, boolean invalid) { Icon icon = getRawIcon(settings); Icon configurationIcon = settings.isTemporary() ? getTemporaryIcon(icon) : icon; if (invalid) { return new InvalidRunConfigurationIcon(configurationIcon); } return configurationIcon; }
getConfigurationIcon
289,834
Icon (@NotNull RunnerAndConfigurationSettings settings) { Icon icon = settings.getFactory().getIcon(settings.getConfiguration()); return icon == null ? AllIcons.Actions.Help : icon; }
getRawIcon
289,835
Icon (@NotNull Icon rawIcon) { return IconLoader.getTransparentIcon(rawIcon, 0.45f); }
getTemporaryIcon
289,836
void (@NotNull AbstractProperty<Boolean> property, boolean value) { if (myStorage.get(property.getName()) == null) { setValueOf(property, value); } }
setIfUndefined
289,837
void (@NotNull AbstractProperty<Boolean> property, Object value) { myValues.put(property, (Boolean)value); onPropertyChanged(property, (Boolean)value); myStorage.put(property.getName(), value.toString()); }
setValueOf
289,838
boolean (@NotNull AbstractProperty property) { return myValues.containsKey(property); }
hasProperty
289,839
Object (@NotNull AbstractProperty<Boolean> property) { Boolean value = myValues.get(property); if (value == null) { String stringValue = myStorage.get(property.getName()); value = stringValue != null ? Boolean.valueOf(stringValue) : property.getDefault(this); myValues.put(property, value); } return value; }
getValueOf
289,840
void (@NotNull SimpleProgramParameters parameters, @NotNull CommonProgramRunConfigurationParameters configuration) { Project project = configuration.getProject(); Module module = getModule(configuration); Map<String, String> envs = new HashMap<>(); if (configuration instanceof EnvFilesOptions) { envs.putAll(configureEnvsFromFiles((EnvFilesOptions)configuration, true)); } envs.putAll(configuration.getEnvs()); EnvironmentUtil.inlineParentOccurrences(envs); for (Map.Entry<String, String> each : envs.entrySet()) { each.setValue(expandPath(each.getValue(), module, project)); } parameters.setEnv(envs); parameters.getProgramParametersList().patchMacroWithEnvs(envs); String parametersString = expandPathAndMacros(configuration.getProgramParameters(), module, project); parameters.getProgramParametersList().addParametersString(parametersString); parameters.setWorkingDirectory(getWorkingDir(configuration, project, module)); parameters.setPassParentEnvs(configuration.isPassParentEnvs()); }
configureConfiguration
289,841
void (boolean validation) { myValidation = validation; }
setValidation
289,842
DataContext (@NotNull Project project, @Nullable Module module, @Nullable Boolean validationMode) { return dataId -> { if (CommonDataKeys.VIRTUAL_FILE.is(dataId)) return project.getBaseDir(); if (CommonDataKeys.PROJECT.is(dataId)) return project; if (PlatformCoreDataKeys.PROJECT_FILE_DIRECTORY.is(dataId)) return project.getBaseDir(); if (PlatformCoreDataKeys.MODULE.is(dataId) || LangDataKeys.MODULE_CONTEXT.is(dataId)) return module; if (VALIDATION_MODE.is(dataId)) return validationMode; return null; }; }
projectContext
289,843
String (@Nullable String path) { return !StringUtil.isEmpty(path) ? expandMacros(path, DataContext.EMPTY_CONTEXT, false) : path; }
expandMacros
289,844
List<String> (@Nullable String parametersStringWithMacros) { if (StringUtil.isEmpty(parametersStringWithMacros)) { return Collections.emptyList(); } String expandedParametersString = expandMacros(parametersStringWithMacros, createContext(DataContext.EMPTY_CONTEXT), true); return ParametersListUtil.parse(expandedParametersString); }
expandMacrosAndParseParameters
289,845
String (@NotNull String path, @NotNull DataContext fallbackDataContext, boolean applyParameterEscaping) { if (!Registry.is("allow.macros.for.run.configurations")) { return path; } DataContext context = createContext(fallbackDataContext); for (Macro macro : MacroManager.getInstance().getMacros()) { boolean paramsMacro = macro instanceof MacroWithParams; String template = "$" + macro.getName() + (paramsMacro ? "(" : "$"); for (int index = path.indexOf(template); index != -1 && index < path.length() + template.length(); index = path.indexOf(template, index)) { String value; int tailIndex; if (paramsMacro) { int endIndex = path.indexOf(")$", index + template.length()); if (endIndex != -1) { value = StringUtil.notNullize(previewOrExpandMacro(macro, context, path.substring(index + template.length(), endIndex))); tailIndex = endIndex + 2; } else { //noinspection AssignmentToForLoopParameter index += template.length(); continue; } } else { tailIndex = index + template.length(); value = StringUtil.notNullize(previewOrExpandMacro(macro, context)); } if (applyParameterEscaping) { value = ParametersListUtil.escape(value); } path = path.substring(0, index) + value + path.substring(tailIndex); //noinspection AssignmentToForLoopParameter index += value.length(); } } return path; }
expandMacros
289,846
DataContext (@NotNull DataContext fallbackDataContext) { DataContext envContext = ExecutionManagerImpl.getEnvironmentDataContext(); if (fallbackDataContext == DataContext.EMPTY_CONTEXT && envContext != null) { Project project = CommonDataKeys.PROJECT.getData(envContext); Module module = PlatformCoreDataKeys.MODULE.getData(envContext); if (project != null) { fallbackDataContext = projectContext(project, module, null); } } DataContext finalFallbackDataContext = fallbackDataContext; DataContext context = envContext == null ? fallbackDataContext : new DataContext() { @Override public @Nullable Object getData(@NotNull String dataId) { Object data = envContext.getData(dataId); return data != null ? data : finalFallbackDataContext.getData(dataId); } }; return context; }
createContext
289,847
String (@Nullable String path, @Nullable Module module, @NotNull Project project) { // https://youtrack.jetbrains.com/issue/IDEA-190100 // if an old macro is used (because stored in the default project and applied for a new imported project) // and module file stored under .idea, use the new module macro instead if (module != null && PathMacroUtil.DEPRECATED_MODULE_DIR.equals(path) && module.getModuleFilePath().contains("/" + Project.DIRECTORY_STORE_FOLDER + "/") && ExternalProjectSystemRegistry.getInstance().getExternalSource(module) != null /* not really required but to reduce possible impact */) { return getDefaultWorkingDir(module); } path = PathMacroManager.getInstance(project).expandPath(path); if (module != null) { path = PathMacroManager.getInstance(module).expandPath(path); } return path; }
expandPath
289,848
void (SimpleProgramParameters parameters, CommonProgramRunConfigurationParameters configuration) { new ProgramParametersConfigurator().configureConfiguration(parameters, configuration); }
configureConfiguration
289,849
String (CommonProgramRunConfigurationParameters configuration, Project project, Module module) { return new ProgramParametersConfigurator().getWorkingDir(configuration, project, module); }
getWorkingDir
289,850
String (String path, Module module, Project project) { return new ProgramParametersConfigurator().expandPath(path, module, project); }
expandPath
289,851
String (String path, Module module, Project project) { return new ProgramParametersConfigurator().expandPathAndMacros(path, module, project); }
expandPathAndMacros
289,852
boolean (@Nullable String url) { return url != null && url.startsWith(SCHEME); }
isMemoryScriptPath
289,853
String (@NotNull VirtualFile file) { if (file.isInLocalFileSystem()) return file.getPath(); long id = ourFileCounter.incrementAndGet(); String url = SCHEME + id + "/" + file.getName(); ourFilesMap.put(url, file); return url; }
getScriptFilePath
289,854
CharSequence (@NotNull VirtualFile file) { Document document = FileDocumentManager.getInstance().getCachedDocument(file); if (document != null) { return document.getText(); } return LoadTextUtil.loadText(file); }
getContent
289,855
boolean () { if (forceEnable) { return true; } IdeaPluginDescriptorImpl corePluginDescriptor = (IdeaPluginDescriptorImpl)PluginManagerCore.getPlugin(PluginManagerCore.CORE_ID); return corePluginDescriptor != null && corePluginDescriptor.modules.contains(PluginId.getId("com.intellij.modules.run.targets")); }
get
289,856
void (@NotNull Disposable parentDisposable) { if (!ApplicationManager.getApplication().isUnitTestMode()) { throw new IllegalArgumentException("Can only be used in tests"); } forceEnable = true; Disposer.register(parentDisposable, () -> forceEnable = false); }
forceEnable
289,857
EventLogGroup () { return GROUP; }
getGroup
289,858
void (@NotNull Project project, @NotNull String typeId) { TARGET_CREATION_BEGAN_EVENT.log(project, typeId); }
reportTargetCreationBegan
289,859
void (@NotNull Project project, @NotNull String typeId, int currentStep) { TARGET_CREATION_CANCELLED_EVENT.log(project, typeId, currentStep); }
reportTargetCreationCancelled
289,860
void (@NotNull Project project, @NotNull String typeId) { TARGET_CREATION_SUCCEEDED_EVENT.log(project, typeId); }
reportTargetCreationSucceeded
289,861
BoundConfigurable (@NotNull JavaLanguageRuntimeConfiguration config, @NotNull TargetEnvironmentType<? extends TargetEnvironmentConfiguration> targetType, @NotNull Supplier<? extends TargetEnvironmentConfiguration> targetSupplier, @NotNull Project project) { return new JavaLanguageRuntimeUI(config, targetType, targetSupplier, project); }
create
289,862
Configurable () { return new ProjectStartupConfigurable(myProject); }
createConfigurable
289,863
boolean () { return !PlatformUtils.isDataGrip(); }
canCreateConfigurable
289,864
String () { return "preferences.startup.tasks"; }
getId
289,865
String () { return "reference.settings.startup.tasks"; }
getHelpTopic
289,866
JComponent () { myModel = new ProjectStartupTasksTableModel(); myTable = new JBTable(myModel); myTable.setShowGrid(false); myTable.getEmptyText().setText(ExecutionBundle.message("settings.project.startup.add.run.configurations.with.the.button")); TableSpeedSearch.installOn(myTable); DefaultCellEditor defaultEditor = (DefaultCellEditor)myTable.getDefaultEditor(Object.class); defaultEditor.setClickCountToStart(1); myTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); DumbAwareAction.create(e -> { int row = myTable.getSelectedRow(); if (row >= 0 && myModel.isCellEditable(row, ProjectStartupTasksTableModel.IS_SHARED_COLUMN)) { myModel.setValueAt(!Boolean.TRUE.equals(myTable.getValueAt(row, ProjectStartupTasksTableModel.IS_SHARED_COLUMN)), row, ProjectStartupTasksTableModel.IS_SHARED_COLUMN); } }).registerCustomShortcutSet(new CustomShortcutSet(KeyEvent.VK_SPACE), myTable); myTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() >= 2) { editRunConfiguration(); } } }); installRenderers(); myDecorator = ToolbarDecorator.createDecorator(myTable) .setAddAction(this::selectAndAddConfiguration) .setAddIcon(LayeredIcon.ADD_WITH_DROPDOWN) .setEditAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { editRunConfiguration(); } }) .setEditActionUpdater(e -> myTable.getSelectedRow() >= 0) .disableUpAction().disableDownAction(); final JPanel tasksPanel = myDecorator.createPanel(); final JLabel label = new JLabel(ExecutionBundle.message("settings.project.startup.run.tasks.and.tools.via.run.configurations")); label.setForeground(NamedColorUtil.getInactiveTextColor()); label.setHorizontalAlignment(SwingConstants.RIGHT); final JPanel wrapper = new JPanel(new BorderLayout()); wrapper.add(new JLabel(ExecutionBundle.message("settings.project.startup.to.be.started.on.project.opening")), BorderLayout.WEST); wrapper.add(label, BorderLayout.EAST); wrapper.setBorder(BorderFactory.createEmptyBorder(0, 0, UIUtil.DEFAULT_VGAP, 0)); final JPanel main = new JPanel(new BorderLayout()); main.add(wrapper, BorderLayout.NORTH); main.add(tasksPanel, BorderLayout.CENTER); return main; }
createComponent
289,867
void (MouseEvent e) { if (e.getClickCount() >= 2) { editRunConfiguration(); } }
mouseClicked
289,868
void (AnActionButton button) { editRunConfiguration(); }
run
289,869
void () { final int row = myTable.getSelectedRow(); if (row < 0) return; final RunnerAndConfigurationSettings selected = myModel.getAllConfigurations().get(row); final RunManager runManager = RunManager.getInstance(myProject); final RunnerAndConfigurationSettings was = runManager.getSelectedConfiguration(); try { runManager.setSelectedConfiguration(selected); new EditConfigurationsDialog(myProject).showAndGet(); } finally { runManager.setSelectedConfiguration(was); } myModel.fireTableDataChanged(); refreshDataUpdateSelection(selected); }
editRunConfiguration
289,870
void (RunnerAndConfigurationSettings settings) { if (myTable.isEmpty()) return; myModel.reValidateConfigurations(new Processor<>() { private final RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(myProject); @Override public boolean process(RunnerAndConfigurationSettings settings) { return runManager.getConfigurationById(settings.getUniqueID()) != null; } }); if (settings != null) { final List<RunnerAndConfigurationSettings> configurations = myModel.getAllConfigurations(); for (int i = 0; i < configurations.size(); i++) { final RunnerAndConfigurationSettings configuration = configurations.get(i); if (configuration == settings) { TableUtil.selectRows(myTable, new int[]{i}); return; } } } TableUtil.selectRows(myTable, new int[]{0}); myTable.getSelectionModel().setLeadSelectionIndex(0); }
refreshDataUpdateSelection
289,871
boolean (RunnerAndConfigurationSettings settings) { return runManager.getConfigurationById(settings.getUniqueID()) != null; }
process
289,872
Icon () { return IconUtil.getAddIcon(); }
getIcon
289,873
String () { return UIUtil.removeMnemonic(ExecutionBundle.message("add.new.run.configuration.action2.name")); }
getText
289,874
void (final @NotNull Project project, final @NotNull Executor executor, @NotNull DataContext context) { final RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(project); List<ConfigurationType> typesToShow = ContainerUtil.filter(ConfigurationType.CONFIGURATION_TYPE_EP.getExtensionList(), configurationType -> { ConfigurationFactory factory = runManager.getFactory(configurationType, null); return factory != null && ProgramRunner.getRunner(executor.getId(), runManager.getConfigurationTemplate(factory).getConfiguration()) != null; }); final JBPopup popup = NewRunConfigurationPopup.createAddPopup(project, typesToShow, "", factory -> ApplicationManager.getApplication().invokeLater(() -> { final EditConfigurationsDialog dialog = new EditConfigurationsDialog(project, factory); if (dialog.showAndGet()) { ApplicationManager.getApplication().invokeLater(() -> { RunnerAndConfigurationSettings configuration = RunManager.getInstance(project).getSelectedConfiguration(); if (configuration != null) { addConfiguration(configuration); } }, project.getDisposed()); } }, project.getDisposed()), null, null, false); showPopup(button, popup); }
perform
289,875
boolean (Executor executor) { return true; }
available
289,876
void (RunnerAndConfigurationSettings configuration) { if (!ProjectStartupRunnerKt.canBeRun(configuration)) { final String message = ExecutionBundle.message("settings.project.startup.warning", configuration.getName()); final Balloon balloon = JBPopupFactory.getInstance() .createHtmlTextBalloonBuilder(message, MessageType.ERROR, null) .setHideOnClickOutside(true) .setFadeoutTime(3000) .setCloseButtonEnabled(true) .createBalloon(); final RelativePoint rp = new RelativePoint(myDecorator.getActionsPanel(), new Point(5, 5)); balloon.show(rp, Balloon.Position.atLeft); return; } myModel.addConfiguration(configuration); refreshDataUpdateSelection(configuration); }
addConfiguration
289,877
void (final AnActionButton button) { final Executor executor = DefaultRunExecutor.getRunExecutorInstance(); final List<ChooseRunConfigurationPopup.ItemWrapper<?>> wrappers = new ArrayList<>(); wrappers.add(createNewWrapper(button)); var allSettings = ChooseRunConfigurationPopup.createSettingsList(myProject, new ExecutorProvider() { @Override public Executor getExecutor() { return executor; } }, false); final Set<RunnerAndConfigurationSettings> existing = new HashSet<>(myModel.getAllConfigurations()); for (ChooseRunConfigurationPopup.ItemWrapper<?> setting : allSettings) { if (setting.getValue() instanceof RunnerAndConfigurationSettings settings) { if (!settings.isTemporary() && ProjectStartupRunnerKt.canBeRun(settings) && !existing.contains(settings)) { wrappers.add(setting); } } } final JBPopup popup = JBPopupFactory.getInstance() .createPopupChooserBuilder(wrappers) .setRenderer(SimpleListCellRenderer.create((label, value, index) -> { label.setIcon(value.getIcon()); label.setText(value.getText()); })) .setItemChosenCallback((at) -> { if (at.getValue() instanceof RunnerAndConfigurationSettings added) { addConfiguration(added); } else { at.perform(myProject, executor, button.getDataContext()); } }) .createPopup(); showPopup(button, popup); }
selectAndAddConfiguration
289,878
Executor () { return executor; }
getExecutor
289,879
void (AnActionButton button, JBPopup popup) { popup.show(button.getPreferredPopupPoint()); }
showPopup
289,880
boolean () { final ProjectStartupTaskManager projectStartupTaskManager = ProjectStartupTaskManager.getInstance(myProject); final Set<RunnerAndConfigurationSettings> shared = new HashSet<>(projectStartupTaskManager.getSharedConfigurations()); final List<RunnerAndConfigurationSettings> list = new ArrayList<>(shared); list.addAll(projectStartupTaskManager.getLocalConfigurations()); list.sort(ProjectStartupTasksTableModel.RunnerAndConfigurationSettingsComparator.getInstance()); if (!Comparing.equal(list, myModel.getAllConfigurations())) return true; if (!Comparing.equal(shared, myModel.getSharedConfigurations())) return true; return false; }
isModified
289,881
void () { final List<RunnerAndConfigurationSettings> shared = new ArrayList<>(); final List<RunnerAndConfigurationSettings> local = new ArrayList<>(); final Set<RunnerAndConfigurationSettings> sharedSet = myModel.getSharedConfigurations(); final List<RunnerAndConfigurationSettings> allConfigurations = myModel.getAllConfigurations(); for (RunnerAndConfigurationSettings configuration : allConfigurations) { if (sharedSet.contains(configuration)) { shared.add(configuration); } else { local.add(configuration); } } ProjectStartupTaskManager.getInstance(myProject).setStartupConfigurations(shared, local); }
apply
289,882
void () { final ProjectStartupTaskManager projectStartupTaskManager = ProjectStartupTaskManager.getInstance(myProject); myModel.setData(projectStartupTaskManager.getSharedConfigurations(), projectStartupTaskManager.getLocalConfigurations()); refreshDataUpdateSelection(null); }
reset
289,883
void () { final TableColumn checkboxColumn = myTable.getColumnModel().getColumn(ProjectStartupTasksTableModel.IS_SHARED_COLUMN); final String header = checkboxColumn.getHeaderValue().toString(); final FontMetrics fm = myTable.getFontMetrics(myTable.getTableHeader().getFont()); final int width = - new JBCheckBox().getPreferredSize().width + fm.stringWidth(header + "ww"); TableUtil.setupCheckboxColumn(checkboxColumn, width); checkboxColumn.setCellRenderer(new BooleanTableCellRenderer()); myTable.getTableHeader().setResizingAllowed(false); myTable.getTableHeader().setReorderingAllowed(false); final TableColumn nameColumn = myTable.getColumnModel().getColumn(ProjectStartupTasksTableModel.NAME_COLUMN); nameColumn.setCellRenderer(new ColoredTableCellRenderer() { @Override protected void customizeCellRenderer(@NotNull JTable table, @Nullable Object value, boolean selected, boolean hasFocus, int row, int column) { final RunnerAndConfigurationSettings settings = myModel.getAllConfigurations().get(row); setIcon(settings.getConfiguration().getIcon()); append(settings.getName()); } }); }
installRenderers
289,884
void (@NotNull JTable table, @Nullable Object value, boolean selected, boolean hasFocus, int row, int column) { final RunnerAndConfigurationSettings settings = myModel.getAllConfigurations().get(row); setIcon(settings.getConfiguration().getIcon()); append(settings.getName()); }
customizeCellRenderer
289,885
void (@NotNull ProjectStartupConfigurationBase state) { XmlSerializerUtil.copyBean(state, this); }
loadState
289,886
void () { myList.clear(); }
clear
289,887
List<ConfigurationDescriptor> () { return myList; }
getList
289,888
void (final @NotNull List<? extends ConfigurationDescriptor> list) { myList.clear(); list.sort(new ConfigurationDescriptorComparator()); myList.addAll(list); }
setList
289,889
boolean () { return myList.isEmpty(); }
isEmpty
289,890
void (@NotNull Collection<? extends RunnerAndConfigurationSettings> collection) { final List<ConfigurationDescriptor> names = ContainerUtil.map(collection, settings -> new ConfigurationDescriptor(settings.getUniqueID(), settings.getName())); setList(names); }
setConfigurations
289,891
boolean (String id) { final List<ConfigurationDescriptor> list = getList(); final Iterator<ConfigurationDescriptor> iterator = list.iterator(); while (iterator.hasNext()) { final ConfigurationDescriptor descriptor = iterator.next(); if (descriptor.getId().equals(id)) { iterator.remove(); return true; } } return false; }
deleteConfiguration
289,892
boolean (String oldId, RunnerAndConfigurationSettings settings) { final List<ConfigurationDescriptor> list = getList(); for (ConfigurationDescriptor descriptor : list) { if (descriptor.getId().equals(oldId)) { final List<ConfigurationDescriptor> newList = new ArrayList<>(list); newList.remove(descriptor); newList.add(new ConfigurationDescriptor(settings.getUniqueID(), settings.getName())); setList(newList); return true; } } return false; }
rename
289,893
String () { return myId; }
getId
289,894
String () { return myName; }
getName
289,895
void (String id) { myId = id; }
setId
289,896
void (String name) { myName = name; }
setName
289,897
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ConfigurationDescriptor that = (ConfigurationDescriptor)o; if (!myId.equals(that.myId)) return false; if (!myName.equals(that.myName)) return false; return true; }
equals
289,898
int () { int result = myId.hashCode(); result = 31 * result + myName.hashCode(); return result; }
hashCode
289,899
int (ConfigurationDescriptor o1, ConfigurationDescriptor o2) { return o1.getName().compareToIgnoreCase(o2.getName()); }
compare