Search in sources :

Example 1 with ProjectViewImpl

use of com.intellij.ide.projectView.impl.ProjectViewImpl in project intellij-community by JetBrains.

the class MavenIdeaPluginConfigurer method configure.

@Override
public void configure(@NotNull MavenProject mavenProject, @NotNull Project project, @Nullable Module module) {
    if (module == null)
        return;
    Element cfg = mavenProject.getPluginConfiguration("com.googlecode", "maven-idea-plugin");
    if (cfg == null)
        return;
    configureJdk(cfg, module);
    MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(project);
    String downloadSources = cfg.getChildTextTrim("downloadSources");
    if (!StringUtil.isEmptyOrSpaces(downloadSources)) {
        projectsManager.getImportingSettings().setDownloadSourcesAutomatically(Boolean.parseBoolean(downloadSources));
    }
    String downloadJavadocs = cfg.getChildTextTrim("downloadJavadocs");
    if (!StringUtil.isEmptyOrSpaces(downloadJavadocs)) {
        projectsManager.getImportingSettings().setDownloadDocsAutomatically(Boolean.parseBoolean(downloadJavadocs));
    }
    String assertNotNull = cfg.getChildTextTrim("assertNotNull");
    if (!StringUtil.isEmptyOrSpaces(assertNotNull)) {
        CompilerConfiguration.getInstance(project).setAddNotNullAssertions(Boolean.parseBoolean(assertNotNull));
    }
    String autoscrollToSource = cfg.getChildTextTrim("autoscrollToSource");
    if (!StringUtil.isEmptyOrSpaces(autoscrollToSource)) {
        ((ProjectViewImpl) ProjectView.getInstance(project)).setAutoscrollToSource(Boolean.parseBoolean(autoscrollToSource), ProjectViewPane.ID);
    }
    String autoscrollFromSource = cfg.getChildTextTrim("autoscrollFromSource");
    if (!StringUtil.isEmptyOrSpaces(autoscrollFromSource)) {
        ((ProjectViewImpl) ProjectView.getInstance(project)).setAutoscrollFromSource(Boolean.parseBoolean(autoscrollFromSource), ProjectViewPane.ID);
    }
    String hideEmptyPackages = cfg.getChildTextTrim("hideEmptyPackages");
    if (!StringUtil.isEmptyOrSpaces(hideEmptyPackages)) {
        ProjectView.getInstance(project).setHideEmptyPackages(Boolean.parseBoolean(hideEmptyPackages), ProjectViewPane.ID);
    }
    String optimizeImportsBeforeCommit = cfg.getChildTextTrim("optimizeImportsBeforeCommit");
    if (!StringUtil.isEmptyOrSpaces(optimizeImportsBeforeCommit)) {
        VcsConfiguration.getInstance(module.getProject()).OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT = Boolean.parseBoolean(optimizeImportsBeforeCommit);
    }
    String performCodeAnalisisBeforeCommit = cfg.getChildTextTrim("performCodeAnalisisBeforeCommit");
    if (!StringUtil.isEmptyOrSpaces(performCodeAnalisisBeforeCommit)) {
        VcsConfiguration.getInstance(module.getProject()).CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT = Boolean.parseBoolean(performCodeAnalisisBeforeCommit);
    }
    String reformatCodeBeforeCommit = cfg.getChildTextTrim("reformatCodeBeforeCommit");
    if (!StringUtil.isEmptyOrSpaces(reformatCodeBeforeCommit)) {
        VcsConfiguration vcsConfiguration = VcsConfiguration.getInstance(module.getProject());
        boolean value = Boolean.parseBoolean(reformatCodeBeforeCommit);
        vcsConfiguration.REFORMAT_BEFORE_FILE_COMMIT = value;
        vcsConfiguration.REFORMAT_BEFORE_PROJECT_COMMIT = value;
    }
}
Also used : MavenProjectsManager(org.jetbrains.idea.maven.project.MavenProjectsManager) Element(org.jdom.Element) ProjectViewImpl(com.intellij.ide.projectView.impl.ProjectViewImpl) VcsConfiguration(com.intellij.openapi.vcs.VcsConfiguration)

Example 2 with ProjectViewImpl

use of com.intellij.ide.projectView.impl.ProjectViewImpl in project intellij-plugins by JetBrains.

the class FlexProjectViewTest method doTest.

private void doTest(boolean sortByType, boolean hideEmptyMiddlePackages, boolean flattenPackages, boolean showMembers, String expected) {
    myPane = myStructure.createPane();
    ProjectViewImpl projectView = (ProjectViewImpl) ProjectView.getInstance(myProject);
    //ProjectViewTestUtil.setupImpl(getProject(), false);
    projectView.addProjectPane(myPane);
    projectView.setSortByType(PANE_ID, sortByType);
    myStructure.setShowMembers(showMembers);
    myStructure.setHideEmptyMiddlePackages(hideEmptyMiddlePackages);
    myStructure.setFlattenPackages(flattenPackages);
    TreeUtil.expandAll(myPane.getTree());
    PlatformTestUtil.assertTreeEqual(myPane.getTree(), expected + "\n" + getRootFiles() + " External Libraries\n", true);
}
Also used : ProjectViewImpl(com.intellij.ide.projectView.impl.ProjectViewImpl)

Example 3 with ProjectViewImpl

use of com.intellij.ide.projectView.impl.ProjectViewImpl in project intellij-community by JetBrains.

the class NavigateFromSourceTest method testAutoscrollFromSourceOnOpening.

public void testAutoscrollFromSourceOnOpening() throws Exception {
    final PsiClass[] classes = JavaDirectoryService.getInstance().getClasses(getPackageDirectory());
    PsiClass psiClass = classes[0];
    FileEditorManager.getInstance(getProject()).openFile(psiClass.getContainingFile().getVirtualFile(), true);
    ProjectView projectView = ProjectView.getInstance(getProject());
    ((ProjectViewImpl) projectView).setAutoscrollFromSource(true, ProjectViewPane.ID);
    ToolWindow toolWindow = ToolWindowManager.getInstance(getProject()).getToolWindow(ToolWindowId.PROJECT_VIEW);
    new ProjectViewToolWindowFactory().createToolWindowContent(getProject(), toolWindow);
    projectView.changeView(ProjectViewPane.ID);
    UIUtil.dispatchAllInvocationEvents();
    JComponent component = ((ProjectViewImpl) projectView).getComponent();
    DataContext context = DataManager.getInstance().getDataContext(component);
    PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(context);
    assertEquals("Class1.java", ((PsiJavaFile) element).getName());
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) DataContext(com.intellij.openapi.actionSystem.DataContext) ProjectView(com.intellij.ide.projectView.ProjectView) ProjectViewImpl(com.intellij.ide.projectView.impl.ProjectViewImpl) ProjectViewToolWindowFactory(com.intellij.ide.projectView.impl.ProjectViewToolWindowFactory)

Example 4 with ProjectViewImpl

use of com.intellij.ide.projectView.impl.ProjectViewImpl in project intellij-community by JetBrains.

the class PackagesTreeStructureTest method doTest.

private void doTest(final boolean showModules, final boolean showLibraryContents, boolean flattenPackages, boolean abbreviatePackageNames, @NonNls final String expected, final int levels) throws InterruptedException {
    final ProjectViewImpl projectView = (ProjectViewImpl) ProjectView.getInstance(myProject);
    projectView.setShowModules(showModules, PackageViewPane.ID);
    projectView.setShowLibraryContents(showLibraryContents, PackageViewPane.ID);
    projectView.setFlattenPackages(flattenPackages, PackageViewPane.ID);
    projectView.setAbbreviatePackageNames(abbreviatePackageNames, 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);
    PlatformTestUtil.assertTreeEqual(tree, expected);
    BaseProjectViewTestCase.checkContainsMethod(packageViewPane.getTreeStructure().getRootElement(), packageViewPane.getTreeStructure());
    Disposer.dispose(packageViewPane);
}
Also used : AbstractProjectTreeStructure(com.intellij.ide.projectView.impl.AbstractProjectTreeStructure) ResourceBundleGrouper(com.intellij.lang.properties.projectView.ResourceBundleGrouper) PackageViewPane(com.intellij.ide.projectView.impl.PackageViewPane) ProjectViewImpl(com.intellij.ide.projectView.impl.ProjectViewImpl)

Example 5 with ProjectViewImpl

use of com.intellij.ide.projectView.impl.ProjectViewImpl in project intellij-community by JetBrains.

the class ProjectViewTestUtil method setupImpl.

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);
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowEP(com.intellij.openapi.wm.ToolWindowEP) ProjectViewImpl(com.intellij.ide.projectView.impl.ProjectViewImpl) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Aggregations

ProjectViewImpl (com.intellij.ide.projectView.impl.ProjectViewImpl)5 ToolWindow (com.intellij.openapi.wm.ToolWindow)2 ProjectView (com.intellij.ide.projectView.ProjectView)1 AbstractProjectTreeStructure (com.intellij.ide.projectView.impl.AbstractProjectTreeStructure)1 PackageViewPane (com.intellij.ide.projectView.impl.PackageViewPane)1 ProjectViewToolWindowFactory (com.intellij.ide.projectView.impl.ProjectViewToolWindowFactory)1 ResourceBundleGrouper (com.intellij.lang.properties.projectView.ResourceBundleGrouper)1 DataContext (com.intellij.openapi.actionSystem.DataContext)1 VcsConfiguration (com.intellij.openapi.vcs.VcsConfiguration)1 ToolWindowEP (com.intellij.openapi.wm.ToolWindowEP)1 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)1 Element (org.jdom.Element)1 MavenProjectsManager (org.jetbrains.idea.maven.project.MavenProjectsManager)1