本文整理汇总了Java中com.intellij.facet.ui.ValidationResult类的典型用法代码示例。如果您正苦于以下问题:Java ValidationResult类的具体用法?Java ValidationResult怎么用?Java ValidationResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ValidationResult类属于com.intellij.facet.ui包,在下文中一共展示了ValidationResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例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));
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}
示例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;
}
示例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));
}
示例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));
}
示例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);
}
示例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();
}
示例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);
}
});
}
示例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;
}
示例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);
}
示例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);
}