mirror of
https://github.com/gildur/SimplePropertiesEditor.git
synced 2026-04-02 16:19:47 +09:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6edac575c4 | ||
|
|
c87e904e11 | ||
|
|
b9c4e9725a | ||
|
|
4e82e32ab6 | ||
|
|
1f00095290 | ||
|
|
a43a19f743 | ||
|
|
c48b7c8c05 | ||
|
|
3d7aa9ee7c | ||
|
|
a19a30490d | ||
|
|
73bad66829 | ||
|
|
2137715576 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1 +1,3 @@
|
|||||||
/bin
|
.metadata/
|
||||||
|
bin/
|
||||||
|
RemoteSystemsTempFiles/
|
||||||
|
|||||||
22
LICENSE
Normal file
22
LICENSE
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
Copyright (c) 2010-2014 Piotr Wolny
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
obtaining a copy of this software and associated documentation
|
||||||
|
files (the "Software"), to deal in the Software without
|
||||||
|
restriction, including without limitation the rights to use,
|
||||||
|
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
19
README.md
Normal file
19
README.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
Simple Properties Editor
|
||||||
|
========================
|
||||||
|
|
||||||
|
Eclipse plug-in for editing Java properties files, automatically converts non-ASCII characters to unicode escape sequences.
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
|
||||||
|
<a href="http://marketplace.eclipse.org/marketplace-client-intro?mpc_install=25025" title="Drag and drop into a running Eclipse workspace to install Simple Properties Editor">
|
||||||
|
<img src="http://marketplace.eclipse.org/sites/all/modules/custom/marketplace/images/installbutton.png"/>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
Drag and drop above button into a running Eclipse workspace or click "Help -> Install new software" and paste update site URL:<br>
|
||||||
|
http://gildur.github.io/SimplePropertiesEditor/updates/
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
<a href="https://raw.githubusercontent.com/gildur/SimplePropertiesEditor/master/LICENSE">MIT</a>
|
||||||
17
feature/.project
Normal file
17
feature/.project
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>feature</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.FeatureBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.pde.FeatureNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
1
feature/build.properties
Normal file
1
feature/build.properties
Normal file
@@ -0,0 +1 @@
|
|||||||
|
bin.includes = feature.xml
|
||||||
50
feature/feature.xml
Normal file
50
feature/feature.xml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<feature
|
||||||
|
id="pl.gildur.simplepropertieseditor.feature"
|
||||||
|
label="Simple Properties Editor"
|
||||||
|
version="1.0.5"
|
||||||
|
provider-name="Piotr Wolny">
|
||||||
|
|
||||||
|
<description url="https://github.com/gildur/SimplePropertiesEditor">
|
||||||
|
Eclipse plug-in for editing Java properties files, automatically converts non-ASCII characters to unicode escape sequences.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright (c) 2010-2014 Piotr Wolny
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<license url="">
|
||||||
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
obtaining a copy of this software and associated documentation
|
||||||
|
files (the "Software"), to deal in the Software without
|
||||||
|
restriction, including without limitation the rights to use,
|
||||||
|
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
</license>
|
||||||
|
|
||||||
|
<url>
|
||||||
|
<update label="Simple Properties Editor" url="http://gildur.github.io/SimplePropertiesEditor/updates"/>
|
||||||
|
</url>
|
||||||
|
|
||||||
|
<plugin
|
||||||
|
id="pl.gildur.simplepropertieseditor"
|
||||||
|
download-size="0"
|
||||||
|
install-size="0"
|
||||||
|
version="0.0.0"
|
||||||
|
unpack="false"/>
|
||||||
|
|
||||||
|
</feature>
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
Manifest-Version: 1.0
|
Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: SimplePropertiesEditor
|
Bundle-Name: Simple Properties Editor
|
||||||
Bundle-SymbolicName: SimplePropertiesEditor; singleton:=true
|
Bundle-SymbolicName: pl.gildur.simplepropertieseditor;singleton:=true
|
||||||
Bundle-Version: 1.0.2
|
Bundle-Version: 1.0.5
|
||||||
Bundle-Activator: org.gildur.simplepropertieseditor.Activator
|
Bundle-Activator: pl.gildur.simplepropertieseditor.Activator
|
||||||
Bundle-Vendor: Piotr Wolny
|
Bundle-Vendor: Piotr Wolny
|
||||||
Require-Bundle: org.eclipse.core.runtime,
|
Require-Bundle: org.eclipse.core.runtime,
|
||||||
org.eclipse.jface.text,
|
org.eclipse.jface.text,
|
||||||
|
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 178 B |
@@ -1,17 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<?eclipse version="3.4"?>
|
<?eclipse version="3.4"?>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.editors">
|
point="org.eclipse.ui.editors">
|
||||||
<editor
|
<editor
|
||||||
name="SimplePropertiesEditor"
|
name="Simple Properties Editor"
|
||||||
extensions="properties"
|
extensions="properties"
|
||||||
icon="icons/icon.gif"
|
icon="icons/icon.gif"
|
||||||
contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
|
contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
|
||||||
class="org.gildur.simplepropertieseditor.editor.SimplePropertiesEditor"
|
class="pl.gildur.simplepropertieseditor.editor.SimplePropertiesEditor"
|
||||||
id="org.gildur.simplepropertieseditor.editor.SimplePropertiesEditor">
|
id="pl.gildur.simplepropertieseditor.editor.SimplePropertiesEditor">
|
||||||
</editor>
|
</editor>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
@@ -1,26 +1,4 @@
|
|||||||
// Copyright (c) 2010 Piotr Wolny
|
package pl.gildur.simplepropertieseditor;
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person
|
|
||||||
// obtaining a copy of this software and associated documentation
|
|
||||||
// files (the "Software"), to deal in the Software without
|
|
||||||
// restriction, including without limitation the rights to use,
|
|
||||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following
|
|
||||||
// conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be
|
|
||||||
// included in all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
||||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
package org.gildur.simplepropertieseditor;
|
|
||||||
|
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||||
28
plugin/src/pl/gildur/simplepropertieseditor/editor/ColorManager.java
Executable file
28
plugin/src/pl/gildur/simplepropertieseditor/editor/ColorManager.java
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
package pl.gildur.simplepropertieseditor.editor;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.swt.graphics.Color;
|
||||||
|
import org.eclipse.swt.graphics.RGB;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
|
||||||
|
public class ColorManager {
|
||||||
|
|
||||||
|
protected Map<RGB, Color> colorTable = new HashMap<RGB, Color>(10);
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
for (Color c : colorTable.values()) {
|
||||||
|
c.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color getColor(RGB rgb) {
|
||||||
|
Color color = colorTable.get(rgb);
|
||||||
|
if (color == null) {
|
||||||
|
color = new Color(Display.getCurrent(), rgb);
|
||||||
|
colorTable.put(rgb, color);
|
||||||
|
}
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package pl.gildur.simplepropertieseditor.editor;
|
||||||
|
|
||||||
|
import org.eclipse.swt.graphics.RGB;
|
||||||
|
|
||||||
|
public interface PropertiesColorConstants {
|
||||||
|
|
||||||
|
RGB DEFAULT = new RGB(0, 0, 0);
|
||||||
|
|
||||||
|
RGB COMMENT = new RGB(0, 255, 0);
|
||||||
|
|
||||||
|
RGB ENTRY = new RGB(0, 0, 255);
|
||||||
|
}
|
||||||
@@ -1,26 +1,4 @@
|
|||||||
// Copyright (c) 2010 Piotr Wolny
|
package pl.gildur.simplepropertieseditor.editor;
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person
|
|
||||||
// obtaining a copy of this software and associated documentation
|
|
||||||
// files (the "Software"), to deal in the Software without
|
|
||||||
// restriction, including without limitation the rights to use,
|
|
||||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following
|
|
||||||
// conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be
|
|
||||||
// included in all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
||||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
package org.gildur.simplepropertieseditor.editor;
|
|
||||||
|
|
||||||
import org.eclipse.jface.text.IDocument;
|
import org.eclipse.jface.text.IDocument;
|
||||||
import org.eclipse.jface.text.TextAttribute;
|
import org.eclipse.jface.text.TextAttribute;
|
||||||
@@ -1,26 +1,4 @@
|
|||||||
// Copyright (c) 2010 Piotr Wolny
|
package pl.gildur.simplepropertieseditor.editor;
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person
|
|
||||||
// obtaining a copy of this software and associated documentation
|
|
||||||
// files (the "Software"), to deal in the Software without
|
|
||||||
// restriction, including without limitation the rights to use,
|
|
||||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following
|
|
||||||
// conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be
|
|
||||||
// included in all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
||||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
package org.gildur.simplepropertieseditor.editor;
|
|
||||||
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
@@ -46,13 +24,10 @@ public class PropertiesDocumentProvider extends FileDocumentProvider {
|
|||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
for (int i = 0; i < content.length(); i++) {
|
for (int i = 0; i < content.length(); i++) {
|
||||||
char c = content.charAt(i);
|
char c = content.charAt(i);
|
||||||
if (c == '\\') {
|
if (c == '\\' && i < content.length() - 1 && content.charAt(i + 1) == 'u') {
|
||||||
c = content.charAt(i + 1);
|
int code = Integer.parseInt(content.substring(i + 2, i + 6), 16);
|
||||||
if (c == 'u') {
|
buffer.append((char) code);
|
||||||
int code = Integer.parseInt(content.substring(i + 2, i + 6), 16);
|
i += 5;
|
||||||
buffer.append((char) code);
|
|
||||||
i += 5;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
buffer.append(c);
|
buffer.append(c);
|
||||||
}
|
}
|
||||||
@@ -1,26 +1,4 @@
|
|||||||
// Copyright (c) 2010 Piotr Wolny
|
package pl.gildur.simplepropertieseditor.editor;
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person
|
|
||||||
// obtaining a copy of this software and associated documentation
|
|
||||||
// files (the "Software"), to deal in the Software without
|
|
||||||
// restriction, including without limitation the rights to use,
|
|
||||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following
|
|
||||||
// conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be
|
|
||||||
// included in all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
||||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
package org.gildur.simplepropertieseditor.editor;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
@@ -112,7 +90,7 @@ public class PropertiesDocumentWrapper implements IDocument {
|
|||||||
ByteBuffer encodedUnknown = asciiCharset.encode("?");
|
ByteBuffer encodedUnknown = asciiCharset.encode("?");
|
||||||
for (int i = 0; i < content.length(); i++) {
|
for (int i = 0; i < content.length(); i++) {
|
||||||
char c = content.charAt(i);
|
char c = content.charAt(i);
|
||||||
if (asciiCharset.encode(String.valueOf(c)).equals(encodedUnknown)) {
|
if (c != '?' && asciiCharset.encode(String.valueOf(c)).equals(encodedUnknown)) {
|
||||||
buffer.append(String.format("\\u%04X", (int) c));
|
buffer.append(String.format("\\u%04X", (int) c));
|
||||||
} else {
|
} else {
|
||||||
buffer.append(c);
|
buffer.append(c);
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package pl.gildur.simplepropertieseditor.editor;
|
||||||
|
|
||||||
|
import org.eclipse.jface.text.rules.*;
|
||||||
|
|
||||||
|
public class PropertiesPartitionScanner extends RuleBasedPartitionScanner {
|
||||||
|
|
||||||
|
public final static String PROPERTIES_COMMENT = "__properties_comment";
|
||||||
|
|
||||||
|
public final static String PROPERTIES_ENTRY = "__properties_entry";
|
||||||
|
|
||||||
|
public PropertiesPartitionScanner() {
|
||||||
|
|
||||||
|
IToken comment = new Token(PROPERTIES_COMMENT);
|
||||||
|
IToken entry = new Token(PROPERTIES_ENTRY);
|
||||||
|
|
||||||
|
IPredicateRule[] rules = new IPredicateRule[2];
|
||||||
|
|
||||||
|
SingleLineRule commentRule = new SingleLineRule("#", null, comment, (char) 0, true);
|
||||||
|
commentRule.setColumnConstraint(0);
|
||||||
|
rules[0] = commentRule;
|
||||||
|
rules[1] = new SingleLineRule("=", null, entry, (char) 0, true);
|
||||||
|
|
||||||
|
setPredicateRules(rules);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package pl.gildur.simplepropertieseditor.editor;
|
||||||
|
|
||||||
|
import org.eclipse.ui.editors.text.TextEditor;
|
||||||
|
|
||||||
|
public class SimplePropertiesEditor extends TextEditor {
|
||||||
|
|
||||||
|
private ColorManager colorManager;
|
||||||
|
|
||||||
|
public SimplePropertiesEditor() {
|
||||||
|
super();
|
||||||
|
colorManager = new ColorManager();
|
||||||
|
setSourceViewerConfiguration(new PropertiesConfiguration(colorManager));
|
||||||
|
setDocumentProvider(new PropertiesDocumentProvider());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
colorManager.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
4
site/.gitignore
vendored
Normal file
4
site/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
artifacts.jar
|
||||||
|
content.jar
|
||||||
|
features/
|
||||||
|
plugins/
|
||||||
17
site/.project
Normal file
17
site/.project
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>site</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.UpdateSiteBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.pde.UpdateSiteNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
7
site/site.xml
Normal file
7
site/site.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<site>
|
||||||
|
<description name="Simple Properties Editor" url="http://gildur.github.io/SimplePropertiesEditor/updates">
|
||||||
|
Eclipse plug-in for editing Java properties files, automatically converts non-ASCII characters to unicode escape sequences.
|
||||||
|
</description>
|
||||||
|
<feature url="features/pl.gildur.simplepropertieseditor.feature_1.0.5.jar" id="pl.gildur.simplepropertieseditor.feature" version="1.0.5"/>
|
||||||
|
</site>
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
// Copyright (c) 2010 Piotr Wolny
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person
|
|
||||||
// obtaining a copy of this software and associated documentation
|
|
||||||
// files (the "Software"), to deal in the Software without
|
|
||||||
// restriction, including without limitation the rights to use,
|
|
||||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following
|
|
||||||
// conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be
|
|
||||||
// included in all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
||||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
package org.gildur.simplepropertieseditor.editor;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.eclipse.swt.graphics.Color;
|
|
||||||
import org.eclipse.swt.graphics.RGB;
|
|
||||||
import org.eclipse.swt.widgets.Display;
|
|
||||||
|
|
||||||
public class ColorManager {
|
|
||||||
|
|
||||||
protected Map<RGB, Color> colorTable = new HashMap<RGB, Color>(10);
|
|
||||||
|
|
||||||
public void dispose() {
|
|
||||||
for (Color c : colorTable.values()) {
|
|
||||||
c.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getColor(RGB rgb) {
|
|
||||||
Color color = colorTable.get(rgb);
|
|
||||||
if (color == null) {
|
|
||||||
color = new Color(Display.getCurrent(), rgb);
|
|
||||||
colorTable.put(rgb, color);
|
|
||||||
}
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
// Copyright (c) 2010 Piotr Wolny
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person
|
|
||||||
// obtaining a copy of this software and associated documentation
|
|
||||||
// files (the "Software"), to deal in the Software without
|
|
||||||
// restriction, including without limitation the rights to use,
|
|
||||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following
|
|
||||||
// conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be
|
|
||||||
// included in all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
||||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
package org.gildur.simplepropertieseditor.editor;
|
|
||||||
|
|
||||||
import org.eclipse.swt.graphics.RGB;
|
|
||||||
|
|
||||||
public interface PropertiesColorConstants {
|
|
||||||
|
|
||||||
RGB DEFAULT = new RGB(0, 0, 0);
|
|
||||||
|
|
||||||
RGB COMMENT = new RGB(0, 255, 0);
|
|
||||||
|
|
||||||
RGB ENTRY = new RGB(0, 0, 255);
|
|
||||||
}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
// Copyright (c) 2010 Piotr Wolny
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person
|
|
||||||
// obtaining a copy of this software and associated documentation
|
|
||||||
// files (the "Software"), to deal in the Software without
|
|
||||||
// restriction, including without limitation the rights to use,
|
|
||||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following
|
|
||||||
// conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be
|
|
||||||
// included in all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
||||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
package org.gildur.simplepropertieseditor.editor;
|
|
||||||
|
|
||||||
import org.eclipse.jface.text.rules.*;
|
|
||||||
|
|
||||||
public class PropertiesPartitionScanner extends RuleBasedPartitionScanner {
|
|
||||||
|
|
||||||
public final static String PROPERTIES_COMMENT = "__properties_comment";
|
|
||||||
|
|
||||||
public final static String PROPERTIES_ENTRY = "__properties_entry";
|
|
||||||
|
|
||||||
public PropertiesPartitionScanner() {
|
|
||||||
|
|
||||||
IToken comment = new Token(PROPERTIES_COMMENT);
|
|
||||||
IToken entry = new Token(PROPERTIES_ENTRY);
|
|
||||||
|
|
||||||
IPredicateRule[] rules = new IPredicateRule[2];
|
|
||||||
|
|
||||||
SingleLineRule commentRule = new SingleLineRule("#", null, comment, (char) 0, true);
|
|
||||||
commentRule.setColumnConstraint(0);
|
|
||||||
rules[0] = commentRule;
|
|
||||||
rules[1] = new SingleLineRule("=", null, entry, (char) 0, true);
|
|
||||||
|
|
||||||
setPredicateRules(rules);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
// Copyright (c) 2010 Piotr Wolny
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person
|
|
||||||
// obtaining a copy of this software and associated documentation
|
|
||||||
// files (the "Software"), to deal in the Software without
|
|
||||||
// restriction, including without limitation the rights to use,
|
|
||||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following
|
|
||||||
// conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be
|
|
||||||
// included in all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
||||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
package org.gildur.simplepropertieseditor.editor;
|
|
||||||
|
|
||||||
import org.eclipse.ui.editors.text.TextEditor;
|
|
||||||
|
|
||||||
public class SimplePropertiesEditor extends TextEditor {
|
|
||||||
|
|
||||||
private ColorManager colorManager;
|
|
||||||
|
|
||||||
public SimplePropertiesEditor() {
|
|
||||||
super();
|
|
||||||
colorManager = new ColorManager();
|
|
||||||
setSourceViewerConfiguration(new PropertiesConfiguration(colorManager));
|
|
||||||
setDocumentProvider(new PropertiesDocumentProvider());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dispose() {
|
|
||||||
colorManager.dispose();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user