com.intellij.openapi.externalSystem.model.ProjectSystemId Java Examples
The following examples show how to use
com.intellij.openapi.externalSystem.model.ProjectSystemId.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AttachExternalProjectAction.java From consulo with Apache License 2.0 | 6 votes |
@RequiredUIAccess @Override public void actionPerformed(@Nonnull AnActionEvent e) { ProjectSystemId externalSystemId = e.getDataContext().getData(ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID); if (externalSystemId == null) { return; } ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(externalSystemId); if (manager == null) { return; } Project project = e.getDataContext().getData(CommonDataKeys.PROJECT); if (project == null) { return; } ImportModuleAction.executeImportAction(project, manager.getExternalProjectDescriptor()); }
Example #2
Source File: ExternalSystemFacadeManager.java From consulo with Apache License 2.0 | 6 votes |
/** * @return gradle api facade to use * @throws Exception in case of inability to return the facade */ @Nonnull public RemoteExternalSystemFacade getFacade(@javax.annotation.Nullable Project project, @Nonnull String externalProjectPath, @Nonnull ProjectSystemId externalSystemId) throws Exception { if (project == null) { project = ProjectManager.getInstance().getDefaultProject(); } IntegrationKey key = new IntegrationKey(project, externalSystemId, externalProjectPath); final RemoteExternalSystemFacade facade = myFacadeWrappers.get(key); if (facade == null) { final RemoteExternalSystemFacade newFacade = (RemoteExternalSystemFacade)Proxy.newProxyInstance( ExternalSystemFacadeManager.class.getClassLoader(), new Class[]{RemoteExternalSystemFacade.class, Consumer.class}, new MyHandler(key) ); myFacadeWrappers.putIfAbsent(key, newFacade); } return myFacadeWrappers.get(key); }
Example #3
Source File: ExternalProjectPathField.java From consulo with Apache License 2.0 | 6 votes |
private static void collapseIfPossible(@Nonnull final Editor editor, @Nonnull ProjectSystemId externalSystemId, @Nonnull Project project) { ExternalSystemManager<?,?,?,?,?> manager = ExternalSystemApiUtil.getManager(externalSystemId); assert manager != null; final AbstractExternalSystemLocalSettings settings = manager.getLocalSettingsProvider().fun(project); final ExternalSystemUiAware uiAware = ExternalSystemUiUtil.getUiAware(externalSystemId); String rawText = editor.getDocument().getText(); for (Map.Entry<ExternalProjectPojo, Collection<ExternalProjectPojo>> entry : settings.getAvailableProjects().entrySet()) { if (entry.getKey().getPath().equals(rawText)) { collapse(editor, uiAware.getProjectRepresentationName(entry.getKey().getPath(), null)); return; } for (ExternalProjectPojo pojo : entry.getValue()) { if (pojo.getPath().equals(rawText)) { collapse(editor, uiAware.getProjectRepresentationName(pojo.getPath(), entry.getKey().getPath())); return; } } } }
Example #4
Source File: ExternalProjectPathField.java From consulo with Apache License 2.0 | 6 votes |
public ExternalProjectPathField(@Nonnull Project project, @Nonnull ProjectSystemId externalSystemId, @Nonnull FileChooserDescriptor descriptor, @Nonnull String fileChooserTitle) { super(createPanel(project, externalSystemId), new MyBrowseListener(descriptor, fileChooserTitle, project)); ActionListener[] listeners = getButton().getActionListeners(); for (ActionListener listener : listeners) { if (listener instanceof MyBrowseListener) { ((MyBrowseListener)listener).setPathField(getChildComponent().getTextField()); break; } } myProject = project; myExternalSystemId = externalSystemId; }
Example #5
Source File: ExternalProjectPathField.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull private static Tree buildRegisteredProjectsTree(@Nonnull Project project, @Nonnull ProjectSystemId externalSystemId) { ExternalSystemTasksTreeModel model = new ExternalSystemTasksTreeModel(externalSystemId); ExternalSystemTasksTree result = new ExternalSystemTasksTree(model, ContainerUtilRt.<String, Boolean>newHashMap(), project, externalSystemId); ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(externalSystemId); assert manager != null; AbstractExternalSystemLocalSettings settings = manager.getLocalSettingsProvider().fun(project); Map<ExternalProjectPojo, Collection<ExternalProjectPojo>> projects = settings.getAvailableProjects(); List<ExternalProjectPojo> rootProjects = ContainerUtilRt.newArrayList(projects.keySet()); ContainerUtil.sort(rootProjects); for (ExternalProjectPojo rootProject : rootProjects) { model.ensureSubProjectsStructure(rootProject, projects.get(rootProject)); } return result; }
Example #6
Source File: RefreshAllExternalProjectsAction.java From consulo with Apache License 2.0 | 6 votes |
@Override public void update(AnActionEvent e) { final Project project = e.getDataContext().getData(CommonDataKeys.PROJECT); 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, new Function<ProjectSystemId, String>() { @Override public String fun(ProjectSystemId projectSystemId) { return 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)); }
Example #7
Source File: ExternalSystemProcessingManager.java From consulo with Apache License 2.0 | 6 votes |
@Nullable public ExternalSystemTask findTask(@Nonnull ExternalSystemTaskType type, @Nonnull ProjectSystemId projectSystemId, @Nonnull final String externalProjectPath) { for(ExternalSystemTask task : myTasksDetails.values()) { if(task instanceof AbstractExternalSystemTask) { AbstractExternalSystemTask externalSystemTask = (AbstractExternalSystemTask)task; if(externalSystemTask.getId().getType() == type && externalSystemTask.getExternalSystemId().getId().equals(projectSystemId.getId()) && externalSystemTask.getExternalProjectPath().equals(externalProjectPath)){ return task; } } } return null; }
Example #8
Source File: MessageCounter.java From consulo with Apache License 2.0 | 6 votes |
public synchronized void remove(@Nullable final String groupName, @Nonnull final NotificationSource notificationSource, @Nonnull final ProjectSystemId projectSystemId) { final Map<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>> groupMap = ContainerUtil.getOrCreate( map, projectSystemId, ContainerUtil.<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>>newHashMap()); if (groupName != null) { final TObjectIntHashMap<NotificationCategory> counter = ContainerUtil.getOrCreate( ContainerUtil.getOrCreate( groupMap, groupName, ContainerUtil.<NotificationSource, TObjectIntHashMap<NotificationCategory>>newHashMap() ), notificationSource, new TObjectIntHashMap<NotificationCategory>() ); counter.clear(); } else { for (Map<NotificationSource, TObjectIntHashMap<NotificationCategory>> sourceMap : groupMap.values()) { sourceMap.remove(notificationSource); } } }
Example #9
Source File: MessageCounter.java From consulo with Apache License 2.0 | 6 votes |
public synchronized void increment(@Nonnull String groupName, @Nonnull NotificationSource source, @Nonnull NotificationCategory category, @Nonnull ProjectSystemId projectSystemId) { final TObjectIntHashMap<NotificationCategory> counter = ContainerUtil.getOrCreate( ContainerUtil.getOrCreate( ContainerUtil.getOrCreate( map, projectSystemId, ContainerUtil.<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>>newHashMap()), groupName, ContainerUtil.<NotificationSource, TObjectIntHashMap<NotificationCategory>>newHashMap() ), source, new TObjectIntHashMap<NotificationCategory>() ); if (!counter.increment(category)) counter.put(category, 1); }
Example #10
Source File: ExternalSystemApiUtil.java From consulo with Apache License 2.0 | 5 votes |
@javax.annotation.Nullable public static ExternalSystemManager<?, ?, ?, ?, ?> getManager(@Nonnull ProjectSystemId externalSystemId) { for (ExternalSystemManager manager : ExternalSystemManager.EP_NAME.getExtensionList()) { if (externalSystemId.equals(manager.getSystemId())) { return manager; } } return null; }
Example #11
Source File: ExternalSystemResolveProjectTask.java From consulo with Apache License 2.0 | 5 votes |
public ExternalSystemResolveProjectTask(@Nonnull ProjectSystemId externalSystemId, @Nonnull Project project, @Nonnull String projectPath, boolean isPreviewMode) { super(externalSystemId, ExternalSystemTaskType.RESOLVE_PROJECT, project, projectPath); myProjectPath = projectPath; myIsPreviewMode = isPreviewMode; }
Example #12
Source File: ModuleData.java From consulo with Apache License 2.0 | 5 votes |
@Deprecated public ModuleData(@Nonnull ProjectSystemId owner, @Nonnull String name, @Nonnull String moduleDir, @Nonnull String externalConfigPath) { this("", owner, name, moduleDir, externalConfigPath); }
Example #13
Source File: ModuleData.java From consulo with Apache License 2.0 | 5 votes |
public ModuleData(@Nonnull String id, @Nonnull ProjectSystemId owner, @Nonnull String name, @Nonnull String moduleFileDirectoryPath, @Nonnull String externalConfigPath) { super(owner, name, name.replaceAll("(/|\\\\)", "_")); myId = id; myExternalConfigPath = externalConfigPath; myArtifacts = Collections.emptyList(); setModuleDirPath(moduleFileDirectoryPath); }
Example #14
Source File: AbstractExternalSystemTask.java From consulo with Apache License 2.0 | 5 votes |
protected AbstractExternalSystemTask(@Nonnull ProjectSystemId id, @Nonnull ExternalSystemTaskType type, @Nonnull Project project, @Nonnull String externalProjectPath) { myExternalSystemId = id; myIdeProject = project; myId = ExternalSystemTaskId.create(id, type, myIdeProject); myExternalProjectPath = externalProjectPath; }
Example #15
Source File: ExternalSystemNotificationManager.java From consulo with Apache License 2.0 | 5 votes |
@Nullable private Content findContent(@Nonnull Pair<NotificationSource, ProjectSystemId> contentIdPair, @Nonnull String contentDisplayName) { Content targetContent = null; final MessageView messageView = ServiceManager.getService(myProject, MessageView.class); for (Content content : messageView.getContentManager().getContents()) { if (contentIdPair.equals(content.getUserData(CONTENT_ID_KEY)) && StringUtil.equals(content.getDisplayName(), contentDisplayName) && !content.isPinned()) { targetContent = content; } } return targetContent; }
Example #16
Source File: ExternalSystemExecuteTaskTask.java From consulo with Apache License 2.0 | 5 votes |
public ExternalSystemExecuteTaskTask(@Nonnull ProjectSystemId externalSystemId, @Nonnull Project project, @Nonnull List<ExternalTaskPojo> tasksToExecute, @Nullable String vmOptions, @javax.annotation.Nullable String scriptParameters, @javax.annotation.Nullable String debuggerSetup) throws IllegalArgumentException { super(externalSystemId, ExternalSystemTaskType.EXECUTE_TASK, project, getLinkedExternalProjectPath(tasksToExecute)); myTasksToExecute = tasksToExecute; myVmOptions = vmOptions; myScriptParameters = scriptParameters; myDebuggerSetup = debuggerSetup; }
Example #17
Source File: ProjectData.java From consulo with Apache License 2.0 | 5 votes |
@Deprecated public ProjectData(@Nonnull ProjectSystemId owner, @Nonnull String ideProjectFileDirectoryPath, @Nonnull String linkedExternalProjectPath) { super(owner, "unnamed"); myLinkedExternalProjectPath = ExternalSystemApiUtil.toCanonicalPath(linkedExternalProjectPath); myIdeProjectFileDirectoryPath = ExternalSystemApiUtil.toCanonicalPath(ideProjectFileDirectoryPath); }
Example #18
Source File: RefreshAllExternalProjectsAction.java From consulo with Apache License 2.0 | 5 votes |
private static List<ProjectSystemId> getSystemIds(AnActionEvent e) { final List<ProjectSystemId> systemIds = ContainerUtil.newArrayList(); final ProjectSystemId externalSystemId = e.getDataContext().getData(ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID); if (externalSystemId != null) { systemIds.add(externalSystemId); } else { for (ExternalSystemManager manager : ExternalSystemManager.EP_NAME.getExtensionList()) { systemIds.add(manager.getSystemId()); } } return systemIds; }
Example #19
Source File: ExternalActionUtil.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public static MyInfo getProcessingInfo(@Nonnull DataContext context) { ExternalProjectPojo externalProject = context.getData(ExternalSystemDataKeys.SELECTED_PROJECT); if (externalProject == null) { return MyInfo.EMPTY; } ProjectSystemId externalSystemId = context.getData(ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID); if (externalSystemId == null) { return MyInfo.EMPTY; } Project ideProject = context.getData(CommonDataKeys.PROJECT); if (ideProject == null) { return MyInfo.EMPTY; } AbstractExternalSystemSettings<?, ?, ?> settings = ExternalSystemApiUtil.getSettings(ideProject, externalSystemId); ExternalProjectSettings externalProjectSettings = settings.getLinkedProjectSettings(externalProject.getPath()); AbstractExternalSystemLocalSettings localSettings = ExternalSystemApiUtil.getLocalSettings(ideProject, externalSystemId); return new MyInfo(externalProjectSettings == null ? null : settings, localSettings == null ? null : localSettings, externalProjectSettings == null ? null : externalProject, ideProject, externalSystemId); }
Example #20
Source File: AbstractExternalSystemTaskConfigurationType.java From consulo with Apache License 2.0 | 5 votes |
@SuppressWarnings("MethodMayBeStatic") @Nonnull protected ExternalSystemRunConfiguration doCreateConfiguration(@Nonnull ProjectSystemId externalSystemId, @Nonnull Project project, @Nonnull ConfigurationFactory factory, @Nonnull String name) { return new ExternalSystemRunConfiguration(externalSystemId, project, factory, name); }
Example #21
Source File: RemoteExternalSystemCommunicationManager.java From consulo with Apache License 2.0 | 5 votes |
@Nullable @Override public RemoteExternalSystemFacade acquire(@Nonnull String id, @Nonnull ProjectSystemId externalSystemId) throws Exception { myTargetExternalSystemId.set(externalSystemId); final RemoteExternalSystemFacade facade; try { facade = mySupport.acquire(this, id); } finally { myTargetExternalSystemId.set(null); } if (facade == null) { return null; } RemoteExternalSystemProgressNotificationManager exported = myExportedNotificationManager.get(); if (exported == null) { try { exported = (RemoteExternalSystemProgressNotificationManager)UnicastRemoteObject.exportObject(myProgressManager, 0); myExportedNotificationManager.set(exported); } catch (RemoteException e) { exported = myExportedNotificationManager.get(); } } if (exported == null) { LOG.warn("Can't export progress manager"); } else { facade.applyProgressManager(exported); } return facade; }
Example #22
Source File: OpenExternalConfigAction.java From consulo with Apache License 2.0 | 5 votes |
@Nullable private static VirtualFile getExternalConfig(@Nonnull DataContext context) { ProjectSystemId externalSystemId = context.getData(ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID); if (externalSystemId == null) { return null; } ExternalProjectPojo projectPojo = context.getData(ExternalSystemDataKeys.SELECTED_PROJECT); if (projectPojo == null) { return null; } String path = projectPojo.getPath(); LocalFileSystem fileSystem = LocalFileSystem.getInstance(); VirtualFile externalSystemConfigPath = fileSystem.refreshAndFindFileByPath(path); if (externalSystemConfigPath == null) { return null; } VirtualFile toOpen = externalSystemConfigPath; for (ExternalSystemConfigLocator locator : ExternalSystemConfigLocator.EP_NAME.getExtensionList()) { if (externalSystemId.equals(locator.getTargetExternalSystemId())) { toOpen = locator.adjust(toOpen); if (toOpen == null) { return null; } } } return toOpen.isDirectory() ? null : toOpen; }
Example #23
Source File: MessageCounter.java From consulo with Apache License 2.0 | 5 votes |
public synchronized int getCount(@Nullable final String groupName, @Nonnull final NotificationSource notificationSource, @Nullable final NotificationCategory notificationCategory, @Nonnull final ProjectSystemId projectSystemId) { int count = 0; final Map<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>> groupMap = ContainerUtil.getOrElse( map, projectSystemId, Collections.<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>>emptyMap()); for (Map.Entry<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>> entry : groupMap.entrySet()) { if (groupName == null || groupName.equals(entry.getKey())) { final TObjectIntHashMap<NotificationCategory> counter = entry.getValue().get(notificationSource); if (counter == null) continue; if (notificationCategory == null) { for (int aCount : counter.getValues()) { count += aCount; } } else { count = counter.get(notificationCategory); } } } return count; }
Example #24
Source File: ExternalSystemApiUtil.java From consulo with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Nonnull public static AbstractExternalSystemSettings getSettings(@Nonnull Project project, @Nonnull ProjectSystemId externalSystemId) throws IllegalArgumentException { ExternalSystemManager<?, ?, ?, ?, ?> manager = getManager(externalSystemId); if (manager == null) { throw new IllegalArgumentException(String.format("Can't retrieve external system settings for id '%s'. Reason: no such external system is registered", externalSystemId.getReadableName())); } return manager.getSettingsProvider().fun(project); }
Example #25
Source File: ExternalSystemApiUtil.java From consulo with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public static <S extends AbstractExternalSystemLocalSettings> S getLocalSettings(@Nonnull Project project, @Nonnull ProjectSystemId externalSystemId) throws IllegalArgumentException { ExternalSystemManager<?, ?, ?, ?, ?> manager = getManager(externalSystemId); if (manager == null) { throw new IllegalArgumentException( String.format("Can't retrieve local external system settings for id '%s'. Reason: no such external system is registered", externalSystemId.getReadableName())); } return (S)manager.getLocalSettingsProvider().fun(project); }
Example #26
Source File: OpenExternalConfigAction.java From consulo with Apache License 2.0 | 5 votes |
@Override public void update(AnActionEvent e) { ProjectSystemId externalSystemId = e.getDataContext().getData(ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID); if (externalSystemId == null) { e.getPresentation().setEnabled(false); return; } e.getPresentation().setText(ExternalSystemBundle.message("action.open.config.text", externalSystemId.getReadableName())); e.getPresentation().setDescription(ExternalSystemBundle.message("action.open.config.description", externalSystemId.getReadableName())); e.getPresentation().setIcon(ExternalSystemUiUtil.getUiAware(externalSystemId).getProjectIcon()); VirtualFile config = getExternalConfig(e.getDataContext()); e.getPresentation().setEnabled(config != null); }
Example #27
Source File: ExternalActionUtil.java From consulo with Apache License 2.0 | 5 votes |
MyInfo(@Nullable AbstractExternalSystemSettings<?, ?, ?> settings, @Nullable AbstractExternalSystemLocalSettings localSettings, @javax.annotation.Nullable ExternalProjectPojo externalProject, @javax.annotation.Nullable Project ideProject, @Nullable ProjectSystemId externalSystemId) { this.settings = settings; this.localSettings = localSettings; this.externalProject = externalProject; this.ideProject = ideProject; this.externalSystemId = externalSystemId; }
Example #28
Source File: InProcessExternalSystemCommunicationManager.java From consulo with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Nullable @Override public RemoteExternalSystemFacade acquire(@Nonnull String id, @Nonnull ProjectSystemId externalSystemId) throws Exception { ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(externalSystemId); assert manager != null; InProcessExternalSystemFacadeImpl result = new InProcessExternalSystemFacadeImpl(manager.getProjectResolverClass(), manager.getTaskManagerClass()); result.applyProgressManager(myProgressManager); return result; }
Example #29
Source File: ExternalSystemAutoImporter.java From consulo with Apache License 2.0 | 5 votes |
MyEntry(@Nonnull ProjectSystemId externalSystemId, @Nonnull AbstractExternalSystemSettings<?, ?, ?> systemSettings, @Nonnull ExternalSystemAutoImportAware aware) { this.externalSystemId = externalSystemId; this.systemSettings = systemSettings; this.aware = aware; }
Example #30
Source File: ExternalSystemAutoImporter.java From consulo with Apache License 2.0 | 5 votes |
private void addPath(@Nonnull ProjectSystemId externalSystemId, @Nonnull String path) { Lock lock = myVfsLock.readLock(); lock.lock(); try { Set<String> paths = myFilesToRefresh.get(externalSystemId); while (paths == null) { myFilesToRefresh.putIfAbsent(externalSystemId, ContainerUtilRt.<String>newHashSet()); paths = myFilesToRefresh.get(externalSystemId); } paths.add(path); } finally { lock.unlock(); } }