Search in sources :

Example 6 with Nullable

use of org.eclipse.che.commons.annotation.Nullable in project che by eclipse.

the class VariableNodeDataAdapter method getNodeByPath.

/** {@inheritDoc} */
@Override
@Nullable
public MutableVariable getNodeByPath(@NotNull MutableVariable root, @NotNull List<String> relativeNodePath) {
    MutableVariable localRoot = root;
    for (int i = 0; i < relativeNodePath.size(); i++) {
        String path = relativeNodePath.get(i);
        if (localRoot != null) {
            List<MutableVariable> variables = new ArrayList<>(localRoot.getVariables());
            localRoot = null;
            for (int j = 0; j < variables.size(); j++) {
                MutableVariable variable = variables.get(i);
                if (variable.getName().equals(path)) {
                    localRoot = variable;
                    break;
                }
            }
            if (i == (relativeNodePath.size() - 1)) {
                return localRoot;
            }
        }
    }
    return null;
}
Also used : MutableVariable(org.eclipse.che.api.debug.shared.model.MutableVariable) ArrayList(java.util.ArrayList) Nullable(org.eclipse.che.commons.annotation.Nullable)

Example 7 with Nullable

use of org.eclipse.che.commons.annotation.Nullable in project che by eclipse.

the class LanguageServerRegistryImpl method findServer.

@Nullable
protected LanguageServer findServer(String extension, String projectPath) throws LanguageServerException {
    ProjectExtensionKey projectKey = createProjectKey(projectPath, extension);
    for (LanguageServerLauncher launcher : extensionToLauncher.get(extension)) {
        if (!projectToServer.containsKey(projectKey)) {
            synchronized (launcher) {
                if (!projectToServer.containsKey(projectKey)) {
                    LanguageServer server = initializer.initialize(launcher, projectPath);
                    projectToServer.put(projectKey, server);
                }
            }
        }
        return projectToServer.get(projectKey);
    }
    return null;
}
Also used : LanguageServer(io.typefox.lsapi.services.LanguageServer) ProjectExtensionKey(org.eclipse.che.api.languageserver.shared.ProjectExtensionKey) LanguageServerLauncher(org.eclipse.che.api.languageserver.launcher.LanguageServerLauncher) Nullable(org.eclipse.che.commons.annotation.Nullable)

Aggregations

Nullable (org.eclipse.che.commons.annotation.Nullable)7 ArrayList (java.util.ArrayList)2 EditorTab (org.eclipse.che.ide.api.parts.EditorTab)2 TabItem (org.eclipse.che.ide.api.parts.PartStackView.TabItem)2 Path (org.eclipse.che.ide.resource.Path)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 LanguageServer (io.typefox.lsapi.services.LanguageServer)1 File (java.io.File)1 IOException (java.io.IOException)1 String.format (java.lang.String.format)1 ArrayDeque (java.util.ArrayDeque)1 Collections.emptyList (java.util.Collections.emptyList)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Queue (java.util.Queue)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 Pattern (java.util.regex.Pattern)1 Collectors.toList (java.util.stream.Collectors.toList)1