Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
276,500 | void (final @NotNull Project project, final @NotNull ProjectSystemId externalSystemId, final @NotNull String externalProjectPath, final @NotNull ExternalProjectRefreshCallback callback, final boolean isPreviewMode, final @NotNull ProgressExecutionMode progressExecutionMode) { var builder = new ImportSpecBuilder(project, externalSystemId) .callback(callback) .use(progressExecutionMode); if (isPreviewMode) builder.usePreviewMode(); refreshProject(externalProjectPath, builder); } | refreshProject |
276,501 | void (final @NotNull Project project, final @NotNull ProjectSystemId externalSystemId, final @NotNull String externalProjectPath, final @NotNull ExternalProjectRefreshCallback callback, final boolean isPreviewMode, final @NotNull ProgressExecutionMode progressExecutionMode, final boolean reportRefreshError) { var builder = new ImportSpecBuilder(project, externalSystemId) .callback(callback) .use(progressExecutionMode); if (isPreviewMode) builder.usePreviewMode(); if (!reportRefreshError) builder.dontReportRefreshErrors(); refreshProject(externalProjectPath, builder); } | refreshProject |
276,502 | void (@NotNull String externalProjectPath, @NotNull ImportSpecBuilder importSpecBuilder) { refreshProject(externalProjectPath, importSpecBuilder.build()); } | refreshProject |
276,503 | void (final @NotNull String externalProjectPath, final @NotNull ImportSpec importSpec) { var project = importSpec.getProject(); var externalSystemId = importSpec.getExternalSystemId(); var isPreviewMode = importSpec.isPreviewMode(); TransactionGuard.getInstance().assertWriteSafeContext(ModalityState.defaultModalityState()); ApplicationManager.getApplication().invokeAndWait(FileDocumentManager.getInstance()::saveAllDocuments); if (!isPreviewMode && !TrustedProjects.isTrusted(project)) { LOG.debug("Skip " + externalSystemId + " load, because project is not trusted", new Throwable()); return; } LOG.debug("Stated " + externalSystemId + " load", new Throwable()); AbstractExternalSystemLocalSettings<?> localSettings = ExternalSystemApiUtil.getLocalSettings(project, externalSystemId); var projectSyncTypeStorage = localSettings.getProjectSyncType(); var previousSyncType = projectSyncTypeStorage.get(externalProjectPath); var syncType = isPreviewMode ? PREVIEW : (previousSyncType == PREVIEW ? IMPORT : RE_IMPORT); projectSyncTypeStorage.put(externalProjectPath, syncType); var resolveProjectTask = new ExternalSystemResolveProjectTask(project, externalProjectPath, importSpec); var taskId = resolveProjectTask.getId(); var projectName = resolveProjectTask.getProjectName(); var externalSystemName = externalSystemId.getReadableName(); var progressExecutionMode = importSpec.getProgressExecutionMode(); var title = progressExecutionMode == ProgressExecutionMode.MODAL_SYNC ? ExternalSystemBundle.message("progress.import.text", projectName, externalSystemName) : ExternalSystemBundle.message("progress.refresh.text", projectName, externalSystemName); if (progressExecutionMode == ProgressExecutionMode.NO_PROGRESS_SYNC || progressExecutionMode == ProgressExecutionMode.NO_PROGRESS_ASYNC) { throw new ExternalSystemException("Please, use progress for the project import!"); } ExternalSystemTaskUnderProgress.executeTaskUnderProgress(project, title, progressExecutionMode, new ExternalSystemTaskUnderProgress() { @Override public @NotNull ExternalSystemTaskId getId() { return taskId; } @Override public void execute(@NotNull ProgressIndicator indicator) { var activity = ExternalSystemStatUtilKt.importActivityStarted(project, externalSystemId, null); try { executeSync(externalProjectPath, importSpec, resolveProjectTask, indicator); } finally { activity.finished(); } } }); } | refreshProject |
276,504 | ExternalSystemTaskId () { return taskId; } | getId |
276,505 | void (@NotNull ProgressIndicator indicator) { var activity = ExternalSystemStatUtilKt.importActivityStarted(project, externalSystemId, null); try { executeSync(externalProjectPath, importSpec, resolveProjectTask, indicator); } finally { activity.finished(); } } | execute |
276,506 | void ( @NotNull String externalProjectPath, @NotNull ImportSpec importSpec, @NotNull ExternalSystemResolveProjectTask resolveProjectTask, @NotNull ProgressIndicator indicator ) { var project = importSpec.getProject(); var taskId = resolveProjectTask.getId(); var externalSystemId = taskId.getProjectSystemId(); var callback = importSpec.getCallback(); var isPreviewMode = importSpec.isPreviewMode(); if (project.isDisposed()) return; if (indicator instanceof ProgressIndicatorEx indicatorEx) { indicatorEx.addStateDelegate(new AbstractProgressIndicatorExBase() { @Override public void cancel() { super.cancel(); resolveProjectTask.cancel(); } }); } var processingManager = ExternalSystemProcessingManager.getInstance(); if (processingManager.findTask(ExternalSystemTaskType.RESOLVE_PROJECT, externalSystemId, externalProjectPath) != null) { if (callback != null) { callback.onFailure(taskId, ExternalSystemBundle.message("error.resolve.already.running", externalProjectPath), null); } return; } if (!(callback instanceof MyMultiExternalProjectRefreshCallback)) { ExternalSystemNotificationManager.getInstance(project) .clearNotifications(null, NotificationSource.PROJECT_SYNC, externalSystemId); } if (!isPreviewMode) { var externalSystemTaskActivator = ExternalProjectsManagerImpl.getInstance(project).getTaskActivator(); if (!externalSystemTaskActivator.runTasks(externalProjectPath, ExternalSystemTaskActivator.Phase.BEFORE_SYNC)) { return; } } var projectName = resolveProjectTask.getProjectName(); var processHandler = new ExternalSystemProcessHandler(resolveProjectTask, projectName + " import") { @Override protected void destroyProcessImpl() { resolveProjectTask.cancel(); closeInput(); } }; var consoleManager = getConsoleManagerFor(resolveProjectTask); var consoleView = consoleManager.attachExecutionConsole(project, resolveProjectTask, null, processHandler); Disposer.register(project, Objects.requireNonNullElse(consoleView, processHandler)); var syncViewManager = project.getService(SyncViewManager.class); try (BuildEventDispatcher eventDispatcher = new ExternalSystemEventDispatcher(taskId, syncViewManager, false)) { var finishSyncEventSupplier = new Ref<Supplier<? extends FinishBuildEvent>>(); var taskListener = new ExternalSystemTaskNotificationListenerAdapter() { @Override public void onStart(@NotNull ExternalSystemTaskId id, String workingDir) { if (isPreviewMode) return; var buildDescriptor = createSyncDescriptor( externalProjectPath, importSpec, resolveProjectTask, processHandler, consoleView, consoleManager ); eventDispatcher.onEvent(id, new StartBuildEventImpl(buildDescriptor, BuildBundle.message("build.event.message.syncing"))); } @Override public void onTaskOutput(@NotNull ExternalSystemTaskId id, @NotNull String text, boolean stdOut) { processHandler.notifyTextAvailable(text, stdOut ? ProcessOutputTypes.STDOUT : ProcessOutputTypes.STDERR); eventDispatcher.setStdOut(stdOut); eventDispatcher.append(text); } @Override public void onFailure(@NotNull ExternalSystemTaskId id, @NotNull Exception e) { finishSyncEventSupplier.set(() -> { var eventTime = System.currentTimeMillis(); var eventMessage = BuildBundle.message("build.status.failed"); var externalSystemName = externalSystemId.getReadableName(); var title = ExternalSystemBundle.message("notification.project.refresh.fail.title", externalSystemName, projectName); var dataContext = BuildConsoleUtils.getDataContext(id, syncViewManager); var eventResult = createFailureResult(title, e, externalSystemId, project, externalProjectPath, dataContext); return new FinishBuildEventImpl(id, null, eventTime, eventMessage, eventResult); }); processHandler.notifyProcessTerminated(1); } @Override public void onCancel(@NotNull ExternalSystemTaskId id) { finishSyncEventSupplier.set(() -> { var eventTime = System.currentTimeMillis(); var eventMessage = BuildBundle.message("build.status.cancelled"); var eventResult = new FailureResultImpl(); return new FinishBuildEventImpl(id, null, eventTime, eventMessage, eventResult); }); processHandler.notifyProcessTerminated(1); } @Override public void onSuccess(@NotNull ExternalSystemTaskId id) { finishSyncEventSupplier.set(() -> { var eventTime = System.currentTimeMillis(); var eventMessage = BuildBundle.message("build.status.finished"); var eventResult = new SuccessResultImpl(); return new FinishBuildEventImpl(id, null, eventTime, eventMessage, eventResult); }); processHandler.notifyProcessTerminated(0); } @Override public void onStatusChange(@NotNull ExternalSystemTaskNotificationEvent event) { if (isPreviewMode) return; if (event instanceof ExternalSystemBuildEvent) { var buildEvent = ((ExternalSystemBuildEvent)event).getBuildEvent(); eventDispatcher.onEvent(event.getId(), buildEvent); } else if (event instanceof ExternalSystemTaskExecutionEvent) { var buildEvent = convert(((ExternalSystemTaskExecutionEvent)event)); eventDispatcher.onEvent(event.getId(), buildEvent); } } }; LOG.info("External project [" + externalProjectPath + "] resolution task started"); var startTS = System.currentTimeMillis(); resolveProjectTask.execute(indicator, taskListener); var endTS = System.currentTimeMillis(); LOG.info("External project [" + externalProjectPath + "] resolution task executed in " + (endTS - startTS) + " ms."); handleSyncResult(externalProjectPath, importSpec, resolveProjectTask, eventDispatcher, finishSyncEventSupplier); } } | executeSync |
276,507 | void () { super.cancel(); resolveProjectTask.cancel(); } | cancel |
276,508 | void () { resolveProjectTask.cancel(); closeInput(); } | destroyProcessImpl |
276,509 | void (@NotNull ExternalSystemTaskId id, String workingDir) { if (isPreviewMode) return; var buildDescriptor = createSyncDescriptor( externalProjectPath, importSpec, resolveProjectTask, processHandler, consoleView, consoleManager ); eventDispatcher.onEvent(id, new StartBuildEventImpl(buildDescriptor, BuildBundle.message("build.event.message.syncing"))); } | onStart |
276,510 | void (@NotNull ExternalSystemTaskId id, @NotNull String text, boolean stdOut) { processHandler.notifyTextAvailable(text, stdOut ? ProcessOutputTypes.STDOUT : ProcessOutputTypes.STDERR); eventDispatcher.setStdOut(stdOut); eventDispatcher.append(text); } | onTaskOutput |
276,511 | void (@NotNull ExternalSystemTaskId id, @NotNull Exception e) { finishSyncEventSupplier.set(() -> { var eventTime = System.currentTimeMillis(); var eventMessage = BuildBundle.message("build.status.failed"); var externalSystemName = externalSystemId.getReadableName(); var title = ExternalSystemBundle.message("notification.project.refresh.fail.title", externalSystemName, projectName); var dataContext = BuildConsoleUtils.getDataContext(id, syncViewManager); var eventResult = createFailureResult(title, e, externalSystemId, project, externalProjectPath, dataContext); return new FinishBuildEventImpl(id, null, eventTime, eventMessage, eventResult); }); processHandler.notifyProcessTerminated(1); } | onFailure |
276,512 | void (@NotNull ExternalSystemTaskId id) { finishSyncEventSupplier.set(() -> { var eventTime = System.currentTimeMillis(); var eventMessage = BuildBundle.message("build.status.cancelled"); var eventResult = new FailureResultImpl(); return new FinishBuildEventImpl(id, null, eventTime, eventMessage, eventResult); }); processHandler.notifyProcessTerminated(1); } | onCancel |
276,513 | void (@NotNull ExternalSystemTaskId id) { finishSyncEventSupplier.set(() -> { var eventTime = System.currentTimeMillis(); var eventMessage = BuildBundle.message("build.status.finished"); var eventResult = new SuccessResultImpl(); return new FinishBuildEventImpl(id, null, eventTime, eventMessage, eventResult); }); processHandler.notifyProcessTerminated(0); } | onSuccess |
276,514 | void (@NotNull ExternalSystemTaskNotificationEvent event) { if (isPreviewMode) return; if (event instanceof ExternalSystemBuildEvent) { var buildEvent = ((ExternalSystemBuildEvent)event).getBuildEvent(); eventDispatcher.onEvent(event.getId(), buildEvent); } else if (event instanceof ExternalSystemTaskExecutionEvent) { var buildEvent = convert(((ExternalSystemTaskExecutionEvent)event)); eventDispatcher.onEvent(event.getId(), buildEvent); } } | onStatusChange |
276,515 | DefaultBuildDescriptor ( @NotNull String externalProjectPath, @NotNull ImportSpec importSpec, @NotNull ExternalSystemResolveProjectTask resolveProjectTask, @NotNull ExternalSystemProcessHandler processHandler, @Nullable ExecutionConsole consoleView, @NotNull ExternalSystemExecutionConsoleManager<ExecutionConsole, ProcessHandler> consoleManager ) { var project = importSpec.getProject(); var taskId = resolveProjectTask.getId(); var externalSystemId = taskId.getProjectSystemId(); var rerunImportAction = new DumbAwareAction() { @Override public void update(@NotNull AnActionEvent e) { e.getPresentation().setEnabled(processHandler.isProcessTerminated()); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.EDT; } @Override public void actionPerformed(@NotNull AnActionEvent e) { e.getPresentation().setEnabled(false); Runnable rerunRunnable = importSpec instanceof ImportSpecImpl ? ((ImportSpecImpl)importSpec).getRerunAction() : null; if (rerunRunnable == null) { refreshProject(externalProjectPath, importSpec); } else { rerunRunnable.run(); } } }; var systemId = externalSystemId.getReadableName(); rerunImportAction.getTemplatePresentation() .setText(ExternalSystemBundle.messagePointer("action.refresh.project.text", systemId)); rerunImportAction.getTemplatePresentation() .setDescription(ExternalSystemBundle.messagePointer("action.refresh.project.description", systemId)); rerunImportAction.getTemplatePresentation().setIcon(AllIcons.Actions.Refresh); var projectName = resolveProjectTask.getProjectName(); return new DefaultBuildDescriptor(taskId, projectName, externalProjectPath, System.currentTimeMillis()) .withProcessHandler(processHandler, null) .withRestartAction(rerunImportAction) .withContentDescriptor(() -> { if (consoleView == null) return null; BuildContentDescriptor contentDescriptor = new BuildContentDescriptor( consoleView, processHandler, consoleView.getComponent(), ExternalSystemBundle.message("build.event.title.sync") ); contentDescriptor.setActivateToolWindowWhenAdded(importSpec.isActivateBuildToolWindowOnStart()); contentDescriptor.setActivateToolWindowWhenFailed(importSpec.isActivateBuildToolWindowOnFailure()); contentDescriptor.setNavigateToError(importSpec.isNavigateToError()); contentDescriptor.setAutoFocusContent(importSpec.isActivateBuildToolWindowOnFailure()); return contentDescriptor; }) .withActions(consoleManager.getCustomActions(project, resolveProjectTask, null)) .withContextActions(consoleManager.getCustomContextActions(project, resolveProjectTask, null)) .withExecutionFilters(consoleManager.getCustomExecutionFilters(project, resolveProjectTask, null)); } | createSyncDescriptor |
276,516 | void (@NotNull AnActionEvent e) { e.getPresentation().setEnabled(processHandler.isProcessTerminated()); } | update |
276,517 | ActionUpdateThread () { return ActionUpdateThread.EDT; } | getActionUpdateThread |
276,518 | void (@NotNull AnActionEvent e) { e.getPresentation().setEnabled(false); Runnable rerunRunnable = importSpec instanceof ImportSpecImpl ? ((ImportSpecImpl)importSpec).getRerunAction() : null; if (rerunRunnable == null) { refreshProject(externalProjectPath, importSpec); } else { rerunRunnable.run(); } } | actionPerformed |
276,519 | void ( @NotNull String externalProjectPath, @NotNull ImportSpec importSpec, @NotNull ExternalSystemResolveProjectTask resolveProjectTask, @NotNull BuildEventDispatcher eventDispatcher, @NotNull Ref<Supplier<? extends FinishBuildEvent>> finishSyncEventSupplier ) { var project = importSpec.getProject(); var taskId = resolveProjectTask.getId(); var externalSystemId = taskId.getProjectSystemId(); var isPreviewMode = importSpec.isPreviewMode(); var callback = importSpec.getCallback(); if (project.isDisposed()) return; try { var error = resolveProjectTask.getError(); if (error == null) { if (callback != null) { var externalProjectData = ProjectDataManagerImpl.getInstance() .getExternalProjectData(project, externalSystemId, externalProjectPath); if (externalProjectData != null) { var externalProject = externalProjectData.getExternalProjectStructure(); if (externalProject != null && importSpec.shouldCreateDirectoriesForEmptyContentRoots()) { externalProject.putUserData(ContentRootDataService.CREATE_EMPTY_DIRECTORIES, Boolean.TRUE); } callback.onSuccess(taskId, externalProject); } } if (!isPreviewMode) { var externalSystemTaskActivator = ExternalProjectsManagerImpl.getInstance(project).getTaskActivator(); externalSystemTaskActivator.runTasks(externalProjectPath, ExternalSystemTaskActivator.Phase.AFTER_SYNC); } return; } if (error instanceof ImportCanceledException) { // stop refresh task return; } if (callback != null) { var message = ExternalSystemApiUtil.buildErrorMessage(error); if (StringUtil.isEmpty(message)) { var systemName = externalSystemId.getReadableName(); message = String.format("Can't resolve %s project at '%s'. Reason: %s", systemName, externalProjectPath, message); } callback.onFailure(taskId, message, extractDetails(error)); } } catch (Throwable t) { finishSyncEventSupplier.set(() -> { var eventTime = System.currentTimeMillis(); var eventMessage = BuildBundle.message("build.status.failed"); var systemName = externalSystemId.getReadableName(); var projectName = resolveProjectTask.getProjectName(); var title = ExternalSystemBundle.message("notification.project.refresh.fail.title", systemName, projectName); var eventResult = createFailureResult(title, t, externalSystemId, project, externalProjectPath, DataContext.EMPTY_CONTEXT); return new FinishBuildEventImpl(taskId, null, eventTime, eventMessage, eventResult); }); } finally { if (!isPreviewMode) { if (isNewProject(project)) { var virtualFile = VfsUtil.findFileByIoFile(new File(externalProjectPath), false); if (virtualFile != null) { VfsUtil.markDirtyAndRefresh(true, false, true, virtualFile); } } project.putUserData(ExternalSystemDataKeys.NEWLY_CREATED_PROJECT, null); project.putUserData(ExternalSystemDataKeys.NEWLY_IMPORTED_PROJECT, null); eventDispatcher.onEvent(taskId, getSyncFinishEvent(taskId, finishSyncEventSupplier)); } } } | handleSyncResult |
276,520 | FinishBuildEvent ( @NotNull ExternalSystemTaskId taskId, @NotNull Ref<? extends Supplier<? extends FinishBuildEvent>> finishSyncEventSupplier ) { Exception exception = null; var finishBuildEventSupplier = finishSyncEventSupplier.get(); if (finishBuildEventSupplier != null) { try { return finishBuildEventSupplier.get(); } catch (Exception e) { exception = e; } } if (!(exception instanceof ControlFlowException)) { LOG.warn("Sync finish event has not been received", exception); } var eventTime = System.currentTimeMillis(); var eventMessage = BuildBundle.message("build.status.cancelled"); var eventResult = new FailureResultImpl(); return new FinishBuildEventImpl(taskId, null, eventTime, eventMessage, eventResult); } | getSyncFinishEvent |
276,521 | boolean ( @NotNull Project project, @NotNull ProjectSystemId systemId, @NotNull Path projectRoot ) { return ExternalSystemTrustedProjectDialog.confirmLinkingUntrustedProject(project, systemId, projectRoot); } | confirmLinkingUntrustedProject |
276,522 | boolean ( @NotNull Project project, @NotNull ProjectSystemId systemId ) { return ExternalSystemTrustedProjectDialog.confirmLoadingUntrustedProject(project, systemId); } | confirmLoadingUntrustedProject |
276,523 | boolean ( @NotNull Project project, @NotNull Collection<ProjectSystemId> systemIds ) { return ExternalSystemTrustedProjectDialog.confirmLoadingUntrustedProject(project, systemIds); } | confirmLoadingUntrustedProject |
276,524 | boolean (Project project) { return project.getUserData(ExternalSystemDataKeys.NEWLY_CREATED_PROJECT) == Boolean.TRUE || project.getUserData(ExternalSystemDataKeys.NEWLY_IMPORTED_PROJECT) == Boolean.TRUE; } | isNewProject |
276,525 | void (@NotNull Module module, boolean isCreatingNewProject, boolean isMavenModule) { var project = module.getProject(); // Postpone project refresh, disable unwanted notifications project.putUserData(ExternalSystemDataKeys.NEWLY_CREATED_PROJECT, isCreatingNewProject ? Boolean.TRUE : null); project.putUserData(ExternalSystemDataKeys.NEWLY_IMPORTED_PROJECT, isCreatingNewProject ? Boolean.TRUE : null); markModuleAsMaven(module, null, isMavenModule); } | configureNewModule |
276,526 | void (@NotNull Module module, @Nullable String moduleVersion, boolean isMavenModule) { // This module will be replaced after import // Make sure the .iml file is not created under the project dir, if 'Store generated project files externally' setting is on. ExternalSystemModulePropertyManager.getInstance(module).setMavenized(isMavenModule, moduleVersion); } | markModuleAsMaven |
276,527 | FailureResultImpl ( @NotNull Throwable exception, @NotNull ProjectSystemId externalSystemId, @NotNull Project project, @NotNull ExternalSystemNotificationManager notificationManager, @NotNull NotificationData notificationData ) { if (notificationData.isBalloonNotification()) { notificationManager.showNotification(externalSystemId, notificationData); return new FailureResultImpl(exception); } final NotificationGroup group; if (notificationData.getBalloonGroup() == null) { var externalProjectsView = ExternalProjectsManagerImpl.getInstance(project) .getExternalProjectsView(externalSystemId); group = externalProjectsView instanceof ExternalProjectsViewImpl ? ((ExternalProjectsViewImpl)externalProjectsView).getNotificationGroup() : null; } else { group = notificationData.getBalloonGroup(); } var line = notificationData.getLine() - 1; var column = notificationData.getColumn() - 1; var virtualFile = notificationData.getFilePath() != null ? findLocalFileByPath(notificationData.getFilePath()) : null; var buildIssueNavigatable = exception instanceof BuildIssueException ? ((BuildIssueException)exception).getBuildIssue().getNavigatable(project) : null; final Navigatable navigatable; if (!isNullOrNonNavigatable(buildIssueNavigatable)) { navigatable = buildIssueNavigatable; } else if (isNullOrNonNavigatable(notificationData.getNavigatable())) { navigatable = virtualFile != null ? new OpenFileDescriptor(project, virtualFile, line, column) : NonNavigatable.INSTANCE; } else { navigatable = notificationData.getNavigatable(); } final Notification notification; if (group == null) { notification = new Notification(externalSystemId.getReadableName() + " build", notificationData.getTitle(), notificationData.getMessage(), notificationData.getNotificationCategory().getNotificationType()) .setListener(notificationData.getListener()); } else { notification = group .createNotification(notificationData.getTitle(), notificationData.getMessage(), notificationData.getNotificationCategory().getNotificationType()) .setListener(notificationData.getListener()); } final FailureImpl failure; if (exception instanceof BuildIssueException) { var buildIssue = ((BuildIssueException)exception).getBuildIssue(); failure = new FailureImpl(buildIssue.getTitle(), notificationData.getMessage(), Collections.emptyList(), exception, notification, navigatable); } else { failure = new FailureImpl(notificationData.getMessage(), exception, notification, navigatable); } return new FailureResultImpl(Collections.singletonList(failure)); } | createFailureResult |
276,528 | boolean (@Nullable Navigatable navigatable) { return navigatable == null || navigatable == NonNavigatable.INSTANCE; } | isNullOrNonNavigatable |
276,529 | BuildEvent (@NotNull ExternalSystemTaskExecutionEvent event) { var buildEvent = ExternalSystemProgressEventConverter.convertBuildEvent(event); if (buildEvent == null) { // Migrated old fallback from previous implementation return new OutputBuildEventImpl( event.getProgressEvent().getEventId(), ObjectUtils.chooseNotNull(event.getProgressEvent().getParentEventId(), event.getId()), event.getProgressEvent().getDescriptor().getDisplayName(), true ); } return buildEvent; } | convert |
276,530 | void (@NotNull ExternalSystemTaskExecutionSettings taskSettings, @NotNull String executorId, @NotNull Project project, @NotNull ProjectSystemId externalSystemId) { runTask(taskSettings, executorId, project, externalSystemId, null, ProgressExecutionMode.IN_BACKGROUND_ASYNC); } | runTask |
276,531 | void (final @NotNull ExternalSystemTaskExecutionSettings taskSettings, final @NotNull String executorId, final @NotNull Project project, final @NotNull ProjectSystemId externalSystemId, final @Nullable TaskCallback callback, final @NotNull ProgressExecutionMode progressExecutionMode) { runTask(taskSettings, executorId, project, externalSystemId, callback, progressExecutionMode, true); } | runTask |
276,532 | void (final @NotNull ExternalSystemTaskExecutionSettings taskSettings, final @NotNull String executorId, final @NotNull Project project, final @NotNull ProjectSystemId externalSystemId, final @Nullable TaskCallback callback, final @NotNull ProgressExecutionMode progressExecutionMode, boolean activateToolWindowBeforeRun) { runTask(taskSettings, executorId, project, externalSystemId, callback, progressExecutionMode, activateToolWindowBeforeRun, null); } | runTask |
276,533 | void (final @NotNull ExternalSystemTaskExecutionSettings taskSettings, final @NotNull String executorId, final @NotNull Project project, final @NotNull ProjectSystemId externalSystemId, final @Nullable TaskCallback callback, final @NotNull ProgressExecutionMode progressExecutionMode, boolean activateToolWindowBeforeRun, @Nullable UserDataHolderBase userData) { var environment = createExecutionEnvironment(project, externalSystemId, taskSettings, executorId); if (environment == null) { LOG.warn("Execution environment for " + externalSystemId + " is null"); return; } var runnerAndConfigurationSettings = environment.getRunnerAndConfigurationSettings(); assert runnerAndConfigurationSettings != null; runnerAndConfigurationSettings.setActivateToolWindowBeforeRun(activateToolWindowBeforeRun); if (userData != null) { var runConfiguration = (ExternalSystemRunConfiguration)runnerAndConfigurationSettings.getConfiguration(); userData.copyUserDataTo(runConfiguration); } var title = AbstractExternalSystemTaskConfigurationType.generateName(project, taskSettings); ExternalSystemTaskUnderProgress.executeTaskUnderProgress(project, title, progressExecutionMode, new ExternalSystemTaskUnderProgress() { @Override public void execute(@NotNull ProgressIndicator indicator) { indicator.setIndeterminate(true); var targetDone = new Semaphore(); var result = new Ref<>(false); var disposable = Disposer.newDisposable(); project.getMessageBus().connect(disposable).subscribe(ExecutionManager.EXECUTION_TOPIC, new ExecutionListener() { @Override public void processStartScheduled(final @NotNull String executorIdLocal, final @NotNull ExecutionEnvironment environmentLocal) { if (executorId.equals(executorIdLocal) && environment.equals(environmentLocal)) { targetDone.down(); } } @Override public void processNotStarted(final @NotNull String executorIdLocal, final @NotNull ExecutionEnvironment environmentLocal) { if (executorId.equals(executorIdLocal) && environment.equals(environmentLocal)) { targetDone.up(); } } @Override public void processTerminated(@NotNull String executorIdLocal, @NotNull ExecutionEnvironment environmentLocal, @NotNull ProcessHandler handler, int exitCode) { if (executorId.equals(executorIdLocal) && environment.equals(environmentLocal)) { result.set(exitCode == 0); targetDone.up(); } } }); try { ApplicationManager.getApplication().invokeAndWait(() -> { try { environment.getRunner().execute(environment); } catch (ExecutionException e) { targetDone.up(); LOG.error(e); } }, ModalityState.defaultModalityState()); } catch (Exception e) { LOG.error(e); Disposer.dispose(disposable); return; } targetDone.waitFor(); Disposer.dispose(disposable); if (callback != null) { if (result.get()) { callback.onSuccess(); } else { callback.onFailure(); } } if (!result.get()) { ApplicationManager.getApplication().invokeLater(() -> { var window = ToolWindowManager.getInstance(project).getToolWindow(environment.getExecutor().getToolWindowId()); if (window != null) { window.activate(null, false, false); } }, project.getDisposed()); } } }); } | runTask |
276,534 | void (@NotNull ProgressIndicator indicator) { indicator.setIndeterminate(true); var targetDone = new Semaphore(); var result = new Ref<>(false); var disposable = Disposer.newDisposable(); project.getMessageBus().connect(disposable).subscribe(ExecutionManager.EXECUTION_TOPIC, new ExecutionListener() { @Override public void processStartScheduled(final @NotNull String executorIdLocal, final @NotNull ExecutionEnvironment environmentLocal) { if (executorId.equals(executorIdLocal) && environment.equals(environmentLocal)) { targetDone.down(); } } @Override public void processNotStarted(final @NotNull String executorIdLocal, final @NotNull ExecutionEnvironment environmentLocal) { if (executorId.equals(executorIdLocal) && environment.equals(environmentLocal)) { targetDone.up(); } } @Override public void processTerminated(@NotNull String executorIdLocal, @NotNull ExecutionEnvironment environmentLocal, @NotNull ProcessHandler handler, int exitCode) { if (executorId.equals(executorIdLocal) && environment.equals(environmentLocal)) { result.set(exitCode == 0); targetDone.up(); } } }); try { ApplicationManager.getApplication().invokeAndWait(() -> { try { environment.getRunner().execute(environment); } catch (ExecutionException e) { targetDone.up(); LOG.error(e); } }, ModalityState.defaultModalityState()); } catch (Exception e) { LOG.error(e); Disposer.dispose(disposable); return; } targetDone.waitFor(); Disposer.dispose(disposable); if (callback != null) { if (result.get()) { callback.onSuccess(); } else { callback.onFailure(); } } if (!result.get()) { ApplicationManager.getApplication().invokeLater(() -> { var window = ToolWindowManager.getInstance(project).getToolWindow(environment.getExecutor().getToolWindowId()); if (window != null) { window.activate(null, false, false); } }, project.getDisposed()); } } | execute |
276,535 | void (final @NotNull String executorIdLocal, final @NotNull ExecutionEnvironment environmentLocal) { if (executorId.equals(executorIdLocal) && environment.equals(environmentLocal)) { targetDone.down(); } } | processStartScheduled |
276,536 | void (final @NotNull String executorIdLocal, final @NotNull ExecutionEnvironment environmentLocal) { if (executorId.equals(executorIdLocal) && environment.equals(environmentLocal)) { targetDone.up(); } } | processNotStarted |
276,537 | void (@NotNull String executorIdLocal, @NotNull ExecutionEnvironment environmentLocal, @NotNull ProcessHandler handler, int exitCode) { if (executorId.equals(executorIdLocal) && environment.equals(environmentLocal)) { result.set(exitCode == 0); targetDone.up(); } } | processTerminated |
276,538 | void (@NotNull String executorId, @NotNull String externalSystemRunnerId) { if (!RUNNER_IDS.containsKey(executorId)) { RUNNER_IDS.put(executorId, externalSystemRunnerId); } else { throw new ExternalSystemException("Executor with ID " + executorId + " is already registered"); } } | registerRunnerId |
276,539 | void (final @NotNull ProjectSystemId externalSystemId, final @NotNull ExternalProjectSettings projectSettings, final @NotNull Project project, final @Nullable Consumer<? super Boolean> importResultCallback, boolean isPreviewMode, final @NotNull ProgressExecutionMode progressExecutionMode) { var systemSettings = ExternalSystemApiUtil.getSettings(project, externalSystemId); var existingSettings = systemSettings.getLinkedProjectSettings(projectSettings.getExternalProjectPath()); if (existingSettings != null) { return; } //noinspection unchecked systemSettings.linkProject(projectSettings); var callback = new ExternalProjectRefreshCallback() { @Override public void onSuccess(final @Nullable DataNode<ProjectData> externalProject) { if (externalProject == null) { if (importResultCallback != null) { importResultCallback.consume(false); } return; } ProjectDataManager.getInstance().importData(externalProject, project); if (importResultCallback != null) { importResultCallback.consume(true); } } @Override public void onFailure(@NotNull String errorMessage, @Nullable String errorDetails) { if (importResultCallback != null) { importResultCallback.consume(false); } } }; var importSpecBuilder = new ImportSpecBuilder(project, externalSystemId).callback(callback).use(progressExecutionMode); if (isPreviewMode) importSpecBuilder.usePreviewMode(); refreshProject(projectSettings.getExternalProjectPath(), importSpecBuilder); } | linkExternalProject |
276,540 | void (final @Nullable DataNode<ProjectData> externalProject) { if (externalProject == null) { if (importResultCallback != null) { importResultCallback.consume(false); } return; } ProjectDataManager.getInstance().importData(externalProject, project); if (importResultCallback != null) { importResultCallback.consume(true); } } | onSuccess |
276,541 | void (@NotNull String errorMessage, @Nullable String errorDetails) { if (importResultCallback != null) { importResultCallback.consume(false); } } | onFailure |
276,542 | void (final @NotNull Project project, final @NotNull ProjectSystemId systemId) { var externalProjectsView = ExternalProjectsManagerImpl.getInstance(project).getExternalProjectsView(systemId); if (externalProjectsView instanceof ExternalProjectsViewImpl externalProjectsViewImpl) { externalProjectsViewImpl.scheduleStructureUpdate(); } } | scheduleExternalViewStructureUpdate |
276,543 | void (Project p, Runnable r) { invokeLater(p, ModalityState.defaultModalityState(), r); } | invokeLater |
276,544 | void (final Project p, final ModalityState state, final Runnable r) { if (isNoBackgroundMode()) { r.run(); } else { ApplicationManager.getApplication().invokeLater(r, state, p.getDisposed()); } } | invokeLater |
276,545 | boolean () { return (ApplicationManager.getApplication().isUnitTestMode() || ApplicationManager.getApplication().isHeadlessEnvironment() && !PlatformUtils.isFleetBackend()); } | isNoBackgroundMode |
276,546 | void (final @Nullable DataNode<ProjectData> externalProject) { if (externalProject == null) { return; } ProjectDataManager.getInstance().importData(externalProject, myProject); } | onSuccess |
276,547 | void (@NotNull String errorMessage, @Nullable String errorDetails) { LOG.warn(errorMessage + "\n" + errorDetails); } | onFailure |
276,548 | void ( @NotNull Project project, @NotNull @Nls String title, @NotNull ProgressExecutionMode progressExecutionMode, @NotNull ExternalSystemTaskUnderProgress task ) { switch (progressExecutionMode) { case NO_PROGRESS_SYNC -> task.execute(new EmptyProgressIndicator()); case MODAL_SYNC -> new Task.Modal(project, title, true) { @Override public @Nullable Object getId() { return task.getId(); } @Override public void run(@NotNull ProgressIndicator indicator) { task.execute(indicator); } }.queue(); case NO_PROGRESS_ASYNC -> ApplicationManager.getApplication().executeOnPooledThread( () -> task.execute(new EmptyProgressIndicator()) ); case IN_BACKGROUND_ASYNC -> new Task.Backgroundable(project, title) { @Override public @Nullable Object getId() { return task.getId(); } @Override public void run(@NotNull ProgressIndicator indicator) { task.execute(indicator); } }.queue(); case START_IN_FOREGROUND_ASYNC -> new Task.Backgroundable(project, title, true, PerformInBackgroundOption.DEAF) { @Override public @Nullable Object getId() { return task.getId(); } @Override public void run(@NotNull ProgressIndicator indicator) { task.execute(indicator); } }.queue(); } } | executeTaskUnderProgress |
276,549 | void (@NotNull ProgressIndicator indicator) { task.execute(indicator); } | run |
276,550 | void (@NotNull ProgressIndicator indicator) { task.execute(indicator); } | run |
276,551 | void (@NotNull ProgressIndicator indicator) { task.execute(indicator); } | run |
276,552 | boolean (Runnable runnable) { return list.add(runnable); } | add |
276,553 | void () { list = new SmartList<>(); } | clear |
276,554 | void () { for (Runnable runnable : list) { runnable.run(); } } | run |
276,555 | void (@NotNull JComponent component, @NotNull MessageType messageType, @NotNull @Nls String message) { final BalloonBuilder builder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, messageType, null) .setDisposable(ApplicationManager.getApplication()) .setFadeoutTime(BALLOON_FADEOUT_TIME); Balloon balloon = builder.createBalloon(); Dimension size = component.getSize(); Balloon.Position position; int x; int y; if (size == null) { x = y = 0; position = Balloon.Position.above; } else { x = Math.min(10, size.width / 2); y = size.height; position = Balloon.Position.below; } balloon.show(new RelativePoint(component, new Point(x, y)), position); } | showBalloon |
276,556 | GridBag (int indentLevel) { Insets insets = JBUI.insets(INSETS, INSETS + INSETS * indentLevel, 0, INSETS); return new GridBag().anchor(GridBagConstraints.WEST).weightx(0).insets(insets); } | getLabelConstraints |
276,557 | GridBag (int indentLevel) { Insets insets = JBUI.insets(INSETS, INSETS + INSETS * indentLevel, 0, INSETS); return new GridBag().weightx(1).coverLine().fillCellHorizontally().anchor(GridBagConstraints.WEST).insets(insets); } | getFillLineConstraints |
276,558 | GridBag (int indentLevel) { GridBag constraints = getFillLineConstraints(indentLevel); constraints.insets.top = 0; return constraints; } | getCommentConstraints |
276,559 | GridBag (int indentLevel, @NotNull JCheckBox checkBox) { GridBag constraints = getCommentConstraints(indentLevel); constraints.insets.left += UIUtil.getCheckBoxTextHorizontalOffset(checkBox); return constraints; } | getCheckBoxCommentConstraints |
276,560 | void (@NotNull JComponent component) { component.add(Box.createVerticalGlue(), new GridBag().weightx(1).weighty(1).fillCell().coverLine()); } | fillBottom |
276,561 | void (@NotNull Object o, boolean show) { for (Class<?> clazz = o.getClass(); clazz != Object.class; clazz = clazz.getSuperclass()) { for (Field field : clazz.getDeclaredFields()) { field.setAccessible(true); try { Object v = field.get(o); if (v instanceof JComponent) { ((JComponent)v).setVisible(show); } } catch (IllegalAccessException e) { // Ignore } } } } | showUi |
276,562 | void (@NotNull Object o) { for (Class<?> clazz = o.getClass(); clazz != Object.class; clazz = clazz.getSuperclass()) { for (Field field : clazz.getDeclaredFields()) { field.setAccessible(true); try { Object v = field.get(o); if (v instanceof JComponent) { field.set(o, null); } } catch (IllegalAccessException e) { // Ignore } } } } | disposeUi |
276,563 | ExternalSystemUiAware (@NotNull ProjectSystemId externalSystemId) { ExternalSystemManager<?,?,?,?,?> manager = ExternalSystemApiUtil.getManager(externalSystemId); return manager instanceof ExternalSystemUiAware ? (ExternalSystemUiAware)manager : DefaultExternalSystemUiAware.INSTANCE; } | getUiAware |
276,564 | void (@NotNull final String actionId, @NotNull final InputEvent e) { final ActionManager actionManager = ActionManager.getInstance(); final AnAction action = actionManager.getAction(actionId); if (action == null) { return; } final Presentation presentation = new Presentation(); DataContext context = DataManager.getInstance().getDataContext(e.getComponent()); final AnActionEvent event = new AnActionEvent(e, context, "", presentation, actionManager, 0); action.update(event); if (presentation.isEnabled()) { action.actionPerformed(event); } } | executeAction |
276,565 | void () { if (myBuffer == null || myBuffer.isEmpty()) { return; } myListener.onTaskOutput(myTaskId, myBuffer.toString(), myStdOut); myBuffer.setLength(0); } | doFlush |
276,566 | void (@NotNull PresentationData presentation) { super.update(presentation); presentation.setIcon(ProgramRunnerUtil.getConfigurationIcon(mySettings, false)); final ExternalSystemRunConfiguration runConfiguration = (ExternalSystemRunConfiguration)mySettings.getConfiguration(); final ExternalSystemTaskExecutionSettings taskExecutionSettings = runConfiguration.getSettings(); final String shortcutHint = StringUtil.nullize(getShortcutsManager().getDescription( taskExecutionSettings.getExternalProjectPath(), mySettings.getName())); final String activatorHint = StringUtil.nullize(getTaskActivator().getDescription( taskExecutionSettings.getExternalSystemId(), taskExecutionSettings.getExternalProjectPath(), getRunConfigurationActivationTaskName(mySettings))); String hint; if (shortcutHint == null) { hint = activatorHint; } else if (activatorHint == null) { hint = shortcutHint; } else { hint = shortcutHint + ", " + activatorHint; } setNameAndTooltip(presentation, getName(), StringUtil.join(taskExecutionSettings.getTaskNames(), " "), hint); } | update |
276,567 | RunnerAndConfigurationSettings () { return mySettings; } | getSettings |
276,568 | String () { return mySettings.getName(); } | getName |
276,569 | boolean () { return true; } | isAlwaysLeaf |
276,570 | String () { return "ExternalSystemView.RunConfigurationMenu"; } | getMenuId |
276,571 | void () { } | updateRunConfiguration |
276,572 | void (SimpleTree tree, InputEvent inputEvent) { ExternalProjectsView projectsView = getExternalProjectsView(); String place = projectsView instanceof Component ? ((Component)projectsView).getName() : "unknown"; ExternalSystemActionsCollector.trigger(myProject, projectsView.getSystemId(), ExternalSystemActionsCollector.ActionId.ExecuteExternalSystemRunConfigurationAction, place, false, null); ProgramRunnerUtil.executeConfiguration(mySettings, DefaultRunExecutor.getRunExecutorInstance()); RunManager runManager = RunManager.getInstance(mySettings.getConfiguration().getProject()); runManager.addConfiguration(mySettings); runManager.setSelectedConfiguration(mySettings); } | handleDoubleClickOrEnter |
276,573 | Navigatable () { return new Navigatable() { @Override public void navigate(boolean requestFocus) { RunManager.getInstance(myProject).setSelectedConfiguration(mySettings); EditConfigurationsDialog dialog = new EditConfigurationsDialog(myProject); dialog.show(); } @Override public boolean canNavigate() { return true; } @Override public boolean canNavigateToSource() { return false; } }; } | getNavigatable |
276,574 | void (boolean requestFocus) { RunManager.getInstance(myProject).setSelectedConfiguration(mySettings); EditConfigurationsDialog dialog = new EditConfigurationsDialog(myProject); dialog.show(); } | navigate |
276,575 | boolean () { return true; } | canNavigate |
276,576 | boolean () { return false; } | canNavigateToSource |
276,577 | void (@NotNull PresentationData presentation) { super.update(presentation); presentation.setIcon(getUiAware().getProjectIcon()); } | update |
276,578 | ExternalSystemNode () { return (ExternalSystemNode)getParent(); } | getGroup |
276,579 | void (@NotNull PresentationData presentation) { setNameAndTooltip(presentation, getName(), myTooltipCache); } | doUpdate |
276,580 | String () { ProjectData data = getData(); if (data == null) return null; return data.getIdeGrouping(); } | getIdeGrouping |
276,581 | void (@Nullable String ideGrouping) { ProjectData data = getData(); if (data != null) { data.setIdeGrouping(ideGrouping); } } | setIdeGrouping |
276,582 | String () { return "ExternalSystemView.ProjectMenu"; } | getMenuId |
276,583 | ModuleNode () { return effectiveRoot; } | getEffectiveRoot |
276,584 | void (@NotNull ExternalSystemViewContributor extension, @NotNull PluginDescriptor pluginDescriptor) { if (contributorPredicate.value(extension)) { myViewContributors.add(extension); } } | extensionAdded |
276,585 | void (@NotNull ExternalSystemViewContributor extension, @NotNull PluginDescriptor pluginDescriptor) { if (contributorPredicate.value(extension)) { myViewContributors.remove(extension); } } | extensionRemoved |
276,586 | Project () { return myProject; } | getProject |
276,587 | ExternalSystemUiAware () { return myUiAware; } | getUiAware |
276,588 | ExternalSystemShortcutsManager () { return myProjectsManager.getShortcutsManager(); } | getShortcutsManager |
276,589 | ExternalSystemTaskActivator () { return myProjectsManager.getTaskActivator(); } | getTaskActivator |
276,590 | ProjectSystemId () { return myExternalSystemId; } | getSystemId |
276,591 | NotificationGroup () { return myNotificationGroup; } | getNotificationGroup |
276,592 | void () { Disposer.register(myProject, this); initTree(); MessageBusConnection busConnection = myProject.getMessageBus().connect(this); busConnection.subscribe(ToolWindowManagerListener.TOPIC, new ToolWindowManagerListener() { boolean wasVisible; @Override public void stateChanged(@NotNull ToolWindowManager toolWindowManager) { if (myToolWindow.isDisposed()) { return; } boolean visible = ((ToolWindowManagerEx)toolWindowManager).shouldUpdateToolWindowContent(myToolWindow); if (!visible || wasVisible) { wasVisible = visible; if (!visible) { scheduleStructureCleanupCache(); } return; } scheduleStructureUpdate(); wasVisible = true; } }); getShortcutsManager().addListener(() -> scheduleTaskAndRunConfigUpdate(), this); getTaskActivator().addListener(() -> scheduleTaskAndRunConfigUpdate(), this); busConnection.subscribe(RunManagerListener.TOPIC, new RunManagerListener() { private void changed() { scheduleStructureRequest(() -> { assert myStructure != null; myStructure.visitExistingNodes(ModuleNode.class, node -> node.updateRunConfigurations()); }); } @Override public void runConfigurationAdded(@NotNull RunnerAndConfigurationSettings settings) { changed(); } @Override public void runConfigurationRemoved(@NotNull RunnerAndConfigurationSettings settings) { changed(); } @Override public void runConfigurationChanged(@NotNull RunnerAndConfigurationSettings settings) { changed(); } }); myToolWindow.setAdditionalGearActions(createAdditionalGearActionsGroup()); scheduleStructureUpdate(); } | init |
276,593 | void (@NotNull ToolWindowManager toolWindowManager) { if (myToolWindow.isDisposed()) { return; } boolean visible = ((ToolWindowManagerEx)toolWindowManager).shouldUpdateToolWindowContent(myToolWindow); if (!visible || wasVisible) { wasVisible = visible; if (!visible) { scheduleStructureCleanupCache(); } return; } scheduleStructureUpdate(); wasVisible = true; } | stateChanged |
276,594 | void () { scheduleStructureRequest(() -> { assert myStructure != null; myStructure.visitExistingNodes(ModuleNode.class, node -> node.updateRunConfigurations()); }); } | changed |
276,595 | void (@NotNull RunnerAndConfigurationSettings settings) { changed(); } | runConfigurationAdded |
276,596 | void (@NotNull RunnerAndConfigurationSettings settings) { changed(); } | runConfigurationRemoved |
276,597 | void (@NotNull RunnerAndConfigurationSettings settings) { changed(); } | runConfigurationChanged |
276,598 | void () { scheduleStructureRequest(() -> { assert myStructure != null; myStructure.updateNodesAsync(Arrays.asList(TaskNode.class, RunConfigurationNode.class)); }); } | scheduleTaskAndRunConfigUpdate |
276,599 | void (@NotNull ExternalSystemNode node, @Nullable String actionId, InputEvent inputEvent) { if (actionId != null) { ExternalSystemActionUtil.executeAction(actionId, getName(), inputEvent); } for (Listener listener : listeners) { listener.onDoubleClickOrEnter(node, inputEvent); } } | handleDoubleClickOrEnter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.