use of com.intellij.openapi.externalSystem.view.ProjectNode in project intellij-community by JetBrains.
the class GradleOpenProjectCompositeConfigurationAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final Project project = getProject(e);
if (project == null)
return;
final ProjectNode projectNode = ExternalSystemDataKeys.SELECTED_PROJECT_NODE.getData(e.getDataContext());
if (projectNode == null || projectNode.getData() == null)
return;
new GradleProjectCompositeSelectorDialog(project, projectNode.getData().getLinkedExternalProjectPath()).showAndGet();
}
use of com.intellij.openapi.externalSystem.view.ProjectNode in project intellij-community by JetBrains.
the class SelectExternalProjectDialog method doOKAction.
@Override
protected void doOKAction() {
SimpleNode node = getSelectedNode();
if (node instanceof NullNode)
node = null;
myResult = node instanceof ProjectNode ? ((ProjectNode) node).getData() : null;
super.doOKAction();
}
use of com.intellij.openapi.externalSystem.view.ProjectNode in project intellij-community by JetBrains.
the class DetachExternalProjectAction method perform.
@Override
public void perform(@NotNull final Project project, @NotNull ProjectSystemId projectSystemId, @NotNull ProjectData projectData, @NotNull AnActionEvent e) {
e.getPresentation().setText(ExternalSystemBundle.message("action.detach.external.project.text", projectSystemId.getReadableName()));
final ProjectNode projectNode = ExternalSystemDataKeys.SELECTED_PROJECT_NODE.getData(e.getDataContext());
assert projectNode != null;
ExternalSystemApiUtil.getLocalSettings(project, projectSystemId).forgetExternalProjects(Collections.singleton(projectData.getLinkedExternalProjectPath()));
ExternalSystemApiUtil.getSettings(project, projectSystemId).unlinkExternalProject(projectData.getLinkedExternalProjectPath());
ExternalProjectsManager.getInstance(project).forgetExternalProjectData(projectSystemId, projectData.getLinkedExternalProjectPath());
// Process orphan modules.
List<Module> orphanModules = ContainerUtilRt.newArrayList();
for (Module module : ModuleManager.getInstance(project).getModules()) {
if (!ExternalSystemApiUtil.isExternalSystemAwareModule(projectSystemId, module))
continue;
String path = ExternalSystemApiUtil.getExternalRootProjectPath(module);
if (projectData.getLinkedExternalProjectPath().equals(path)) {
orphanModules.add(module);
}
}
if (!orphanModules.isEmpty()) {
projectNode.getGroup().remove(projectNode);
ProjectDataManager.getInstance().removeData(ProjectKeys.MODULE, orphanModules, Collections.<DataNode<ModuleData>>emptyList(), projectData, project, false);
}
}
use of com.intellij.openapi.externalSystem.view.ProjectNode in project intellij-community by JetBrains.
the class ExternalSystemSelectProjectDataToImportAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final Project project = getProject(e);
final ProjectSystemId projectSystemId = getSystemId(e);
final List<ExternalSystemNode> selectedNodes = ExternalSystemDataKeys.SELECTED_NODES.getData(e.getDataContext());
final ExternalProjectInfo projectInfo;
final ExternalSystemNode<?> externalSystemNode = ContainerUtil.getFirstItem(selectedNodes);
if (externalSystemNode == null) {
projectInfo = ContainerUtil.getFirstItem(ProjectDataManager.getInstance().getExternalProjectsData(project, projectSystemId));
} else {
final ProjectNode projectNode = externalSystemNode instanceof ProjectNode ? (ProjectNode) externalSystemNode : externalSystemNode.findParent(ProjectNode.class);
assert projectNode != null;
final ProjectData projectData = projectNode.getData();
assert projectData != null;
projectInfo = ProjectDataManager.getInstance().getExternalProjectData(project, projectSystemId, projectData.getLinkedExternalProjectPath());
}
final ExternalProjectDataSelectorDialog dialog;
if (projectInfo != null) {
dialog = new ExternalProjectDataSelectorDialog(project, projectInfo, externalSystemNode != null ? externalSystemNode.getData() : null);
dialog.showAndGet();
}
}
use of com.intellij.openapi.externalSystem.view.ProjectNode in project intellij-community by JetBrains.
the class ToggleAutoImportAction method getProjectSettings.
@Nullable
private ExternalProjectSettings getProjectSettings(AnActionEvent e) {
final ProjectNode projectNode = ExternalSystemDataKeys.SELECTED_PROJECT_NODE.getData(e.getDataContext());
if (projectNode == null || projectNode.getData() == null)
return null;
final AbstractExternalSystemSettings externalSystemSettings = ExternalSystemApiUtil.getSettings(getProject(e), getSystemId(e));
return externalSystemSettings.getLinkedProjectSettings(projectNode.getData().getLinkedExternalProjectPath());
}
Aggregations