Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
277,600
NotificationCategory (NotificationType notificationType) { return switch (notificationType) { case INFORMATION -> INFO; case WARNING -> WARNING; case ERROR -> ERROR; default -> SIMPLE; }; }
convert
277,601
NotificationCategory (int type) { return switch (type) { case MessageCategory.ERROR -> ERROR; case MessageCategory.WARNING -> WARNING; case MessageCategory.INFORMATION, MessageCategory.STATISTICS, MessageCategory.NOTE -> INFO; case MessageCategory.SIMPLE -> SIMPLE; default -> SIMPLE; }; }
convert
277,602
void (@NotNull String url, @Nullable String text) { disabledLinks.put(url, text); }
addDisabledLink
277,603
TreeCellEditor () { return myRightTreeCellEditor; }
getRightSelfEditor
277,604
boolean () { return true; }
startEditingOnMouseMove
277,605
void (@NotNull HyperlinkEvent event) { disableLink(event, null); }
disableLink
277,606
void (@NotNull final HyperlinkEvent event, @Nullable final String linkText) { if (event.getSource() instanceof MyJEditorPane) { UIUtil.invokeLaterIfNeeded(() -> { final MyJEditorPane editorPane = (MyJEditorPane)event.getSource(); editorPane.myElement.addDisabledLink(event.getDescription(), linkText); editorPane.myElement.updateStyle(editorPane, null, null, true, false); }); } }
disableLink
277,607
void (@NotNull JEditorPane editorPane, @Nullable JTree tree, Object value, boolean selected, boolean hasFocus) { super.updateStyle(editorPane, tree, value, selected, hasFocus); final HTMLDocument htmlDocument = (HTMLDocument)editorPane.getDocument(); final Style linkStyle = htmlDocument.getStyleSheet().getStyle(LINK_STYLE); StyleConstants.setForeground(linkStyle, IdeTooltipManager.getInstance().getLinkForeground(false)); StyleConstants.setItalic(linkStyle, true); HTMLDocument.Iterator iterator = htmlDocument.getIterator(HTML.Tag.A); while (iterator.isValid()) { boolean disabledLink = false; final AttributeSet attributes = iterator.getAttributes(); if (attributes instanceof SimpleAttributeSet) { final Object attribute = attributes.getAttribute(HTML.Attribute.HREF); if (attribute instanceof String && disabledLinks.containsKey(attribute)) { disabledLink = true; //TODO [Vlad] add support for disabled link text update ////final String linkText = disabledLinks.get(attribute); //if (linkText != null) { //} ((SimpleAttributeSet)attributes).removeAttribute(HTML.Attribute.HREF); } if (attribute == null) { disabledLink = true; } } if (!disabledLink) { htmlDocument.setCharacterAttributes( iterator.getStartOffset(), iterator.getEndOffset() - iterator.getStartOffset(), linkStyle, false); } iterator.next(); } }
updateStyle
277,608
void (Component comp, int x, int y) { if (myTree == null) return; final TreePath path = myTree.getLeadSelectionPath(); if (path == null) { return; } DefaultActionGroup group = new DefaultActionGroup(); group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE)); group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_COPY)); ActionPopupMenu menu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.COMPILER_MESSAGES_POPUP, group); menu.getComponent().show(comp, x, y); }
invokePopup
277,609
Component (JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row) { myTree = tree; updateStyle(editorComponent, tree, value, selected, false); return editorComponent; }
getTreeCellEditorComponent
277,610
Object () { return null; }
getCellEditorValue
277,611
void (HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { final NotificationListener notificationListener = myNotification.getListener(); if (notificationListener != null) { notificationListener.hyperlinkUpdate(myNotification, e); } } }
hyperlinkUpdate
277,612
void (SimpleColoredComponent renderer, JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { renderer.setIcon(getIcon(kind)); renderer.setFont(tree.getFont()); renderer.append(NewErrorTreeRenderer.calcPrefix(NotificationMessageElement.this)); }
customizeCellRenderer
277,613
Icon (@NotNull ErrorTreeElementKind kind) { return switch (kind) { case INFO -> AllIcons.General.Information; case ERROR -> AllIcons.General.Error; case WARNING -> AllIcons.General.Warning; case NOTE -> AllIcons.General.Tip; case GENERIC -> ICON_16; }; }
getIcon
277,614
CustomizeColoredTreeCellRenderer () { return myRightTreeCellRenderer; }
getRightSelfRenderer
277,615
CustomizeColoredTreeCellRenderer () { return myLeftTreeCellRenderer; }
getLeftSelfRenderer
277,616
JEditorPane (@NotNull JEditorPane myEditorPane) { String message = StringUtil.join(this.getText(), "<br>"); myEditorPane.setEditable(false); myEditorPane.setOpaque(false); myEditorPane.setEditorKit(HTMLEditorKitBuilder.simple()); myEditorPane.setHighlighter(null); final StyleSheet styleSheet = ((HTMLDocument)myEditorPane.getDocument()).getStyleSheet(); final Style style = styleSheet.addStyle(MSG_STYLE, null); styleSheet.addStyle(LINK_STYLE, style); myEditorPane.setText(message); return myEditorPane; }
installJep
277,617
void (@NotNull JEditorPane editorPane, @Nullable JTree tree, Object value, boolean selected, boolean hasFocus) { final HTMLDocument htmlDocument = (HTMLDocument)editorPane.getDocument(); final Style style = htmlDocument.getStyleSheet().getStyle(MSG_STYLE); if (value instanceof LoadingNode) { StyleConstants.setForeground(style, JBColor.GRAY); } else { StyleConstants.setForeground(style, UIUtil.getTreeForeground(selected, hasFocus)); } if (tree != null && WideSelectionTreeUI.isWideSelection(tree)) { editorPane.setOpaque(false); } else { editorPane.setOpaque(selected && hasFocus); } htmlDocument.setCharacterAttributes(0, htmlDocument.getLength(), style, false); }
updateStyle
277,618
Component (JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { updateStyle(myEditorPane, tree, value, selected, hasFocus); return myEditorPane; }
getTreeCellRendererComponent
277,619
AccessibleContext () { if (accessibleContext == null) { return new AccessibleMyEditorPane(); } return accessibleContext; }
getAccessibleContext
277,620
AccessibleRole () { return AccessibleRole.LABEL; }
getAccessibleRole
277,621
String () { try { Document document = MyEditorPane.this.getDocument(); String result = document.getText(0, document.getLength()); @NlsSafe String resultWithPunctuation = AccessibleContextUtil.replaceLineSeparatorsWithPunctuation(result); return resultWithPunctuation; } catch (BadLocationException e) { return super.getAccessibleName(); } }
getAccessibleName
277,622
String () { return "MessageCounter{" + "map=" + map + '}'; }
toString
277,623
ExternalSystemNotificationManager (@NotNull Project project) { return project.getService(ExternalSystemNotificationManager.class); }
getInstance
277,624
boolean (@NotNull Throwable error, @NotNull ProjectSystemId externalSystemId) { if (RemoteUtil.unwrap(error) instanceof BuildIssueException) return false; return ExternalSystemNotificationExtension.EP_NAME.getExtensionList().stream() .anyMatch(extension -> externalSystemId.equals(extension.getTargetExternalSystemId()) && extension.isInternalError(error)); }
isInternalError
277,625
boolean (@NotNull Key<String> notificationKey) { Notification notification = myUniqueNotifications.get(notificationKey); return notification != null && !notification.isExpired(); }
isNotificationActive
277,626
void (final @NotNull ProjectSystemId externalSystemId, final @NotNull NotificationData notificationData) { showNotification(externalSystemId, notificationData, null); }
showNotification
277,627
void (final @NotNull ProjectSystemId externalSystemId, final @NotNull NotificationData notificationData, @Nullable Key<String> notificationKey) { Disposer.register(this, notificationData); if (ApplicationManager.getApplication().isHeadlessEnvironment()) { if (notificationData.getNotificationCategory() == NotificationCategory.INFO) { LOG.debug(notificationData.getMessage()); } else { LOG.warn(notificationData.getMessage()); } } if (ApplicationManager.getApplication().isUnitTestMode()) { @SuppressWarnings("UseOfSystemOutOrSystemErr") PrintStream out = notificationData.getNotificationCategory() == NotificationCategory.INFO ? System.out : System.err; out.println(notificationData.getMessage()); return; } if (notificationKey != null && isNotificationActive(notificationKey)) return; myUpdateQueue.queue(new Update(new Object()) { @Override public void run() { if (isDisposedOrNotOpen()) return; assert myProject != null; Project project = myProject; final Application app = ApplicationManager.getApplication(); Runnable action = () -> { if (!initializedExternalSystem.contains(externalSystemId)) { app.runWriteAction(() -> { if (isDisposedOrNotOpen()) return; ExternalSystemUtil.ensureToolWindowContentInitialized(project, externalSystemId); initializedExternalSystem.add(externalSystemId); }); } if (isDisposedOrNotOpen()) return; NotificationGroup group; if (notificationData.getBalloonGroup() == null) { ExternalProjectsView externalProjectsView = ExternalProjectsManagerImpl.getInstance(project).getExternalProjectsView(externalSystemId); group = externalProjectsView instanceof ExternalProjectsViewImpl ? ((ExternalProjectsViewImpl)externalProjectsView).getNotificationGroup() : null; } else { group = notificationData.getBalloonGroup(); } if (group == null) return; final Notification notification = group .createNotification(notificationData.getTitle(), notificationData.getMessage(), notificationData.getNotificationCategory().getNotificationType()) .setListener(notificationData.getListener()); if (notificationKey == null) { myNotifications.add(notification); } else { Notification oldNotification = myUniqueNotifications.put(notificationKey, notification); if (oldNotification != null) { oldNotification.expire(); } } if (notificationData.isBalloonNotification()) { applyNotification(notification); } else { addMessage(notification, externalSystemId, notificationData); } }; app.invokeLater(action, ModalityState.defaultModalityState(), project.getDisposed()); } }); }
showNotification
277,628
void () { if (isDisposedOrNotOpen()) return; assert myProject != null; Project project = myProject; final Application app = ApplicationManager.getApplication(); Runnable action = () -> { if (!initializedExternalSystem.contains(externalSystemId)) { app.runWriteAction(() -> { if (isDisposedOrNotOpen()) return; ExternalSystemUtil.ensureToolWindowContentInitialized(project, externalSystemId); initializedExternalSystem.add(externalSystemId); }); } if (isDisposedOrNotOpen()) return; NotificationGroup group; if (notificationData.getBalloonGroup() == null) { ExternalProjectsView externalProjectsView = ExternalProjectsManagerImpl.getInstance(project).getExternalProjectsView(externalSystemId); group = externalProjectsView instanceof ExternalProjectsViewImpl ? ((ExternalProjectsViewImpl)externalProjectsView).getNotificationGroup() : null; } else { group = notificationData.getBalloonGroup(); } if (group == null) return; final Notification notification = group .createNotification(notificationData.getTitle(), notificationData.getMessage(), notificationData.getNotificationCategory().getNotificationType()) .setListener(notificationData.getListener()); if (notificationKey == null) { myNotifications.add(notification); } else { Notification oldNotification = myUniqueNotifications.put(notificationKey, notification); if (oldNotification != null) { oldNotification.expire(); } } if (notificationData.isBalloonNotification()) { applyNotification(notification); } else { addMessage(notification, externalSystemId, notificationData); } }; app.invokeLater(action, ModalityState.defaultModalityState(), project.getDisposed()); }
run
277,629
void (final @Nullable String groupName, final @NotNull NotificationSource notificationSource, final @NotNull ProjectSystemId externalSystemId) { myMessageCounter.remove(groupName, notificationSource, externalSystemId); if (ApplicationManager.getApplication().isUnitTestMode()) return; final Pair<NotificationSource, ProjectSystemId> contentIdPair = Pair.create(notificationSource, externalSystemId); myUpdateQueue.queue(new Update(new Object()) { @Override public void run() { if (isDisposedOrNotOpen()) return; assert myProject != null; Project project = myProject; for (Iterator<Notification> iterator = myNotifications.iterator(); iterator.hasNext(); ) { Notification notification = iterator.next(); if (groupName == null || groupName.equals(notification.getGroupId())) { notification.expire(); iterator.remove(); } } List<Key> toRemove = new SmartList<>(); myUniqueNotifications.forEach((key, notification) -> { if (groupName == null || groupName.equals(notification.getGroupId())) { notification.expire(); toRemove.add(key); } }); toRemove.forEach(myUniqueNotifications::remove); final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.MESSAGES_WINDOW); if (toolWindow == null) return; final MessageView messageView = MessageView.getInstance(project); UIUtil.invokeLaterIfNeeded(() -> { if (project.isDisposed()) return; for (Content content: messageView.getContentManager().getContents()) { if (!content.isPinned() && contentIdPair.equals(content.getUserData(CONTENT_ID_KEY))) { if (groupName == null) { messageView.getContentManager().removeContent(content, true); } else { assert content.getComponent() instanceof NewEditableErrorTreeViewPanel; NewEditableErrorTreeViewPanel errorTreeView = (NewEditableErrorTreeViewPanel)content.getComponent(); ErrorViewStructure errorViewStructure = errorTreeView.getErrorViewStructure(); errorViewStructure.removeGroup(groupName); } } } }); } }); }
clearNotifications
277,630
void () { if (isDisposedOrNotOpen()) return; assert myProject != null; Project project = myProject; for (Iterator<Notification> iterator = myNotifications.iterator(); iterator.hasNext(); ) { Notification notification = iterator.next(); if (groupName == null || groupName.equals(notification.getGroupId())) { notification.expire(); iterator.remove(); } } List<Key> toRemove = new SmartList<>(); myUniqueNotifications.forEach((key, notification) -> { if (groupName == null || groupName.equals(notification.getGroupId())) { notification.expire(); toRemove.add(key); } }); toRemove.forEach(myUniqueNotifications::remove); final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.MESSAGES_WINDOW); if (toolWindow == null) return; final MessageView messageView = MessageView.getInstance(project); UIUtil.invokeLaterIfNeeded(() -> { if (project.isDisposed()) return; for (Content content: messageView.getContentManager().getContents()) { if (!content.isPinned() && contentIdPair.equals(content.getUserData(CONTENT_ID_KEY))) { if (groupName == null) { messageView.getContentManager().removeContent(content, true); } else { assert content.getComponent() instanceof NewEditableErrorTreeViewPanel; NewEditableErrorTreeViewPanel errorTreeView = (NewEditableErrorTreeViewPanel)content.getComponent(); ErrorViewStructure errorViewStructure = errorTreeView.getErrorViewStructure(); errorViewStructure.removeGroup(groupName); } } } }); }
run
277,631
void (final @NotNull Notification notification, final @NotNull ProjectSystemId externalSystemId, final @NotNull NotificationData notificationData) { final VirtualFile virtualFile = notificationData.getFilePath() != null ? ExternalSystemUtil.findLocalFileByPath(notificationData.getFilePath()) : null; final String groupName = virtualFile != null ? virtualFile.getPresentableUrl() : notificationData.getTitle(); myMessageCounter .increment(groupName, notificationData.getNotificationSource(), notificationData.getNotificationCategory(), externalSystemId); int line = notificationData.getLine() - 1; int column = notificationData.getColumn() - 1; if (virtualFile == null) line = column = -1; final int guiLine = line < 0 ? -1 : line + 1; final int guiColumn = column < 0 ? 0 : column + 1; if (isDisposedOrNotOpen()) return; assert myProject != null; Project project = myProject; final Navigatable navigatable = notificationData.getNavigatable() != null ? notificationData.getNavigatable() : virtualFile != null ? new OpenFileDescriptor(project, virtualFile, line, column) : NonNavigatable.INSTANCE; final ErrorTreeElementKind kind = ErrorTreeElementKind.convertMessageFromCompilerErrorType(notificationData.getNotificationCategory().getMessageCategory()); final String[] message = notificationData.getMessage().split("\n"); final String exportPrefix = NewErrorTreeViewPanel.createExportPrefix(guiLine); final String rendererPrefix = NewErrorTreeViewPanel.createRendererPrefix(guiLine, guiColumn); UIUtil.invokeLaterIfNeeded(() -> { boolean activate = notificationData.getNotificationCategory() == NotificationCategory.ERROR || notificationData.getNotificationCategory() == NotificationCategory.WARNING; final NewErrorTreeViewPanel errorTreeView = prepareMessagesView(externalSystemId, notificationData.getNotificationSource(), activate); final GroupingElement groupingElement = errorTreeView.getErrorViewStructure().getGroupingElement(groupName, null, virtualFile); final NavigatableMessageElement navigatableMessageElement; // Note: Given that screen readers don't currently support hyperlinks and // that having a cell editor for a panel in a tree view node makes // the user-interaction confusing for keyboard only users, // don't create a editable element if screen reader is active. if (notificationData.hasLinks() && !ScreenReader.isActive()) { navigatableMessageElement = new EditableNotificationMessageElement( notification, kind, groupingElement, message, navigatable, exportPrefix, rendererPrefix); } else { navigatableMessageElement = new NotificationMessageElement( kind, groupingElement, message, navigatable, exportPrefix, rendererPrefix); } errorTreeView.getErrorViewStructure().addNavigatableMessage(groupName, navigatableMessageElement); errorTreeView.updateTree(); }); }
addMessage
277,632
void (final @NotNull Notification notification) { if (!isDisposedOrNotOpen()) { notification.notify(myProject); } }
applyNotification
277,633
NewErrorTreeViewPanel (final @NotNull ProjectSystemId externalSystemId, final @NotNull NotificationSource notificationSource, boolean activateView) { ThreadingAssertions.assertEventDispatchThread(); final NewErrorTreeViewPanel errorTreeView; final String contentDisplayName = getContentDisplayName(notificationSource, externalSystemId); final Pair<NotificationSource, ProjectSystemId> contentIdPair = Pair.create(notificationSource, externalSystemId); Content targetContent = findContent(contentIdPair, contentDisplayName); assert myProject != null; final MessageView messageView = MessageView.getInstance(myProject); if (targetContent == null || !contentIdPair.equals(targetContent.getUserData(CONTENT_ID_KEY))) { errorTreeView = new NewEditableErrorTreeViewPanel(myProject, null, true, true, null); targetContent = ContentFactory.getInstance().createContent(errorTreeView, contentDisplayName, true); targetContent.putUserData(CONTENT_ID_KEY, contentIdPair); messageView.getContentManager().addContent(targetContent); Disposer.register(targetContent, errorTreeView); } else { assert targetContent.getComponent() instanceof NewEditableErrorTreeViewPanel; errorTreeView = (NewEditableErrorTreeViewPanel)targetContent.getComponent(); } messageView.getContentManager().setSelectedContent(targetContent); final ToolWindow tw = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW); if (activateView && tw != null && !tw.isActive()) { tw.activate(null, false); } return errorTreeView; }
prepareMessagesView
277,634
void () { myProject = null; myNotifications.clear(); myUniqueNotifications.clear(); initializedExternalSystem.clear(); }
dispose
277,635
boolean () { return myProject == null || myProject.isDisposed() || !myProject.isOpen(); }
isDisposedOrNotOpen
277,636
ExternalSystemProgressNotificationManager () { return ApplicationManager.getApplication().getService(ExternalSystemProgressNotificationManager.class); }
getInstance
277,637
void (@NotNull Notification notification, @NotNull HyperlinkEvent event) { ProjectSettingsService.getInstance(myProject).openProjectSettings(); }
hyperlinkActivated
277,638
void (@NotNull Notification notification, @NotNull HyperlinkEvent event) { ExternalSystemManager<?, ?, ?, ?, ?> manager; if (myLinkedProjectPath == null || !((manager = ExternalSystemApiUtil.getManager(mySystemId)) instanceof ExternalSystemConfigurableAware)) { ShowSettingsUtil.getInstance().showSettingsDialog(myProject, mySystemId.getReadableName()); return; } final Configurable configurable = ((ExternalSystemConfigurableAware)manager).getConfigurable(myProject); if(configurable instanceof AbstractExternalSystemConfigurable) { ShowSettingsUtil.getInstance().editConfigurable(myProject, configurable, () -> ((AbstractExternalSystemConfigurable<?, ?, ?>)configurable).selectProject(myLinkedProjectPath)); } }
hyperlinkActivated
277,639
void (@NotNull ExternalSystemExecutionSettings settings) { }
setSettings
277,640
void (@NotNull ExternalSystemTaskNotificationListener notificationListener) { }
setNotificationListener
277,641
boolean (@NotNull ExternalSystemTaskId id) { return false; }
isTaskInProgress
277,642
boolean (@NotNull ExternalSystemTaskId id) { return false; }
cancelTask
277,643
void (@NotNull ExternalSystemExecutionSettings settings) { }
setSettings
277,644
void (@NotNull ExternalSystemTaskNotificationListener notificationListener) { }
setNotificationListener
277,645
boolean (@NotNull ExternalSystemTaskId id) { return false; }
isTaskInProgress
277,646
void (@NotNull ExternalSystemTaskId id, @NotNull String projectPath) { }
onStart
277,647
void (@NotNull ExternalSystemTaskId id) { }
onEnvironmentPrepared
277,648
void (@NotNull ExternalSystemTaskNotificationEvent event) { }
onStatusChange
277,649
void (@NotNull ExternalSystemTaskId id, @NotNull String text, boolean stdOut) { }
onTaskOutput
277,650
void (@NotNull ExternalSystemTaskId id) { }
onEnd
277,651
void (@NotNull ExternalSystemTaskId id) { }
onSuccess
277,652
void (@NotNull ExternalSystemTaskId id, @NotNull Exception e) { }
onFailure
277,653
void (@NotNull ExternalSystemTaskId id) { }
beforeCancel
277,654
void (ExternalSystemTaskId id) { }
onCancel
277,655
void (@NotNull S settings) { mySettings.set(settings); }
setSettings
277,656
void (@NotNull ExternalSystemTaskNotificationListener listener) { myListener.set(listener); }
setNotificationListener
277,657
ExternalSystemTaskNotificationListener () { return myListener.get(); }
getNotificationListener
277,658
boolean (@NotNull ExternalSystemTaskId id) { Set<ExternalSystemTaskId> tasks = myTasksInProgress.get(id.getType()); return tasks != null && tasks.contains(id); }
isTaskInProgress
277,659
RemoteExternalSystemFacade<S> () { return myDelegate; }
getDelegate
277,660
T () { return myDelegate; }
getDelegate
277,661
BuildIssue () { return myBuildIssue; }
getBuildIssue
277,662
String[] (@NotNull BuildIssue issue) { return issue.getQuickFixes().stream().map(fix -> fix.getId()).toArray(String[]::new); }
getQuickfixIds
277,663
Icon (@NotNull String path, int cacheKey, int flags) { return IconManager.getInstance().loadRasterizedIcon(path, ExternalSystemIcons.class.getClassLoader(), cacheKey, flags); }
load
277,664
void (final String... moduleNames) { JavaCompileTestUtil.compileModules(myProject, useProjectTaskManager, moduleNames); }
compileModules
277,665
void (String... artifactNames) { JavaCompileTestUtil.buildArtifacts(myProject, useProjectTaskManager, artifactNames); }
buildArtifacts
277,666
Artifact (Project project, String artifactName) { return ReadAction.compute(() -> ArtifactsTestUtil.findArtifact(project, artifactName)); }
findArtifact
277,667
void (final String artifactName, final String expected) { Artifact artifact = findArtifact(myProject, artifactName); assertThat(toSystemIndependentName(artifact.getOutputPath())).isEqualTo(expected); }
assertArtifactOutputPath
277,668
void (String artifactName, TestFileSystemItem fs) { final Artifact artifact = findArtifact(myProject, artifactName); final String outputFile = artifact.getOutputFilePath(); assert outputFile != null; final File file = new File(outputFile); assert file.exists(); fs.assertFileEqual(file); }
assertArtifactOutput
277,669
void (String moduleName, String... outputs) { Module module = getModule(moduleName); String[] outputPaths = ContainerUtil.map2Array(CompilerPaths.getOutputPaths(new Module[]{module}), String.class, s -> getAbsolutePath(s)); assertUnorderedElementsAreEqual(outputPaths, outputs); String[] outputPathsFromEnumerator = ContainerUtil.map2Array( OrderEnumerator.orderEntries(module).withoutSdk().withoutLibraries().withoutDepModules().classes().getUrls(), String.class, VfsUtilCore::urlToPath ); assertUnorderedElementsAreEqual(outputPathsFromEnumerator, outputs); }
assertModuleOutputs
277,670
void (String moduleName, String output, String testOutput) { CompilerModuleExtension e = getCompilerExtension(moduleName); assertFalse(e.isCompilerOutputPathInherited()); assertEquals(output, getAbsolutePath(e.getCompilerOutputUrl())); assertEquals(testOutput, getAbsolutePath(e.getCompilerOutputUrlForTests())); }
assertModuleOutput
277,671
void (String moduleName) { CompilerModuleExtension e = getCompilerExtension(moduleName); assertTrue(e.isCompilerOutputPathInherited()); }
assertModuleInheritedOutput
277,672
CompilerModuleExtension (String module) { return CompilerModuleExtension.getInstance(getModule(module)); }
getCompilerExtension
277,673
void (String... expectedNames) { final List<String> actualNames = ContainerUtil.map( ReadAction.compute(() -> ArtifactManager.getInstance(myProject).getAllArtifactsIncludingInvalid()), artifact -> artifact.getName()); assertUnorderedElementsAreEqual(actualNames, expectedNames); }
assertArtifacts
277,674
ExternalSystemSettingsControl<TestExternalProjectSettings> (@NotNull TestExternalProjectSettings settings) { return new TestExternalProjectSettingsControl(settings); }
createProjectSettingsControl
277,675
ExternalSystemSettingsControl<TestExternalSystemSettings> (@NotNull TestExternalSystemSettings settings) { return new TestExternalSystemSettingsControl(); }
createSystemSettingsControl
277,676
TestExternalProjectSettings () { throw new UnsupportedOperationException(); }
newProjectSettings
277,677
String () { return "ES Settings"; }
getId
277,678
void (@NotNull PaintAwarePanel canvas, int indentLevel) { }
fillUi
277,679
void () { }
reset
277,680
boolean () { return false; }
isModified
277,681
void (@NotNull TestExternalSystemSettings settings) { }
apply
277,682
void () { }
disposeUIResources
277,683
void (boolean show) { }
showUi
277,684
void (@NotNull PaintAwarePanel content, int indentLevel) { }
fillExtraControls
277,685
boolean () { return false; }
isExtraSettingModified
277,686
void (boolean isDefaultModuleCreation) { }
resetExtraSettings
277,687
void (@NotNull TestExternalProjectSettings settings) { }
applyExtraSettings
277,688
boolean (@NotNull TestExternalProjectSettings settings) { return false; }
validate
277,689
boolean () { return false; }
runInDispatchThread
277,690
void () { Module module = ModuleManager.getInstance(myProject).findModuleByName(TEST_MODULE_NAME); ExternalProjectsManagerImpl.getInstance(myProject).init(); addTaskTrigger("beforeBuildTask1", BEFORE_COMPILE, module); addTaskTrigger("beforeBuildTask2", BEFORE_COMPILE, module); addTaskTrigger("afterBuildTask1", AFTER_COMPILE, module); addTaskTrigger("afterBuildTask2", AFTER_COMPILE, module); addTaskTrigger("beforeReBuildTask1", BEFORE_REBUILD, module); addTaskTrigger("beforeReBuildTask2", BEFORE_REBUILD, module); addTaskTrigger("afterReBuildTask1", AFTER_REBUILD, module); addTaskTrigger("afterReBuildTask2", AFTER_REBUILD, module); build(module); assertEquals("beforeBuildTask1,beforeBuildTask2,afterBuildTask1,afterBuildTask2", TASKS_TRACE.get(myProject).toString()); TASKS_TRACE.get(myProject).setLength(0); rebuild(module); assertEquals("beforeReBuildTask1,beforeReBuildTask2,afterReBuildTask1,afterReBuildTask2", TASKS_TRACE.get(myProject).toString()); }
testBeforeAfterBuildTasks
277,691
void (String taskName, ExternalSystemTaskActivator.Phase phase, Module module) { String projectPath = ExternalSystemApiUtil.getExternalProjectPath(module); ExternalSystemTaskActivator taskActivator = ExternalProjectsManagerImpl.getInstance(myProject).getTaskActivator(); taskActivator.addTask(new ExternalSystemTaskActivator.TaskActivationEntry(TEST_EXTERNAL_SYSTEM_ID, phase, projectPath, taskName)); }
addTaskTrigger
277,692
void (@NotNull Module module) { Promise<ProjectTaskManager.Result> promise = ProjectTaskManager.getInstance(module.getProject()).build(module); edt(() -> PlatformTestUtil.waitForPromise(promise)); }
build
277,693
void (@NotNull Module module) { Promise<ProjectTaskManager.Result> promise = ProjectTaskManager.getInstance(module.getProject()).rebuild(module); edt(() -> PlatformTestUtil.waitForPromise(promise)); }
rebuild
277,694
String () { return "Test_external_system_id"; }
getConfigurationFactoryId
277,695
boolean (@NotNull ExternalSystemTaskId taskId, @NotNull ExternalSystemTaskNotificationListener listener) { return false; }
cancelTask
277,696
void () { final List<String> callTrace = new ArrayList<>(); maskProjectDataServices(new TestDataService(callTrace)); new ProjectDataManagerImpl().importData( new DataNode<>(ProjectKeys.PROJECT, new ProjectData(ProjectSystemId.IDE, "externalName", "externalPath", "linkedPath"), null), myProject); assertContainsElements(callTrace, "computeOrphanData"); }
testDataServiceIsCalledIfNoNodes
277,697
void () { final List<String> callTrace = new ArrayList<>(); maskProjectDataServices(new RunAfterTestDataService(callTrace), new TestDataService(callTrace)); new ProjectDataManagerImpl().importData( new DataNode<>(ProjectKeys.PROJECT, new ProjectData(ProjectSystemId.IDE, "externalName", "externalPath", "linkedPath"), null), myProject); assertOrderedEquals(callTrace, "importData", "computeOrphanData", "removeData", "importDataAfter", "computeOrphanDataAfter", "removeDataAfter"); }
testDataServiceKeyOrdering
277,698
void () { int n = 100; final List<String> callTrace = new ArrayList<>(); TestDataService[] dataServiceArray = new TestDataService[n]; for (int i = 0; i < n; i++) { dataServiceArray[i] = new TestDataService(callTrace); } maskProjectDataServices(dataServiceArray); final CountDownLatch latch = new CountDownLatch(1); final Ref<Throwable> caughtCME = new Ref<>(null); Thread iterating = new Thread(() -> { await(latch); try { List<ProjectDataService<?, ?>> services = ProjectDataManagerImpl.getInstance().findService(TestDataService.TEST_KEY); for (ProjectDataService<?, ?> service : services) { Thread.yield(); } } catch (ConcurrentModificationException e) { caughtCME.set(e); } }, "Iterating over services"); Thread lookup = new Thread(() -> { await(latch); try { for (int i = 0; i < n; i++) { Thread.yield(); ProjectDataManagerImpl.getInstance().findService(TestDataService.TEST_KEY); } } catch (ConcurrentModificationException e) { caughtCME.set(e); } }, "Lookup service with sorting"); iterating.start(); lookup.start(); latch.countDown(); ConcurrencyUtil.joinAll(iterating, lookup); assertNull(caughtCME.get()); }
testConcurrentDataServiceAccess
277,699
void () { ProjectDataManagerImpl dataManager = ProjectDataManagerImpl.getInstance(); ConcurrentDetectingDataService detectingService = new ConcurrentDetectingDataService(); maskProjectDataServices(detectingService); int degreeOfConcurrency = 2; CountDownLatch testStart = new CountDownLatch(1); AtomicInteger unfinishedImportsCount = new AtomicInteger(degreeOfConcurrency); final List<Thread> threads = Stream.generate(() -> createProjectDataStub()) .limit(degreeOfConcurrency) .map(p -> { @SuppressWarnings("SSBasedInspection") var t = new Thread( new RunAll(() -> testStart.await(), () -> dataManager.importData(p, myProject), () -> unfinishedImportsCount.decrementAndGet())); t.start(); return t; }).toList(); testStart.countDown(); PlatformTestUtil.waitWithEventsDispatching("Project Data Import did not finish in time", () -> unfinishedImportsCount.get() == 0, 5); joinAll(threads, 100); assertFalse("DataNodes must not be processed concurrently", detectingService.wasConcurrentRunDetected()); }
testConcurrentDataImport