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


Java CompileContext.getProject方法代码示例

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


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

示例1: isReleaseBuild

import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
public static boolean isReleaseBuild(@NotNull CompileContext context) {
  final Boolean value = context.getCompileScope().getUserData(RELEASE_BUILD_KEY);
  if (value != null && value.booleanValue()) {
    return true;
  }
  final Project project = context.getProject();
  final Set<Artifact> artifacts = ArtifactCompileScope.getArtifactsToBuild(project, context.getCompileScope(), false);

  if (artifacts != null) {
    for (Artifact artifact : artifacts) {
      final ArtifactProperties<?> properties = artifact.getProperties(AndroidArtifactPropertiesProvider.getInstance());
      if (properties instanceof AndroidApplicationArtifactProperties) {
        final AndroidArtifactSigningMode signingMode = ((AndroidApplicationArtifactProperties)properties).getSigningMode();

        if (signingMode != AndroidArtifactSigningMode.DEBUG &&
            signingMode != AndroidArtifactSigningMode.DEBUG_WITH_CUSTOM_CERTIFICATE) {
          return true;
        }
      }
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:AndroidCompileUtil.java

示例2: 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);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:AntArtifactProperties.java

示例3: onBuildFinished

import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
@Override
public void onBuildFinished(@NotNull final Artifact artifact, @NotNull final CompileContext compileContext) {
  if (!(artifact.getArtifactType() instanceof JavaFxApplicationArtifactType)) {
    return;
  }
  final Project project = compileContext.getProject();
  final Set<Module> modules = ApplicationManager.getApplication().runReadAction(new Computable<Set<Module>>() {
    @Override
    public Set<Module> compute() {
      return ArtifactUtil.getModulesIncludedInArtifacts(Collections.singletonList(artifact), project);
    }
  });
  if (modules.isEmpty()) {
    return;
  }

  Sdk fxCompatibleSdk = null;
  for (Module module : modules) {
    final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
    if (sdk != null && sdk.getSdkType() instanceof JavaSdk) {
      if (((JavaSdk)sdk.getSdkType()).isOfVersionOrHigher(sdk, JavaSdkVersion.JDK_1_7)) {
        fxCompatibleSdk = sdk;
        break;
      }
    }
  }

  if (fxCompatibleSdk == null) {
    compileContext.addMessage(CompilerMessageCategory.ERROR, "Java version 7 or higher is required to build JavaFX package", null, -1, -1);
    return;
  }

  final JavaFxArtifactProperties properties =
          (JavaFxArtifactProperties)artifact.getProperties(JavaFxArtifactPropertiesProvider.getInstance());

  final JavaFxPackager javaFxPackager = new JavaFxPackager(artifact, properties, project) {
    @Override
    protected void registerJavaFxPackagerError(String message) {
      compileContext.addMessage(CompilerMessageCategory.ERROR, message, null, -1, -1);
    }
  };
  javaFxPackager.buildJavaFxArtifact(fxCompatibleSdk.getHomePath());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:JavaFxArtifactProperties.java

示例4: execute

import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
@Override
public boolean execute(@NotNull final CompileContext context) {
  if(isErroneous(context)) {
    return false;
  }

  final Project project = context.getProject();

  final RunConfiguration runConfiguration =
      context.getCompileScope().getUserData(CompileStepBeforeRun.RUN_CONFIGURATION);

  if(!isDefracRunConfiguration(runConfiguration)) {
    return true;
  }

  final DefracRunConfiguration defracRunConfiguration =
      (DefracRunConfiguration)runConfiguration;

  final Module[] modules = defracRunConfiguration.getModules();

  if(modules.length != 1) {
    reportError(context, "No module found");
    return false;
  }

  final DefracFacet facet = DefracFacet.getInstance(modules[0]);

  if(facet == null) {
    reportError(context,"Couldn't find defrac facet");
    return false;
  }

  if(!shouldRunForFacet(facet)) {
    return true;
  }

  try {
    context.getProgressIndicator().pushState();
    setProgressIndicatorText(context, facet);

    UIUtil.invokeAndWaitIfNeeded(new Runnable() {
      @Override
      public void run() {
        final ConsoleView console =
            DefracConsoleView.getInstance(project);

        if(console != null) {
          console.clear();
        }
      }
    });

    return doCompile(context, defracRunConfiguration, facet);
  } finally {
    context.getProgressIndicator().popState();
  }
}
 
开发者ID:defrac,项目名称:defrac-plugin-intellij,代码行数:58,代码来源:DefracCompilerTask.java

示例5: EnhancerCompilerInstance

import com.intellij.openapi.compiler.CompileContext; //导入方法依赖的package包/类
public EnhancerCompilerInstance(CompileContext context) {
  super(context);
  myProject = context.getProject();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:5,代码来源:EnhancerCompilerInstance.java


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