• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java RunResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: doImport

import com.intellij.openapi.application.RunResult; //导入依赖的package包/类
private void doImport(final Collection<DataNode<IdeaJavaProject>> toImport, final Project project, final IdeModifiableModelsProvider modelsProvider)
  throws Throwable {
  RunResult result = new WriteCommandAction.Simple(project) {
    @Override
    protected void run() throws Throwable {
      if (!project.isDisposed()) {
        Map<String, IdeaJavaProject> gradleProjectsByName = indexByModuleName(toImport);
        for (Module module : modelsProvider.getModules()) {
          IdeaJavaProject javaProject = gradleProjectsByName.get(module.getName());
          if (javaProject != null) {
            customizeModule(module, modelsProvider, javaProject);
          }
        }
      }
    }
  }.execute();
  Throwable error = result.getThrowable();
  if (error != null) {
    throw error;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:JavaProjectDataService.java


示例2: onOk

import com.intellij.openapi.application.RunResult; //导入依赖的package包/类
@Override
public void onOk(@Nonnull NewClassDialog dialog) {
    final PsiDirectory directory = ideView.getOrChooseDirectory();
    if (directory == null) {
        dialog.cancel();
        return;
    }

    try {
        final CommandActionFactory actionFactory = commandActionFactoryProvider.get();
        final JavaConverterFactory converterFactory = javaConverterFactoryProvider.get();
        final NewClassCommandAction command = actionFactory.create(
                dialog.getClassName(),
                dialog.getJson(),
                directory,
                converterFactory.create(settings)
        );

        final ProgressManager progressManager = ProgressManager.getInstance();
        progressManager.runProcessWithProgressSynchronously(() -> {
            final ProgressIndicator indicator = progressManager.getProgressIndicator();
            if (indicator != null) {
                indicator.setIndeterminate(true);
                indicator.setText(bundle.message("progress.text", dialog.getClassName()));
            }

            final RunResult<PsiFile> result = command.execute();
            return result.getResultObject();
        }, bundle.message("progress.title"), false, project);
        dialog.close();
    } catch (RuntimeException e) {
        LOGGER.warn("Unable to create a class", e);
        onError(dialog, e.getCause());
    }
}
 
开发者ID:t28hub,项目名称:json2java4idea,代码行数:36,代码来源:NewClassAction.java


示例3: run

import com.intellij.openapi.application.RunResult; //导入依赖的package包/类
@Override
public void run() {
    logger.info("Preparing to write a total of " + sketchFiles.size() + " to the project package " + packageFqn + ".");

    for (PsiFile sketchFile : sketchFiles) {
        logger.info("Writing the sketch PSI file '" + sketchFile.getName() + "' to the project package '" + packageFqn + "'.");

        String sketchFileExtension = PathUtil.getFileExtension(sketchFile.getName());

        if (sketchFileExtension == null || ! sketchFileExtension.equals(JavaFileType.DEFAULT_EXTENSION)) {
            String generatedSketchFileName = PathUtil.makeFileName(PathUtil.getFileName(sketchFile.getName()), JavaFileType.DEFAULT_EXTENSION);

            sketchFile.setName(generatedSketchFileName);
        }

        WriteCommandAction.Simple<String> command = new WriteCommandAction.Simple<String>(project, sketchFile) {

            @Override
            protected void run() throws Throwable {
                CodeStyleManager.getInstance(project).reformat(sketchFile, false);
                packageFqn.add(sketchFile);
            }
        };

        RunResult<String> result = command.execute();
        logger.debug("Result of executing the file write action is: '" + result.getResultObject() + "'.");
    }
}
 
开发者ID:mistodev,项目名称:processing-idea,代码行数:29,代码来源:ImportedSketchClassWriter.java


示例4: doImport

import com.intellij.openapi.application.RunResult; //导入依赖的package包/类
private static void doImport(@NotNull final Collection<DataNode<IdeaGradleProject>> toImport,
                             @NotNull final Project project,
                             @NotNull final IdeModifiableModelsProvider modelsProvider) throws Throwable {
  RunResult result = new WriteCommandAction.Simple(project) {
    @Override
    protected void run() throws Throwable {
      if (!project.isDisposed()) {
        Map<String, IdeaGradleProject> gradleProjectsByName = indexByModuleName(toImport);
        for (Module module : modelsProvider.getModules()) {
          IdeaGradleProject gradleProject = gradleProjectsByName.get(module.getName());
          if (gradleProject == null) {
            // This happens when there is an orphan IDEA module that does not map to a Gradle project. One way for this to happen is when
            // opening a project created in another machine, and Gradle import assigns a different name to a module. Then, user decides not
            // to delete the orphan module when Studio prompts to do so.
            Facets.removeAllFacetsOfType(AndroidGradleFacet.TYPE_ID, modelsProvider.getModifiableFacetModel(module));
          }
          else {
            String gradleVersion = gradleProject.getGradleVersion();
            if (isNotEmpty(gradleVersion)) {
              setGradleVersionUsed(project, gradleVersion);
            }
            customizeModule(module, gradleProject, modelsProvider);
          }
        }
      }
    }
  }.execute();
  Throwable error = result.getThrowable();
  if (error != null) {
    throw error;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:GradleProjectDataService.java


示例5: execute

import com.intellij.openapi.application.RunResult; //导入依赖的package包/类
@NotNull
@Override
@Deprecated()
public RunResult execute() {
    return super.execute();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:DataWriter.java


示例6: 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


示例7: 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


示例8: 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类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ColumnOverride类代码示例发布时间:2022-05-22
下一篇:
Java SubArtifact类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap