当前位置: 首页>>代码示例>>Java>>正文


Java RunResult.getResultObject方法代码示例

本文整理汇总了Java中com.intellij.openapi.application.RunResult.getResultObject方法的典型用法代码示例。如果您正苦于以下问题:Java RunResult.getResultObject方法的具体用法?Java RunResult.getResultObject怎么用?Java RunResult.getResultObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.application.RunResult的用法示例。


在下文中一共展示了RunResult.getResultObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: write

import com.intellij.openapi.application.RunResult; //导入方法依赖的package包/类
@Override
protected void write(@NotNull Project project, @NotNull PsiDirectory extensionRootDirectory, @NotNull String className) {
    if (!className.endsWith("ViewHelper")) {
        className += "ViewHelper";
    }

    final String finalClassName = className;
    RunResult<PsiElement> elementRunResult = new WriteCommandAction<PsiElement>(project) {

        @Override
        protected void run(@NotNull Result result) throws Throwable {
            PsiElement extensionFile;
            Map<String, String> context = new HashMap<>();

            String calculatedNamespace = ExtensionUtility.findDefaultNamespace(extensionRootDirectory);
            if (calculatedNamespace == null) {
                result.setResult(null);
                return;
            }

            calculatedNamespace += "ViewHelpers";

            context.put("namespace", calculatedNamespace);
            context.put("className", finalClassName);

            String majorVersion = null;
            if (TYPO3Utility.getTYPO3Version(project) != null && TYPO3Utility.isMajorMinorCmsVersion(project, "7.6")) {
                majorVersion = "7";
            } else if (TYPO3Utility.getTYPO3Version(project) != null && TYPO3Utility.isMajorMinorCmsVersion(project, "8.7")) {
                majorVersion = "8";
            } else if (TYPO3Utility.getTYPO3Version(project) != null && TYPO3Utility.getTYPO3Version(project).startsWith("9.")) {
                majorVersion = "9";
            }

            if (majorVersion == null) {
                result.setResult(null);
                return;
            }

            try {
                extensionFile = ExtensionFileGenerationUtil.fromTemplate(
                        "extension_file/" + majorVersion + "/ViewHelper.php",
                        "Classes/ViewHelpers",
                        finalClassName + ".php",
                        extensionRootDirectory,
                        context,
                        project
                );

                if (extensionFile != null) {
                    result.setResult(extensionFile);
                }
            } catch (IncorrectOperationException e) {
                // file already exists
            }
        }
    }.execute();

    if (elementRunResult.getResultObject() != null) {
        new OpenFileDescriptor(project, elementRunResult.getResultObject().getContainingFile().getVirtualFile(), 0).navigate(true);
    } else {
        Messages.showErrorDialog("Cannot create extension file", "Error");
    }
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:65,代码来源:GenerateViewHelperAction.java

示例2: write

import com.intellij.openapi.application.RunResult; //导入方法依赖的package包/类
@Override
protected void write(@NotNull Project project, @NotNull PsiDirectory extensionRootDirectory, @NotNull String className) {

    final String finalClassName = className;
    RunResult<PsiElement> elementRunResult = new WriteCommandAction<PsiElement>(project) {

        @Override
        protected void run(@NotNull Result result) throws Throwable {
            PsiElement extensionFile;
            Map<String, String> context = new HashMap<>();

            String calculatedNamespace = ExtensionUtility.findDefaultNamespace(extensionRootDirectory);
            if (calculatedNamespace == null) {
                result.setResult(null);
                return;
            }

            calculatedNamespace += "Domain\\Model";

            context.put("namespace", calculatedNamespace);
            context.put("className", finalClassName);

            try {
                extensionFile = ExtensionFileGenerationUtil.fromTemplate(
                        "extension_file/ExtbaseEntity.php",
                        "Classes/Domain/Model",
                        finalClassName + ".php",
                        extensionRootDirectory,
                        context,
                        project
                );

                if (extensionFile != null) {
                    result.setResult(extensionFile);
                }
            } catch (IncorrectOperationException e) {
                // file already exists
            }
        }
    }.execute();

    if (elementRunResult.getResultObject() != null) {
        new OpenFileDescriptor(project, elementRunResult.getResultObject().getContainingFile().getVirtualFile(), 0).navigate(true);
    } else {
        Messages.showErrorDialog("Cannot create extension file", "Error");
    }
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:48,代码来源:GenerateExtbaseEntityAction.java

示例3: write

import com.intellij.openapi.application.RunResult; //导入方法依赖的package包/类
@Override
protected void write(@NotNull Project project, @NotNull PsiDirectory extensionRootDirectory, @NotNull String className) {
    if (!className.endsWith("Controller")) {
        className += "Controller";
    }

    final String finalClassName = className;
    RunResult<PsiElement> elementRunResult = new WriteCommandAction<PsiElement>(project) {

        @Override
        protected void run(@NotNull Result result) throws Throwable {
            PsiElement extensionFile;
            Map<String, String> context = new HashMap<>();

            String calculatedNamespace = ExtensionUtility.findDefaultNamespace(extensionRootDirectory);
            if (calculatedNamespace == null) {
                result.setResult(null);
                return;
            }

            calculatedNamespace += "Controller";

            context.put("namespace", calculatedNamespace);
            context.put("className", finalClassName);

            try {
                extensionFile = ExtensionFileGenerationUtil.fromTemplate(
                        "extension_file/ExtbaseActionController.php",
                        "Classes/Controller",
                        finalClassName + ".php",
                        extensionRootDirectory,
                        context,
                        project
                );

                if (extensionFile != null) {
                    result.setResult(extensionFile);
                }
            } catch (IncorrectOperationException e) {
                // file already exists
            }
        }
    }.execute();

    if (elementRunResult.getResultObject() != null) {
        new OpenFileDescriptor(project, elementRunResult.getResultObject().getContainingFile().getVirtualFile(), 0).navigate(true);
    } else {
        Messages.showErrorDialog("Cannot create extension file", "Error");
    }
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:51,代码来源:GenerateActionControllerAction.java


注:本文中的com.intellij.openapi.application.RunResult.getResultObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。