本文整理汇总了Java中com.intellij.ide.projectView.ProjectView类的典型用法代码示例。如果您正苦于以下问题:Java ProjectView类的具体用法?Java ProjectView怎么用?Java ProjectView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProjectView类属于com.intellij.ide.projectView包,在下文中一共展示了ProjectView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateUI
import com.intellij.ide.projectView.ProjectView; //导入依赖的package包/类
public static void updateUI(@NotNull Project project, @NotNull Task task, boolean navigateToTask) {
StudyCheckUtils.drawAllPlaceholders(project, task);
ProjectView.getInstance(project).refresh();
StudyToolWindow toolWindow = StudyUtils.getStudyToolWindow(project);
if (toolWindow != null) {
String text = task.getTaskDescription();
if (text == null) {
task.addTaskText(task.getTaskDescriptionName(), CCUtils.TASK_DESCRIPTION_TEXT);
text = CCUtils.TASK_DESCRIPTION_TEXT;
}
toolWindow.setTaskText(text, project);
}
if (navigateToTask) {
StudyNavigator.navigateToTask(project, task);
}
}
示例2: onSuccess
import com.intellij.ide.projectView.ProjectView; //导入依赖的package包/类
@Override
public void onSuccess() {
String message = myResult.getMessage();
StudyStatus status = myResult.getStatus();
myTask.setStatus(status);
switch (status) {
case Failed:
myChecker.onTaskFailed(message);
break;
case Solved:
myChecker.onTaskSolved(message);
break;
default:
StudyCheckUtils.showTestResultPopUp(message, MessageType.WARNING.getPopupBackground(), myProject);
}
ApplicationManager.getApplication().invokeLater(() -> {
StudyUtils.updateToolWindows(myProject);
ProjectView.getInstance(myProject).refresh();
for (StudyCheckListener listener : StudyCheckListener.EP_NAME.getExtensions()) {
listener.afterCheck(myProject, myTask);
}
});
myChecker.clearState();
myCheckInProgress.set(false);
}
示例3: actionPerformed
import com.intellij.ide.projectView.ProjectView; //导入依赖的package包/类
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getProject();
if (project == null) {
return;
}
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
return;
}
CCNewProjectPanel panel =
new CCNewProjectPanel(course.getName(), Course.getAuthorsString(course.getAuthors()), course.getDescription());
setupLanguageLevels(course, panel);
DialogBuilder builder = createChangeInfoDialog(project, panel);
if (builder.showAndGet()) {
course.setAuthorsAsString(panel.getAuthors());
course.setName(panel.getName());
course.setDescription(panel.getDescription());
setVersion(course, panel);
ProjectView.getInstance(project).refresh();
ProjectInspectionProfileManager.getInstance(project).fireProfileChanged();
}
}
示例4: selectInTargetFile
import com.intellij.ide.projectView.ProjectView; //导入依赖的package包/类
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);
}
}
}
});
}
示例5: addSubtreeToUpdateByElement
import com.intellij.ide.projectView.ProjectView; //导入依赖的package包/类
@Override
public boolean addSubtreeToUpdateByElement(Object element) {
// should convert PsiDirectories into PackageElements
if (element instanceof PsiDirectory) {
PsiDirectory dir = (PsiDirectory)element;
final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(dir);
if (ProjectView.getInstance(myProject).isShowModules(getId())) {
Module[] modules = getModulesFor(dir);
boolean rv = false;
for (Module module : modules) {
rv |= addPackageElementToUpdate(aPackage, module);
}
return rv;
}
else {
return addPackageElementToUpdate(aPackage, null);
}
}
return super.addSubtreeToUpdateByElement(element);
}
示例6: doTest
import com.intellij.ide.projectView.ProjectView; //导入依赖的package包/类
private void doTest(final boolean showModules, final boolean showLibraryContents, @NonNls final String expected, final int levels) {
final ProjectViewImpl projectView = (ProjectViewImpl)ProjectView.getInstance(myProject);
projectView.setShowModules(showModules, PackageViewPane.ID);
projectView.setShowLibraryContents(showLibraryContents, PackageViewPane.ID);
projectView.setFlattenPackages(false, PackageViewPane.ID);
projectView.setHideEmptyPackages(true, PackageViewPane.ID);
PackageViewPane packageViewPane = new PackageViewPane(myProject);
packageViewPane.createComponent();
((AbstractProjectTreeStructure) packageViewPane.getTreeStructure()).setProviders(new ResourceBundleGrouper(myProject));
packageViewPane.updateFromRoot(true);
JTree tree = packageViewPane.getTree();
TreeUtil.expand(tree, levels);
IdeaTestUtil.assertTreeEqual(tree, expected);
BaseProjectViewTestCase.checkContainsMethod(packageViewPane.getTreeStructure().getRootElement(), packageViewPane.getTreeStructure());
Disposer.dispose(packageViewPane);
}
示例7: testSelectProject
import com.intellij.ide.projectView.ProjectView; //导入依赖的package包/类
public void testSelectProject() {
ProjectView projectView = ProjectView.getInstance(getProject());
projectView.changeView(ProjectViewPane.ID);
assertEquals(ProjectViewPane.ID, projectView.getCurrentViewId());
//FavoritesManager favoritesManager = FavoritesManager.getInstance(getProject());
//favoritesManager.createNewList("xxxx");
//
//AbstractProjectViewPane currentPane = projectView.getCurrentProjectViewPane();
//assertEquals(FavoritesProjectViewPane.ID, currentPane.getId());
//assertEquals("xxxx", currentPane.getSubId());
//
//favoritesManager.createNewList("yyyy");
//currentPane = projectView.getCurrentProjectViewPane();
//assertEquals(FavoritesProjectViewPane.ID, currentPane.getId());
//assertEquals("yyyy", currentPane.getSubId());
//
//favoritesManager.removeFavoritesList("xxxx");
//currentPane = projectView.getCurrentProjectViewPane();
//assertEquals(FavoritesProjectViewPane.ID, currentPane.getId());
//assertEquals("yyyy", currentPane.getSubId());
}
示例8: setupImpl
import com.intellij.ide.projectView.ProjectView; //导入依赖的package包/类
public static void setupImpl(@NotNull Project project, boolean loadPaneExtensions) {
ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project);
ToolWindow toolWindow = toolWindowManager.getToolWindow(ToolWindowId.PROJECT_VIEW);
if (toolWindow == null) {
ToolWindowEP[] beans = Extensions.getExtensions(ToolWindowEP.EP_NAME);
for (final ToolWindowEP bean : beans) {
if (bean.id.equals(ToolWindowId.PROJECT_VIEW)) {
toolWindow = toolWindowManager.registerToolWindow(bean.id, new JLabel(), ToolWindowAnchor.fromText(bean.anchor), project,
false, bean.canCloseContents);
break;
}
}
}
((ProjectViewImpl)ProjectView.getInstance(project)).setupImpl(toolWindow, loadPaneExtensions);
}
示例9: select
import com.intellij.ide.projectView.ProjectView; //导入依赖的package包/类
@Override
public void select(Object object, VirtualFile file, boolean requestFocus) {
if (!(object instanceof PsiElement)) return;
/*PsiElement element = (PsiElement)object;
PsiFile psiFile = element.getContainingFile();
if (psiFile != null) {
element = psiFile;
}
if (element instanceof PsiJavaFile) {
final PsiClass[] classes = ((PsiJavaFile)element).getClasses();
if (classes.length > 0) {
element = classes[0];
}
}
final PsiElement originalElement = element.getOriginalElement();*/
final VirtualFile virtualFile = PsiUtilBase.getVirtualFile((PsiElement)object);
final String list = FavoritesViewSelectInTarget.findSuitableFavoritesList(virtualFile, myProject, getSubId());
if (list == null) return;
if (!list.equals(getSubId())) {
ProjectView.getInstance(myProject).changeView(ID, list);
}
myViewPanel.selectElement(object, virtualFile, requestFocus);
}
示例10: doubleClick
import com.intellij.ide.projectView.ProjectView; //导入依赖的package包/类
private 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);
}
示例11: doSelectModuleOrGroup
import com.intellij.ide.projectView.ProjectView; //导入依赖的package包/类
private void doSelectModuleOrGroup(final Object toSelect, final boolean requestFocus) {
ToolWindowManager windowManager=ToolWindowManager.getInstance(myProject);
final Runnable runnable = new Runnable() {
@Override
public void run() {
ProjectView projectView = ProjectView.getInstance(myProject);
if (requestFocus) {
projectView.changeView(getId(), getSubId());
}
((BaseProjectTreeBuilder)getTreeBuilder()).selectInWidth(toSelect, requestFocus, new Condition<AbstractTreeNode>(){
@Override
public boolean value(final AbstractTreeNode node) {
return node instanceof AbstractModuleNode || node instanceof ModuleGroupNode || node instanceof AbstractProjectNode;
}
});
}
};
if (requestFocus) {
windowManager.getToolWindow(ToolWindowId.PROJECT_VIEW).activate(runnable);
}
else {
runnable.run();
}
}
示例12: update
import com.intellij.ide.projectView.ProjectView; //导入依赖的package包/类
@Override
public void update(AnActionEvent e) {
super.update(e);
e.getPresentation().setEnabled(false);
final DataContext dataContext = e.getDataContext();
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
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);
}
}
}
}
示例13: selectElement
import com.intellij.ide.projectView.ProjectView; //导入依赖的package包/类
@Override
public void selectElement(final PsiElement element) {
if (element != null) {
final PackageSet packageSet = getCurrentScope().getValue();
final PsiFile psiFile = element.getContainingFile();
if (packageSet == null) return;
final VirtualFile virtualFile = psiFile != null ? psiFile.getVirtualFile() :
(element instanceof PsiDirectory ? ((PsiDirectory)element).getVirtualFile() : null);
if (virtualFile != null) {
final ProjectView projectView = ProjectView.getInstance(myProject);
final NamedScopesHolder holder = NamedScopesHolder.getHolder(myProject, CURRENT_SCOPE_NAME, myDependencyValidationManager);
if (packageSet instanceof PackageSetBase && !((PackageSetBase)packageSet).contains(virtualFile, myProject, holder) ||
psiFile != null && !packageSet.contains(psiFile, holder)) {
projectView.changeView(ProjectViewPane.ID);
}
projectView.select(element, virtualFile, false);
}
Editor editor = EditorHelper.openInEditor(element);
if (editor != null) {
ToolWindowManager.getInstance(myProject).activateEditorComponent();
}
}
}
示例14: queueUpdate
import com.intellij.ide.projectView.ProjectView; //导入依赖的package包/类
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();
}
});
}
示例15: fireListeners
import com.intellij.ide.projectView.ProjectView; //导入依赖的package包/类
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());
}