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

Java ValidationResult类代码示例

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

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



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

示例1: check

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
@NotNull
@Override
public ValidationResult check() {
  final Set<? extends LibraryKind> libraryKinds = myLibraryDescription.getSuitableLibraryKinds();
  final Ref<Boolean> found = Ref.create(false);
  myContext.getRootModel().orderEntries().using(myContext.getModulesProvider()).recursively().librariesOnly().forEachLibrary(new Processor<Library>() {
    @Override
    public boolean process(Library library) {
      if (LibraryPresentationManager.getInstance().isLibraryOfKind(library, myContext.getLibrariesContainer(), libraryKinds)) {
        found.set(true);
        return false;
      }
      return true;
    }
  });
  if (found.get()) return ValidationResult.OK;

  return new ValidationResult(IdeBundle.message("label.missed.libraries.text", myLibraryCategoryName), new LibrariesQuickFix(myLibraryDescription));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FrameworkLibraryValidatorImpl.java


示例2: check

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
@NotNull
public ValidationResult check() {
  if (myRequiredLibraries == null) {
    return ValidationResult.OK;
  }

  List<VirtualFile> roots = collectRoots(myContext.getRootModel());
  RequiredLibrariesInfo.RequiredClassesNotFoundInfo info = myRequiredLibraries.checkLibraries(VfsUtil.toVirtualFileArray(roots));
  if (info == null) {
    return ValidationResult.OK;
  }

  String missingJars = IdeBundle.message("label.missed.libraries.prefix") + " " + info.getMissingJarsText();
  LibraryInfo[] missingLibraries = info.getLibraryInfos();
  CustomLibraryDescription description = new OldCustomLibraryDescription(missingLibraries, myDescription.getDefaultLibraryName());
  return new ValidationResult(missingJars, new LibrariesQuickFix(description));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FacetLibrariesValidatorImpl.java


示例3: validate

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
@Override
public void validate() {
  for (FacetEditorValidator validator : myValidators) {
    ValidationResult validationResult = validator.check();
    if (!validationResult.isOk()) {
      myMainPanel.setVisible(true);
      myWarningLabel.setText(XmlStringUtil.wrapInHtml(validationResult.getErrorMessage()));
      myWarningLabel.setVisible(true);
      myCurrentQuickFix = validationResult.getQuickFix();
      myQuickFixButton.setVisible(myCurrentQuickFix != null);
      if (myCurrentQuickFix != null) {
        String buttonText = myCurrentQuickFix.getFixButtonText();
        myQuickFixButton.setText(buttonText != null ? buttonText : IdeBundle.message("button.facet.quickfix.text"));
      }
      changeValidity(false);
      return;
    }
  }
  myCurrentQuickFix = null;
  setNoErrors();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:FacetErrorPanel.java


示例4: initErrorValidation

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
private void initErrorValidation() {
  FacetErrorPanel facetErrorPanel = new FacetErrorPanel();
  myErrorPanel.add(facetErrorPanel.getComponent(), BorderLayout.CENTER);

  facetErrorPanel.getValidatorsManager().registerValidator(new FacetEditorValidator() {
    @NotNull
    @Override
    public ValidationResult check() {
      if (!myFacetEnabled) {
        return ValidationResult.OK;
      }
      return validateScriptName(getScriptName());
    }
  }, myScript);

  facetErrorPanel.getValidatorsManager().validate();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:BuildoutConfigPanel.java


示例5: createAdvancedSettings

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
@Override
@Nullable
protected JPanel createAdvancedSettings() {
  JComponent advancedSettings = null;
  if (myProjectGenerator instanceof PythonProjectGenerator)
    advancedSettings = ((PythonProjectGenerator)myProjectGenerator).getSettingsPanel(myProjectDirectory);
  else if (myProjectGenerator instanceof WebProjectTemplate) {
    advancedSettings = ((WebProjectTemplate)myProjectGenerator).getPeer().getComponent();
  }
  if (advancedSettings != null) {
    final JPanel jPanel = new JPanel(new VerticalFlowLayout());
    final HideableDecorator deco = new HideableDecorator(jPanel, "Mor&e Settings", false);
    boolean isValid = checkValid();
    deco.setOn(!isValid);
    if (myProjectGenerator instanceof PythonProjectGenerator && !deco.isExpanded()) {
      final ValidationResult result = ((PythonProjectGenerator)myProjectGenerator).warningValidation(getSdk());
      deco.setOn(!result.isOk());
    }
    deco.setContentComponent(advancedSettings);
    return jPanel;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ProjectSpecificSettingsStep.java


示例6: checkSdk

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
private void checkSdk() {
  final String path = mySdkEditor.getPath();
  if (StringUtil.isEmptyOrSpaces(path)) {
    myErrorLabel.setVisible(true);
    myErrorLabel.setHyperlinkText("App Engine SDK path not specified. ", "Download", "");
    myMainPanel.repaint();
    return;
  }

  final ValidationResult result = AppEngineSdkUtil.checkPath(path);
  myErrorLabel.setVisible(!result.isOk());
  if (!result.isOk()) {
    myErrorLabel.setText("App Engine SDK path is not correct");
  }
  myMainPanel.repaint();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AppEngineSupportProvider.java


示例7: checkPath

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
@NotNull
public static ValidationResult checkPath(String path) {
  final AppEngineSdkImpl sdk = new AppEngineSdkImpl(path);

  final File appCfgFile = sdk.getAppCfgFile();
  if (!appCfgFile.exists()) {
    return createNotFoundMessage(path, appCfgFile);
  }

  final File toolsApiJarFile = sdk.getToolsApiJarFile();
  if (!toolsApiJarFile.exists()) {
    return createNotFoundMessage(path, toolsApiJarFile);
  }

  return ValidationResult.OK;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AppEngineSdkUtil.java


示例8: check

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
@Override
public ValidationResult check() {
  final Set<? extends LibraryKind> libraryKinds = myLibraryDescription.getSuitableLibraryKinds();
  final Ref<Boolean> found = Ref.create(false);
  myContext.getRootModel().orderEntries().using(myContext.getModulesProvider()).recursively().librariesOnly().forEachLibrary(new Processor<Library>() {
    @Override
    public boolean process(Library library) {
      if (LibraryPresentationManager.getInstance().isLibraryOfKind(library, myContext.getLibrariesContainer(), libraryKinds)) {
        found.set(true);
        return false;
      }
      return true;
    }
  });
  if (found.get()) return ValidationResult.OK;

  return new ValidationResult(StringUtil.capitalize(myLibraryCategoryName) + " library not found in the module dependencies list", new LibrariesQuickFix(myLibraryDescription));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:FrameworkLibraryValidatorImpl.java


示例9: check

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
public ValidationResult check() {
  if (myRequiredLibraries == null) {
    return ValidationResult.OK;
  }

  List<VirtualFile> roots = collectRoots(myContext.getRootModel());
  RequiredLibrariesInfo.RequiredClassesNotFoundInfo info = myRequiredLibraries.checkLibraries(VfsUtil.toVirtualFileArray(roots));
  if (info == null) {
    return ValidationResult.OK;
  }

  String missingJars = IdeBundle.message("label.missed.libraries.prefix") + " " + info.getMissingJarsText();
  LibraryInfo[] missingLibraries = info.getLibraryInfos();
  CustomLibraryDescription description = new OldCustomLibraryDescription(missingLibraries, myDescription.getDefaultLibraryName());
  return new ValidationResult(missingJars, new LibrariesQuickFix(description));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:FacetLibrariesValidatorImpl.java


示例10: checkValid

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
protected void checkValid() {
  String projectName = myProjectNameTextField.getText();
  if (projectName.trim().isEmpty()) {
    setOKActionEnabled(false);
    setErrorText("Project name can't be empty");
    return;
  }
  if (myLocationField.getText().indexOf('$') >= 0) {
    setOKActionEnabled(false);
    setErrorText("Project directory name must not contain the $ character");
    return;
  }
  DirectoryProjectGenerator generator = getProjectGenerator();
  if (generator != null) {
    String baseDirPath = myLocationField.getTextField().getText();
    ValidationResult validationResult = generator.validate(baseDirPath);
    if (!validationResult.isOk()) {
      setOKActionEnabled(false);
      setErrorText(validationResult.getErrorMessage());
      return;
    }
  }
  setOKActionEnabled(true);
  setErrorText(null);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:NewDirectoryProjectDialog.java


示例11: validate

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
@Override
public void validate() {
  for (FacetEditorValidator validator : myValidators) {
    ValidationResult validationResult = validator.check();
    if (!validationResult.isOk()) {
      myMainPanel.setVisible(true);
      myWarningLabel.setText(HTML_PREFIX + validationResult.getErrorMessage() + HTML_SUFFIX);
      myWarningLabel.setVisible(true);
      myCurrentQuickFix = validationResult.getQuickFix();
      myQuickFixButton.setVisible(myCurrentQuickFix != null);
      if (myCurrentQuickFix != null) {
        String buttonText = myCurrentQuickFix.getFixButtonText();
        myQuickFixButton.setText(buttonText != null ? buttonText : IdeBundle.message("button.facet.quickfix.text"));
      }
      changeValidity(false);
      return;
    }
  }
  myCurrentQuickFix = null;
  setNoErrors();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:FacetErrorPanel.java


示例12: PyStudyDirectoryProjectGenerator

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
public PyStudyDirectoryProjectGenerator(boolean isLocal) {
  this.isLocal = isLocal;
  myGenerator = new StudyProjectGenerator();
  myGenerator.addSettingsStateListener(new StudyProjectGenerator.SettingsListener() {
    @Override
    public void stateChanged(ValidationResult result) {
      setValidationResult(result);
    }
  });
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:11,代码来源:PyStudyDirectoryProjectGenerator.java


示例13: validate

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
@NotNull
@Override
public ValidationResult validate(@NotNull String s) {
  ValidationResult validationResult = validate();
  if (!validationResult.isOk()) {
    myValidationResult = validationResult;
  }

  return myValidationResult;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:11,代码来源:PyStudyDirectoryProjectGenerator.java


示例14: validate

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
@NotNull
@Override
public ValidationResult validate(@NotNull String s) {
  String message = "";
  message = mySettingsPanel.getDescription().isEmpty() ? "Enter description" : message;
  message = mySettingsPanel.getAuthors().length == 0 ? "Enter author name" : message;
  message = mySettingsPanel.getName().isEmpty() ? "Enter course name" : message;
  return message.isEmpty() ? ValidationResult.OK : new ValidationResult(message);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:10,代码来源:PyCCProjectGenerator.java


示例15: checkValid

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
private void checkValid() {
  String projectName = myProjectNameTextField.getText();

  if (projectName.trim().isEmpty()) {
    setOKActionEnabled(false);
    setErrorText(IdeBundle.message("new.dir.project.error.empty"));
    return;
  }

  if (myLocationField.getText().indexOf('$') >= 0) {
    setOKActionEnabled(false);
    setErrorText(IdeBundle.message("new.dir.project.error.buck"));
    return;
  }

  DirectoryProjectGenerator generator = getProjectGenerator();
  if (generator != null) {
    String baseDirPath = myLocationField.getTextField().getText();
    ValidationResult validationResult = generator.validate(baseDirPath);
    if (!validationResult.isOk()) {
      setOKActionEnabled(false);
      setErrorText(validationResult.getErrorMessage());
      return;
    }
  }

  setOKActionEnabled(true);
  setErrorText(null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:NewDirectoryProjectDialog.java


示例16: checkValid

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
public boolean checkValid() {
  if (myLocationField == null) return true;
  final String projectName = myLocationField.getText();
  setErrorText(null);

  if (projectName.trim().isEmpty()) {
    setErrorText("Project name can't be empty");
    return false;
  }
  if (myLocationField.getText().indexOf('$') >= 0) {
    setErrorText("Project directory name must not contain the $ character");
    return false;
  }
  if (myProjectGenerator != null) {
    final String baseDirPath = myLocationField.getTextField().getText();
    ValidationResult validationResult = myProjectGenerator.validate(baseDirPath);
    if (!validationResult.isOk()) {
      setErrorText(validationResult.getErrorMessage());
      return false;
    }
    if (myProjectGenerator instanceof WebProjectTemplate) {
      final WebProjectGenerator.GeneratorPeer peer = ((WebProjectTemplate)myProjectGenerator).getPeer();
      final ValidationInfo validationInfo = peer.validate();
      if (validationInfo != null && !peer.isBackgroundJobRunning()) {
        setErrorText(validationInfo.message);
        return false;
      }
    }
  }

  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:ProjectSettingsStepBase.java


示例17: PyStudyDirectoryProjectGenerator

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
public PyStudyDirectoryProjectGenerator() {
  myGenerator = new StudyProjectGenerator();
  myGenerator.addSettingsStateListener(new StudyProjectGenerator.SettingsListener() {
    @Override
    public void stateChanged(ValidationResult result) {
      setValidationResult(result);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PyStudyDirectoryProjectGenerator.java


示例18: validateScriptName

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
private static ValidationResult validateScriptName(String scriptName) {
  if (StringUtil.isEmpty(scriptName)) {
    return new ValidationResult("Please specify buildout script");
  }
  try {
    getScriptFile(scriptName);
  }
  catch (ConfigurationException e) {
    return new ValidationResult(e.getMessage());
  }
  return ValidationResult.OK;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:BuildoutConfigPanel.java


示例19: initErrorValidation

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
private void initErrorValidation() {
  final FacetErrorPanel facetErrorPanel = new FacetErrorPanel();
  myErrorPanel.add(facetErrorPanel.getComponent(), BorderLayout.CENTER);

  facetErrorPanel.getValidatorsManager().registerValidator(new FacetEditorValidator() {
    @NotNull
    @Override
    public ValidationResult check() {
      final Sdk sdk = PythonSdkType.findPythonSdk(myModule);
      if (sdk != null) {
        final Object selectedItem = myTestRunnerComboBox.getSelectedItem();
        if (PythonTestConfigurationsModel.PY_TEST_NAME.equals(selectedItem)) {
          if (!VFSTestFrameworkListener.getInstance().isPyTestInstalled(sdk)) {
            return new ValidationResult(PyBundle.message("runcfg.testing.no.test.framework", "py.test"),
                                        createQuickFix(sdk, facetErrorPanel, PyNames.PY_TEST));
          }
        }
        else if (PythonTestConfigurationsModel.PYTHONS_NOSETEST_NAME.equals(selectedItem)) {
          if (!VFSTestFrameworkListener.getInstance().isNoseTestInstalled(sdk)) {
            return new ValidationResult(PyBundle.message("runcfg.testing.no.test.framework", "nosetest"),
                                        createQuickFix(sdk, facetErrorPanel, PyNames.NOSE_TEST));
          }
        }
        else if (PythonTestConfigurationsModel.PYTHONS_ATTEST_NAME.equals(selectedItem)) {
          if (!VFSTestFrameworkListener.getInstance().isAtTestInstalled(sdk)) {
            return new ValidationResult(PyBundle.message("runcfg.testing.no.test.framework", "attest"),
                                        createQuickFix(sdk, facetErrorPanel, PyNames.AT_TEST));
          }
        }
      }
      return ValidationResult.OK;
    }
  }, myTestRunnerComboBox);

  facetErrorPanel.getValidatorsManager().validate();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:PyIntegratedToolsConfigurable.java


示例20: validate

import com.intellij.facet.ui.ValidationResult; //导入依赖的package包/类
@NotNull
@Override
public ValidationResult validate(@NotNull String baseDirPath) {
  /*if (PythonSdkType.isRemote(myProjectAction.getSdk())) {
    if (PythonRemoteInterpreterManager.getInstance() == null) {
      return new ValidationResult(PythonRemoteInterpreterManager.WEB_DEPLOYMENT_PLUGIN_IS_DISABLED);
    }
  }*/
  return ValidationResult.OK;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:PythonBaseProjectGenerator.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java CoordinateBuilder类代码示例发布时间:2022-05-22
下一篇:
Java WrappedSignedProperty类代码示例发布时间: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