Search in sources :

Example 96 with Project

use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.

the class GriffonFramework method updateProjectStructure.

@Override
public void updateProjectStructure(@NotNull final Module module) {
    if (!MvcModuleStructureUtil.isEnabledStructureUpdate())
        return;
    final VirtualFile root = findAppRoot(module);
    if (root == null)
        return;
    WriteAction.run(() -> {
        MvcModuleStructureUtil.updateModuleStructure(module, createProjectStructure(module, false), root);
        if (hasSupport(module)) {
            MvcModuleStructureUtil.updateAuxiliaryPluginsModuleRoots(module, this);
            MvcModuleStructureUtil.updateGlobalPluginModule(module.getProject(), this);
        }
    });
    final Project project = module.getProject();
    ChangeListManager.getInstance(project).addFilesToIgnore(IgnoredBeanFactory.ignoreUnderDirectory(getUserHomeGriffon(), project));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project)

Example 97 with Project

use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.

the class ExpandAllAction method update.

@Override
public void update(AnActionEvent e) {
    final Project project = e.getProject();
    if (project == null) {
        e.getPresentation().setEnabled(false);
        return;
    }
    e.getPresentation().setEnabled(DynamicToolWindowWrapper.getInstance(project).getTreeTable().getRowCount() > 0);
}
Also used : Project(com.intellij.openapi.project.Project)

Example 98 with Project

use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.

the class ExpandAllAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final Project project = e.getProject();
    if (project == null)
        return;
    final TreeTableTree tree = DynamicToolWindowWrapper.getInstance(project).getTreeTable().getTree();
    TreeUtil.expandAll(tree);
}
Also used : Project(com.intellij.openapi.project.Project) TreeTableTree(com.intellij.ui.treeStructure.treetable.TreeTableTree)

Example 99 with Project

use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.

the class SceneBuilderImpl method isCompatibleLanguageLevel.

private static boolean isCompatibleLanguageLevel(@NotNull PsiClass aClass, @Nullable LanguageLevel targetLevel) {
    if (targetLevel == null)
        return true;
    final Project project = aClass.getProject();
    final VirtualFile vFile = PsiUtilCore.getVirtualFile(aClass);
    if (vFile == null)
        return true;
    Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(vFile);
    if (module == null) {
        final OrderEntry entry = LibraryUtil.findLibraryEntry(vFile, project);
        if (entry != null) {
            module = entry.getOwnerModule();
        }
    }
    Sdk jdk = module != null ? ModuleRootManager.getInstance(module).getSdk() : null;
    if (jdk == null) {
        jdk = ProjectRootManager.getInstance(project).getProjectSdk();
    }
    if (jdk == null)
        return true;
    final String versionString = jdk.getVersionString();
    if (versionString != null) {
        final JavaSdkVersion jdkVersion = JdkVersionUtil.getVersion(versionString);
        if (jdkVersion != null) {
            return targetLevel.isAtLeast(jdkVersion.getMaxLanguageLevel());
        }
    }
    return true;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) JavaSdkVersion(com.intellij.openapi.projectRoots.JavaSdkVersion) Sdk(com.intellij.openapi.projectRoots.Sdk) Module(com.intellij.openapi.module.Module)

Example 100 with Project

use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.

the class JavaFxArtifactProperties method onBuildFinished.

@Override
public void onBuildFinished(@NotNull final Artifact artifact, @NotNull final CompileContext compileContext) {
    if (!(artifact.getArtifactType() instanceof JavaFxApplicationArtifactType)) {
        return;
    }
    final Project project = compileContext.getProject();
    final Set<Module> modules = ReadAction.compute(() -> ArtifactUtil.getModulesIncludedInArtifacts(Collections.singletonList(artifact), project));
    if (modules.isEmpty()) {
        return;
    }
    Sdk fxCompatibleSdk = null;
    for (Module module : modules) {
        final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
        if (sdk != null && sdk.getSdkType() instanceof JavaSdk) {
            if (((JavaSdk) sdk.getSdkType()).isOfVersionOrHigher(sdk, JavaSdkVersion.JDK_1_7)) {
                fxCompatibleSdk = sdk;
                break;
            }
        }
    }
    if (fxCompatibleSdk == null) {
        compileContext.addMessage(CompilerMessageCategory.ERROR, "Java version 7 or higher is required to build JavaFX package", null, -1, -1);
        return;
    }
    final JavaFxArtifactProperties properties = (JavaFxArtifactProperties) artifact.getProperties(JavaFxArtifactPropertiesProvider.getInstance());
    final JavaFxPackager javaFxPackager = new JavaFxPackager(artifact, properties, project) {

        @Override
        protected void registerJavaFxPackagerError(String message) {
            compileContext.addMessage(CompilerMessageCategory.ERROR, message, null, -1, -1);
        }
    };
    javaFxPackager.buildJavaFxArtifact(fxCompatibleSdk.getHomePath());
}
Also used : Project(com.intellij.openapi.project.Project) JavaSdk(com.intellij.openapi.projectRoots.JavaSdk) JavaSdk(com.intellij.openapi.projectRoots.JavaSdk) Sdk(com.intellij.openapi.projectRoots.Sdk) Module(com.intellij.openapi.module.Module)

Aggregations

Project (com.intellij.openapi.project.Project)3623 VirtualFile (com.intellij.openapi.vfs.VirtualFile)874 NotNull (org.jetbrains.annotations.NotNull)580 Nullable (org.jetbrains.annotations.Nullable)478 Module (com.intellij.openapi.module.Module)368 PsiFile (com.intellij.psi.PsiFile)334 Editor (com.intellij.openapi.editor.Editor)301 PsiElement (com.intellij.psi.PsiElement)292 ArrayList (java.util.ArrayList)214 File (java.io.File)212 Document (com.intellij.openapi.editor.Document)180 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)172 List (java.util.List)158 IOException (java.io.IOException)107 TextRange (com.intellij.openapi.util.TextRange)99 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)96 IncorrectOperationException (com.intellij.util.IncorrectOperationException)95 Presentation (com.intellij.openapi.actionSystem.Presentation)94 DataContext (com.intellij.openapi.actionSystem.DataContext)92 PsiDirectory (com.intellij.psi.PsiDirectory)90