本文整理汇总了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");
}
}
示例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");
}
}
示例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");
}
}