本文整理汇总了Java中com.intellij.execution.configurations.RuntimeConfigurationException类的典型用法代码示例。如果您正苦于以下问题:Java RuntimeConfigurationException类的具体用法?Java RuntimeConfigurationException怎么用?Java RuntimeConfigurationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RuntimeConfigurationException类属于com.intellij.execution.configurations包,在下文中一共展示了RuntimeConfigurationException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkConfiguration
import com.intellij.execution.configurations.RuntimeConfigurationException; //导入依赖的package包/类
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
super.checkConfiguration();
String message = "Select valid path to the file with tests";
VirtualFile testsFile = LocalFileSystem.getInstance().findFileByPath(myPathToTest);
if (testsFile == null) {
throw new RuntimeConfigurationException(message);
}
VirtualFile taskDir = StudyUtils.getTaskDir(testsFile);
if (taskDir == null) {
throw new RuntimeConfigurationException(message);
}
if (StudyUtils.getTask(myProject, taskDir) == null) {
throw new RuntimeConfigurationException(message);
}
}
示例2: checkConfiguration
import com.intellij.execution.configurations.RuntimeConfigurationException; //导入依赖的package包/类
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
if (StringUtils.isBlank(repositoryUID)) {
throw new RuntimeConfigurationException(I18nSupport.getValue("run.configuration.error.repository.uid"));
}
if (StringUtils.isBlank(repositoryURL)) {
throw new RuntimeConfigurationException(I18nSupport.getValue("run.configuration.error.repository.url"));
}
if (StringUtils.isBlank(specificationName)) {
throw new RuntimeConfigurationException(I18nSupport.getValue("run.configuration.error.specification"));
}
if (StringUtils.isBlank(repositoryClass)) {
throw new RuntimeConfigurationException(I18nSupport.getValue("run.configuration.error.repository.class"));
}
super.checkConfiguration();
}
示例3: testMoveApplication
import com.intellij.execution.configurations.RuntimeConfigurationException; //导入依赖的package包/类
public void testMoveApplication() throws IOException {
PsiClass psiClass = mySource.createClass("Application", APPLICATION_CODE);
assertNotNull(psiClass);
ApplicationConfiguration configuration = createConfiguration(psiClass);
move(psiClass, "pkg");
try {
configuration.checkConfiguration();
}
catch (RuntimeConfigurationException e) {
assertTrue("Unexpected ConfigurationException: " + e ,false);
}
assertEquals("pkg.Application", configuration.MAIN_CLASS_NAME);
rename(JavaPsiFacade.getInstance(myProject).findPackage("pkg"), "pkg2");
assertEquals("pkg2.Application", configuration.MAIN_CLASS_NAME);
}
示例4: checkConfiguration
import com.intellij.execution.configurations.RuntimeConfigurationException; //导入依赖的package包/类
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
super.checkConfiguration();
if (StringUtil.isEmptyOrSpaces(myFolderName) && myTestType == TestType.TEST_FOLDER) {
throw new RuntimeConfigurationError(PyBundle.message("runcfg.unittest.no_folder_name"));
}
if (StringUtil.isEmptyOrSpaces(getScriptName()) && myTestType != TestType.TEST_FOLDER) {
throw new RuntimeConfigurationError(PyBundle.message("runcfg.unittest.no_script_name"));
}
if (StringUtil.isEmptyOrSpaces(myClassName) && (myTestType == TestType.TEST_METHOD || myTestType == TestType.TEST_CLASS)) {
throw new RuntimeConfigurationError(PyBundle.message("runcfg.unittest.no_class_name"));
}
if (StringUtil.isEmptyOrSpaces(myMethodName) && (myTestType == TestType.TEST_METHOD || myTestType == TestType.TEST_FUNCTION)) {
throw new RuntimeConfigurationError(PyBundle.message("runcfg.unittest.no_method_name"));
}
}
示例5: checkConfiguration
import com.intellij.execution.configurations.RuntimeConfigurationException; //导入依赖的package包/类
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
final TestData data = myConfig.getPersistantData();
final SourceScope scope = data.getScope().getSourceScope(myConfig);
if (scope == null) {
throw new RuntimeConfigurationException("Invalid scope specified");
}
PsiClass psiClass = JavaPsiFacade.getInstance(myConfig.getProject()).findClass(data.getMainClassName(), scope.getGlobalSearchScope());
if (psiClass == null) throw new RuntimeConfigurationException("Class '" + data.getMainClassName() + "' not found");
PsiMethod[] methods = psiClass.findMethodsByName(data.getMethodName(), true);
if (methods.length == 0) {
throw new RuntimeConfigurationException("Method '" + data.getMethodName() + "' not found");
}
for (PsiMethod method : methods) {
if (!method.hasModifierProperty(PsiModifier.PUBLIC)) {
throw new RuntimeConfigurationException("Non public method '" + data.getMethodName() + "'specified");
}
}
}
示例6: checkConfiguration
import com.intellij.execution.configurations.RuntimeConfigurationException; //导入依赖的package包/类
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
JavaParametersUtil.checkAlternativeJRE(getConfiguration());
ProgramParametersUtil.checkWorkingDirectoryExist(
getConfiguration(), getConfiguration().getProject(), getConfiguration().getConfigurationModule().getModule());
final String dirName = getConfiguration().getPersistentData().getDirName();
if (dirName == null || dirName.isEmpty()) {
throw new RuntimeConfigurationError("Directory is not specified");
}
final VirtualFile file = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(dirName));
if (file == null) {
throw new RuntimeConfigurationWarning("Directory \'" + dirName + "\' is not found");
}
final Module module = getConfiguration().getConfigurationModule().getModule();
if (module == null) {
throw new RuntimeConfigurationError("Module to choose classpath from is not specified");
}
}
示例7: checkConfiguration
import com.intellij.execution.configurations.RuntimeConfigurationException; //导入依赖的package包/类
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
final JUnitConfiguration.Data data = getConfiguration().getPersistentData();
final Set<String> patterns = data.getPatterns();
if (patterns.isEmpty()) {
throw new RuntimeConfigurationWarning("No pattern selected");
}
final GlobalSearchScope searchScope = GlobalSearchScope.allScope(getConfiguration().getProject());
for (String pattern : patterns) {
final String className = pattern.contains(",") ? StringUtil.getPackageName(pattern, ',') : pattern;
final PsiClass psiClass = JavaExecutionUtil.findMainClass(getConfiguration().getProject(), className, searchScope);
if (psiClass != null && !JUnitUtil.isTestClass(psiClass)) {
throw new RuntimeConfigurationWarning("Class " + className + " not a test");
}
}
}
示例8: checkConfiguration
import com.intellij.execution.configurations.RuntimeConfigurationException; //导入依赖的package包/类
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
// Our handler check is not valid when we don't have BlazeProjectData.
if (BlazeProjectDataManager.getInstance(getProject()).getBlazeProjectData() == null) {
throw new RuntimeConfigurationError(
"Configuration cannot be run until project has been synced.");
}
if (Strings.isNullOrEmpty(targetPattern)) {
throw new RuntimeConfigurationError(
String.format(
"You must specify a %s target expression.", Blaze.buildSystemName(getProject())));
}
if (!targetPattern.startsWith("//")) {
throw new RuntimeConfigurationError(
"You must specify the full target expression, starting with //");
}
String error = TargetExpression.validate(targetPattern);
if (error != null) {
throw new RuntimeConfigurationError(error);
}
handler.checkConfiguration();
}
示例9: checkConfiguration
import com.intellij.execution.configurations.RuntimeConfigurationException; //导入依赖的package包/类
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
super.checkConfiguration();
Label label = getTarget();
if (label == null) {
throw new RuntimeConfigurationError("Select a target to run");
}
TargetInfo target = TargetFinder.findTargetInfo(getProject(), label);
if (target == null) {
throw new RuntimeConfigurationError("The selected target does not exist.");
}
if (!IntellijPluginRule.isPluginTarget(target)) {
throw new RuntimeConfigurationError("The selected target is not an intellij_plugin");
}
if (!IdeaJdkHelper.isIdeaJdk(pluginSdk)) {
throw new RuntimeConfigurationError("Select an IntelliJ Platform Plugin SDK");
}
}
示例10: forceCreateDirectories
import com.intellij.execution.configurations.RuntimeConfigurationException; //导入依赖的package包/类
/**
* Force create directories, if it exists it won't do anything
*
* @param path
* @throws IOException
* @throws RuntimeConfigurationException
*/
private void forceCreateDirectories(@NotNull final String path) throws IOException, RuntimeConfigurationException {
Session session = connect(ssh.get());
try {
ChannelExec channelExec = (ChannelExec) session.openChannel("exec");
List<String> commands = Arrays.asList(
String.format("mkdir -p %s", path),
String.format("cd %s", path),
String.format("mkdir -p %s", FileUtilities.CLASSES),
String.format("mkdir -p %s", FileUtilities.LIB),
String.format("cd %s", path + FileUtilities.SEPARATOR + FileUtilities.CLASSES),
"rm -rf *"
);
for (String command : commands) {
consoleView.print(EmbeddedLinuxJVMBundle.getString("pi.deployment.command") + command + NEW_LINE, ConsoleViewContentType.SYSTEM_OUTPUT);
}
channelExec.setCommand(LinuxCommand.builder().commands(commands).build().toString());
channelExec.connect();
channelExec.disconnect();
} catch (JSchException e) {
setErrorOnUI(e.getMessage());
}
}
示例11: runJavaApp
import com.intellij.execution.configurations.RuntimeConfigurationException; //导入依赖的package包/类
/**
* Runs that java app with the specified command and then takes the console output from target to host machine
*
* @param path
* @param cmd
* @throws IOException
*/
private void runJavaApp(@NotNull final String path, @NotNull final String cmd) throws IOException, RuntimeConfigurationException {
consoleView.print(NEW_LINE + EmbeddedLinuxJVMBundle.getString("pi.deployment.build") + NEW_LINE + NEW_LINE, ConsoleViewContentType.SYSTEM_OUTPUT);
Session session = connect(ssh.get());
consoleView.setSession(session);
try {
ChannelExec channelExec = (ChannelExec) session.openChannel("exec");
channelExec.setOutputStream(System.out, true);
channelExec.setErrStream(System.err, true);
List<String> commands = Arrays.asList(
String.format("%s kill -9 $(ps -efww | grep \"%s\"| grep -v grep | tr -s \" \"| cut -d\" \" -f2)", params.isRunAsRoot() ? "sudo" : "", params.getMainclass()),
String.format("cd %s", path),
String.format("tar -xvf %s.tar", consoleView.getProject().getName()),
"rm *.tar",
cmd);
for (String command : commands) {
consoleView.print(EmbeddedLinuxJVMBundle.getString("pi.deployment.command") + command + NEW_LINE, ConsoleViewContentType.SYSTEM_OUTPUT);
}
channelExec.setCommand(LinuxCommand.builder().commands(commands).build().toString());
channelExec.connect();
checkOnProcess(channelExec);
} catch (JSchException e) {
setErrorOnUI(e.getMessage());
}
}
示例12: connect
import com.intellij.execution.configurations.RuntimeConfigurationException; //导入依赖的package包/类
/**
* Authenticates and connects to remote target via ssh protocol
* @param session
* @return
*/
@SneakyThrows({RuntimeConfigurationException.class})
private Session connect(Session session) {
if (!session.isConnected()) {
session = EmbeddedSSHClient.builder()
.username(params.getUsername())
.password(params.getPassword())
.hostname(params.getHostname())
.port(params.getSshPort())
.build().get();
if (!session.isConnected()) {
setErrorOnUI(EmbeddedLinuxJVMBundle.getString("ssh.remote.error"));
throw new RuntimeConfigurationException(EmbeddedLinuxJVMBundle.getString("ssh.remote.error"));
} else {
return session;
}
}
return session;
}
示例13: checkConfiguration
import com.intellij.execution.configurations.RuntimeConfigurationException; //导入依赖的package包/类
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
if (artifactPointer == null || artifactPointer.getArtifact() == null) {
throw new RuntimeConfigurationError(
GctBundle.message("appengine.run.server.artifact.missing"));
}
if (!CloudSdkService.getInstance().isValidCloudSdk()) {
throw new RuntimeConfigurationError(
GctBundle.message("appengine.run.server.sdk.misconfigured.panel.message"));
}
if (ProjectRootManager.getInstance(commonModel.getProject()).getProjectSdk() == null) {
throw new RuntimeConfigurationError(GctBundle.getString("appengine.run.server.nosdk"));
}
}
示例14: requireCabalVersionMinimum
import com.intellij.execution.configurations.RuntimeConfigurationException; //导入依赖的package包/类
protected void requireCabalVersionMinimum(double minimumVersion, @NotNull String errorMessage) throws RuntimeConfigurationException {
final HaskellBuildSettings buildSettings = HaskellBuildSettings.getInstance(getProject());
final String cabalPath = buildSettings.getCabalPath();
if (cabalPath.isEmpty()) {
throw new RuntimeConfigurationError("Path to cabal is not set.");
}
GeneralCommandLine cabalCmdLine = new GeneralCommandLine(cabalPath, "--numeric-version");
Either<ExecUtil.ExecError, String> result = ExecUtil.readCommandLine(cabalCmdLine);
if (result.isLeft()) {
//noinspection ThrowableResultOfMethodCallIgnored
ExecUtil.ExecError e = EitherUtil.unsafeGetLeft(result);
NotificationUtil.displaySimpleNotification(
NotificationType.ERROR, getProject(), "cabal", e.getMessage()
);
throw new RuntimeConfigurationError("Failed executing cabal to check its version: " + e.getMessage());
}
final String out = EitherUtil.unsafeGetRight(result);
final Matcher m = EXTRACT_CABAL_VERSION_REGEX.matcher(out);
if (!m.find()) {
throw new RuntimeConfigurationError("Could not parse cabal version: '" + out + "'");
}
final Double actualVersion = Double.parseDouble(m.group(1));
if (actualVersion < minimumVersion) {
throw new RuntimeConfigurationError(errorMessage);
}
}
示例15: checkConfiguration
import com.intellij.execution.configurations.RuntimeConfigurationException; //导入依赖的package包/类
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
JavaParametersUtil.checkAlternativeJRE(myConfiguration);
ProgramParametersUtil.checkWorkingDirectoryExist(myConfiguration, myConfiguration.getProject(), myConfiguration.getConfigurationModule().getModule());
final String dirName = myConfiguration.getPersistentData().getDirName();
if (dirName == null || dirName.isEmpty()) {
throw new RuntimeConfigurationError("Directory is not specified");
}
final VirtualFile file = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(dirName));
if (file == null) {
throw new RuntimeConfigurationWarning("Directory \'" + dirName + "\' is not found");
}
final Module module = myConfiguration.getConfigurationModule().getModule();
if (module == null) {
throw new RuntimeConfigurationError("Module to choose classpath from is not specified");
}
}