當前位置: 首頁>>代碼示例>>Java>>正文


Java Project.getBasePath方法代碼示例

本文整理匯總了Java中com.intellij.openapi.project.Project.getBasePath方法的典型用法代碼示例。如果您正苦於以下問題:Java Project.getBasePath方法的具體用法?Java Project.getBasePath怎麽用?Java Project.getBasePath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.project.Project的用法示例。


在下文中一共展示了Project.getBasePath方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getWorkDir

import com.intellij.openapi.project.Project; //導入方法依賴的package包/類
public File getWorkDir() {
    Project p = this.project;
    if (p == null) {
        p = ProjectManager.getInstance().getDefaultProject();
        Project[] ps = ProjectManager.getInstance().getOpenProjects();
        if (ps != null) {
            for (Project t : ps) {
                if (!t.isDefault()) {
                    p = t;
                }
            }
        }
    }
    File dir = new File(p.getBasePath(), Project.DIRECTORY_STORE_FOLDER);
    return dir;
}
 
開發者ID:Jamling,項目名稱:SmartQQ4IntelliJ,代碼行數:17,代碼來源:IMWindowFactory.java

示例2: unpackCourseArchive

import com.intellij.openapi.project.Project; //導入方法依賴的package包/類
private static void unpackCourseArchive(final Project project) {
  FileChooserDescriptor descriptor =
    new FileChooserDescriptor(true, true, true, true, true, false);

  final VirtualFile virtualFile = FileChooser.chooseFile(descriptor, project, null);
  if (virtualFile == null) {
    return;
  }
  final String basePath = project.getBasePath();
  if (basePath == null) return;

  Course course = StudyProjectGenerator.getCourse(virtualFile.getPath());
  if (course == null) {
    Messages.showErrorDialog("This course is incompatible with current version", "Failed to Unpack Course");
    return;
  }
  generateFromStudentCourse(project, course);
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:19,代碼來源:CCFromCourseArchive.java

示例3: getWizard

import com.intellij.openapi.project.Project; //導入方法依賴的package包/類
private AddModuleWizard getWizard(final Project project) throws ConfigurationException {
    final HybrisProjectImportProvider provider = getHybrisProjectImportProvider();
    final String basePath = project.getBasePath();
    final String projectName = project.getName();
    final Sdk jdk = ProjectRootManager.getInstance(project).getProjectSdk();
    final String compilerOutputUrl = CompilerProjectExtension.getInstance(project).getCompilerOutputUrl();
    final HybrisProjectSettings settings = HybrisProjectSettingsComponent.getInstance(project).getState();

    final AddModuleWizard wizard = new AddModuleWizard(null, basePath, provider) {

        protected void init() {
            // non GUI mode
        }
    };
    final WizardContext wizardContext = wizard.getWizardContext();
    wizardContext.setProjectJdk(jdk);
    wizardContext.setProjectName(projectName);
    wizardContext.setCompilerOutputDirectory(compilerOutputUrl);
    final StepSequence stepSequence = wizard.getSequence();
    for (ModuleWizardStep step : stepSequence.getAllSteps()) {
        if (step instanceof NonGuiSupport) {
            ((NonGuiSupport) step).nonGuiModeImport(settings);
        }
    }
    return wizard;
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:27,代碼來源:ProjectRefreshAction.java

示例4: runActivity

import com.intellij.openapi.project.Project; //導入方法依賴的package包/類
@Override
public void runActivity(@NotNull Project project)
{
    String expectedPath = project.getBasePath() + "/roc.config.js";
    File configFile = new File(expectedPath);

    if (!configFile.isFile())
    {
        return;
    }

    try
    {
        FetchCompletions fetchCompletions = new FetchCompletions(project);
        fetchCompletions.run();
    }
    catch (Exception e)
    {
        NotificationGroup group = new NotificationGroup("ROC_GROUP", NotificationDisplayType.STICKY_BALLOON, true, null, RocIcons.ROC);
        Notification notification = group.createNotification("Failed to fetch roc-completions!", "", e.getMessage(), NotificationType.ERROR);
        Notifications.Bus.notify(notification);
    }
}
 
開發者ID:whitefire,項目名稱:roc-completion,代碼行數:24,代碼來源:CompletionPreloader.java

示例5: getProjectTitle

import com.intellij.openapi.project.Project; //導入方法依賴的package包/類
@Override
public String getProjectTitle(@NotNull Project project) {

    String projectCustomTitle;
    try {
        String projectDefaultTitle = defaultBuilder.getProjectTitle(project);
        String projectName = project.getName();
        String projectPath = project.getBasePath();

        projectCustomTitle = engine.eval("projectTemplate({" +
                "projectDefaultTitle: '" + projectDefaultTitle + "'," +
                "projectName: '" + projectName + "'," +
                "projectPath: '" + projectPath + "'" +
                "})").toString();

    } catch (Exception e) {
        projectCustomTitle = defaultBuilder.getProjectTitle(project);
    }

    return projectCustomTitle;
}
 
開發者ID:mabdurrahman,項目名稱:custom-title-plugin,代碼行數:22,代碼來源:CustomFrameTitleBuilder.java

示例6: generateClassPath

import com.intellij.openapi.project.Project; //導入方法依賴的package包/類
public static String generateClassPath(Project project,String classRootPath,String packagePath, String className) {
    classRootPath = classRootPath.replace("/",File.separator);
    classRootPath = classRootPath.replace("\\\\",File.separator);
    try {
        classRootPath = classRootPath.replace("\\", File.separator);
    }catch (Exception ex){}
    if(!classRootPath.substring(classRootPath.length()-1).equals(File.separator)){
        classRootPath = classRootPath+File.separator;
    }
    if(!classRootPath.substring(0,1).equals(File.separator)){
        classRootPath = File.separator + classRootPath;
    }
    return project.getBasePath()  + classRootPath + packagePath.replace(".",File.separator) +File.separator + className;
}
 
開發者ID:zeng198821,項目名稱:CodeGenerate,代碼行數:15,代碼來源:CodeMakerUtil.java

示例7: doAction

import com.intellij.openapi.project.Project; //導入方法依賴的package包/類
@Override
public void doAction(AnActionEvent anActionEvent) {
    Project project = anActionEvent.getData(PlatformDataKeys.PROJECT);
    String path = project.getBasePath();
    gradleLocation = RNPathUtil.getAndroidProjectPath(path);

    if (gradleLocation == null) {
        NotificationUtils.gradleFileNotFound();
    } else {
        if(command() == null) {
            return;
        }
        terminal.createNewSession();
        new Thread(() -> {
            try {
                // Wait 0.5 second for the terminal to show up, no wait works ok on WebStorm but not on Android Studio
                Thread.currentThread().sleep(500L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            // Below code without ApplicationManager.getApplication().invokeLater() will throw exception
            // : IDEA Access is allowed from event dispatch thread only.
            ApplicationManager.getApplication().invokeLater(() -> {
                terminal.executeShell("cd \"" + gradleLocation + "\"");
                terminal.executeShell(command());
            });
        }).start();
    }
}
 
開發者ID:beansoftapp,項目名稱:react-native-console,代碼行數:30,代碼來源:ReactNativeTerminal.java

示例8: hadInitFreeline

import com.intellij.openapi.project.Project; //導入方法依賴的package包/類
/**
 * if had init freeline return true
 */
public static boolean hadInitFreeline(Project project) {
    if (project != null) {
        String projectPath = project.getBasePath();
        // freeline directory
        File freelineDir = new File(projectPath, "freeline");
        // freeline.py file
        File freeline_py = new File(projectPath, "freeline.py");
        if (freelineDir.exists() && freeline_py.exists()) {
            return true;
        }
    }
    return false;
}
 
開發者ID:beansoftapp,項目名稱:react-native-console,代碼行數:17,代碼來源:RNUtil.java

示例9: getRNProjectRootPathFromConfig

import com.intellij.openapi.project.Project; //導入方法依賴的package包/類
/**
 * Get the real react native project root path.
 * @param project
 * @return
 */
private static String getRNProjectRootPathFromConfig(Project project) {
    String path = project.getBasePath();
    File file = new File(path, RN_CONSOLE_FILE);
    if (file.exists()) {
        String p = parseCurrentPathFromRNConsoleJsonFile(file);
        if(p != null) {
            return new File(path, p).getAbsolutePath();
        }
        return null;
    } else {
        return null;
    }
}
 
開發者ID:beansoftapp,項目名稱:react-native-console,代碼行數:19,代碼來源:RNPathUtil.java

示例10: deploy

import com.intellij.openapi.project.Project; //導入方法依賴的package包/類
private void deploy(TelemetryToolWindow window, Project project, DataContext context) {
    setActionEnabled(false);
    String projectPath = project.getBasePath();
    String modules = composeModulesArgument(project);
    String classpath = composeClasspathArgument(context);
    String androidSdkPath = Utils.getAndroidSdkPath(project);

    window.message("Deployment in progress...");
    window.message(" ");
    window.update();

    new AsyncExecutor<DetailedDeployReport>() {

        @Override
        public DetailedDeployReport onBackground() {
            DeployResult result = executeJar(window, projectPath, modules, classpath, androidSdkPath);
            return new DetailedDeployReport(result, ImmutableList.of());
        }

        @Override
        public void onActionComplete(DetailedDeployReport report) {
            if (report.result == DeployResult.OK) {
                window.green(report.result.message);
                EventLog.info(report.result.message);

            } else if (report.result == DeployResult.TERMINATED) {
                window.warn(report.result.message);
                EventLog.warn(report.result.message);

            } else {
                window.error(report.result.message);
                EventLog.error(report.result.message);
            }

            window.update();
            setActionEnabled(true);
        }
    }.start();
}
 
開發者ID:andreyfomenkov,項目名稱:green-cat,代碼行數:40,代碼來源:Deploy.java

示例11: setCompilerOutput

import com.intellij.openapi.project.Project; //導入方法依賴的package包/類
protected void setCompilerOutput(@NotNull Project project) {
  CompilerProjectExtension compilerProjectExtension = CompilerProjectExtension.getInstance(project);
  String basePath = project.getBasePath();
  if (compilerProjectExtension != null && basePath != null) {
    compilerProjectExtension.setCompilerOutputUrl(VfsUtilCore.pathToUrl(FileUtilRt.toSystemDependentName(basePath)));
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:8,代碼來源:EduIntellijCourseProjectGeneratorBase.java

示例12: OnProjectSync

import com.intellij.openapi.project.Project; //導入方法依賴的package包/類
public OnProjectSync(Project project) {
    if (project == null) {
        return;
    }
    projectBasePath = project.getBasePath();
}
 
開發者ID:DanielMartinus,項目名稱:IntelliJ-codestyle-sync,代碼行數:7,代碼來源:OnProjectSync.java

示例13: getSourceBasePath

import com.intellij.openapi.project.Project; //導入方法依賴的package包/類
public static String getSourceBasePath(Project project) {

        return  project.getBasePath();
        //String classPath = project.getProjectFilePath();
        //return classPath.substring(0, classPath.lastIndexOf('/'));
    }
 
開發者ID:zeng198821,項目名稱:CodeGenerate,代碼行數:7,代碼來源:CodeMakerUtil.java

示例14: getProjectBasePath

import com.intellij.openapi.project.Project; //導入方法依賴的package包/類
static String getProjectBasePath(Project project) {
    return project.getBasePath() != null ? project.getBasePath() : "./";
}
 
開發者ID:JFrogDev,項目名稱:jfrog-idea-plugin,代碼行數:4,代碼來源:ScanManager.java

示例15: processNamespaces

import com.intellij.openapi.project.Project; //導入方法依賴的package包/類
public static void processNamespaces(Project project, Set<PhpNamespaceRootInfo> roots) {
    VirtualFile composerFile = project.getBaseDir().findChild("composer.json");

    if (composerFile == null) {
        PhpPsr4NamespaceNotifier.showNotificationByMessageId(
                project,
                "actions.detect.namespace.roots.no.composer.json.detected",
                (NotificationListener)null
        );

        throw new ProcessCanceledException();
    }

    JsonFile psiFile = (JsonFile) PsiManager.getInstance(project).findFile(composerFile);

    if (psiFile != null) {
        JsonProperty[] properties = PsiTreeUtil.getChildrenOfType(psiFile.getTopLevelValue(), JsonProperty.class);

        if (properties != null) {
            boolean found = false;
            for (JsonProperty property : properties) {
                if (!property.getName().equals("autoload") && !property.getName().equals("autoload-dev")) {
                    continue;
                }

                if (property.getValue() != null && property.getValue() instanceof JsonObject) {
                    JsonProperty[] namespacesTypes = PsiTreeUtil.getChildrenOfType(
                        property.getValue(),
                        JsonProperty.class
                    );

                    if (namespacesTypes != null) {
                        for (JsonProperty namespaceType : namespacesTypes) {
                            if (!namespaceType.getName().equals("psr-4")) {
                                continue;
                            }

                            JsonProperty[] namespaces = PsiTreeUtil.getChildrenOfType(
                                    namespaceType.getValue(),
                                    JsonProperty.class
                            );

                            if (namespaces != null) {
                                for (JsonProperty namespace : namespaces) {
                                    if (namespace.getValue() != null &&
                                        namespace.getValue() instanceof JsonStringLiteral
                                    ) {
                                        String path = project.getBasePath()
                                                + File.separator
                                                + ((JsonStringLiteral) namespace.getValue()).getValue();

                                        if (!FileUtil.exists(path)) {
                                            continue;
                                        }

                                        PhpNamespaceRootInfo rootInfo = PhpNamespaceRootInfo.create(
                                            path,
                                            namespace.getName()
                                        );

                                        roots.add(rootInfo);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
 
開發者ID:aurimasniekis,項目名稱:idea-php-psr4-namespace-detector,代碼行數:72,代碼來源:PhpPsr4NamespaceRootDetector.java


注:本文中的com.intellij.openapi.project.Project.getBasePath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。