Java Code Examples for com.intellij.openapi.util.Key

The following examples show how to use com.intellij.openapi.util.Key. These examples are extracted from open source projects.
Example 1
Project: logviewer   File: LogView.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Prints the message to console
 */
private void printMessageToConsole(String line) {
    final ConsoleView console = getConsole();
    final LogFilterModel.MyProcessingResult processingResult = myLogFilterModel.processLine(line);
    if (processingResult.isApplicable()) {
        final Key key = processingResult.getKey();
        if (key != null) {
            ConsoleViewContentType type = ConsoleViewContentType.getConsoleViewType(key);
            if (type != null) {
                final String messagePrefix = processingResult.getMessagePrefix();
                if (messagePrefix != null) {
                    String formattedPrefix = logFormatter.formatPrefix(messagePrefix);
                    if (console != null) {
                        console.print(formattedPrefix, type);
                    }
                }
                String formattedMessage = logFormatter.formatMessage(line);
                if (console != null) {
                    console.print(formattedMessage + "\n", type);
                }
            }
        }
    }
}
 
Example 2
Project: idea-php-symfony2-plugin   File: FileIndexCaches.java    License: MIT License 6 votes vote down vote up
/**
 * @param dataHolderKey Main data to cache
 * @param dataHolderNames Cache extracted name Set
 */
static public synchronized <T> Map<String, List<T>> getSetDataCache(@NotNull final Project project, @NotNull Key<CachedValue<Map<String, List<T>>>> dataHolderKey, final @NotNull Key<CachedValue<Set<String>>> dataHolderNames, @NotNull final ID<String, T> ID, @NotNull final GlobalSearchScope scope) {
    return CachedValuesManager.getManager(project).getCachedValue(
        project,
        dataHolderKey,
        () -> {
            Map<String, List<T>> items = new HashMap<>();

            final FileBasedIndex fileBasedIndex = FileBasedIndex.getInstance();

            getIndexKeysCache(project, dataHolderNames, ID).forEach(service ->
                items.put(service, fileBasedIndex.getValues(ID, service, scope))
            );

            return CachedValueProvider.Result.create(items, getModificationTrackerForIndexId(project, ID));
        },
        false
    );
}
 
Example 3
Project: Intellij-Plugin   File: GaugeOutputToGeneralTestEventsProcessor.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected boolean processServiceMessages(String text, Key outputType, ServiceMessageVisitor visitor) throws ParseException {
    this.outputType = outputType;
    this.visitor = visitor;
    if (text.startsWith("{")) {
        ExecutionEvent event = new GsonBuilder().create().fromJson(text, ExecutionEvent.class);
        for (EventProcessor processor : processors)
            if (processor.canProcess(event)) return processor.process(event);
    }
    if (text.trim().startsWith("Process finished with exit code") && unexpectedEndProcessor.canProcess(null))
        unexpectedEndProcessor.process(new ExecutionEvent() {{
            result = new ExecutionResult() {{
                status = SUCCESS.equals(handler.getExitCode()) ? ExecutionEvent.SKIP : ExecutionEvent.FAIL;
            }};
        }});
    return super.processServiceMessages(text, outputType, visitor);
}
 
Example 4
Project: CppTools   File: CppHighlightingPassFactoryBase.java    License: Apache License 2.0 6 votes vote down vote up
public void doApplyInformationToEditor() {
      if (command != null && command.isUpToDate()) {
//        if (!command.hasReadyResult()) {
//          assert false;
//          return;
//        }
        Key<Long> updateMarkKey = getUpdateMarkKey();
        Long integer = editor.getUserData(updateMarkKey);
        long count = PsiManager.getInstance(psiFile.getProject()).getModificationTracker().getModificationCount();
        if (integer != null && integer == count) {
          return;
        }

        addMarkers();
        editor.putUserData(updateMarkKey, count);

        if (HighlightUtils.debug) {
          HighlightUtils.trace(psiFile, editor, "Applied information:");
        }
      }
    }
 
Example 5
Project: js-graphql-intellij-plugin   File: JSGraphQLEndpointErrorAnnotator.java    License: MIT License 6 votes vote down vote up
private void annotateRedeclarations(@NotNull JSGraphQLEndpointNamedTypeDef element, PsiFile importingFile, Key<Multimap<String, JSGraphQLEndpointNamedTypeDefinition>> key, @NotNull AnnotationHolder holder) {
	final Key<Boolean> annotationKey = Key.create(element.getContainingFile().getName() + ":" + element.getTextOffset());
	if (holder.getCurrentAnnotationSession().getUserData(annotationKey) == Boolean.TRUE) {
		// already annotated about redeclaration
		return;
	}
	Multimap<String, JSGraphQLEndpointNamedTypeDefinition> knownDefinitionsByName = holder.getCurrentAnnotationSession().getUserData(key);
	if (knownDefinitionsByName == null) {
		knownDefinitionsByName = HashMultimap.create();
		for (JSGraphQLEndpointNamedTypeDefinition definition : JSGraphQLEndpointPsiUtil.getKnownDefinitions(importingFile, JSGraphQLEndpointNamedTypeDefinition.class, true, null)) {
			if (definition.getNamedTypeDef() != null) {
				knownDefinitionsByName.put(definition.getNamedTypeDef().getText(), definition);
			}
		}
	}
	final String typeName = element.getText();
	final Collection<JSGraphQLEndpointNamedTypeDefinition> typesWithSameName = knownDefinitionsByName.get(typeName);
	if (typesWithSameName != null && typesWithSameName.size() > 1) {
		final Set<String> files = typesWithSameName.stream().map(t -> "'" + t.getContainingFile().getName() + "'").collect(Collectors.toSet());
		holder.createErrorAnnotation(element, "'" + typeName + "' is redeclared in " + StringUtils.join(files, ", "));
		holder.getCurrentAnnotationSession().putUserData(annotationKey, Boolean.TRUE);
	}
}
 
Example 6
Project: idea-gitignore   File: ExecutionOutputParser.java    License: MIT License 5 votes vote down vote up
/**
 * Handles single output line.
 *
 * @param text       execution response
 * @param outputType output type
 */
public void onTextAvailable(@NotNull String text, @NotNull Key outputType) {
    if (outputType == ProcessOutputTypes.SYSTEM) {
        return;
    }

    if (outputType == ProcessOutputTypes.STDERR) {
        errorsReported = true;
        return;
    }

    ContainerUtil.addIfNotNull(outputs, parseOutput(StringUtil.trimEnd(text, "\n").trim()));
}
 
Example 7
Project: lsp4intellij   File: LSPPsiElement.java    License: Apache License 2.0 5 votes vote down vote up
public <T> void putCopyableUserData(Key<T> key, T value) {
    boolean control = true;
    while (control) {
        KeyFMap map = getUserMap();
        KeyFMap copyableMap = map.get(COPYABLE_USER_MAP_KEY);
        if (copyableMap == null)
            copyableMap = KeyFMap.EMPTY_MAP;
        KeyFMap newCopyableMap = (value == null) ? copyableMap.minus(key) : copyableMap.plus(key, value);
        KeyFMap newMap = (newCopyableMap.isEmpty()) ?
                map.minus(COPYABLE_USER_MAP_KEY) :
                map.plus(COPYABLE_USER_MAP_KEY, newCopyableMap);
        if ((newMap.equalsByReference(map)) || changeUserMap(map, newMap))
            control = false;
    }
}
 
Example 8
Project: intellij-haxe   File: PsiElementDelegate.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Nullable
@Contract(
    pure = true
)
public <T> T getCopyableUserData(Key<T> key) {
  return wrappedElement.getCopyableUserData(key);
}
 
Example 9
Project: BashSupport   File: BashFunctionProcessor.java    License: Apache License 2.0 5 votes vote down vote up
public <T> T getHint(@NotNull Key<T> key) {
    if (key.equals(Keys.VISITED_SCOPES_KEY)) {
        return (T) visitedElements;
    }

    if (key.equals(Keys.FILE_WALK_GO_DEEP)) {
        return (T) Boolean.FALSE;
    }

    return null;
}
 
Example 10
Project: vue-for-idea   File: NodeRunner.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * @param commandLine command line to sdk
 * @param timeoutInMilliseconds timeout
 * @return process output
 * @throws ExecutionException
 */
@NotNull
public static ProcessOutput execute(@NotNull GeneralCommandLine commandLine,ProcessListener listener, int timeoutInMilliseconds) throws ExecutionException {
    LOG.info("Running node command: " + commandLine.getCommandLineString());
    Process process = commandLine.createProcess();
    OSProcessHandler processHandler = new ColoredProcessHandler(process, commandLine.getCommandLineString(), Charsets.UTF_8);
    final ProcessOutput output = new ProcessOutput();
    processHandler.addProcessListener(new ProcessAdapter() {
        public void onTextAvailable(ProcessEvent event, Key outputType) {
            if (outputType.equals(ProcessOutputTypes.STDERR)) {
                output.appendStderr(event.getText());
                if(listener!=null){
                    listener.onError(processHandler,event.getText());
                }
            } else if (!outputType.equals(ProcessOutputTypes.SYSTEM)) {
                output.appendStdout(event.getText());
                if(listener!=null){
                    listener.onOutput(processHandler,event.getText());
                }
            }else if(outputType.equals(ProcessOutputTypes.SYSTEM)){
                if(listener!=null){
                    listener.onCommand(processHandler,event.getText());
                }
            }
        }
    });
    processHandler.startNotify();
    if (processHandler.waitFor(timeoutInMilliseconds)) {
        output.setExitCode(process.exitValue());
    } else {
        processHandler.destroyProcess();
        output.setTimeout();
    }
    if (output.isTimeout()) {
        throw new ExecutionException("Command '" + commandLine.getCommandLineString() + "' is timed out.");
    }
    return output;
}
 
Example 11
Project: reasonml-idea-plugin   File: BsProcessHandler.java    License: MIT License 5 votes vote down vote up
@Override
public final void notifyTextAvailable(@NotNull final String text, @NotNull final Key outputType) {
    String cleanedText = SystemInfo.isWindows ? text.replace("┆", "|") : text;

    StringBuilder sb = new StringBuilder();
    m_ansiEscapeDecoder.escapeText(cleanedText, outputType, (chunk, attributes) -> {
        sb.append(chunk);
        super.notifyTextAvailable(chunk, attributes);
    });

    if (m_listener != null) {
        m_listener.onRawTextAvailable(sb.toString());
    }
}
 
Example 12
Project: reasonml-idea-plugin   File: DuneOutputListener.java    License: MIT License 5 votes vote down vote up
@Override
public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) {
    String text = event.getText();

    /*
    File "CmtExtractor.ml", line 80, characters 67-70:
    Error: Unbound value cmt
    Hint: Did you mean cmtx?
    */
    if (text.startsWith("File")) {
        m_latestInfo = extractExtendedFilePositions(text);
        if (m_latestInfo != null) {
            m_latestInfo.isError = false;
        }
    } else if (text.startsWith("Error:")) {
        if (m_latestInfo != null) {
            m_latestInfo.isError = true;
            m_latestInfo.message = text.substring(6);
        }
    } else if (text.startsWith("Hint:")) {
        if (m_latestInfo != null) {
            m_latestInfo.message += " (" + text + ")";
        }
    }

    //m_previousText = text;
}
 
Example 13
Project: logviewer   File: LogView.java    License: Apache License 2.0 5 votes vote down vote up
@NotNull
@Override
public MyProcessingResult processLine(String line) {
    LogCatMessage message = null;
    String continuation = null;
    boolean validContinuation = false;
    try {
        message = AndroidLogcatFormatter.tryParseMessage(line);
        continuation = message == null ? AndroidLogcatFormatter.tryParseContinuation(line) : null;
        validContinuation = continuation != null && this.myPrevHeader != null;
    } catch (Exception ignored) {
    }

    if (message == null && !validContinuation) {
        return new MyProcessingResult(ProcessOutputTypes.STDOUT, canAcceptMessage(line), null);
    } else {
        if (message != null) {
            this.myPrevHeader = message.getHeader();
            this.myCustomApplicable = this.isMessageApplicable(message);
            this.myMessageSoFar.setLength(0);
        }

        boolean isApplicable = this.myCustomApplicable;
        if (!isApplicable) {
            this.myMessageSoFar.append(line);
            this.myMessageSoFar.append('\n');
        }

        Key key = AndroidLogcatUtils.getProcessOutputType(this.myPrevHeader.getLogLevel());
        MyProcessingResult result = new MyProcessingResult(key, isApplicable, this.myMessageSoFar.toString());
        if (isApplicable) {
            this.myMessageSoFar.setLength(0);
        }

        return result;
    }
}
 
Example 14
Project: buck   File: BuckCommandHandler.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Notify listeners for each complete line. Note that in the case of stderr, the last line is
 * saved.
 */
protected void notifyLines(final Key outputType, final Iterable<String> lines) {
  if (outputType == ProcessOutputTypes.STDERR) {
    StringBuilder stderr = new StringBuilder();
    for (String line : lines) {
      // Check if the line has at least one character or digit
      if (CHARACTER_DIGITS_PATTERN.matcher(line).matches()) {
        stderr.append(line);
      }
    }
    if (stderr.length() != 0) {
      buckModule.getBuckEventsConsumer().consumeConsoleEvent(stderr.toString());
    }
  }
}
 
Example 15
Project: intellij-plugin-v4   File: InputPanel.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void removeHighlighters(Editor editor, Key<?> key) {
	// Remove anything with user data accessible via key
	MarkupModel markupModel = editor.getMarkupModel();
	for (RangeHighlighter r : markupModel.getAllHighlighters()) {
		if ( r.getUserData(key)!=null ) {
			markupModel.removeHighlighter(r);
		}
	}
}
 
Example 16
Project: intellij-csv-validator   File: CsvTableEditorSwingTest.java    License: Apache License 2.0 5 votes vote down vote up
public void testUserDataHolder() {
    Key<String> testKey = new Key<>("myKey");
    String value = "This is just a test";
    assertNull(fileEditor.getUserData(testKey));
    fileEditor.putUserData(testKey, value);
    assertEquals(value, fileEditor.getUserData(testKey));
}
 
Example 17
Project: flutter-intellij   File: FlutterLogEntryParser.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Nullable
FlutterLogEntry parseDaemonEvent(@NotNull ProcessEvent event, @Nullable Key outputType) {
  // TODO(pq): process outputType
  final String text = event.getText();
  if (text.isEmpty()) return null;

  return parseDaemonEvent(text);
}
 
Example 18
Project: GitToolBox   File: GitPushRejectedDetector.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onLineAvailable(String line, Key outputType) {
  Matcher matcher = REJECTED_PATTERN.matcher(line);
  if (matcher.matches()) {
    rejectedRefs.add(createRejected(matcher));
  }
}
 
Example 19
Project: intellij-haxe   File: HaxeMacroUtil.java    License: Apache License 2.0 5 votes vote down vote up
public static Set<HaxeComponentName> findVariables(@Nullable PsiElement at) {
  if (at == null) {
    return Collections.emptySet();
  }
  final Set<HaxeComponentName> result = new THashSet<HaxeComponentName>();
  PsiTreeUtil.treeWalkUp(new PsiScopeProcessor() {
    @Override
    public boolean execute(@NotNull PsiElement element, ResolveState state) {
      if (element instanceof HaxeNamedComponent) {
        final HaxeNamedComponent haxeNamedComponent = (HaxeNamedComponent)element;
        if (haxeNamedComponent.getComponentName() != null && HaxeComponentType.isVariable(HaxeComponentType.typeOf(haxeNamedComponent))) {
          result.add(haxeNamedComponent.getComponentName());
        }
      }
      return true;
    }

    @Override
    public <T> T getHint(@NotNull Key<T> hintKey) {
      return null;
    }

    @Override
    public void handleEvent(Event event, @Nullable Object associated) {
    }
  }, at, null, ResolveState.initial());
  return result;
}
 
Example 20
Project: lombok-intellij-plugin   File: ConfigDiscoveryTest.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Before
public void setUp() {
  discovery = new ConfigDiscovery(fileBasedIndex);

  when(project.getUserData(any(Key.class))).thenReturn(globalSearchScope);

  when(psiClass.getProject()).thenReturn(project);
  when(psiClass.getContainingFile()).thenReturn(psiFile);
  when(psiFile.getVirtualFile()).thenReturn(virtualFile);
  when(virtualFile.getParent()).thenReturn(parentVirtualFile);

  when(parentVirtualFile.getCanonicalPath()).thenReturn("/a/b/c/d/e/f");
}
 
Example 21
Project: flutter-intellij   File: BazelTestRunner.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public Connector(ProcessHandler handler) {
  listener = new ProcessAdapter() {
    @Override
    public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) {
      if (!outputType.equals(ProcessOutputTypes.STDOUT)) {
        return;
      }

      final String text = event.getText();
      if (FlutterSettings.getInstance().isVerboseLogging()) {
        LOG.info("[<-- " + text.trim() + "]");
      }

      stdoutParser.appendOutput(text);

      for (String line : stdoutParser.getAvailableLines()) {
        if (line.startsWith("[{")) {
          line = line.trim();

          final String json = line.substring(1, line.length() - 1);
          dispatchJson(json);
        }
      }
    }

    @Override
    public void processWillTerminate(@NotNull ProcessEvent event, boolean willBeDestroyed) {
      handler.removeProcessListener(listener);
    }
  };
  handler.addProcessListener(listener);
}
 
Example 22
Project: flutter-intellij   File: FlutterTestRunner.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public Connector(ProcessHandler handler) {
  listener = new ProcessAdapter() {
    @Override
    public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) {
      if (!outputType.equals(ProcessOutputTypes.STDOUT)) {
        return;
      }

      final String text = event.getText();
      if (FlutterSettings.getInstance().isVerboseLogging()) {
        LOG.info("[<-- " + text.trim() + "]");
      }

      stdoutParser.appendOutput(text);

      for (String line : stdoutParser.getAvailableLines()) {
        if (line.startsWith("[{")) {
          line = line.trim();

          final String json = line.substring(1, line.length() - 1);
          dispatchJson(json);
        }
      }
    }

    @Override
    public void processWillTerminate(@NotNull ProcessEvent event, boolean willBeDestroyed) {
      handler.removeProcessListener(listener);
    }
  };
  handler.addProcessListener(listener);
}
 
Example 23
Project: GitToolBox   File: GitRevListLeftRightCounter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onLineAvailable(String line, Key outputType) {
  if (aheadLine(line)) {
    onAheadLine(line);
  } else if (behindLine(line)) {
    onBehindLine(line);
  }
}
 
Example 24
Project: buck   File: BuckJsonCommandHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onTextAvailable(String text, Key outputType) {
  if (ProcessOutputTypes.STDOUT.equals(outputType)) {
    mStdoutBuilder.append(text);
  } else if (ProcessOutputTypes.STDERR.equals(outputType)) {
    mStderrBuilder.append(text);
  }
}
 
Example 25
Project: flutter-intellij   File: FlutterLogEntryParser.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Nullable
FlutterLogEntry parseDaemonEvent(@NotNull ProcessEvent event, @Nullable Key outputType) {
  // TODO(pq): process outputType
  final String text = event.getText();
  if (text.isEmpty()) return null;

  return parseDaemonEvent(text);
}
 
Example 26
Project: jscs-plugin   File: JscsRunner.java    License: MIT License 5 votes vote down vote up
@NotNull
private static ProcessOutput execute(@NotNull GeneralCommandLine commandLine, int timeoutInMilliseconds) throws ExecutionException {
    LOG.info("Running jscs command: " + commandLine.getCommandLineString());
    Process process = commandLine.createProcess();
    OSProcessHandler processHandler = new ColoredProcessHandler(process, commandLine.getCommandLineString(), Charsets.UTF_8);
    final ProcessOutput output = new ProcessOutput();
    processHandler.addProcessListener(new ProcessAdapter() {
        public void onTextAvailable(ProcessEvent event, Key outputType) {
            if (outputType.equals(ProcessOutputTypes.STDERR)) {
                output.appendStderr(event.getText());
            } else if (!outputType.equals(ProcessOutputTypes.SYSTEM)) {
                output.appendStdout(event.getText());
            }
        }
    });
    processHandler.startNotify();
    if (processHandler.waitFor(timeoutInMilliseconds)) {
        output.setExitCode(process.exitValue());
    } else {
        processHandler.destroyProcess();
        output.setTimeout();
    }
    if (output.isTimeout()) {
        throw new ExecutionException("Command '" + commandLine.getCommandLineString() + "' is timed out.");
    }
    return output;
}
 
Example 27
Project: intellij-pants-plugin   File: PantsIntegrationTestCase.java    License: Apache License 2.0 5 votes vote down vote up
@NotNull
protected RunResult runWithConfiguration(RunConfiguration configuration) {
  PantsMakeBeforeRun.replaceDefaultMakeWithPantsMake(configuration);
  PantsMakeBeforeRun.setRunConfigurationWorkingDirectory(configuration);
  PantsJUnitRunnerAndConfigurationSettings runnerAndConfigurationSettings =
    new PantsJUnitRunnerAndConfigurationSettings(configuration);
  ExecutionEnvironmentBuilder environmentBuilder =
    ExecutionUtil.createEnvironment(DefaultRunExecutor.getRunExecutorInstance(), runnerAndConfigurationSettings);
  ExecutionEnvironment environment = environmentBuilder.build();

  List<String> output = new ArrayList<>();
  List<String> errors = new ArrayList<>();
  ProcessAdapter processAdapter = new ProcessAdapter() {
    @Override
    public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) {
      if (outputType == ProcessOutputTypes.STDOUT) {
        output.add(event.getText());
      }
      else if (outputType == ProcessOutputTypes.STDERR) {
        errors.add(event.getText());
      }
    }
  };

  ProgramRunnerUtil.executeConfiguration(environment, false, false);
  OSProcessHandler handler = (OSProcessHandler) environment.getContentToReuse().getProcessHandler();
  handler.addProcessListener(processAdapter);
  assertTrue(handler.waitFor());

  return new RunResult(handler.getExitCode(), output, errors);
}
 
Example 28
Project: buck   File: ResultCallbackBuckHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void notifyLines(Key outputType, Iterable<String> lines) {
  super.notifyLines(outputType, lines);
  if (outputType == ProcessOutputTypes.STDOUT) {
    for (String line : lines) {
      stdout.append(line);
    }
  }
}
 
Example 29
Project: intellij   File: BlazeConsoleServiceImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void print(String text, ConsoleViewContentType contentType) {
  Key<?> key =
      contentType == ConsoleViewContentType.ERROR_OUTPUT
          ? ProcessOutputTypes.STDERR
          : ProcessOutputTypes.STDOUT;
  ansiEscapeDecoder.escapeText(text, key, this);
}
 
Example 30
Project: editorconfig-jetbrains   File: EditorSettingsManager.java    License: MIT License 5 votes vote down vote up
private static <T> void applyConfigValueToUserData(VirtualFile file, Key<T> userDataKey, String editorConfigKey,
                                                   String configValue, Map<String, T> configMap) {
    if (configValue.isEmpty()) {
        file.putUserData(userDataKey, null);
    } else {
        final T data = configMap.get(configValue);
        if (data == null) {
            LOG.warn(Utils.invalidConfigMessage(configValue, editorConfigKey, file.getCanonicalPath()));
        } else {
            file.putUserData(userDataKey, data);
            LOG.debug("Applied " + editorConfigKey + " settings for: " + file.getCanonicalPath());
        }
    }
}
 
Example 31
Project: intellij-haxe   File: HaxeCompilerProcessHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void coloredChunksAvailable(@NotNull List<Pair<String, Key>> chunks) {
  List<String> lines = new ArrayList<String>();
  StringBuilder line = new StringBuilder();

  for (Pair<String, Key> chunk : chunks) {

    // TODO: Spit out the colored chunks... somehow...
    coloredTextAvailable(chunk.getFirst(), chunk.getSecond());

    // Combine/split chunks into lines for error processing.
    String part = chunk.getFirst();
    int nl;
    while (null != part && !part.isEmpty() && (nl = part.indexOf('\n')) >= 0) {
      line.append(part.substring(0, nl + 1));
      lines.add(line.toString());
      line.setLength(0);
      part = part.substring(nl + 1);
    }
    if (null != part && !part.isEmpty()) {
      line.append(part);
    }
  }
  if (0 != line.length()) {
    lines.add(line.toString());
  }
  context.handleOutput(lines.toArray(new String[0]));
}
 
Example 32
Project: GitToolBox   File: TagsLineListener.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void onLineAvailable(String line, Key outputType) {
  if (ProcessOutputType.isStdout(outputType)) {
    tags.addAll(parseTags(line));
  }
}
 
Example 33
Project: intellij-haxe   File: PsiElementDelegate.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public <T> void putUserData(@NotNull Key<T> key, @Nullable T value) {
  wrappedElement.putUserData(key, value);
}
 
Example 34
Project: intellij-quarkus   File: LSPPSiElement.java    License: Eclipse Public License 2.0 4 votes vote down vote up
@Nullable
@Override
public <T> T getCopyableUserData(Key<T> key) {
    return (T) copyableUserData.get(key);
}
 
Example 35
Project: idea-gitignore   File: IgnoredEditingNotificationProvider.java    License: MIT License 4 votes vote down vote up
/**
 * Gets notification key.
 *
 * @return notification key
 */
@NotNull
@Override
public Key<EditorNotificationPanel> getKey() {
    return KEY;
}
 
Example 36
Project: intellij-quarkus   File: LSPPSiElement.java    License: Eclipse Public License 2.0 4 votes vote down vote up
@Override
public <T> void putUserData(@NotNull Key<T> key, @Nullable T value) {
    userData.put(key, value);
}
 
Example 37
Project: BashSupport   File: BashVarVariantsProcessor.java    License: Apache License 2.0 4 votes vote down vote up
public <T> T getHint(@NotNull Key<T> tKey) {
    return null;
}
 
Example 38
Project: reasonml-idea-plugin   File: BsOutputListener.java    License: MIT License 4 votes vote down vote up
@Override
public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) {
}
 
Example 39
Project: reasonml-idea-plugin   File: BsProcessHandler.java    License: MIT License 4 votes vote down vote up
@Override
public void coloredTextAvailable(@NotNull String text, @NotNull Key attributes) {
    super.notifyTextAvailable(text, attributes);
}
 
Example 40
Project: intellij-csv-validator   File: CsvTableEditor.java    License: Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public <T> T getUserData(@NotNull Key<T> key) {
    return userDataHolder.getUserData(key);
}