use of com.intellij.openapi.externalSystem.model.ProjectSystemId in project intellij-community by JetBrains.
the class OpenTasksActivationManagerAction method isEnabled.
@Override
protected boolean isEnabled(AnActionEvent e) {
if (!super.isEnabled(e))
return false;
final List<ExternalSystemNode> selectedNodes = ExternalSystemDataKeys.SELECTED_NODES.getData(e.getDataContext());
if (selectedNodes == null || selectedNodes.size() != 1)
return false;
final Object externalData = selectedNodes.get(0).getData();
ProjectSystemId projectSystemId = getSystemId(e);
e.getPresentation().setText(ExternalSystemBundle.message("external.system.task.activation.title"));
e.getPresentation().setDescription(ExternalSystemBundle.message("external.system.task.activation.description", projectSystemId.getReadableName()));
final boolean isProjectNode = externalData instanceof ProjectData || externalData instanceof ModuleData;
return isProjectNode && StringUtil.isNotEmpty(((ExternalConfigPathAware) externalData).getLinkedExternalProjectPath());
}
use of com.intellij.openapi.externalSystem.model.ProjectSystemId in project intellij-community by JetBrains.
the class RefreshAllExternalProjectsAction method update.
@Override
public void update(AnActionEvent e) {
final Project project = e.getProject();
if (project == null) {
e.getPresentation().setEnabled(false);
return;
}
final List<ProjectSystemId> systemIds = getSystemIds(e);
if (systemIds.isEmpty()) {
e.getPresentation().setEnabled(false);
return;
}
final String name = StringUtil.join(systemIds, projectSystemId -> projectSystemId.getReadableName(), ",");
e.getPresentation().setText(ExternalSystemBundle.message("action.refresh.all.projects.text", name));
e.getPresentation().setDescription(ExternalSystemBundle.message("action.refresh.all.projects.description", name));
ExternalSystemProcessingManager processingManager = ServiceManager.getService(ExternalSystemProcessingManager.class);
e.getPresentation().setEnabled(!processingManager.hasTaskOfTypeInProgress(ExternalSystemTaskType.RESOLVE_PROJECT, project));
}
use of com.intellij.openapi.externalSystem.model.ProjectSystemId in project intellij-community by JetBrains.
the class ToolWindowTaskService method processData.
@Override
protected void processData(@NotNull Collection<DataNode<TaskData>> nodes, @NotNull Project project) {
if (nodes.isEmpty()) {
return;
}
ProjectSystemId externalSystemId = nodes.iterator().next().getData().getOwner();
ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(externalSystemId);
assert manager != null;
ExternalSystemKeymapExtension.updateActions(project, nodes);
MultiMap<ExternalConfigPathAware, DataNode<TaskData>> grouped = ContainerUtil.groupBy(nodes, TASK_HOLDER_RETRIEVAL_STRATEGY);
Map<String, Collection<ExternalTaskPojo>> data = ContainerUtilRt.newHashMap();
for (Map.Entry<ExternalConfigPathAware, Collection<DataNode<TaskData>>> entry : grouped.entrySet()) {
data.put(entry.getKey().getLinkedExternalProjectPath(), ContainerUtilRt.map2List(entry.getValue(), MAPPER));
}
AbstractExternalSystemLocalSettings settings = manager.getLocalSettingsProvider().fun(project);
Map<String, Collection<ExternalTaskPojo>> availableTasks = ContainerUtilRt.newHashMap(settings.getAvailableTasks());
availableTasks.putAll(data);
settings.setAvailableTasks(availableTasks);
}
use of com.intellij.openapi.externalSystem.model.ProjectSystemId in project android by JetBrains.
the class AndroidGradleProjectResolver method doCreateModule.
@NotNull
private DataNode<ModuleData> doCreateModule(@NotNull IdeaModule gradleModule, @NotNull DataNode<ProjectData> projectDataNode) {
String moduleName = gradleModule.getName();
if (moduleName == null) {
throw new IllegalStateException("Module with undefined name detected: " + gradleModule);
}
String projectPath = projectDataNode.getData().getLinkedExternalProjectPath();
String moduleConfigPath = getModuleConfigPath(resolverCtx, gradleModule, projectPath);
String gradlePath = gradleModule.getGradleProject().getPath();
String moduleId = isEmpty(gradlePath) || ":".equals(gradlePath) ? moduleName : gradlePath;
ProjectSystemId owner = GradleConstants.SYSTEM_ID;
String typeId = StdModuleTypes.JAVA.getId();
ModuleData moduleData = new ModuleData(moduleId, owner, typeId, moduleName, moduleConfigPath, moduleConfigPath);
ExternalProject externalProject = resolverCtx.getExtraProject(gradleModule, ExternalProject.class);
if (externalProject != null) {
moduleData.setDescription(externalProject.getDescription());
}
return projectDataNode.createChild(ProjectKeys.MODULE, moduleData);
}
use of com.intellij.openapi.externalSystem.model.ProjectSystemId in project intellij-community by JetBrains.
the class ExternalSystemNotificationManager method clearNotifications.
public void clearNotifications(@Nullable final String groupName, @NotNull final NotificationSource notificationSource, @NotNull final ProjectSystemId externalSystemId) {
myMessageCounter.remove(groupName, notificationSource, externalSystemId);
myUpdater.submit(() -> {
if (myProject.isDisposed())
return;
for (Iterator<Notification> iterator = myNotifications.iterator(); iterator.hasNext(); ) {
Notification notification = iterator.next();
if (groupName == null || groupName.equals(notification.getGroupId())) {
notification.expire();
iterator.remove();
}
}
final ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
if (toolWindow == null)
return;
final Pair<NotificationSource, ProjectSystemId> contentIdPair = Pair.create(notificationSource, externalSystemId);
final MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
UIUtil.invokeLaterIfNeeded(() -> {
if (myProject.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);
}
}
}
});
});
}
Aggregations