use of com.intellij.openapi.externalSystem.model.ProjectSystemId in project intellij-community by JetBrains.
the class GradleOpenProjectCompositeConfigurationAction method isVisible.
@Override
protected boolean isVisible(AnActionEvent e) {
final Project project = getProject(e);
if (project == null)
return false;
ProjectSystemId systemId = getSystemId(e);
if (!GradleConstants.SYSTEM_ID.equals(systemId))
return false;
if (GradleSettings.getInstance(project).getLinkedProjectsSettings().size() > 1) {
final ProjectNode projectNode = ExternalSystemDataKeys.SELECTED_PROJECT_NODE.getData(e.getDataContext());
if (projectNode == null || projectNode.getData() == null)
return false;
GradleProjectSettings projectSettings = GradleSettings.getInstance(project).getLinkedProjectSettings(projectNode.getData().getLinkedExternalProjectPath());
GradleProjectSettings.CompositeBuild compositeBuild = null;
if (projectSettings != null) {
compositeBuild = projectSettings.getCompositeBuild();
}
if (compositeBuild == null || compositeBuild.getCompositeDefinitionSource() == CompositeDefinitionSource.IDE)
return true;
}
return false;
}
use of com.intellij.openapi.externalSystem.model.ProjectSystemId in project intellij-community by JetBrains.
the class ExternalProjectDataCache method getRootExternalProject.
@Nullable
public ExternalProject getRootExternalProject(@NotNull ProjectSystemId systemId, @NotNull File projectRootDir) {
ExternalProject externalProject = myExternalRootProjects.get(Pair.create(systemId, projectRootDir));
if (LOG.isDebugEnabled()) {
LOG.debug("Can not find data for project at: " + projectRootDir);
LOG.debug("Existing imported projects paths: " + ContainerUtil.map(myExternalRootProjects.entrySet(), (Function<Map.Entry<Pair<ProjectSystemId, File>, ExternalProject>, Object>) entry -> {
if (!(entry.getValue() instanceof ExternalProject))
return null;
return Pair.create(entry.getKey(), entry.getValue().getProjectDir());
}));
}
return externalProject;
}
use of com.intellij.openapi.externalSystem.model.ProjectSystemId in project intellij-community by JetBrains.
the class ToolWindowModuleService method processData.
@Override
protected void processData(@NotNull final Collection<DataNode<ModuleData>> nodes, @NotNull Project project) {
if (nodes.isEmpty()) {
return;
}
ProjectSystemId externalSystemId = nodes.iterator().next().getData().getOwner();
ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(externalSystemId);
assert manager != null;
final MultiMap<DataNode<ProjectData>, DataNode<ModuleData>> grouped = ExternalSystemApiUtil.groupBy(nodes, ProjectKeys.PROJECT);
Map<ExternalProjectPojo, Collection<ExternalProjectPojo>> data = ContainerUtilRt.newHashMap();
for (Map.Entry<DataNode<ProjectData>, Collection<DataNode<ModuleData>>> entry : grouped.entrySet()) {
data.put(ExternalProjectPojo.from(entry.getKey().getData()), ContainerUtilRt.map2List(entry.getValue(), MAPPER));
}
AbstractExternalSystemLocalSettings settings = manager.getLocalSettingsProvider().fun(project);
Set<String> pathsToForget = detectRenamedProjects(data, settings.getAvailableProjects());
if (!pathsToForget.isEmpty()) {
settings.forgetExternalProjects(pathsToForget);
}
Map<ExternalProjectPojo, Collection<ExternalProjectPojo>> projects = ContainerUtilRt.newHashMap(settings.getAvailableProjects());
projects.putAll(data);
settings.setAvailableProjects(projects);
}
use of com.intellij.openapi.externalSystem.model.ProjectSystemId in project intellij-community by JetBrains.
the class MessageCounterTest method testIncrement.
@Test
public void testIncrement() throws Exception {
MessageCounter counter = new MessageCounter();
counter.increment(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM);
assertEquals(counter.toString(), 1, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM));
assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM));
assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM));
counter.increment(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM);
assertEquals(counter.toString(), 1, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM));
assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM));
assertEquals(counter.toString(), 2, counter.getCount(null, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM));
assertEquals(counter.toString(), 2, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM));
counter.increment(GROUP2, NotificationSource.PROJECT_SYNC, NotificationCategory.WARNING, OTHER_BUILD_SYSTEM);
assertEquals(counter.toString(), 1, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM));
assertEquals(counter.toString(), 1, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM));
assertEquals(counter.toString(), 0, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.WARNING, OTHER_BUILD_SYSTEM));
assertEquals(counter.toString(), 0, counter.getCount(GROUP2, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM));
assertEquals(counter.toString(), 0, counter.getCount(GROUP2, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM));
assertEquals(counter.toString(), 1, counter.getCount(GROUP2, NotificationSource.PROJECT_SYNC, NotificationCategory.WARNING, OTHER_BUILD_SYSTEM));
assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM));
assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM));
assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, NotificationCategory.WARNING, OTHER_BUILD_SYSTEM));
assertEquals(counter.toString(), 3, counter.getCount(null, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM));
counter.increment(GROUP2, NotificationSource.PROJECT_SYNC, NotificationCategory.SIMPLE, new ProjectSystemId("anotherBuildSystem"));
assertEquals(counter.toString(), 2, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM));
assertEquals(counter.toString(), 1, counter.getCount(GROUP2, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM));
counter.remove(GROUP2, NotificationSource.PROJECT_SYNC, OTHER_BUILD_SYSTEM);
assertEquals(counter.toString(), 0, counter.getCount(GROUP2, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM));
assertEquals(counter.toString(), 2, counter.getCount(null, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM));
counter.remove(null, NotificationSource.PROJECT_SYNC, OTHER_BUILD_SYSTEM);
assertEquals(counter.toString(), 0, counter.getCount(null, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM));
}
use of com.intellij.openapi.externalSystem.model.ProjectSystemId in project intellij-community by JetBrains.
the class ExternalSystemTaskActivator method runTasksQueue.
private boolean runTasksQueue(final Queue<Pair<ProjectSystemId, ExternalSystemTaskExecutionSettings>> tasksQueue) {
final Pair<ProjectSystemId, ExternalSystemTaskExecutionSettings> pair = tasksQueue.poll();
if (pair == null)
return true;
final ProjectSystemId systemId = pair.first;
final ExternalSystemTaskExecutionSettings executionSettings = pair.getSecond();
final Semaphore targetDone = new Semaphore();
targetDone.down();
final Ref<Boolean> result = new Ref<>(false);
ExternalSystemUtil.runTask(executionSettings, DefaultRunExecutor.EXECUTOR_ID, myProject, systemId, new TaskCallback() {
@Override
public void onSuccess() {
result.set(runTasksQueue(tasksQueue));
targetDone.up();
}
@Override
public void onFailure() {
targetDone.up();
}
}, ProgressExecutionMode.IN_BACKGROUND_ASYNC, false);
targetDone.waitFor();
return result.get();
}
Aggregations