mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 21:55:01 +07:00
Properties language psi api extracted for upsource
This commit is contained in:
@@ -249,7 +249,7 @@ public def layoutCommunityPlugins(String home) {
|
||||
}
|
||||
|
||||
dir("plugins") {
|
||||
def simplePlugins = ["commander", "copyright", "properties", "java-i18n", "hg4idea", "github", "ui-designer-core"] //, "tasks-time-tracking"]
|
||||
def simplePlugins = ["commander", "copyright", "java-i18n", "hg4idea", "github", "ui-designer-core"] //, "tasks-time-tracking"]
|
||||
|
||||
simplePlugins.each {
|
||||
layoutPlugin it
|
||||
@@ -268,6 +268,16 @@ public def layoutCommunityPlugins(String home) {
|
||||
}
|
||||
}
|
||||
|
||||
dir("properties") {
|
||||
dir("lib") {
|
||||
jar("properties.jar") {
|
||||
module("properties-psi-api")
|
||||
module("properties-psi-impl")
|
||||
module("properties")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
layoutPlugin("maven") {
|
||||
jar("maven-jps-plugin.jar") {
|
||||
module("maven-jps-plugin")
|
||||
|
||||
@@ -98,13 +98,6 @@ options.java.attribute.descriptor.recursive.call=Recursive calls highlighting
|
||||
options.java.attribute.descriptor.annotation.name=Annotation name
|
||||
options.java.attribute.descriptor.annotation.attribute.name=Annotation attribute name
|
||||
|
||||
options.properties.attribute.descriptor.property.key=Property key
|
||||
options.properties.attribute.descriptor.property.value=Property value
|
||||
options.properties.attribute.descriptor.key.value.separator=Key/value separator
|
||||
options.properties.attribute.descriptor.comment=Comment
|
||||
options.properties.attribute.descriptor.valid.string.escape=Valid string escape
|
||||
options.properties.attribute.descriptor.invalid.string.escape=Invalid string escape
|
||||
|
||||
options.xml.attribute.descriptor.prologue=Prologue
|
||||
options.xml.attribute.descriptor.comment=Comment
|
||||
options.xml.attribute.descriptor.tag=Tag
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
<orderEntry type="module" module-name="java-indexing-api" />
|
||||
<orderEntry type="module" module-name="groovy-jps-plugin" />
|
||||
<orderEntry type="module" module-name="ByteCodeViewer" />
|
||||
<orderEntry type="module" module-name="properties-psi-api" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
<orderEntry type="module" module-name="jsp-base-openapi" />
|
||||
<orderEntry type="module" module-name="jsp-openapi" />
|
||||
<orderEntry type="module" module-name="testFramework-java" scope="TEST" />
|
||||
<orderEntry type="module" module-name="properties-psi-api" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
<orderEntry type="module" module-name="maven-artifact-resolver-m31" />
|
||||
<orderEntry type="module" module-name="spellchecker" />
|
||||
<orderEntry type="module" module-name="vcs-api" />
|
||||
<orderEntry type="module" module-name="properties-psi-api" />
|
||||
</component>
|
||||
<component name="copyright">
|
||||
<Base>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="core-api" />
|
||||
<orderEntry type="module" module-name="editor-ui-api" />
|
||||
<orderEntry type="module" module-name="analysis-api" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
+8
-1
@@ -33,4 +33,11 @@ action.I18nize.text=Internationali_ze...
|
||||
action.I18nize.description=Replace Java string literal or JSP text with internationalized expression
|
||||
create.property.quickfix.text=Create Property
|
||||
unescape=Unescape
|
||||
trail.spaces.property.inspection.display.name=Trailing Spaces in Property
|
||||
trail.spaces.property.inspection.display.name=Trailing Spaces in Property
|
||||
|
||||
options.properties.attribute.descriptor.property.key=Property key
|
||||
options.properties.attribute.descriptor.property.value=Property value
|
||||
options.properties.attribute.descriptor.key.value.separator=Key/value separator
|
||||
options.properties.attribute.descriptor.comment=Comment
|
||||
options.properties.attribute.descriptor.valid.string.escape=Valid string escape
|
||||
options.properties.attribute.descriptor.invalid.string.escape=Invalid string escape
|
||||
+8
-3
@@ -19,7 +19,7 @@ import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.fileTypes.LanguageFileType;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.encoding.EncodingManager;
|
||||
import com.intellij.openapi.vfs.encoding.EncodingRegistry;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -63,7 +63,12 @@ public class PropertiesFileType extends LanguageFileType {
|
||||
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, final byte[] content) {
|
||||
Charset charset = EncodingManager.getInstance().getDefaultCharsetForPropertiesFiles(file);
|
||||
return charset == null ? CharsetToolkit.getDefaultSystemCharset().name() : charset.name();
|
||||
final EncodingRegistry encodingManager = EncodingRegistry.getInstance();
|
||||
if (encodingManager != null) {
|
||||
final Charset encoding = encodingManager.getEncoding(file, true);
|
||||
if (encoding != null) return encoding.toString();
|
||||
}
|
||||
final Charset charset = CharsetToolkit.getDefaultSystemCharset();
|
||||
return charset != null ? charset.toString() : null;
|
||||
}
|
||||
}
|
||||
+7
-8
@@ -21,7 +21,6 @@ import com.intellij.lexer.Lexer;
|
||||
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
|
||||
import com.intellij.openapi.options.OptionsBundle;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.StringEscapesTokenTypes;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
@@ -87,16 +86,16 @@ public class PropertiesHighlighter extends SyntaxHighlighterBase {
|
||||
|
||||
@NotNull
|
||||
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
|
||||
return pack(keys1.get(tokenType), keys2.get(tokenType));
|
||||
return SyntaxHighlighterBase.pack(keys1.get(tokenType), keys2.get(tokenType));
|
||||
}
|
||||
|
||||
public static final Map<TextAttributesKey, Pair<String, HighlightSeverity>> DISPLAY_NAMES = new THashMap<TextAttributesKey, Pair<String, HighlightSeverity>>(6);
|
||||
static {
|
||||
DISPLAY_NAMES.put(PROPERTY_KEY, new Pair<String, HighlightSeverity>(OptionsBundle.message("options.properties.attribute.descriptor.property.key"),null));
|
||||
DISPLAY_NAMES.put(PROPERTY_VALUE, new Pair<String, HighlightSeverity>(OptionsBundle.message("options.properties.attribute.descriptor.property.value"), null));
|
||||
DISPLAY_NAMES.put(PROPERTY_KEY_VALUE_SEPARATOR, new Pair<String, HighlightSeverity>(OptionsBundle.message("options.properties.attribute.descriptor.key.value.separator"), null));
|
||||
DISPLAY_NAMES.put(PROPERTY_COMMENT, new Pair<String, HighlightSeverity>(OptionsBundle.message("options.properties.attribute.descriptor.comment"), null));
|
||||
DISPLAY_NAMES.put(PROPERTIES_VALID_STRING_ESCAPE, new Pair<String, HighlightSeverity>(OptionsBundle.message("options.properties.attribute.descriptor.valid.string.escape"), null));
|
||||
DISPLAY_NAMES.put(PROPERTIES_INVALID_STRING_ESCAPE, new Pair<String, HighlightSeverity>(OptionsBundle.message("options.properties.attribute.descriptor.invalid.string.escape"), HighlightSeverity.WARNING));
|
||||
DISPLAY_NAMES.put(PROPERTY_KEY, new Pair<String, HighlightSeverity>(PropertiesBundle.message("options.properties.attribute.descriptor.property.key"),null));
|
||||
DISPLAY_NAMES.put(PROPERTY_VALUE, new Pair<String, HighlightSeverity>(PropertiesBundle.message("options.properties.attribute.descriptor.property.value"), null));
|
||||
DISPLAY_NAMES.put(PROPERTY_KEY_VALUE_SEPARATOR, new Pair<String, HighlightSeverity>(PropertiesBundle.message("options.properties.attribute.descriptor.key.value.separator"), null));
|
||||
DISPLAY_NAMES.put(PROPERTY_COMMENT, new Pair<String, HighlightSeverity>(PropertiesBundle.message("options.properties.attribute.descriptor.comment"), null));
|
||||
DISPLAY_NAMES.put(PROPERTIES_VALID_STRING_ESCAPE, new Pair<String, HighlightSeverity>(PropertiesBundle.message("options.properties.attribute.descriptor.valid.string.escape"), null));
|
||||
DISPLAY_NAMES.put(PROPERTIES_INVALID_STRING_ESCAPE, new Pair<String, HighlightSeverity>(PropertiesBundle.message("options.properties.attribute.descriptor.invalid.string.escape"), HighlightSeverity.WARNING));
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
package com.intellij.lang.properties.parsing;
|
||||
|
||||
import com.intellij.lang.properties.PropertiesLanguage;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
/**
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.NonNls;
|
||||
*/
|
||||
public class PropertiesElementType extends IElementType {
|
||||
public PropertiesElementType(@NonNls String debugName) {
|
||||
super(debugName, StdFileTypes.PROPERTIES.getLanguage());
|
||||
super(debugName, PropertiesLanguage.INSTANCE);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="properties-psi-api" />
|
||||
<orderEntry type="module" module-name="core-impl" />
|
||||
<orderEntry type="module" module-name="editor-ui-api" />
|
||||
<orderEntry type="module" module-name="analysis-api" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.intellij.properties;
|
||||
|
||||
import com.intellij.core.CoreApplicationEnvironment;
|
||||
import com.intellij.core.CoreProjectEnvironment;
|
||||
import com.intellij.lang.properties.PropertiesFileType;
|
||||
|
||||
/**
|
||||
* @author Anna Bulenkova
|
||||
*/
|
||||
public class PropertiesCoreEnvironment {
|
||||
public static class ApplicationEnvironment {
|
||||
public ApplicationEnvironment(CoreApplicationEnvironment appEnvironment) {
|
||||
appEnvironment.registerFileType(PropertiesFileType.INSTANCE, "properties");
|
||||
}
|
||||
}
|
||||
|
||||
public static class ProjectEnvironment {
|
||||
public ProjectEnvironment(CoreProjectEnvironment projectEnvironment) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,8 @@
|
||||
<orderEntry type="module" module-name="spellchecker" />
|
||||
<orderEntry type="module" module-name="resources" scope="TEST" />
|
||||
<orderEntry type="module" module-name="xml" />
|
||||
<orderEntry type="module" module-name="properties-psi-api" />
|
||||
<orderEntry type="module" module-name="properties-psi-impl" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
<orderEntry type="module" module-name="spellchecker" />
|
||||
<orderEntry type="module" module-name="jps-builders" />
|
||||
<orderEntry type="module" module-name="xml" />
|
||||
<orderEntry type="module" module-name="properties-psi-api" />
|
||||
</component>
|
||||
<component name="copyright">
|
||||
<Base>
|
||||
|
||||
Reference in New Issue
Block a user