Search in sources :

Example 1 with ValidationResult

use of com.jetbrains.commandInterface.commandLine.ValidationResult in project intellij-community by JetBrains.

the class CommandLinePsiImplUtils method getValidationResult.

/**
   * Searches for validation result for command line
   *
   * @param commandLinePart command line part
   * @return validation result (if any)
   */
@Nullable
private static ValidationResult getValidationResult(@NotNull final CommandLinePart commandLinePart) {
    final CommandLineFile commandLineFile = commandLinePart.getCommandLineFile();
    if (commandLineFile == null) {
        return null;
    }
    final ValidationResult validationResult = commandLineFile.getValidationResult();
    if (validationResult == null) {
        return null;
    }
    return validationResult;
}
Also used : CommandLineFile(com.jetbrains.commandInterface.commandLine.psi.CommandLineFile) ValidationResult(com.jetbrains.commandInterface.commandLine.ValidationResult) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with ValidationResult

use of com.jetbrains.commandInterface.commandLine.ValidationResult in project intellij-community by JetBrains.

the class ArgumentHintLayer method modificationCountChanged.

@Override
public void modificationCountChanged() {
    ApplicationManager.getApplication().assertIsDispatchThread();
    final String newText = myConsole.getFile().getText();
    if (newText.equals(myLastText)) {
        // If text did not changed from last time, we do nothing
        return;
    }
    // Store text for next time check
    myLastText = newText;
    // Reset current argument
    myNextArg = null;
    final PsiFile consoleFile = myConsole.getFile();
    // Get next arg from file
    if (consoleFile instanceof CommandLineFile) {
        final ValidationResult result = ((CommandLineFile) consoleFile).getValidationResult();
        myNextArg = result != null ? result.getNextArg() : null;
        // We need to repaint us if argument changed
        repaint();
    }
}
Also used : CommandLineFile(com.jetbrains.commandInterface.commandLine.psi.CommandLineFile) PsiFile(com.intellij.psi.PsiFile) ValidationResult(com.jetbrains.commandInterface.commandLine.ValidationResult)

Aggregations

ValidationResult (com.jetbrains.commandInterface.commandLine.ValidationResult)2 CommandLineFile (com.jetbrains.commandInterface.commandLine.psi.CommandLineFile)2 PsiFile (com.intellij.psi.PsiFile)1 Nullable (org.jetbrains.annotations.Nullable)1