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;
}
}
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);
}
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());
}
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);
}
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);
}
Aggregations