com.intellij.ide.projectView.impl.AbstractProjectViewPane Java Examples
The following examples show how to use
com.intellij.ide.projectView.impl.AbstractProjectViewPane.
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: PullCommand.java From ADB-Duang with MIT License | 6 votes |
private void selectInTargetFile(final VirtualFile targetFile) { UIUtil.invokeLaterIfNeeded(new Runnable() { public void run() { Project project = deviceResult.anActionEvent.getProject(); Editor editor = deviceResult.anActionEvent.getData(PlatformDataKeys.EDITOR); MySelectInContext selectInContext = new MySelectInContext(targetFile, editor, project); ProjectViewImpl projectView = (ProjectViewImpl) ProjectView.getInstance(project); AbstractProjectViewPane currentProjectViewPane = projectView.getCurrentProjectViewPane(); SelectInTarget target = currentProjectViewPane.createSelectInTarget(); if (target != null && target.canSelect(selectInContext)) { target.selectIn(selectInContext, false); } else { selectInContext = new MySelectInContext(targetFile.getParent(), editor, project); if (target != null && target.canSelect(selectInContext)) { target.selectIn(selectInContext, false); } } } }); }
Example #2
Source File: ScopeTreeViewPanel.java From consulo with Apache License 2.0 | 6 votes |
private void fireListeners(ChangeList list, @Nullable String oldName) { AbstractProjectViewPane pane = ProjectView.getInstance(myProject).getCurrentProjectViewPane(); if (pane == null || !ScopeViewPane.ID.equals(pane.getId())) { return; } final String subId = pane.getSubId(); if (!list.getName().equals(subId) && (oldName == null || !oldName.equals(subId))) { return; } ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { myDependencyValidationManager.fireScopeListeners(); } }, myProject.getDisposed()); }
Example #3
Source File: ScopeTreeViewPanel.java From consulo with Apache License 2.0 | 6 votes |
private void queueUpdate(final VirtualFile fileToRefresh, final Function<PsiFile, DefaultMutableTreeNode> rootToReloadGetter, final String scopeName) { if (myProject.isDisposed()) return; AbstractProjectViewPane pane = ProjectView.getInstance(myProject).getCurrentProjectViewPane(); if (pane == null || !ScopeViewPane.ID.equals(pane.getId()) || !scopeName.equals(pane.getSubId())) { return; } myUpdateQueue.queue(new Update(fileToRefresh) { @Override public void run() { if (myProject.isDisposed() || !fileToRefresh.isValid()) return; final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(fileToRefresh); if (psiFile != null) { reload(rootToReloadGetter.fun(psiFile)); } } @Override public boolean isExpired() { return !isTreeShowing(); } }); }
Example #4
Source File: EditScopesAction.java From consulo with Apache License 2.0 | 6 votes |
@Override public void update(AnActionEvent e) { super.update(e); e.getPresentation().setEnabled(false); final DataContext dataContext = e.getDataContext(); final Project project = dataContext.getData(CommonDataKeys.PROJECT); if (project != null) { final AbstractProjectViewPane projectViewPane = ProjectView.getInstance(project).getCurrentProjectViewPane(); if (projectViewPane != null) { final String scopeName = projectViewPane.getSubId(); if (scopeName != null) { e.getPresentation().setEnabled(true); } } } }
Example #5
Source File: NavBarPanel.java From consulo with Apache License 2.0 | 6 votes |
protected void doubleClick(final Object object) { if (object instanceof Navigatable) { Navigatable navigatable = (Navigatable)object; if (navigatable.canNavigate()) { navigatable.navigate(true); } } else if (object instanceof Module) { ProjectView projectView = ProjectView.getInstance(myProject); AbstractProjectViewPane projectViewPane = projectView.getProjectViewPaneById(projectView.getCurrentViewId()); if (projectViewPane != null) { projectViewPane.selectModule((Module)object, true); } } else if (object instanceof Project) { return; } hideHint(true); }
Example #6
Source File: FileUtil.java From OpenTerminalHere with Apache License 2.0 | 5 votes |
/** * determine the VirtualFile which selected in Project view * @param project * @return */ public static VirtualFile getSelectedProjectFile(@NotNull Project project) { AbstractProjectViewPane currentProjectViewPane = ProjectView.getInstance(project).getCurrentProjectViewPane(); if (currentProjectViewPane == null) { return null; } DefaultMutableTreeNode node = currentProjectViewPane.getSelectedNode(); if (node == null) { return null; } Object selected = null; Object userObject = node.getUserObject(); if (userObject instanceof AbstractTreeNode) { selected = ((AbstractTreeNode)userObject).getValue(); } else if (userObject instanceof NodeDescriptor) { selected = ((NodeDescriptor)userObject).getElement(); } if (selected == null) { return null; } VirtualFile vf = null; if (selected instanceof PsiDirectory) { vf = ((PsiDirectory)selected).getVirtualFile(); } else if (selected instanceof PsiElement) { vf = ((PsiElement) selected).getContainingFile().getVirtualFile().getParent(); } else { // ignored } return vf; }
Example #7
Source File: ProjectViewSelectInTarget.java From consulo with Apache License 2.0 | 5 votes |
@Override @Nonnull public Collection<SelectInTarget> getSubTargets(@Nonnull SelectInContext context) { List<SelectInTarget> result = new ArrayList<>(); AbstractProjectViewPane pane = ProjectView.getInstance(myProject).getProjectViewPaneById(getMinorViewId()); int index = 0; for (String subId : pane.getSubIds()) { result.add(new ProjectSubViewSelectInTarget(this, subId, index++)); } return result; }
Example #8
Source File: ProjectViewSelectInTarget.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public static ActionCallback select(@Nonnull Project project, final Object toSelect, @Nullable final String viewId, @Nullable final String subviewId, final VirtualFile virtualFile, final boolean requestFocus) { final ActionCallback result = new ActionCallback(); final ProjectView projectView = ProjectView.getInstance(project); if (ApplicationManager.getApplication().isUnitTestMode()) { AbstractProjectViewPane pane = projectView.getProjectViewPaneById(ProjectViewPane.ID); pane.select(toSelect, virtualFile, requestFocus); return result; } ToolWindowManager windowManager = ToolWindowManager.getInstance(project); final ToolWindow projectViewToolWindow = windowManager.getToolWindow(ToolWindowId.PROJECT_VIEW); final Runnable runnable = () -> { Runnable r = () -> projectView.selectCB(toSelect, virtualFile, requestFocus).notify(result); projectView.changeViewCB(ObjectUtils.chooseNotNull(viewId, ProjectViewPane.ID), subviewId).doWhenProcessed(r); }; if (requestFocus) { projectViewToolWindow.activate(runnable, true); } else { projectViewToolWindow.show(runnable); } return result; }
Example #9
Source File: ProjectView.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull default AsyncResult<Void> selectCB(Object element, VirtualFile file, boolean requestFocus){ final AbstractProjectViewPane viewPane = getCurrentProjectViewPane(); if (viewPane != null && viewPane instanceof AbstractProjectViewPSIPane) { return ((AbstractProjectViewPSIPane)viewPane).selectCB(element, file, requestFocus); } select(element, file, requestFocus); return AsyncResult.resolved(); }
Example #10
Source File: ModuleGroupNode.java From consulo with Apache License 2.0 | 5 votes |
private static List<Module> extractModules(TreeNode[] sourceNodes) { final List<Module> modules = new ArrayList<>(); for (TreeNode sourceNode : sourceNodes) { if (sourceNode instanceof DefaultMutableTreeNode) { final Object userObject = AbstractProjectViewPane.extractValueFromNode(sourceNode); if (userObject instanceof Module) { modules.add((Module)userObject); } } } return modules; }
Example #11
Source File: MoveModulesToGroupAction.java From consulo with Apache License 2.0 | 5 votes |
public static void doMove(final Module[] modules, final ModuleGroup group, @Nullable final DataContext dataContext) { Project project = modules[0].getProject(); for (final Module module : modules) { ModifiableModuleModel model = dataContext != null ? dataContext.getData(LangDataKeys.MODIFIABLE_MODULE_MODEL) : null; if (model != null){ model.setModuleGroupPath(module, group == null ? null : group.getGroupPath()); } else { ModuleManagerImpl.getInstanceImpl(project).setModuleGroupPath(module, group == null ? null : group.getGroupPath()); } } AbstractProjectViewPane pane = ProjectView.getInstance(project).getCurrentProjectViewPane(); if (pane != null) { pane.updateFromRoot(true); } if (!ProjectSettingsService.getInstance(project).processModulesMoved(modules, group) && pane != null) { if (group != null) { pane.selectModuleGroup(group, true); } else { pane.selectModule(modules[0], true); } } }
Example #12
Source File: ScratchTreeStructureProvider.java From consulo with Apache License 2.0 | 5 votes |
public ScratchTreeStructureProvider(Project project) { registerUpdaters(project, project, new Runnable() { AbstractProjectViewPane updateTarget; @Override public void run() { if (updateTarget == null) { updateTarget = ProjectView.getInstance(project).getProjectViewPaneById(ProjectViewPane.ID); } if (updateTarget != null) updateTarget.updateFromRoot(true); } }); }
Example #13
Source File: IgnoreManager.java From idea-gitignore with MIT License | 5 votes |
/** * Rebuilds {@link #confirmedIgnoredFiles} map. * * @param silent propagate {@link IgnoreManager.TrackedIgnoredListener#TRACKED_IGNORED} event */ public void run(boolean silent) { final ConcurrentMap<VirtualFile, VcsRoot> result = ContainerUtil.newConcurrentMap(); for (VcsRoot vcsRoot : vcsRoots) { if (!Utils.isGitPluginEnabled() || !(vcsRoot.getVcs() instanceof GitVcs)) { continue; } final VirtualFile root = vcsRoot.getPath(); for (String path : ExternalExec.getIgnoredFiles(vcsRoot)) { final VirtualFile file = root.findFileByRelativePath(path); if (file != null) { result.put(file, vcsRoot); } } } if (!silent && !result.isEmpty()) { project.getMessageBus().syncPublisher(TRACKED_IGNORED).handleFiles(result); } confirmedIgnoredFiles.clear(); confirmedIgnoredFiles.putAll(result); notConfirmedIgnoredFiles.clear(); debouncedStatusesChanged.run(); for (AbstractProjectViewPane pane : AbstractProjectViewPane.EP_NAME.getExtensions()) { if (pane.getTreeBuilder() != null) { pane.getTreeBuilder().queueUpdate(); } } }
Example #14
Source File: Unity3dShowMetaFileProjectViewPaneOptionProvider.java From consulo-unity3d with Apache License 2.0 | 5 votes |
@Override @RequiredUIAccess public void addToolbarActions(@Nonnull AbstractProjectViewPane pane, @Nonnull DefaultActionGroup actionGroup) { if(pane instanceof ProjectViewPane) { actionGroup.addAction(new ShowMetaFilesAction(pane)).setAsSecondary(true); } }
Example #15
Source File: ProjectView.java From consulo with Apache License 2.0 | 4 votes |
default void select(Object element, VirtualFile file, boolean requestFocus) { final AbstractProjectViewPane viewPane = getCurrentProjectViewPane(); if (viewPane != null) { viewPane.select(element, file, requestFocus); } }
Example #16
Source File: ShowExcludedFilesProjectViewPaneOptionProvider.java From consulo with Apache License 2.0 | 4 votes |
@Override public void addToolbarActions(@Nonnull AbstractProjectViewPane pane, @Nonnull DefaultActionGroup actionGroup) { if (pane instanceof ProjectViewPane) { actionGroup.addAction(new ShowExcludedFilesAction(pane)).setAsSecondary(true); } }
Example #17
Source File: ShowExcludedFilesProjectViewPaneOptionProvider.java From consulo with Apache License 2.0 | 4 votes |
private ShowExcludedFilesAction(AbstractProjectViewPane pane) { super(IdeBundle.message("action.show.excluded.files"), IdeBundle.message("action.show.hide.excluded.files"), null); myPane = pane; }
Example #18
Source File: ProjectViewSelectInTarget.java From consulo with Apache License 2.0 | 4 votes |
public String getSubIdPresentableName(String subId) { AbstractProjectViewPane pane = ProjectView.getInstance(myProject).getProjectViewPaneById(getMinorViewId()); return pane.getPresentableSubIdName(subId); }
Example #19
Source File: Unity3dShowMetaFileProjectViewPaneOptionProvider.java From consulo-unity3d with Apache License 2.0 | 4 votes |
private ShowMetaFilesAction(AbstractProjectViewPane pane) { super("Show '.meta' Files", "Show '.meta' Files", null); myPane = pane; }
Example #20
Source File: ProjectViewPaneOptionProvider.java From consulo with Apache License 2.0 | votes |
void addToolbarActions(@Nonnull AbstractProjectViewPane pane, @Nonnull DefaultActionGroup actionGroup);
Example #21
Source File: ProjectView.java From consulo with Apache License 2.0 | votes |
void addProjectPane(final AbstractProjectViewPane pane);
Example #22
Source File: ProjectView.java From consulo with Apache License 2.0 | votes |
void removeProjectPane(AbstractProjectViewPane instance);
Example #23
Source File: ProjectView.java From consulo with Apache License 2.0 | votes |
AbstractProjectViewPane getProjectViewPaneById(String id);
Example #24
Source File: ProjectView.java From consulo with Apache License 2.0 | votes |
AbstractProjectViewPane getCurrentProjectViewPane();