本文整理汇总了Java中com.intellij.openapi.compiler.CompileContext.addMessage方法的典型用法代码示例。如果您正苦于以下问题:Java CompileContext.addMessage方法的具体用法?Java CompileContext.addMessage怎么用?Java CompileContext.addMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.compiler.CompileContext
的用法示例。
在下文中一共展示了CompileContext.addMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createProcessingItem
import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
@NotNull
private ProcessingItem createProcessingItem(@NotNull final CompileContext context,
@NotNull final OCamlCompileContext ocamlContext,
@NotNull final OCamlModule mainOCamlModule) {
final File cmoFile = mainOCamlModule.getCompiledImplementationFile();
VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(cmoFile);
if (file == null) {
context.addMessage(ERROR, "File \"" + FileUtil.toSystemDependentName(cmoFile.getAbsolutePath()) + "\" was not created. Rebuild the project.", null, -1, -1);
return createFakeProcessingItem(mainOCamlModule.getSourcesDir());
}
final File exeFile = mainOCamlModule.getCompiledExecutableFile();
final Boolean thereWasRecompilation = context.getUserData(THERE_WAS_RECOMPILATION);
final boolean forceRecompilation = (thereWasRecompilation != null && thereWasRecompilation) || context.isRebuild();
return createProcessingItem(mainOCamlModule, file, exeFile, ocamlContext.isDebugMode(), forceRecompilation);
}
示例2: getJarEntryInputStream
import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
@Nullable
public static BufferedInputStream getJarEntryInputStream(VirtualFile sourceFile, final CompileContext context) throws IOException {
final String fullPath = sourceFile.getPath();
final int jarEnd = fullPath.indexOf(JarFileSystem.JAR_SEPARATOR);
LOG.assertTrue(jarEnd != -1, fullPath);
String pathInJar = fullPath.substring(jarEnd + JarFileSystem.JAR_SEPARATOR.length());
String jarPath = fullPath.substring(0, jarEnd);
final ZipFile jarFile = new ZipFile(new File(FileUtil.toSystemDependentName(jarPath)));
final ZipEntry entry = jarFile.getEntry(pathInJar);
if (entry == null) {
context.addMessage(CompilerMessageCategory.ERROR, "Cannot extract '" + pathInJar + "' from '" + jarFile.getName() + "': entry not found", null, -1, -1);
return null;
}
return new BufferedInputStream(jarFile.getInputStream(entry)) {
@Override
public void close() throws IOException {
super.close();
jarFile.close();
}
};
}
示例3: addErrorToContext
import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
private static void addErrorToContext(String error, CompileContext context,
String errorRoot)
{
// TODO: Add a button to the Haxe module settings to control whether we always open the window or not.
if (context.getUserData(messageWindowAutoOpened) == null) {
openCompilerMessagesWindow(context);
context.putUserData(messageWindowAutoOpened, "yes");
}
final HaxeCompilerError compilerError = HaxeCompilerError.create
(errorRoot,
error,
!ApplicationManager.getApplication().isUnitTestMode());
if (null != compilerError) {
context.addMessage
(compilerError.getCategory(),
compilerError.getErrorMessage(),
VfsUtilCore.pathToUrl(compilerError.getPath()),
compilerError.getLine(),
compilerError.getColumn());
}
}
示例4: reportDeploymentDescriptorDoesNotExists
import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
public void reportDeploymentDescriptorDoesNotExists(ConfigFile descriptor, CompileContext context, Module module) {
final String description = ModuleType.get(module).getName() + " '" + module.getName() + '\'';
String descriptorPath = VfsUtil.urlToPath(descriptor.getUrl());
final String message =
CompilerBundle.message("message.text.compiling.item.deployment.descriptor.could.not.be.found", description, descriptorPath);
context.addMessage(CompilerMessageCategory.ERROR, message, null, -1, -1);
}
示例5: checkConfigFile
import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
public void checkConfigFile(final ConfigFile descriptor, final CompileContext compileContext, final Module module) {
if (new File(VfsUtil.urlToPath(descriptor.getUrl())).exists()) {
String message = getConfigFileErrorMessage(descriptor);
if (message != null) {
final String moduleDescription = ModuleType.get(module).getName() + " '" + module.getName() + '\'';
compileContext.addMessage(CompilerMessageCategory.ERROR,
CompilerBundle.message("message.text.compiling.module.message", moduleDescription, message),
descriptor.getUrl(), -1, -1);
}
}
else {
DeploymentUtil.getInstance().reportDeploymentDescriptorDoesNotExists(descriptor, compileContext, module);
}
}
示例6: runAntTarget
import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
private void runAntTarget(CompileContext compileContext, final Artifact artifact) {
if (myExtensionProperties.myEnabled) {
final Project project = compileContext.getProject();
final AntBuildTarget target = findTarget(AntConfiguration.getInstance(project));
if (target != null) {
final DataContext dataContext = SimpleDataContext.getProjectContext(project);
List<BuildFileProperty> properties = getAllProperties(artifact);
final boolean success = AntConfigurationImpl.executeTargetSynchronously(dataContext, target, properties);
if (!success) {
compileContext.addMessage(CompilerMessageCategory.ERROR, "Cannot build artifact '" + artifact.getName() + "': ant target '" + target.getDisplayName() + "' failed with error", null, -1, -1);
}
}
}
}
示例7: makeModule
import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
public static boolean makeModule(CompileContext context, Module module) {
NimModuleComponent moduleComponent = NimModuleComponent.getInstance(module);
NimModuleComponent.ModuleType moduleType = moduleComponent.getModuleType();
ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
Sdk sdk = moduleRootManager.getSdk();
if (sdk == null) {
context.addMessage(CompilerMessageCategory.ERROR, "Nim SDK must be selected.", null, -1, -1);
return false;
}
RunnerAndConfigurationSettings selectedConfiguration = RunManager.getInstance(module.getProject()).getSelectedConfiguration();
if (selectedConfiguration == null) {
context.addMessage(CompilerMessageCategory.ERROR, "Nim run configuration must be selected.", null, -1, -1);
return false;
}
RunConfiguration runConfiguration = selectedConfiguration.getConfiguration();
if (runConfiguration == null) {
context.addMessage(CompilerMessageCategory.ERROR, "Nim run configuration must be selected.", null, -1, -1);
return false;
}
if (!(runConfiguration instanceof NimRunConfiguration)) {
context.addMessage(CompilerMessageCategory.ERROR, "Selected run configuration must be Nim run configuration.", null, -1, -1);
return false;
}
NimRunConfiguration nimRunConfiguration = (NimRunConfiguration)runConfiguration;
return makeModule(context, module, moduleType, module.getModuleFilePath(), sdk, nimRunConfiguration);
}
示例8: getBaseCompilerCommandLineForFile
import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
@Nullable
protected GeneralCommandLine getBaseCompilerCommandLineForFile(@NotNull final VirtualFile file,
@NotNull final ProjectFileIndex fileIndex,
@NotNull final CompileContext context,
final boolean isDebugMode) {
final Module module = fileIndex.getModuleForFile(file);
if (module == null) {
context.addMessage(ERROR, "Cannot determine module for \"" + OCamlFileUtil.getPathToDisplay(file) + "\" file.", file.getUrl(), INVALID_INT, INVALID_INT);
return null;
}
final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
if (!OCamlModuleUtil.isOCamlSdk(sdk)) {
context.addMessage(ERROR, "Sdk of module \"" + module.getName() + "\" is invalid.", file.getUrl(), INVALID_INT, INVALID_INT);
return null;
}
//noinspection ConstantConditions
final String sdkHomePath = sdk.getHomePath();
final String compilerExePath = OCamlSdkType.getByteCodeCompilerExecutable(sdkHomePath).getAbsolutePath();
final GeneralCommandLine cmd = new GeneralCommandLine();
cmd.setWorkDirectory(sdkHomePath);
cmd.setExePath(compilerExePath);
if (isDebugMode) {
cmd.addParameter("-g");
}
return cmd;
}
示例9: processErrorAndWarningLines
import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
protected boolean processErrorAndWarningLines(@NotNull final List<String> lines, @NotNull final CompileContext context, @Nullable final VirtualFile file) {
boolean hasError = false;
final List<FailureMessage> failures = parseOutput(lines);
for (final FailureMessage failure : failures) {
final boolean isError = failure.getType() == FailureMessage.Type.ERROR;
final String url = file == null ? findUrl(failure) : file.getUrl();
context.addMessage(isError ? ERROR : WARNING, failure.getMessageText(), url, failure.getLineNumber(), failure.getStartPosition());
hasError |= isError;
}
return hasError;
}
示例10: getProcessingItems
import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
@NotNull
public ProcessingItem[] getProcessingItems(@NotNull final CompileContext context) {
final ProgressIndicator progressIndicator = context.getProgressIndicator();
progressIndicator.setIndeterminate(true);
progressIndicator.setText("Preparing files for compiling...");
final ArrayList<ProcessingItem> items = new ArrayList<ProcessingItem>();
final ArrayList<OCamlModule> ocamlModules = new ArrayList<OCamlModule>();
final OCamlCompileContext ocamlContext = OCamlCompileContext.createOn(context);
final boolean isDebugMode = ocamlContext.isDebugMode();
try {
if (ocamlContext.isStandaloneCompile()) {
ocamlModules.addAll(collectItemsForStandaloneCompile(context, items));
}
else {
final OCamlModule mainOCamlModule = getMainOCamlModule(ocamlContext);
ocamlModules.add(mainOCamlModule);
ocamlModules.addAll(mainOCamlModule.collectAllDependencies());
Collections.reverse(ocamlModules);
}
}
catch (final CyclicDependencyException e) {
context.addMessage(ERROR, e.getMessage(), null, -1, -1);
return new ProcessingItem[0];
}
final boolean isRebuild = context.isRebuild();
final LocalFileSystem fileSystem = LocalFileSystem.getInstance();
for (final OCamlModule ocamlModule : ocamlModules) {
processFile(fileSystem.findFileByIoFile(ocamlModule.getInterfaceFile()), ocamlModule.getCompiledInterfaceFile(), items, isDebugMode, isRebuild);
processFile(fileSystem.findFileByIoFile(ocamlModule.getImplementationFile()), ocamlModule.getCompiledImplementationFile(), items, isDebugMode, isRebuild);
}
return items.toArray(new ProcessingItem[items.size()]);
}
示例11: process
import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
@NotNull
public ProcessingItem[] process(@NotNull final CompileContext context, @NotNull final ProcessingItem[] items) {
final ProgressIndicator progressIndicator = context.getProgressIndicator();
progressIndicator.setIndeterminate(false);
progressIndicator.setText("Linking...");
final double allCount = items.length;
int processedCount = -1;
final ArrayList<ProcessingItem> processedItems = new ArrayList<ProcessingItem>();
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(context.getProject()).getFileIndex();
final OCamlCompileContext ocamlContext = OCamlCompileContext.createOn(context);
for (final ProcessingItem item : items) {
progressIndicator.setText2("");
processedCount++;
progressIndicator.setFraction(processedCount / allCount);
if (!(item instanceof OCamlLinkerProcessingItem)) continue;
final OCamlModule mainOCamlModule = ((OCamlLinkerProcessingItem) item).getOCamlModule();
if (mainOCamlModule == null) continue;
final String exeFilePath = mainOCamlModule.getCompiledExecutableFile().getAbsolutePath();
progressIndicator.setText2(exeFilePath);
try {
link(mainOCamlModule, fileIndex, context, ocamlContext);
} catch (final CyclicDependencyException e) {
context.addMessage(ERROR, e.getMessage(), null, -1, -1);
continue;
}
processedItems.add(item);
}
return processedItems.toArray(new ProcessingItem[processedItems.size()]);
}
示例12: link
import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
private void link(@NotNull final OCamlModule ocamlModule,
@NotNull final ProjectFileIndex fileIndex,
@NotNull final CompileContext context,
final OCamlCompileContext ocamlContext) throws CyclicDependencyException {
final GeneralCommandLine cmd = getBaseCompilerCommandLineForFile(ocamlModule.getSourcesDir(), fileIndex, context, ocamlContext.isDebugMode());
if (cmd == null) return;
cmd.addParameter("-o");
cmd.addParameter(ocamlModule.getCompiledExecutableFile().getAbsolutePath());
if (!ocamlContext.isStandaloneCompile()) {
cmd.getParametersList().addParametersString(getRunConfiguration(ocamlContext).getLinkerOptions());
}
final List<OCamlModule> dependencies = ocamlModule.collectAllDependencies();
Collections.reverse(dependencies);
for (final OCamlModule dependency : dependencies) {
cmd.addParameter(dependency.getCompiledImplementationFile().getAbsolutePath());
}
cmd.addParameter(ocamlModule.getCompiledImplementationFile().getAbsolutePath());
try {
final ProcessOutput processOutput = OCamlSystemUtil.execute(cmd);
processInfoLines(processOutput.getStdoutLines(), context, null);
processErrorAndWarningLines(processOutput.getStderrLines(), context, null);
}
catch (final ExecutionException e) {
context.addMessage(ERROR, e.getLocalizedMessage(), null, -1, -1);
}
//todo OCamlSystemUtil.addStdPaths(cmd, sdk);
//todo libraries!!! maybe in OCamlModule
}
示例13: showMessage
import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
private void showMessage(Api.PerformRefactoringResponse response, CompileContext context, RefactorStatusCallback refactorStatusCallback) {
refactorStatusCallback.onFinish(new RefactoringStatus(false, "Please fix all errors before refactoring."));
for (String error : response.getErrorsList()) {
GaugeError gaugeError = GaugeError.getInstance(error);
if (gaugeError != null) {
context.addMessage(CompilerMessageCategory.ERROR, gaugeError.getMessage(), Paths.get(gaugeError.getFileName()).toUri().toString(), gaugeError.getLineNumber(), -1);
} else {
context.addMessage(CompilerMessageCategory.ERROR, error, null, -1, -1);
}
}
}
示例14: executeIfExistsAndValid
import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
private boolean executeIfExistsAndValid(CompileContext context, XmlBeansConfiguration configuration) {
if (configuration != null && configuration.isValid(module)) {
return doExecute(context, configuration);
}
else {
context.addMessage(CompilerMessageCategory.WARNING, "Skipped " +
getTaskDescription() +
" for XMLBeans " +
(configuration.getProduction() ? "production" : "test") +
" execution on module " +
module.getName() +
" because configuration is invalid.", null, -1, -1);
return true;
}
}
示例15: doExecute
import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
@Override
public boolean doExecute(CompileContext context, XmlBeansConfiguration configuration) {
File generatedClassesSrcDirectory = getGeneratedClassesSrcDirectory(configuration);
if (generatedClassesSrcDirectory.exists() && !FileUtil.delete(generatedClassesSrcDirectory)) {
context
.addMessage(CompilerMessageCategory.ERROR, "Could not delete file : " + generatedClassesSrcDirectory.getAbsolutePath(), null, -1,
-1);
return false;
}
return true;
}