Register UAST services and extensions

This commit is contained in:
Dmitry Jemerov
2017-04-06 15:19:42 +02:00
parent f29cb2a482
commit d135f3fc82
8 changed files with 55 additions and 2 deletions
@@ -11,5 +11,6 @@
<orderEntry type="module" module-name="java-psi-api" />
<orderEntry type="module" module-name="projectModel-api" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
<orderEntry type="module" module-name="uast-common" />
</component>
</module>
@@ -0,0 +1,42 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.uast;
import com.intellij.lang.Language;
import com.intellij.lang.MetaLanguage;
import com.intellij.util.containers.HashSet;
import org.jetbrains.uast.UastLanguagePlugin;
import java.util.Set;
/**
* @author yole
*/
public class UastMetaLanguage extends MetaLanguage {
private final Set<Language> myLanguages = new HashSet<>();
protected UastMetaLanguage() {
super("UAST");
for (UastLanguagePlugin plugin: UastLanguagePlugin.Companion.getInstances()) {
myLanguages.add(plugin.getLanguage());
}
}
@Override
public boolean matchesLanguage(Language language) {
return myLanguages.contains(language);
}
}
+1
View File
@@ -49,6 +49,7 @@
<orderEntry type="module" module-name="spellchecker" />
<orderEntry type="library" name="nekohtml" level="project" />
<orderEntry type="module" module-name="built-in-server" />
<orderEntry type="module" module-name="uast-java" />
<orderEntry type="library" name="gson" level="project" />
<orderEntry type="module-library">
<library>
+1 -2
View File
@@ -14,5 +14,4 @@
<orderEntry type="module" module-name="projectModel-api" />
<orderEntry type="module" module-name="editor-ui-api" exported="" />
</component>
</module>
</module>
+1
View File
@@ -17,5 +17,6 @@
<orderEntry type="module" module-name="editor-ui-ex" />
<orderEntry type="module" module-name="indexing-impl" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
<orderEntry type="module" module-name="uast-common" />
</component>
</module>
@@ -904,6 +904,8 @@
<extensionPoint name="metaLanguage" interface="com.intellij.lang.MetaLanguage"/>
<extensionPoint name="longLineInspectionPolicy" interface="com.intellij.codeInspection.longLine.LongLineInspectionPolicy"/>
<extensionPoint qualifiedName="org.jetbrains.uast.uastLanguagePlugin"
interface="org.jetbrains.uast.UastLanguagePlugin"/>
</extensionPoints>
</idea-plugin>
@@ -1022,6 +1022,9 @@
<automaticRenamerFactory implementation="com.intellij.refactoring.rename.RelatedFilesRenamerFactory"/>
<refactoring.moveHandler implementation="com.intellij.refactoring.move.moveFilesOrDirectories.MoveRelatedFilesHandler"
order="before moveFileOrDir"/>
<projectService serviceInterface="org.jetbrains.uast.UastContext" serviceImplementation="org.jetbrains.uast.UastContext"/>
<metaLanguage implementation="com.intellij.uast.UastMetaLanguage"/>
</extensions>
</idea-plugin>
+4
View File
@@ -1918,6 +1918,10 @@
<longLineInspectionPolicy implementation="com.intellij.codeInspection.JavaLongLineInspectionPolicy"/>
</extensions>
<extensions defaultExtensionNs="org.jetbrains.uast">
<uastLanguagePlugin implementation="org.jetbrains.uast.java.JavaUastLanguagePlugin"/>
</extensions>
<actions>
<action id="ShowProjectStructureSettings" class="com.intellij.ide.actions.ShowStructureSettingsAction"
icon="AllIcons.General.ProjectStructure">