Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
290,900 | Key<UnknownTask> () { return myId; } | getId |
290,901 | String () { return ExecutionBundle.message("before.launch.run.unknown.task"); } | getName |
290,902 | String (UnknownTask task) { return ExecutionBundle.message("before.launch.run.unknown.task") + " " + myId.toString(); //NON-NLS } | getDescription |
290,903 | boolean (@NotNull RunConfiguration configuration, @NotNull UnknownTask task) { return false; } | canExecuteTask |
290,904 | boolean (@NotNull DataContext context, @NotNull RunConfiguration configuration, @NotNull ExecutionEnvironment env, @NotNull UnknownTask task) { return true; } | executeTask |
290,905 | UnknownTask (@NotNull RunConfiguration runConfiguration) { return new UnknownTask(getId()); } | createTask |
290,906 | void (@NotNull Element element) { myConfig = element; } | readExternal |
290,907 | void (@NotNull Element element) { if (myConfig != null) { element.removeContent(); final List<Attribute> attributes = myConfig.getAttributes(); for (Attribute attribute : attributes) { element.setAttribute(attribute.clone()); } for (Element child : myConfig.getChildren()) { element.addContent(child.clone()); } } } | writeExternal |
290,908 | boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; UnknownTask that = (UnknownTask)o; if (!JDOMUtil.areElementsEqual(myConfig, that.myConfig)) return false; return true; } | equals |
290,909 | int () { int result = super.hashCode(); result = 31 * result + JDOMUtil.hashCode(myConfig, false); return result; } | hashCode |
290,910 | RefactoringElementListener (final PsiElement element) { RefactoringElementListenerComposite composite = null; for (RunConfiguration configuration : RunManager.getInstance(element.getProject()).getAllConfigurationsList()) { if (configuration instanceof RefactoringListenerProvider) { // todo: perhaps better way to handle listeners? RefactoringElementListener listener; try { listener = ((RefactoringListenerProvider)configuration).getRefactoringElementListener(element); } catch (Exception e) { LOG.error(e); continue; } if (listener != null) { if (configuration instanceof LocatableConfiguration) { listener = new NameGeneratingListenerDecorator((LocatableConfiguration)configuration, listener); } if (composite == null) { composite = new RefactoringElementListenerComposite(); } composite.addListener(listener); } } } return composite; } | getListener |
290,911 | void (@NotNull RunnerAndConfigurationSettings settings) { myBeforeRunStepsPanel.doReset(settings); content.beforeRunStepsRow.visible(!(settings.getConfiguration() instanceof WithoutOwnBeforeRunSteps)); content.isAllowRunningInParallelCheckBox.setSelected(settings.getConfiguration().isAllowRunningInParallel()); content.isAllowRunningInParallelCheckBox.setVisible(settings.isTemplate() && settings.getFactory().getSingletonPolicy().isPolicyConfigurable()); if (myRCStorageUi != null) { myRCStorageUi.reset(settings); myRunOnTargetPanel.reset(); } } | doReset |
290,912 | JComponent () { content.componentPlace.setLayout(new BorderLayout()); content.componentPlace.add(myEditor.getComponent(), BorderLayout.CENTER); DataManager.registerDataProvider(content.panel, dataId -> { if (CONFIGURATION_EDITOR_KEY.is(dataId)) { return this; } return null; }); return content.panel; } | createEditor |
290,913 | boolean () { return myRCStorageUi != null && myRCStorageUi.isModified() || myEditor.isSpecificallyModified(); } | isSpecificallyModified |
290,914 | void (final @NotNull RunnerAndConfigurationSettings settings) { myEditor.resetEditorFrom(settings); doReset(settings); } | resetEditorFrom |
290,915 | void (@NotNull RunnerAndConfigurationSettingsImpl settings, boolean isSnapshot) { final RunConfiguration runConfiguration = settings.getConfiguration(); List<BeforeRunTask<?>> tasks = ContainerUtil.copyList(myBeforeRunStepsPanel.getTasks()); RunnerAndConfigurationSettings settingsToApply = null; if (isSnapshot) { runConfiguration.setBeforeRunTasks(tasks); } else { RunManagerImpl runManager = settings.getManager(); runManager.setBeforeRunTasks(runConfiguration, tasks); settingsToApply = runManager.getSettings(runConfiguration); } if (settingsToApply == null) { settingsToApply = settings; } settingsToApply.setEditBeforeRun(myBeforeRunStepsPanel.needEditBeforeRun()); settingsToApply.setActivateToolWindowBeforeRun(myBeforeRunStepsPanel.needActivateToolWindowBeforeRun()); settingsToApply.setFocusToolWindowBeforeRun(myBeforeRunStepsPanel.needFocusToolWindowBeforeRun()); if (content.isAllowRunningInParallelCheckBox.isVisible()) { settings.getConfiguration().setAllowRunningInParallel(content.isAllowRunningInParallelCheckBox.isSelected()); } if (myRCStorageUi != null) { // editing a template run configuration myRCStorageUi.apply(settings); if (!isSnapshot) { myRCStorageUi.reset(settings); // to reset its internal state } } } | doApply |
290,916 | void (@NotNull BeforeRunTask<?> task) { myBeforeRunStepsPanel.addTask(task); } | addBeforeLaunchStep |
290,917 | void (@NotNull List<BeforeRunTask<?>> tasks) { myBeforeRunStepsPanel.replaceTasks(tasks); } | replaceBeforeLaunchSteps |
290,918 | void () { fireEditorStateChanged(); } | fireStepsBeforeRunChanged |
290,919 | void (@NotNull String title) { content.beforeRunStepsRow.setTitle(title); } | titleChanged |
290,920 | void (String targetName) { myEditor.targetChanged(targetName); } | targetChanged |
290,921 | SettingsEditor<RunnerAndConfigurationSettings> (@NotNull RunnerAndConfigurationSettings settings) { SettingsEditor<?> configurationEditor = settings.getConfiguration().getConfigurationEditor(); //noinspection unchecked return configurationEditor instanceof RunConfigurationFragmentedEditor<?> ? new RunnerAndConfigurationSettingsEditor(settings, (RunConfigurationFragmentedEditor<RunConfigurationBase<?>>)configurationEditor) : new ConfigurationSettingsEditorWrapper(settings, (SettingsEditor<RunConfiguration>)configurationEditor); } | createWrapper |
290,922 | boolean () { try { RunnerAndConfigurationSettings original = getSettings(); final RunManagerImpl runManager = ((RunnerAndConfigurationSettingsImpl)original).getManager(); if (!original.isTemplate() && !runManager.hasSettings(original)) { return true; } if (isSpecificallyModified()) { return true; } SettingsEditor<RunnerAndConfigurationSettings> editor = getEditor(); if (editor instanceof ConfigurationSettingsEditorWrapper && !((ConfigurationSettingsEditorWrapper)editor).supportsSnapshots()) { return super.isModified(); } if (!getEditor().isReadyForApply()) { return true; } RunnerAndConfigurationSettings snapshot = getSnapshot(); Element originalXml = ((SerializableScheme)original).writeScheme(); Element snapshotXml = ((SerializableScheme)snapshot).writeScheme(); return !JDOMUtil.areElementsEqual(originalXml, snapshotXml); } catch (ConfigurationException e) { //ignore } return super.isModified(); } | isModified |
290,923 | JComponent () { return wrapWithScrollPane(super.createComponent()); } | createComponent |
290,924 | JBScrollPane (@Nullable JComponent component) { JBScrollPane scrollPane = new JBScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER) { @Override public Dimension getMinimumSize() { Dimension d = super.getMinimumSize(); JViewport viewport = getViewport(); if (viewport != null) { Component view = viewport.getView(); if (view instanceof Scrollable) { d.width = ((Scrollable)view).getPreferredScrollableViewportSize().width; } if (view != null) { d.width = view.getMinimumSize().width; } } d.height = Math.max(d.height, JBUIScale.scale(400)); return d; } }; scrollPane.setBorder(JBUI.Borders.empty()); scrollPane.setViewportBorder(JBUI.Borders.empty()); if (component != null) { scrollPane.getViewport().setView(component); } return scrollPane; } | wrapWithScrollPane |
290,925 | Dimension () { Dimension d = super.getMinimumSize(); JViewport viewport = getViewport(); if (viewport != null) { Component view = viewport.getView(); if (view instanceof Scrollable) { d.width = ((Scrollable)view).getPreferredScrollableViewportSize().width; } if (view != null) { d.width = view.getMinimumSize().width; } } d.height = Math.max(d.height, JBUIScale.scale(400)); return d; } | getMinimumSize |
290,926 | void (@NotNull ConfigurationType extension, @NotNull PluginDescriptor pluginDescriptor) { myTypesToShow = null; myOtherTypes = null; myGroups = null; } | extensionRemoved |
290,927 | void (@NotNull Project project) { root = createDescriptor(project, "<invisible-templates-root>", null); other = createDescriptor(project, ExecutionBundle.message("add.new.run.configuration.other.types.node.text"), root, NodeDescriptor.DEFAULT_WEIGHT + 1); myTypesToShow = new ArrayList<>( RunConfigurable.Companion.configurationTypeSorted(project, true, ConfigurationType.CONFIGURATION_TYPE_EP.getExtensionList(), true)); myOtherTypes = ConfigurationType.CONFIGURATION_TYPE_EP.getExtensionList().stream() .filter(configurationType -> !(configurationType instanceof VirtualConfigurationType)) .collect(Collectors.toList()); myOtherTypes.sort((o1, o2) -> RunConfigurationListManagerHelperKt.compareTypesForUi(o1, o2)); myOtherTypes.removeAll(myTypesToShow); myGroups = createGroups(project, myTypesToShow); } | initStructure |
290,928 | List<GroupDescriptor> (@NotNull Project project, @NotNull List<ConfigurationType> fullList) { return Arrays.asList( //it's just an example, 'how-to' //new GroupDescriptor(project, getRootElement(), AllIcons.FileTypes.Java, "Java", getTypes(fullList, "Application", "JarApplication")), //new GroupDescriptor(project, getRootElement(), AllIcons.RunConfigurations.TestPassed, "Tests", getTypes(fullList, "JUnit", "TestNG")) ); } | createGroups |
290,929 | List<ConfigurationType> (List<ConfigurationType> fullList, String... ids) { List<String> idsList = Arrays.asList(ids); List<ConfigurationType> result = new ArrayList<>(); for (Iterator<ConfigurationType> iterator = fullList.iterator(); iterator.hasNext(); ) { ConfigurationType type = iterator.next(); if (idsList.contains(type.getId())) { result.add(type); //Note, here we remove an element from full 'plain' list as we put the element into some group iterator.remove(); } } return result; } | getTypes |
290,930 | boolean () { return false; } | update |
290,931 | String () { return myName; } | getElement |
290,932 | int () { return DEFAULT_WEIGHT - 1; } | getWeight |
290,933 | void () { myIcon.dispose(); } | dispose |
290,934 | void (Container parent) { // propagate bound to all children for(int i = 0; i< getComponentCount(); i++) { getComponent(i).setBounds(0, 0, getWidth(), getHeight()); } } | layoutContainer |
290,935 | Dimension (Container parent) { return myContent.getPreferredSize(); } | preferredLayoutSize |
290,936 | JComponent () { return myContent; } | getContent |
290,937 | void (Container parent) { Dimension size = myIcon.getPreferredSize(); Dimension preferredSize = myJLabel.getPreferredSize(); int width = getWidth(); int offset = width - size.width - 15 - preferredSize.width; myIcon.setBounds(offset, 0, size.width, size.height); myJLabel.setBounds(offset + size.width + 3, 0, preferredSize.width, size.height); } | layoutContainer |
290,938 | Dimension (Container parent) { return myContent.getPreferredSize(); } | preferredLayoutSize |
290,939 | void () { synchronized (myLock) { flushAllPendingChunks(); } } | dispose |
290,940 | void (@NotNull String text, @NotNull ProcessOutputType outputType, @NotNull Runnable flushRunnable) { long nowNano = getNanoTime(); synchronized (myLock) { ProcessOutputType baseOutputType = outputType.getBaseOutputType(); if (ProcessOutputType.SYSTEM.equals(baseOutputType)) { handleSystemOutput(flushRunnable, nowNano); return; } Boolean textEndsWithNewline = text.isEmpty() ? null : StringUtil.endsWithChar(text, '\n'); if ((myLastFlushedChunkBaseOutputType == null || baseOutputType.equals(myLastFlushedChunkBaseOutputType))) { boolean newlineAdded = !myFlushedChunksEndWithNewline && Boolean.TRUE.equals(textEndsWithNewline); if (textEndsWithNewline != null) { myFlushedChunksEndWithNewline = textEndsWithNewline; } myLastFlushedChunkBaseOutputType = baseOutputType; myLastFlushedChunkCreatedNanoTime = nowNano; flushRunnable.run(); if (newlineAdded && myPendingChunks.size() > 0 && myPendingChunks.get(0).getNanoTimePassedSinceLastFlushedChunk(nowNano) >= AWAIT_SAME_STREAM_TEXT_NANO) { processPendingChunks(nowNano); } return; } Chunk chunk = new Chunk(textEndsWithNewline, baseOutputType, nowNano, myLastFlushedChunkCreatedNanoTime, flushRunnable); myPendingChunks.add(chunk); if (!isProcessingScheduled()) { long delayNano = AWAIT_SAME_STREAM_TEXT_NANO - chunk.getNanoTimePassedSinceLastFlushedChunk(nowNano); if (delayNano <= 0) { processPendingChunks(nowNano); } else { myReschedules++; scheduleProcessPendingChunks(delayNano); } } } } | doWhenStreamsSynchronized |
290,941 | void (@NotNull Runnable flushRunnable, long nowNano) { if (myPendingChunks.isEmpty()) { flushRunnable.run(); return; } Chunk first = myPendingChunks.get(0); // flush after the last pending chunk myPendingChunks.add(new Chunk(null, first.myBaseOutputType, nowNano, myLastFlushedChunkCreatedNanoTime, flushRunnable)); } | handleSystemOutput |
290,942 | void (long nowNano) { synchronized (myLock) { if (myPendingChunks.isEmpty()) { // There could be no pending chunks in the following case: // When pending chunks were processed for the first time, another stream didn't end with a newline => the chunks were re-scheduled. // Then, another stream got a newline => the pending chunks were processed immediately. myReschedules = 0; return; } // All pending chunks should have the same base output type (`chunk.myBaseOutputType`). Chunk eldestChunk = myPendingChunks.get(0); long awaitNano = eldestChunk.getNanoTimePassedSinceLastFlushedChunk(nowNano); if ((awaitNano >= AWAIT_SAME_STREAM_TEXT_NANO && myFlushedChunksEndWithNewline) || myReschedules > (isUnitTestMode ? 10 : 1)) { flushAllPendingChunks(); } if (!myPendingChunks.isEmpty()) { myReschedules++; scheduleProcessPendingChunks(AWAIT_SAME_STREAM_TEXT_NANO); } else { myReschedules = 0; } } } | processPendingChunks |
290,943 | void () { for (Chunk chunk : myPendingChunks) { flush(chunk); } myPendingChunks.clear(); } | flushAllPendingChunks |
290,944 | void (@NotNull Chunk chunk) { if (chunk.myTextEndsWithNewline != null) { myFlushedChunksEndWithNewline = chunk.myTextEndsWithNewline; } myLastFlushedChunkBaseOutputType = chunk.myBaseOutputType; myLastFlushedChunkCreatedNanoTime = chunk.myCreatedNanoTime; chunk.myFlushRunnable.run(); } | flush |
290,945 | void (@NotNull GeneralCommandLine commandLine) { commandLine.withRedirectErrorStream(Registry.is("run.processes.with.redirectedErrorStream", false)); } | redirectErrorStreamIfNeeded |
290,946 | String () { return "ends-with-newline='" + myTextEndsWithNewline + '\'' + ", outputType=" + myBaseOutputType; } | toString |
290,947 | String () { return myTemplate.getConfiguration().getName(); } | getDisplayName |
290,948 | String () { return null; } | getHelpTopic |
290,949 | boolean () { return !tokens.isEmpty() && tokens.peekLast() != CR_TOKEN && StringUtil.endsWithChar(tokens.peekLast().getText(), '\r'); } | hasTrailingCR |
290,950 | void (@NotNull String currentText) { if (StringUtil.startsWith(currentText, "\n")) { TokenInfo last = tokens.removeLast(); String lastTextWithNoCR = last.getText().substring(0, last.length() - 1); if (!lastTextWithNoCR.isEmpty()) { TokenInfo newLast = new TokenInfo(last.contentType, lastTextWithNoCR, last.getHyperlinkInfo()); tokens.addLast(newLast); size --; } return; } removeLastLine(); } | combineTrailingCRWith |
290,951 | void () { // when \r happens, need to delete the last line while (!tokens.isEmpty() && tokens.peekLast() != CR_TOKEN) { TokenInfo last = tokens.removeLast(); String text = last.getText(); int lfIndex = text.lastIndexOf('\n'); if (lfIndex != -1) { // split token TokenInfo newToken = new TokenInfo(last.contentType, text.substring(0, lfIndex + 1), last.getHyperlinkInfo()); tokens.addLast(newToken); size -= text.length() - newToken.length(); return; } // remove the token entirely, move to the previous size -= text.length(); } if (tokens.isEmpty()) { // \r at the very beginning. return CR_TOKEN to signal this tokens.addLast(CR_TOKEN); size ++; } } | removeLastLine |
290,952 | void () { // toss tokens from the beginning until size became < maxCapacity int excess = size - maxCapacity; while (excess > startIndex) { TokenInfo info = tokens.getFirst(); int length = info.length(); if (length > excess) { // slice a part of this info startIndex = excess; break; } startIndex = 0; tokens.removeFirst(); size -= info.length(); excess = size - maxCapacity; } assert startIndex >= 0 && size >= 0 && maxCapacity >= 0: "startIndex="+startIndex+"; size="+size+"; maxCapacity="+maxCapacity; //assert tokens.toList().stream().mapToInt(TokenInfo::length).sum() == size; } | trim |
290,953 | CharSequence (@NotNull List<? extends TokenInfo> tokens) { int size = 0; for (TokenInfo token : tokens) { size += token.getText().length(); } StringBuilder result = new StringBuilder(size); for (TokenInfo token : tokens) { result.append(token.getText()); } return result.toString(); } | getRawText |
290,954 | List<TokenInfo> () { List<TokenInfo> list = tokens.isEmpty() ? Collections.emptyList() : new ArrayList<>(tokens); if (startIndex != 0) { // slice the first token TokenInfo first = list.get(0); TokenInfo sliced = new TokenInfo(first.contentType, first.getText().substring(startIndex), first.getHyperlinkInfo()); return ContainerUtil.concat(Collections.singletonList(sliced), list.subList(1, list.size())); } return list; } | getInfos |
290,955 | String () { return contentType + "[" + length() + "]"; } | toString |
290,956 | String () { return getRawText(getInfos()).toString(); } | toString |
290,957 | RunConfigurable () { return (RunConfigurable)super.getConfigurable(); } | getConfigurable |
290,958 | void (final @NotNull ConfigurationFactory factory) { final RunConfigurable configurable = getConfigurable(); final SingleConfigurationConfigurable<RunConfiguration> configuration = configurable.createNewConfiguration(factory); if (!isVisible()) { getContentPanel().addComponentListener(new ComponentAdapter() { @Override public void componentShown(ComponentEvent e) { configurable.updateRightPanel(configuration); getContentPanel().removeComponentListener(this); } }); } } | addRunConfiguration |
290,959 | void (ComponentEvent e) { configurable.updateRightPanel(configuration); getContentPanel().removeComponentListener(this); } | componentShown |
290,960 | void () { RunConfigurable configurable = getConfigurable(); super.doOKAction(); if (isOK()) { // if configurable was not modified, apply was not called and Run Configurable has not called 'updateActiveConfigurationFromSelected' configurable.updateActiveConfigurationFromSelected(); } } | doOKAction |
290,961 | DialogStyle () { return DialogStyle.COMPACT; } | getStyle |
290,962 | void (ActionEvent e) { SingleConfigurationConfigurable<RunConfiguration> selected = getConfigurable().getSelectedConfiguration(); LOG.assertTrue(selected != null, "No configuration selected"); LOG.assertTrue(myExecutor != null, "No executor selected"); ExecutorRegistryImpl.RunnerHelper.run(myProject, selected.getConfiguration(), selected.getSettings(), Objects.requireNonNull(myDataContext), myExecutor); doOKAction(); } | actionPerformed |
290,963 | JButton (Action action) { if (action == myRunAction) { JBOptionButton button = new JBOptionButton(action, null); button.setAddSeparator(false); button.setOptionTooltipText(getDefaultTooltip()); button.setIconTextGap(JBUI.CurrentTheme.ActionsList.elementIconGap()); return button; } return super.createJButtonForAction(action); } | createJButtonForAction |
290,964 | void (@Nullable RunnerAndConfigurationSettings selected) { if (myRunAction == null) return; Executor executor = null; if (selected != null) { executor = ExecutionManagerImpl.getInstance(myProject).getRecentExecutor(selected); } if (executor == null) { executor = ExecutorRegistry.getInstance().getExecutorById(DefaultRunExecutor.EXECUTOR_ID); if (executor != null && selected != null && !canRun(selected, executor)) { executor = ExecutorRegistry.getInstance().getExecutorById(ToolWindowId.DEBUG); if (executor != null && !canRun(selected, executor)) { executor = null; } } } updateRunButton(executor, selected); } | updateSelectedExecutor |
290,965 | boolean (@Nullable RunnerAndConfigurationSettings settings, Executor executor) { return settings != null && ExecutorRegistryImpl.RunnerHelper.canRun(myProject, executor, settings.getConfiguration()); } | canRun |
290,966 | void (@Nullable Executor executor, @Nullable RunnerAndConfigurationSettings selected) { myExecutor = executor; JBOptionButton button = (JBOptionButton)Objects.requireNonNull(getButton(Objects.requireNonNull(myRunAction))); button.setVisible(executor != null && myDataContext != null); button.setEnabled(executor != null && myDataContext != null); if (executor != null) { myRunAction.putValue(Action.NAME, executor.getActionName()); button.setText(executor.getActionName()); button.setIcon(executor.getIcon()); myExecutorActions.forEach(action -> action.unregisterCustomShortcutSet(getContentPanel())); myExecutorActions.clear(); if (selected != null) { ExecutorRegistryImpl.ExecutorAction action = createAction(selected, executor); DefaultActionGroup group = new DefaultActionGroup(); RunConfigurationsComboBoxAction.addExecutorActions(group, exec -> createAction(selected, exec), exec -> exec != executor); button.setOptions(Arrays.asList(group.getChildren(null))); button.setToolTipText(UIUtil.removeMnemonic(executor.getStartActionText(selected.getName())) + " (" + KeymapUtil.getFirstKeyboardShortcutText(action) + ")"); } } } | updateRunButton |
290,967 | void (@NotNull AnActionEvent e) { run(myProject, selected, Objects.requireNonNull(myDataContext)); doOKAction(); } | actionPerformed |
290,968 | RunnerAndConfigurationSettings (@NotNull AnActionEvent e) { return selected; } | getSelectedConfiguration |
290,969 | boolean () { return true; } | hideDisabledExecutorButtons |
290,970 | void () { if (myExecutor != null && myRunAction == null) { updateDialogForSingleExecutor(); } else { SingleConfigurationConfigurable<RunConfiguration> configurable = getConfigurable().getSelectedConfiguration(); updateSelectedExecutor(configurable == null ? null : configurable.getSettings()); } } | updateDialog |
290,971 | void () { @Nls StringBuilder buffer = new StringBuilder(); buffer.append(myExecutor.getId()); SingleConfigurationConfigurable<RunConfiguration> configuration = getConfigurable().getSelectedConfiguration(); if (configuration != null) { buffer.append(" - "); buffer.append(configuration.getNameText()); ReadAction.nonBlocking(() -> canRun(configuration.getSettings(), myExecutor)) .finishOnUiThread(ModalityState.current(), b -> setOKActionEnabled(b)) .expireWith(getDisposable()) .submit(AppExecutorUtil.getAppExecutorService()); } setTitle(buffer.toString()); } | updateDialogForSingleExecutor |
290,972 | ActionButton () { PopupState<Balloon> state = PopupState.forBalloon(); AnAction showStoragePathAction = new DumbAwareAction() { @Override public void actionPerformed(@NotNull AnActionEvent e) { if (!state.isRecentlyHidden()) manageStorageFileLocation(state); } }; Presentation presentation = new Presentation(ExecutionBundle.message("run.configuration.manage.file.location")); presentation.setIcon(GEAR_WITH_DROPDOWN_ICON); presentation.setDisabledIcon(GEAR_WITH_DROPDOWN_DISABLED_ICON); return new ActionButton(showStoragePathAction, presentation, ActionPlaces.TOOLBAR, ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE); } | createStoreAsFileGearButton |
290,973 | void (@NotNull AnActionEvent e) { if (!state.isRecentlyHidden()) manageStorageFileLocation(state); } | actionPerformed |
290,974 | void (@Nullable PopupState<Balloon> state) { Disposable balloonDisposable = Disposer.newDisposable(); Function<String, String> pathToErrorMessage = path -> getErrorIfBadFolderPathForStoringInArbitraryFile(myProject, path); RunConfigurationStoragePopup popup = new RunConfigurationStoragePopup(myProject, getDotIdeaStoragePath(myProject), pathToErrorMessage, balloonDisposable); Balloon balloon = JBPopupFactory.getInstance().createBalloonBuilder(popup.getMainPanel()) .setDialogMode(true) .setBorderInsets(JBUI.insets(20, 15, 10, 15)) .setFillColor(UIUtil.getPanelBackground()) .setHideOnAction(false) .setHideOnLinkClick(false) .setHideOnKeyOutside(false) // otherwise any keypress in file chooser hides the underlying balloon .setBlockClicksThroughBalloon(true) .setRequestFocus(true) .createBalloon(); balloon.setAnimationEnabled(false); String path = myRCStorageType == RCStorageType.DotIdeaFolder ? getDotIdeaStoragePath(myProject) : StringUtil.notNullize(myFolderPathIfStoredInArbitraryFile); Set<String> pathsToSuggest = new LinkedHashSet<>(); if (getErrorIfBadFolderPathForStoringInArbitraryFile(myProject, path) == null) { pathsToSuggest.add(path); } if (myRCStorageTypeInitial == RCStorageType.ArbitraryFileInProject && myFolderPathIfStoredInArbitraryFileInitial != null) { pathsToSuggest.add(myFolderPathIfStoredInArbitraryFileInitial); } pathsToSuggest.add(getDotIdeaStoragePath(myProject)); pathsToSuggest.addAll(getFolderPathsWithinProjectWhereRunConfigurationsStored(myProject)); popup.reset(path, pathsToSuggest, () -> balloon.hide()); balloon.addListener(new JBPopupListener() { @Override public void onClosed(@NotNull LightweightWindowEvent event) { Disposer.dispose(balloonDisposable); String newPath = popup.getPath(); if (!newPath.equals(path)) { applyChangedStoragePath(newPath); if (myOnModifiedRunnable != null) { myOnModifiedRunnable.run(); } } } }); if (state != null) state.prepareToShow(balloon); balloon.show(RelativePoint.getSouthOf(myStoreAsFileCheckBox), Balloon.Position.below); } | manageStorageFileLocation |
290,975 | void (@NotNull LightweightWindowEvent event) { Disposer.dispose(balloonDisposable); String newPath = popup.getPath(); if (!newPath.equals(path)) { applyChangedStoragePath(newPath); if (myOnModifiedRunnable != null) { myOnModifiedRunnable.run(); } } } | onClosed |
290,976 | void (String newPath) { if (newPath.equals(getDotIdeaStoragePath(myProject))) { myRCStorageType = RCStorageType.DotIdeaFolder; myFolderPathIfStoredInArbitraryFile = null; } else { myRCStorageType = RCStorageType.ArbitraryFileInProject; myFolderPathIfStoredInArbitraryFile = newPath; } validatePath(); } | applyChangedStoragePath |
290,977 | void () { ReadAction.nonBlocking(this::checkPathAndGetErrorIcon) .expireWhen(() -> !myStoreAsFileGearButton.isShowing()) .finishOnUiThread(ModalityState.defaultModalityState(), myStoreAsFileGearButton::setIcon) .submit(NonUrgentExecutor.getInstance()); } | validatePath |
290,978 | Icon () { if (myStoreAsFileCheckBox.isSelected() && myRCStorageType == RCStorageType.ArbitraryFileInProject && getErrorIfBadFolderPathForStoringInArbitraryFile(myProject, myFolderPathIfStoredInArbitraryFile) != null) { return GEAR_WITH_DROPDOWN_ERROR_ICON; } return GEAR_WITH_DROPDOWN_ICON; } | checkPathAndGetErrorIcon |
290,979 | void () { // all that tricky logic, see the flowchart from the issue description https://youtrack.jetbrains.com/issue/UX-1126 // 1. If this RC had been shared before Run Configurations dialog was opened - use the state that was used before. // This handles the case when user opens shared RC for editing and clicks the 'Save to file' check box two times. if (myRCStorageTypeInitial == RCStorageType.DotIdeaFolder) { myRCStorageType = RCStorageType.DotIdeaFolder; myFolderPathIfStoredInArbitraryFile = null; return; } if (myRCStorageTypeInitial == RCStorageType.ArbitraryFileInProject) { myRCStorageType = RCStorageType.ArbitraryFileInProject; myFolderPathIfStoredInArbitraryFile = StringUtil.notNullize(myFolderPathIfStoredInArbitraryFileInitial); return; } // 2. For IPR-based projects keep using project.ipr file to store RCs by default if (!ProjectKt.isDirectoryBased(myProject)) { myRCStorageType = RCStorageType.DotIdeaFolder; myFolderPathIfStoredInArbitraryFile = null; return; } // Rider prefers project_base_dir/.run/ folder to .idea/runConfigurations/ if (!PlatformUtils.isRider()) { // 3. If the project is not under VCS, keep using .idea/runConfigurations RunConfigurationVcsSupport vcsSupport = myProject.getService(RunConfigurationVcsSupport.class); if (!vcsSupport.hasActiveVcss(myProject)) { myRCStorageType = RCStorageType.DotIdeaFolder; myFolderPathIfStoredInArbitraryFile = null; return; } // 4. If .idea/runConfigurations is not excluded from VCS (e.g. not in .gitignore), then use it if (!isDotIdeaStorageVcsIgnored(vcsSupport)) { myRCStorageType = RCStorageType.DotIdeaFolder; myFolderPathIfStoredInArbitraryFile = null; return; } } // notNullize is to make inspections happy. Paths can't be null for non-default project VirtualFile baseDir = LocalFileSystem.getInstance().findFileByPath(StringUtil.notNullize(myProject.getBasePath())); LOG.assertTrue(baseDir != null); // 5. If project base dir is not within project content, use .idea/runConfigurations // In Rider baseDir always not in the project content by design after migration to the new workspace model. if (!PlatformUtils.isRider() && !ProjectFileIndex.getInstance(myProject).isInContent(baseDir)) { myRCStorageType = RCStorageType.DotIdeaFolder; myFolderPathIfStoredInArbitraryFile = null; return; } // 6. If there are other RCs stored in arbitrary files (and all in the same folder) - suggest that folder Collection<String> otherFolders = getFolderPathsWithinProjectWhereRunConfigurationsStored(myProject); if (otherFolders.size() == 1) { myRCStorageType = RCStorageType.ArbitraryFileInProject; myFolderPathIfStoredInArbitraryFile = otherFolders.iterator().next(); return; } // default is .../project_base_dir/.run/ folder myRCStorageType = RCStorageType.ArbitraryFileInProject; myFolderPathIfStoredInArbitraryFile = baseDir.getPath() + "/.run"; } | setStorageTypeAndPathToTheBestPossibleState |
290,980 | boolean (RunConfigurationVcsSupport vcsSupport) { if (myDotIdeaStorageVcsIgnored == null) { myDotIdeaStorageVcsIgnored = vcsSupport.isDirectoryVcsIgnored(myProject, getDotIdeaStoragePath(myProject)); } return myDotIdeaStorageVcsIgnored.booleanValue(); } | isDotIdeaStorageVcsIgnored |
290,981 | Collection<String> (@NotNull Project project) { Set<String> result = new HashSet<>(); for (RunnerAndConfigurationSettings settings : RunManager.getInstance(project).getAllSettings()) { String filePath = settings.getPathIfStoredInArbitraryFileInProject(); // two conditions on the next line are effectively equivalent, this is to make inspections happy if (settings.isStoredInArbitraryFileInProject() && filePath != null) { result.add(PathUtil.getParentPath(filePath)); } } return result; } | getFolderPathsWithinProjectWhereRunConfigurationsStored |
290,982 | JPanel () { return FormBuilder.createFormBuilder().setFormLeftIndent(10).setHorizontalGap(0) .addLabeledComponent(myStoreAsFileCheckBox, myStoreAsFileGearButton) .getPanel(); } | createComponent |
290,983 | void (ActionListener listener) { myStoreAsFileCheckBox.addActionListener(listener); } | addStoreAsFileCheckBoxListener |
290,984 | boolean () { return myRCStorageType == RCStorageType.DotIdeaFolder || myRCStorageType == RCStorageType.ArbitraryFileInProject; } | isStoredInFile |
290,985 | boolean () { if (myRCStorageType != myRCStorageTypeInitial) return true; if (myRCStorageType == RCStorageType.ArbitraryFileInProject && !Objects.equals(myFolderPathIfStoredInArbitraryFileInitial, myFolderPathIfStoredInArbitraryFile)) { return true; } return false; } | isModified |
290,986 | void (@NotNull RunnerAndConfigurationSettings settings) { boolean isManagedRunConfiguration = settings.getConfiguration().getType().isManaged(); myRCStorageType = settings.isStoredInArbitraryFileInProject() ? RCStorageType.ArbitraryFileInProject : settings.isStoredInDotIdeaFolder() ? RCStorageType.DotIdeaFolder : RCStorageType.Workspace; myFolderPathIfStoredInArbitraryFile = PathUtil.getParentPath(StringUtil.notNullize(settings.getPathIfStoredInArbitraryFileInProject())); myRCStorageTypeInitial = myRCStorageType; myFolderPathIfStoredInArbitraryFileInitial = myFolderPathIfStoredInArbitraryFile; myStoreAsFileCheckBox.setEnabled(isManagedRunConfiguration); myStoreAsFileCheckBox.setSelected(myRCStorageType == RCStorageType.DotIdeaFolder || myRCStorageType == RCStorageType.ArbitraryFileInProject); myStoreAsFileGearButton.setVisible(isManagedRunConfiguration); myStoreAsFileGearButton.setEnabled(myStoreAsFileCheckBox.isSelected()); validatePath(); } | reset |
290,987 | void (@NotNull RunnerAndConfigurationSettings settings) { apply(settings, true); } | apply |
290,988 | void (@NotNull RunnerAndConfigurationSettings settings, boolean checkPathValidity) { switch (myRCStorageType) { case Workspace -> settings.storeInLocalWorkspace(); case DotIdeaFolder -> settings.storeInDotIdeaFolder(); case ArbitraryFileInProject -> { if (checkPathValidity && getErrorIfBadFolderPathForStoringInArbitraryFile(myProject, myFolderPathIfStoredInArbitraryFile) != null) { // don't apply incorrect UI to the model } else { // not sure the 'Template' prefix of the 'Template XXX.run.xml' file name should be localized. String name = settings.isTemplate() ? "Template " + settings.getType().getDisplayName() : settings.getName(); String fileName = getFileNameByRCName(name); settings.storeInArbitraryFileInProject(myFolderPathIfStoredInArbitraryFile + "/" + fileName); } } default -> throw new IllegalStateException("Unexpected value: " + myRCStorageType); } } | apply |
290,989 | ComboBox<String> (@NotNull Project project, @NotNull Disposable uiDisposable) { ComboBox<String> comboBox = new ComboBox<>(JBUI.scale(500)); comboBox.setEditable(true); // chooseFiles is set to true to be able to select project.ipr file in IPR-based projects. Other files are not visible/selectable in the chooser FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, false, false, false, false) { @Override public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) { // dotIdeaStoragePath may be a path to the project.ipr file in IPR-based projects if (file.getPath().equals(myDotIdeaStoragePath)) return true; return file.isDirectory() && super.isFileVisible(file, showHiddenFiles); } @Override public boolean isFileSelectable(@Nullable VirtualFile file) { if (file == null) return false; if (file.getPath().equals(myDotIdeaStoragePath)) return true; return file.isDirectory() && super.isFileSelectable(file) && !file.getPath().endsWith("/.idea") && !file.getPath().contains("/.idea/") && ReadAction.compute(() -> ProjectFileIndex.getInstance(project).isInContent(file)); } }; Runnable selectFolderAction = new BrowseFolderRunnable<>(null, null, project, descriptor, comboBox, TextComponentAccessor.STRING_COMBOBOX_WHOLE_TEXT) { }; comboBox.initBrowsableEditor(selectFolderAction, uiDisposable); return comboBox; } | createPathComboBox |
290,990 | boolean (VirtualFile file, boolean showHiddenFiles) { // dotIdeaStoragePath may be a path to the project.ipr file in IPR-based projects if (file.getPath().equals(myDotIdeaStoragePath)) return true; return file.isDirectory() && super.isFileVisible(file, showHiddenFiles); } | isFileVisible |
290,991 | boolean (@Nullable VirtualFile file) { if (file == null) return false; if (file.getPath().equals(myDotIdeaStoragePath)) return true; return file.isDirectory() && super.isFileSelectable(file) && !file.getPath().endsWith("/.idea") && !file.getPath().contains("/.idea/") && ReadAction.compute(() -> ProjectFileIndex.getInstance(project).isInContent(file)); } | isFileSelectable |
290,992 | String () { return ""; } | getDisplayName |
290,993 | Icon () { return EmptyIcon.ICON_16; } | getIcon |
290,994 | String () { return ""; } | getId |
290,995 | ConfigurationFactory[] () { return ConfigurationFactory.EMPTY_ARRAY; } | getConfigurationFactories |
290,996 | JBPopup (@NotNull Project project, final @NotNull List<? extends ConfigurationType> typesToShow, final @NotNull @Nls String defaultText, final @NotNull Consumer<? super ConfigurationFactory> creator, final @Nullable ConfigurationType selectedConfigurationType, final @Nullable Runnable finalStep, boolean showTitle) { if (Registry.is("run.configuration.use.tree.popup.to.add.new", false)) { return createAddTreePopup(project, creator, selectedConfigurationType, showTitle); } BaseListPopupStep<ConfigurationType> step = new BaseListPopupStep<>( showTitle ? ExecutionBundle.message("add.new.run.configuration.action2.name") : null, typesToShow) { @Override public @NotNull String getTextFor(final ConfigurationType type) { return type != HIDDEN_ITEMS_STUB ? type.getDisplayName() : defaultText; } @Override public boolean isSpeedSearchEnabled() { return true; } @Override public Icon getIconFor(final ConfigurationType type) { return type.getIcon(); } @Override public PopupStep<?> onChosen(final ConfigurationType type, final boolean finalChoice) { if (hasSubstep(type)) { return getSupStep(type); } if (type == HIDDEN_ITEMS_STUB) { return doFinalStep(finalStep); } final ConfigurationFactory[] factories = type.getConfigurationFactories(); if (factories.length > 0) { creator.consume(factories[0]); } return FINAL_CHOICE; } @Override public int getDefaultOptionIndex() { return selectedConfigurationType != HIDDEN_ITEMS_STUB ? typesToShow.indexOf(selectedConfigurationType) : super.getDefaultOptionIndex(); } private ListPopupStep<?> getSupStep(final ConfigurationType type) { final ConfigurationFactory[] factories = type.getConfigurationFactories(); Arrays.sort(factories, (factory1, factory2) -> factory1.getName().compareToIgnoreCase(factory2.getName())); return new BaseListPopupStep<>( ExecutionBundle.message("add.new.run.configuration.action.name", type.getDisplayName()), factories) { @Override public @NotNull String getTextFor(final ConfigurationFactory value) { return value.getName(); } @Override public Icon getIconFor(final ConfigurationFactory factory) { return factory.getIcon(); } @Override public PopupStep<?> onChosen(final ConfigurationFactory factory, final boolean finalChoice) { creator.consume(factory); return FINAL_CHOICE; } }; } @Override public boolean hasSubstep(final ConfigurationType type) { return type.getConfigurationFactories().length > 1; } }; return new ListPopupImpl(project, step) { @Override protected void onSpeedSearchPatternChanged() { List<ConfigurationType> values = step.getValues(); values.clear(); values.addAll(RunConfigurable.Companion.configurationTypeSorted(project, false, ConfigurationType.CONFIGURATION_TYPE_EP.getExtensionList(), true)); getListModel().updateOriginalList(); super.onSpeedSearchPatternChanged(); } }; } | createAddPopup |
290,997 | String (final ConfigurationType type) { return type != HIDDEN_ITEMS_STUB ? type.getDisplayName() : defaultText; } | getTextFor |
290,998 | boolean () { return true; } | isSpeedSearchEnabled |
290,999 | Icon (final ConfigurationType type) { return type.getIcon(); } | getIconFor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.