use of com.intellij.openapi.externalSystem.ExternalSystemManager in project intellij-community by JetBrains.
the class ExternalSystemFacadeManager method doGetFacade.
@SuppressWarnings("ConstantConditions")
@NotNull
private RemoteExternalSystemFacade doGetFacade(@NotNull IntegrationKey key, @NotNull Project project) throws Exception {
final boolean currentInProcess = ExternalSystemApiUtil.isInProcessMode(key.getExternalSystemId());
final ExternalSystemCommunicationManager myCommunicationManager = currentInProcess ? myInProcessCommunicationManager : myRemoteCommunicationManager;
ExternalSystemManager manager = ExternalSystemApiUtil.getManager(key.getExternalSystemId());
if (project.isDisposed() || manager == null) {
return RemoteExternalSystemFacade.NULL_OBJECT;
}
Pair<RemoteExternalSystemFacade, ExternalSystemExecutionSettings> pair = myRemoteFacades.get(key);
if (pair != null && prepare(myCommunicationManager, project, key, pair)) {
return pair.first;
}
myLock.lock();
try {
pair = myRemoteFacades.get(key);
if (pair != null && prepare(myCommunicationManager, project, key, pair)) {
return pair.first;
}
if (pair != null) {
myFacadeWrappers.clear();
myRemoteFacades.clear();
}
return doCreateFacade(key, project, myCommunicationManager);
} finally {
myLock.unlock();
}
}
use of com.intellij.openapi.externalSystem.ExternalSystemManager in project intellij-community by JetBrains.
the class ExternalSystemStartupActivity method runActivity.
@Override
public void runActivity(@NotNull final Project project) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
return;
}
Runnable task = () -> {
for (ExternalSystemManager<?, ?, ?, ?, ?> manager : ExternalSystemApiUtil.getAllManagers()) {
if (manager instanceof StartupActivity) {
((StartupActivity) manager).runActivity(project);
}
}
if (project.getUserData(ExternalSystemDataKeys.NEWLY_IMPORTED_PROJECT) != Boolean.TRUE) {
for (ExternalSystemManager manager : ExternalSystemManager.EP_NAME.getExtensions()) {
final boolean isNewProject = project.getUserData(ExternalSystemDataKeys.NEWLY_CREATED_PROJECT) == Boolean.TRUE;
if (isNewProject) {
ExternalSystemUtil.refreshProjects(new ImportSpecBuilder(project, manager.getSystemId()).createDirectoriesForEmptyContentRoots());
}
}
}
ExternalToolWindowManager.handle(project);
ExternalSystemVcsRegistrar.handle(project);
ProjectRenameAware.beAware(project);
};
ExternalProjectsManager.getInstance(project).init();
DumbService.getInstance(project).runWhenSmart(DisposeAwareRunnable.create(task, project));
}
use of com.intellij.openapi.externalSystem.ExternalSystemManager in project intellij-community by JetBrains.
the class ExternalSystemProjectsWatcher method scheduleUpdate.
private void scheduleUpdate(String projectPath) {
Pair<ExternalSystemManager, ExternalProjectSettings> linkedProject = findLinkedProjectSettings(projectPath);
if (linkedProject == null)
return;
ExternalSystemManager<?, ?, ?, ?, ?> manager = linkedProject.first;
ProjectSystemId systemId = manager.getSystemId();
boolean useAutoImport = linkedProject.second.isUseAutoImport();
if (useAutoImport) {
final ExternalSystemTask resolveTask = ServiceManager.getService(ExternalSystemProcessingManager.class).findTask(ExternalSystemTaskType.RESOLVE_PROJECT, systemId, projectPath);
final ExternalSystemTaskState taskState = resolveTask == null ? null : resolveTask.getState();
if (taskState == null || taskState.isStopped()) {
scheduleRefresh(myProject, projectPath, systemId, false);
} else if (taskState != ExternalSystemTaskState.NOT_STARTED) {
// TODO re-schedule to wait for the project import task end
}
} else {
myUpdatesQueue.queue(new Update(Pair.create(systemId, projectPath)) {
public void run() {
doUpdateNotifications(false, systemId, projectPath);
}
});
}
}
use of com.intellij.openapi.externalSystem.ExternalSystemManager in project intellij-community by JetBrains.
the class RefreshAllExternalProjectsAction method getSystemIds.
private static List<ProjectSystemId> getSystemIds(AnActionEvent e) {
final List<ProjectSystemId> systemIds = ContainerUtil.newArrayList();
final ProjectSystemId externalSystemId = ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID.getData(e.getDataContext());
if (externalSystemId != null) {
systemIds.add(externalSystemId);
} else {
for (ExternalSystemManager manager : ExternalSystemManager.EP_NAME.getExtensions()) {
systemIds.add(manager.getSystemId());
}
}
return systemIds;
}
use of com.intellij.openapi.externalSystem.ExternalSystemManager in project intellij-community by JetBrains.
the class ConfigurationErrorEvent method process.
@Override
public void process(@NotNull final TestEventXmlView xml) throws TestEventXmlView.XmlParserException {
final String errorTitle = xml.getEventTitle();
final String configurationErrorMsg = xml.getEventMessage();
final boolean openSettings = xml.isEventOpenSettings();
final Project project = getProject();
assert project != null;
final String message = openSettings ? String.format("<br>\n%s<br><br>\n\n<a href=\"Gradle settings\">Open gradle settings</a>", configurationErrorMsg) : String.format("<br>\n%s", configurationErrorMsg);
GradleNotification.getInstance(project).showBalloon(errorTitle, message, NotificationType.WARNING, new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
notification.expire();
if ("Gradle settings".equals(event.getDescription())) {
ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(GradleConstants.SYSTEM_ID);
assert manager instanceof GradleManager;
GradleManager gradleManager = (GradleManager) manager;
Configurable configurable = gradleManager.getConfigurable(project);
ShowSettingsUtil.getInstance().editConfigurable(project, configurable);
} else {
BrowserUtil.browse(event.getDescription());
}
}
});
}
Aggregations