public code v1

This commit is contained in:
Francisco Jesús Martínez Mimbrera
2026-05-23 00:32:57 +02:00
commit 759a8968a2
4357 changed files with 163763 additions and 0 deletions
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>flintstones.group</groupId>
<artifactId>flintstones.bundles</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.nebula.widgets.opal.commons</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>[bundle] Opal Common Elements Plug-in</name>
<organization>
<name>Laurent CARON</name>
</organization>
</project>
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.nebula.widgets.opal.commons</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<filteredResources>
<filter>
<id>1779484362759</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
@@ -0,0 +1,12 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Opal Common Elements Plug-in
Bundle-SymbolicName: org.eclipse.nebula.widgets.opal.commons
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Laurent CARON
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.equinox.common;visibility:=reexport,
org.eclipse.swt;visibility:=reexport
Export-Package: org.eclipse.nebula.widgets.opal.commons,
org.eclipse.nebula.widgets.opal.commons.resources
Automatic-Module-Name: org.eclipse.nebula.widgets.opal.commons
@@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2018, Laurent CARON.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
-->
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.nebula</groupId>
<artifactId>commons</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.nebula.widgets.opal.commons</artifactId>
<packaging>eclipse-plugin</packaging>
</project>
@@ -0,0 +1,151 @@
/*******************************************************************************
* Copyright (c) 2012 Laurent CARON. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Waldimiro Rossi - addRoundRectangle and addCircle methods
* Laurent CARON (laurent.caron at gmail dot com) - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.opal.commons;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Device;
import org.eclipse.swt.graphics.Path;
/**
* AdvancedPath, a Path object that contains extra paths
* @see Path
*/
public class AdvancedPath extends Path {
/**
* Contructor
*
* @param device
*/
public AdvancedPath(final Device device) {
super(device);
}
/**
* Adds to the receiver the circle specified by x, y, radius
*
* @param x the x coordinate of the rectangle to add
* @param y the y coordinate of the rectangle to add
* @param radius the width of the radius
*
* <ul>
* <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public void addCircle(final float x, final float y, final float radius) {
if (this.isDisposed())
SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
this.addArc(x, y, radius, radius, 0, 360);
}
/**
* Adds to the receiver the round-cornered rectangle specified by x, y, width and height.
*
* @param x the x coordinate of the rectangle to add
* @param y the y coordinate of the rectangle to add
* @param width the width of the rectangle to add
* @param height the height of the rectangle to add
* @param arcWidth the width of the arc
* @param arcHeight the height of the arc
* <ul>
* <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public void addRoundRectangle(final float x, final float y, final float width, final float height, final float arcWidth, final float arcHeight) {
if (this.isDisposed())
SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
// Top left corner
this.cubicTo(x, y, x, y, x, y + arcHeight);
this.cubicTo(x, y, x, y, x + arcWidth, y);
// Top right corner
this.cubicTo(x + width, y, x + width, y, x + width - arcWidth, y);
this.cubicTo(x + width, y, x + width, y, x + width, y + arcHeight);
// Bottom right corner
this.cubicTo(x + width, y + height, x + width, y + height, x + width, y + height - arcHeight);
this.cubicTo(x + width, y + height, x + width, y + height, x + width - arcWidth, y + height);
// Bottom left corner
this.cubicTo(x, y + height, x, y + height, x + arcWidth, y + height);
this.cubicTo(x, y + height, x, y + height, x, y + height - arcHeight);
}
/**
* Adds to the receiver the rectangle specified by x, y, width and height.<br/>
* This rectangle is round-cornered on the left, and straight on the right.
*
* @param x the x coordinate of the rectangle to add
* @param y the y coordinate of the rectangle to add
* @param width the width of the rectangle to add
* @param height the height of the rectangle to add
* @param arcWidth the width of the arc
* @param arcHeight the height of the arc
* <ul>
* <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public void addRoundRectangleStraightRight(final float x, final float y, final float width, final float height, final float arcWidth, final float arcHeight) {
if (this.isDisposed())
SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
// Top left corner
this.cubicTo(x, y, x, y, x, y + arcHeight);
this.cubicTo(x, y, x, y, x + arcWidth, y);
// Top right corner
this.lineTo(x + width, y);
// Bottom right corner
this.lineTo(x + width, y + height);
// Bottom left corner
this.cubicTo(x, y + height, x, y + height, x + arcWidth, y + height);
this.cubicTo(x, y + height, x, y + height, x, y + height - arcHeight);
}
/**
* Adds to the receiver the rectangle specified by x, y, width and height.<br/>
* This rectangle is round-cornered on the right, and straight on the left.
*
* @param x the x coordinate of the rectangle to add
* @param y the y coordinate of the rectangle to add
* @param width the width of the rectangle to add
* @param height the height of the rectangle to add
* @param arcWidth the width of the arc
* @param arcHeight the height of the arc
* <ul>
* <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public void addRoundRectangleStraightLeft(final float x, final float y, final float width, final float height, final float arcWidth, final float arcHeight) {
if (this.isDisposed())
SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
// Top left corner
this.moveTo(x, y);
this.lineTo(x + width - arcWidth, y);
// Top right corner
this.cubicTo(x + width, y, x + width, y, x + width - arcWidth, y);
this.cubicTo(x + width, y, x + width, y, x + width, y + arcHeight);
// Bottom right corner
this.cubicTo(x + width, y + height, x + width, y + height, x + width, y + height - arcHeight);
this.cubicTo(x + width, y + height, x + width, y + height, x + width - arcWidth, y + height);
// Bottom left corner
this.lineTo(x, y + height);
this.lineTo(x, y);
}
}
@@ -0,0 +1,47 @@
/*******************************************************************************
* Copyright (c) 2011 Laurent CARON
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Laurent CARON (laurent.caron at gmail dot com) - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.opal.commons;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
@SuppressWarnings({ "nls", "javadoc" })
public class FileToolbox {
/**
* Loads a file into a stream
*
* @param fileName file name
* @return a stream composed of this file
*/
public static InputStream getInputStream(final String fileName) {
if (fileName.startsWith("jar:")) {
URL url;
try {
url = new URL(fileName);
return url.openStream();
} catch (final MalformedURLException e) {
throw new RuntimeException(e);
} catch (final IOException e) {
throw new RuntimeException(e);
}
} else
try {
return new FileInputStream(fileName);
} catch (final FileNotFoundException e) {
throw new RuntimeException(e);
}
}
}
@@ -0,0 +1,91 @@
/*******************************************************************************
* Copyright (c) 2011 Laurent CARON All rights reserved. This program and the
* accompanying materials are made available under the terms of the Eclipse
* Public License v1.0 which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: Laurent CARON (laurent.caron at gmail dot com) - initial API
* and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.opal.commons;
import java.util.ArrayList;
import java.util.List;
/**
* Instance of this class are queues that have a fixed size.<br/>
* When the queue is full, the elements are shifted and the first element is
* lost.
*
* @param <T> Type of objects stored in this queue
*/
public class FixedSizeQueue<T> {
private T[] buffer;
private int index;
/**
* Constructor
*
* @param capacity initial capacity
*/
@SuppressWarnings("unchecked")
public FixedSizeQueue(final int capacity) {
this.buffer = (T[]) new Object[capacity];
this.index = 0;
}
/**
* Store an element in the buffer
*
* @param element element to store
*/
public void put(final T element) {
if (this.index == this.buffer.length) {
// Full
System.arraycopy(this.buffer, 1, this.buffer, 0, this.buffer.length - 1);
this.buffer[this.index - 1] = element;
} else
this.buffer[this.index++] = element;
}
/**
* @return all values stored in this queue
*/
public List<T> getValues() {
final List<T> list = new ArrayList<>(this.index);
for (int i = 0; i < this.index; i++)
if (this.buffer[i] != null)
list.add(this.buffer[i]);
return list;
}
/**
* @return size of the buffer
*/
public int getSize() {
return this.index;
}
/**
* @param newSize new size of the buffer. If newSize is lower than the actual
* size, the buffer will contain the last elements that have been
* stored
*/
@SuppressWarnings("unchecked")
public void resizeTo(int newSize) {
if (newSize < 0)
newSize = 1;
if (newSize == this.buffer.length)
return;
final T[] resizedBuffer = (T[]) new Object[newSize];
if (newSize > this.buffer.length)
System.arraycopy(this.buffer, 0, resizedBuffer, 0, this.buffer.length);
else {
final int startPos = Math.max(0, this.index - newSize);
System.arraycopy(this.buffer, startPos, resizedBuffer, 0, newSize);
this.index = newSize;
}
this.buffer = resizedBuffer;
}
}
@@ -0,0 +1,486 @@
/*******************************************************************************
* Copyright (c) 2012-2013 Laurent CARON All rights reserved. This program and
* the accompanying materials are made available under the terms of the Eclipse
* Public License v1.0 which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: Laurent CARON (laurent.caron at gmail dot com) - Initial
* implementation and API
*******************************************************************************/
package org.eclipse.nebula.widgets.opal.commons;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
/**
* Instances of this class are used to convert pseudo-HTML content of a styled
* text into style ranges
*/
@SuppressWarnings("nls")
public class HTMLStyledTextParser {
private final StyledText styledText;
private StringBuilder output;
private StringBuilder currentTag;
private final List<StyleRange> listOfStyles;
private final LinkedList<StyleRange> stack;
private int currentPosition;
private final int defaultHeight;
private static final Map<String, Integer[]> HTML_CODES = HTMLStyledTextParser.initHTMLCode();
/**
* Constructor
*
* @param styledText styled text to analyze
*/
HTMLStyledTextParser(final StyledText styledText) {
this.styledText = styledText;
this.listOfStyles = new ArrayList<>();
this.stack = new LinkedList<>();
final FontData data = styledText.getFont()
.getFontData()[0];
this.defaultHeight = data.getHeight();
}
private static Map<String, Integer[]> initHTMLCode() {
final Map<String, Integer[]> map = new HashMap<>();
map.put("aliceblue", new Integer[] { 240, 248, 255 });
map.put("antiquewhite", new Integer[] { 250, 235, 215 });
map.put("aqua", new Integer[] { 0, 255, 255 });
map.put("aquamarine", new Integer[] { 127, 255, 212 });
map.put("azure", new Integer[] { 240, 255, 255 });
map.put("beige", new Integer[] { 245, 245, 220 });
map.put("bisque", new Integer[] { 255, 228, 196 });
map.put("black", new Integer[] { 0, 0, 0 });
map.put("blanchedalmond", new Integer[] { 255, 235, 205 });
map.put("blue", new Integer[] { 0, 0, 255 });
map.put("blueviolet", new Integer[] { 138, 43, 226 });
map.put("brown", new Integer[] { 165, 42, 42 });
map.put("burlywood", new Integer[] { 222, 184, 135 });
map.put("cadetblue", new Integer[] { 95, 158, 160 });
map.put("chartreuse", new Integer[] { 127, 255, 0 });
map.put("chocolate", new Integer[] { 210, 105, 30 });
map.put("coral", new Integer[] { 255, 127, 80 });
map.put("cornflowerblue", new Integer[] { 100, 149, 237 });
map.put("cornsilk", new Integer[] { 255, 248, 220 });
map.put("crimson", new Integer[] { 220, 20, 60 });
map.put("cyan", new Integer[] { 0, 255, 255 });
map.put("darkblue", new Integer[] { 0, 0, 139 });
map.put("darkcyan", new Integer[] { 0, 139, 139 });
map.put("darkgoldenrod", new Integer[] { 184, 134, 11 });
map.put("darkgray", new Integer[] { 169, 169, 169 });
map.put("darkgreen", new Integer[] { 0, 100, 0 });
map.put("darkgrey", new Integer[] { 169, 169, 169 });
map.put("darkkhaki", new Integer[] { 189, 183, 107 });
map.put("darkmagenta", new Integer[] { 139, 0, 139 });
map.put("darkolivegreen", new Integer[] { 85, 107, 47 });
map.put("darkorange", new Integer[] { 255, 140, 0 });
map.put("darkorchid", new Integer[] { 153, 50, 204 });
map.put("darkred", new Integer[] { 139, 0, 0 });
map.put("darksalmon", new Integer[] { 233, 150, 122 });
map.put("darkseagreen", new Integer[] { 143, 188, 143 });
map.put("darkslateblue", new Integer[] { 72, 61, 139 });
map.put("darkslategray", new Integer[] { 47, 79, 79 });
map.put("darkslategrey", new Integer[] { 47, 79, 79 });
map.put("darkturquoise", new Integer[] { 0, 206, 209 });
map.put("darkviolet", new Integer[] { 148, 0, 211 });
map.put("deeppink", new Integer[] { 255, 20, 147 });
map.put("deepskyblue", new Integer[] { 0, 191, 255 });
map.put("dimgray", new Integer[] { 105, 105, 105 });
map.put("dimgrey", new Integer[] { 105, 105, 105 });
map.put("dodgerblue", new Integer[] { 30, 144, 255 });
map.put("firebrick", new Integer[] { 178, 34, 34 });
map.put("floralwhite", new Integer[] { 255, 250, 240 });
map.put("forestgreen", new Integer[] { 34, 139, 34 });
map.put("fuchsia", new Integer[] { 255, 0, 255 });
map.put("gainsboro", new Integer[] { 220, 220, 220 });
map.put("ghostwhite", new Integer[] { 248, 248, 255 });
map.put("gold", new Integer[] { 255, 215, 0 });
map.put("goldenrod", new Integer[] { 218, 165, 32 });
map.put("gray", new Integer[] { 128, 128, 128 });
map.put("green", new Integer[] { 0, 128, 0 });
map.put("greenyellow", new Integer[] { 173, 255, 47 });
map.put("grey", new Integer[] { 128, 128, 128 });
map.put("honeydew", new Integer[] { 240, 255, 240 });
map.put("hotpink", new Integer[] { 255, 105, 180 });
map.put("indianred", new Integer[] { 205, 92, 92 });
map.put("indigo", new Integer[] { 75, 0, 130 });
map.put("ivory", new Integer[] { 255, 255, 240 });
map.put("khaki", new Integer[] { 240, 230, 140 });
map.put("lavender", new Integer[] { 230, 230, 250 });
map.put("lavenderblush", new Integer[] { 255, 240, 245 });
map.put("lawngreen", new Integer[] { 124, 252, 0 });
map.put("lemonchiffon", new Integer[] { 255, 250, 205 });
map.put("lightblue", new Integer[] { 173, 216, 230 });
map.put("lightcoral", new Integer[] { 240, 128, 128 });
map.put("lightcyan", new Integer[] { 224, 255, 255 });
map.put("lightgoldenrodyellow", new Integer[] { 250, 250, 210 });
map.put("lightgray", new Integer[] { 211, 211, 211 });
map.put("lightgreen", new Integer[] { 144, 238, 144 });
map.put("lightgrey", new Integer[] { 211, 211, 211 });
map.put("lightpink", new Integer[] { 255, 182, 193 });
map.put("lightsalmon", new Integer[] { 255, 160, 122 });
map.put("lightseagreen", new Integer[] { 32, 178, 170 });
map.put("lightskyblue", new Integer[] { 135, 206, 250 });
map.put("lightslategray", new Integer[] { 119, 136, 153 });
map.put("lightslategrey", new Integer[] { 119, 136, 153 });
map.put("lightsteelblue", new Integer[] { 176, 196, 222 });
map.put("lightyellow", new Integer[] { 255, 255, 224 });
map.put("lime", new Integer[] { 0, 255, 0 });
map.put("limegreen", new Integer[] { 50, 205, 50 });
map.put("linen", new Integer[] { 250, 240, 230 });
map.put("magenta", new Integer[] { 255, 0, 255 });
map.put("maroon", new Integer[] { 128, 0, 0 });
map.put("mediumaquamarine", new Integer[] { 102, 205, 170 });
map.put("mediumblue", new Integer[] { 0, 0, 205 });
map.put("mediumorchid", new Integer[] { 186, 85, 211 });
map.put("mediumpurple", new Integer[] { 147, 112, 219 });
map.put("mediumseagreen", new Integer[] { 60, 179, 113 });
map.put("mediumslateblue", new Integer[] { 123, 104, 238 });
map.put("mediumspringgreen", new Integer[] { 0, 250, 154 });
map.put("mediumturquoise", new Integer[] { 72, 209, 204 });
map.put("mediumvioletred", new Integer[] { 199, 21, 133 });
map.put("midnightblue", new Integer[] { 25, 25, 112 });
map.put("mintcream", new Integer[] { 245, 255, 250 });
map.put("mistyrose", new Integer[] { 255, 228, 225 });
map.put("moccasin", new Integer[] { 255, 228, 181 });
map.put("navajowhite", new Integer[] { 255, 222, 173 });
map.put("navy", new Integer[] { 0, 0, 128 });
map.put("oldlace", new Integer[] { 253, 245, 230 });
map.put("olive", new Integer[] { 128, 128, 0 });
map.put("olivedrab", new Integer[] { 107, 142, 35 });
map.put("orange", new Integer[] { 255, 165, 0 });
map.put("orangered", new Integer[] { 255, 69, 0 });
map.put("orchid", new Integer[] { 218, 112, 214 });
map.put("palegoldenrod", new Integer[] { 238, 232, 170 });
map.put("palegreen", new Integer[] { 152, 251, 152 });
map.put("paleturquoise", new Integer[] { 175, 238, 238 });
map.put("palevioletred", new Integer[] { 219, 112, 147 });
map.put("papayawhip", new Integer[] { 255, 239, 213 });
map.put("peachpuff", new Integer[] { 255, 218, 185 });
map.put("peru", new Integer[] { 205, 133, 63 });
map.put("pink", new Integer[] { 255, 192, 203 });
map.put("plum", new Integer[] { 221, 160, 221 });
map.put("powderblue", new Integer[] { 176, 224, 230 });
map.put("purple", new Integer[] { 128, 0, 128 });
map.put("red", new Integer[] { 255, 0, 0 });
map.put("rosybrown", new Integer[] { 188, 143, 143 });
map.put("royalblue", new Integer[] { 65, 105, 225 });
map.put("saddlebrown", new Integer[] { 139, 69, 19 });
map.put("salmon", new Integer[] { 250, 128, 114 });
map.put("sandybrown", new Integer[] { 244, 164, 96 });
map.put("seagreen", new Integer[] { 46, 139, 87 });
map.put("seashell", new Integer[] { 255, 245, 238 });
map.put("sienna", new Integer[] { 160, 82, 45 });
map.put("silver", new Integer[] { 192, 192, 192 });
map.put("skyblue", new Integer[] { 135, 206, 235 });
map.put("slateblue", new Integer[] { 106, 90, 205 });
map.put("slategray", new Integer[] { 112, 128, 144 });
map.put("slategrey", new Integer[] { 112, 128, 144 });
map.put("snow", new Integer[] { 255, 250, 250 });
map.put("springgreen", new Integer[] { 0, 255, 127 });
map.put("steelblue", new Integer[] { 70, 130, 180 });
map.put("tan", new Integer[] { 210, 180, 140 });
map.put("teal", new Integer[] { 0, 128, 128 });
map.put("thistle", new Integer[] { 216, 191, 216 });
map.put("tomato", new Integer[] { 255, 99, 71 });
map.put("turquoise", new Integer[] { 64, 224, 208 });
map.put("violet", new Integer[] { 238, 130, 238 });
map.put("wheat", new Integer[] { 245, 222, 179 });
map.put("white", new Integer[] { 255, 255, 255 });
map.put("whitesmoke", new Integer[] { 245, 245, 245 });
map.put("yellow", new Integer[] { 255, 255, 0 });
map.put("yellowgreen", new Integer[] { 154, 205, 50 });
return map;
}
/**
* Parse the content, build the list of style ranges and apply them to the
* styled text widget
*
* @throws IOException
*/
public void parse() throws IOException {
if (this.styledText == null || "".equals(this.styledText.getText()
.trim()))
return;
this.initBeforeParsing();
final String text = this.styledText.getText()
.trim();
final int max = text.length();
boolean inTag = false;
for (int i = 0; i < max; i++) {
final char currentChar = text.charAt(i);
if (currentChar == '<') {
inTag = true;
continue;
} else if (currentChar == '>') {
inTag = false;
this.handleTag();
this.currentTag.delete(0, this.currentTag.length());
} else if (inTag)
this.currentTag.append(currentChar);
else {
this.currentPosition++;
this.output.append(currentChar);
}
}
this.styledText.setText(this.output.toString());
this.styledText.setStyleRanges(this.removeDoublons());
}
private StyleRange[] removeDoublons() {
final Iterator<StyleRange> mainIt = this.listOfStyles.iterator();
while (mainIt.hasNext()) {
final StyleRange current = mainIt.next();
final Iterator<StyleRange> it = this.listOfStyles.iterator();
while (it.hasNext()) {
final StyleRange other = it.next();
if (current == other)
continue;
if (current.start == other.start && current.length == other.length) {
current.fontStyle = current.fontStyle | other.fontStyle;
if (current.font == null)
current.font = other.font;
if (current.foreground == null)
current.foreground = other.foreground;
if (current.background == null)
current.background = other.background;
it.remove();
}
}
}
return this.listOfStyles.toArray(new StyleRange[this.listOfStyles.size()]);
}
private void initBeforeParsing() {
this.output = new StringBuilder();
this.currentTag = new StringBuilder();
this.listOfStyles.clear();
this.stack.clear();
this.currentPosition = 0;
}
private void handleTag() {
final String tag = this.currentTag.toString()
.toLowerCase();
if ("br".equals(tag) || "br/".equals(tag)) {
this.output.append("\n");
this.currentPosition++;
return;
}
if ("b".equals(tag)) {
this.processBeginBold();
return;
}
if ("i".equals(tag)) {
this.processBeginItalic();
return;
}
if ("u".equals(tag)) {
this.processBeginUnderline();
return;
}
if (tag.startsWith("size=")) {
this.processBeginSize();
return;
}
if (tag.startsWith("color=")) {
this.processBeginColor();
return;
}
if (tag.startsWith("backgroundcolor=")) {
this.processBeginBackgroundColor();
return;
}
final String[] acceptedClosingTags = new String[] { "/b", "/i", "/u", "/size", "/color", "/backgroundcolor" };
for (final String closingTag : acceptedClosingTags)
if (closingTag.equals(tag)) {
this.processEndTag(closingTag);
return;
}
final String text = "<" + tag + ">";
this.output.append(text);
this.currentPosition += text.length();
}
private void processBeginBold() {
final StyleRange currentStyleRange = new StyleRange();
currentStyleRange.start = this.currentPosition;
currentStyleRange.length = 0;
currentStyleRange.fontStyle = SWT.BOLD;
currentStyleRange.data = "</b>";
this.stack.push(currentStyleRange);
}
private void processEndTag(final String expectedTag) {
final StyleRange currentStyleRange = this.stack.pop();
final String wholeExpectedTag = "<" + expectedTag + ">";
if (!wholeExpectedTag.equals(currentStyleRange.data)) {
final StringBuilder sb = new StringBuilder();
sb.append("Error at position #")
.append(this.currentPosition)
.//
append(" - closing ")
.//
append(wholeExpectedTag)
.//
append(" tag found but ")
. //
append(currentStyleRange.data)
.//
append(" tag expected !");
throw new RuntimeException(sb.toString());
}
currentStyleRange.length = this.currentPosition - currentStyleRange.start;
this.listOfStyles.add(currentStyleRange);
}
private void processBeginItalic() {
final StyleRange currentStyleRange = new StyleRange();
currentStyleRange.start = this.currentPosition;
currentStyleRange.length = 0;
currentStyleRange.fontStyle = SWT.ITALIC;
currentStyleRange.data = "</i>";
this.stack.push(currentStyleRange);
}
private void processBeginUnderline() {
final StyleRange currentStyleRange = new StyleRange();
currentStyleRange.start = this.currentPosition;
currentStyleRange.length = 0;
currentStyleRange.fontStyle = SWT.NONE;
currentStyleRange.underline = true;
currentStyleRange.data = "</u>";
this.stack.push(currentStyleRange);
}
private void processBeginSize() {
final StyleRange currentStyleRange = new StyleRange();
currentStyleRange.start = this.currentPosition;
currentStyleRange.length = 0;
currentStyleRange.fontStyle = SWT.NONE;
currentStyleRange.font = this.computeFont();
currentStyleRange.data = "</size>";
this.stack.push(currentStyleRange);
}
private Font computeFont() {
final String fontSize = this.currentTag.toString()
.toLowerCase()
.replace("size=", "");
if (fontSize.length() == 0)
throw new RuntimeException("Argument size is empty !");
int newSize = this.defaultHeight;
if (fontSize.startsWith("+")) {
final int delta = Integer.valueOf(fontSize.substring(1));
newSize += delta;
} else if (fontSize.startsWith("-")) {
final int delta = Integer.valueOf(fontSize.substring(1));
newSize -= delta;
}
final FontData fd = this.styledText.getFont()
.getFontData()[0];
final Font newFont = new Font(this.styledText.getDisplay(), fd.getName(), newSize, SWT.NONE);
this.styledText.addListener(SWT.Dispose, event -> newFont.dispose());
return newFont;
}
private void processBeginColor() {
final StyleRange currentStyleRange = new StyleRange();
currentStyleRange.start = this.currentPosition;
currentStyleRange.length = 0;
currentStyleRange.fontStyle = SWT.NONE;
currentStyleRange.foreground = this.computeColor();
currentStyleRange.data = "</color>";
this.stack.push(currentStyleRange);
}
private Color computeColor() {
final String fontColor = this.currentTag.toString()
.toLowerCase()
.replace("color=", "")
.replace("background", "");
if (fontColor.length() == 0)
throw new RuntimeException("Argument color is empty !");
int red, green, blue;
if (fontColor.startsWith("#")) {
final String hexa = fontColor.substring(1);
if (hexa.length() != 6)
throw new RuntimeException("Argument [" + hexa + "] is not valid !");
try {
red = Integer.parseInt(hexa.substring(0, 2)
.toLowerCase(), 16);
green = Integer.parseInt(hexa.substring(2, 4)
.toLowerCase(), 16);
blue = Integer.parseInt(hexa.substring(4, 6)
.toLowerCase(), 16);
} catch (final NumberFormatException nfe) {
throw new RuntimeException("Argument [" + hexa + "] is not valid !");
}
} else if (fontColor.indexOf(',') > -1) {
final String[] args = fontColor.split(",");
if (args.length != 3)
throw new RuntimeException("Argument [" + fontColor + "] is not valid !");
try {
red = Integer.parseInt(args[0]);
green = Integer.parseInt(args[1]);
blue = Integer.parseInt(args[2]);
} catch (final NumberFormatException nfe) {
throw new RuntimeException("Argument [" + fontColor + "] is not valid !");
}
} else {
final Integer[] rgb = HTMLStyledTextParser.HTML_CODES.get(fontColor.toLowerCase());
if (rgb == null) {
red = 0;
green = 0;
blue = 0;
} else {
red = rgb[0];
green = rgb[1];
blue = rgb[2];
}
}
final Color color = new Color(this.styledText.getDisplay(), red, green, blue);
this.styledText.addListener(SWT.Dispose, e -> {
color.dispose();
});
return color;
}
private void processBeginBackgroundColor() {
final StyleRange currentStyleRange = new StyleRange();
currentStyleRange.start = this.currentPosition;
currentStyleRange.length = 0;
currentStyleRange.fontStyle = SWT.NONE;
currentStyleRange.background = this.computeColor();
currentStyleRange.data = "</backgroundcolor>";
this.stack.push(currentStyleRange);
}
}
@@ -0,0 +1,159 @@
/*******************************************************************************
* Copyright (c) 2011 Laurent CARON
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Laurent CARON (laurent.caron at gmail dot com) - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.opal.commons;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
/**
* Instances of this object are items manipulated by the widgets of the Opal Project. These items are highly customizable, you can set :
* <ul>
* <li>Background and foreground colors,
* <li>Font
* <li>Image
* <li>Text
* <li>Height
* </ul>
* You can also store data using the <code>setData<code> methods.
*
*/
public abstract class OpalItem {
private final Map<String, Object> data = new HashMap<>();
private Object datum;
private Color background;
private Font font;
private Color foreground;
private Image image;
private String text;
private int height = -1;
/**
* @return the background color of the item
*/
public Color getBackground() {
return this.background;
}
/**
* @return the the data stored in this item
*/
public Object getData() {
return this.datum;
}
/**
* @param key a key
* @return the the data stored in this item associated to this key
*/
public Object getData(final String key) {
return this.data.get(key);
}
/**
* @return the font of the item
*/
public Font getFont() {
return this.font;
}
/**
* @return the foreground color of the item
*/
public Color getForeground() {
return this.foreground;
}
/**
* @return the height of the item
*/
public int getHeight() {
return this.height;
}
/**
* @return the image stored in this item
*/
public Image getImage() {
return this.image;
}
/**
* @return the text stored in this item
*/
public String getText() {
return this.text;
}
/**
* @param background set the background color of this item
*/
public void setBackground(final Color background) {
this.background = background;
}
/**
* @param font set the font of this item
*/
public void setFont(final Font font) {
this.font = font;
}
/**
* @param foreground set the foreground color of this item
*/
public void setForeground(final Color foreground) {
this.foreground = foreground;
}
/**
* @param height set the height of this item
*/
public void setHeight(final int height) {
this.height = height;
}
/**
* @param image set the image of this item
*/
public void setImage(final Image image) {
this.image = image;
}
/**
* @param text set the text of this item
*/
public void setText(final String text) {
this.text = text;
}
/**
* @param data set the data stored in this item
*/
public void setData(final Object data) {
this.datum = data;
}
/**
* Store a data associated to a given key in this item
*
* @param key key
* @param value value associated to this key
*/
public void setData(final String key, final Object value) {
this.data.put(key, value);
}
}
@@ -0,0 +1,72 @@
/*******************************************************************************
* Copyright (c) 2012 Laurent CARON
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Laurent CARON (laurent.caron at gmail dot com) - Initial implementation and API
*******************************************************************************/
package org.eclipse.nebula.widgets.opal.commons;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseTrackAdapter;
import org.eclipse.swt.widgets.Composite;
/**
* Instances of this class are StyledText that are read-only, that means that we
* use it only as a renderer
*
* @see StyledText
*/
public class ReadOnlyStyledText extends StyledText {
/**
* Constructs a new instance of this class given its parent and a style
* value describing its behavior and appearance.
* <p>
* The style value is either one of the style constants defined in class
* <code>SWT</code> which is applicable to instances of this class, or must
* be built by <em>bitwise OR</em>'ing together (that is, using the
* <code>int</code> "|" operator) two or more of those <code>SWT</code>
* style constants. The class description lists the style constants that are
* applicable to the class. Style bits are also inherited from superclasses.
* </p>
*
* @param parent a widget which will be the parent of the new instance
* (cannot be null)
* @param style the style of widget to construct
*
* @exception IllegalArgumentException
* <ul>
* <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
* </ul>
* <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
* thread that created the parent</li>
* </ul>
*
* @see SWT#FULL_SELECTION
* @see SWT#MULTI
* @see SWT#SINGLE
* @see #getStyle
* @see StyledText
*/
public ReadOnlyStyledText(final Composite parent, final int style) {
super(parent, style | SWT.WRAP | SWT.READ_ONLY);
this.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseEnter(final MouseEvent e) {
ReadOnlyStyledText.this.setCursor(ReadOnlyStyledText.this.getDisplay()
.getSystemCursor(SWT.CURSOR_ARROW));
}
});
this.setCaret(null);
this.addListener(SWT.Selection, e -> {
this.setSelection(0, 0);
});
}
}
@@ -0,0 +1,86 @@
package org.eclipse.nebula.widgets.opal.commons;
import java.util.ResourceBundle;
@SuppressWarnings({ "nls", "javadoc" })
public class ResourceManager {
private static final ResourceBundle RSC = ResourceBundle.getBundle(ResourceManager.class.getPackage()
.getName() + "/resources/opal");
public static final String OK = "Ok";
public static final String CANCEL = "Cancel";
public static final String CLOSE = "Close";
public static final String YES = "Yes";
public static final String NO = "No";
public static final String MEGABYTES = "megabytes";
public static final String PERFORM_GC = "performGC";
public static final String LOGIN = "login";
public static final String NAME = "name";
public static final String PASSWORD = "password";
public static final String REMEMBER_PASSWORD = "rememberPassword";
public static final String LOGIN_FAILED = "loginFailed";
public static final String INPUT = "Input";
public static final String APPLICATION_ERROR = "ApplicationError";
public static final String INFORMATION = "Information";
public static final String WARNING = "Warning";
public static final String CHOICE = "Choice";
public static final String EXCEPTION = "Exception";
public static final String SELECT = "Select";
public static final String FEWER_DETAILS = "FewerDetails";
public static final String MORE_DETAILS = "MoreDetails";
public static final String TIP_OF_THE_DAY = "tipOfTheDay";
public static final String DID_YOU_KNOW = "didYouKnow";
public static final String SHOW_TIP_AT_STARTUP = "showTipAtStartup";
public static final String PREVIOUS_TIP = "previousTip";
public static final String NEXT_TIP = "nextTip";
public static final String CHOOSE = "choose";
public static final String PREFERENCES = "preferences";
public static final String VALID_URL = "validURL";
public static final String CHOOSE_DIRECTORY = "chooseDirectory";
public static final String ITALIC = "italic";
public static final String BOLD = "bold";
public static final String CATEGORY_SHORT_DESCRIPTION = "category.shortDescription";
public static final String DESCRIPTION_SHORT_DESCRIPTION = "description.shortDescription";
public static final String SORT_SHORT_DESCRIPTION = "sort.shortDescription";
public static final String PROPERTY = "property";
public static final String VALUE = "value";
public static final String EDIT_PROPERTY = "editProperty";
public static final String WIDTH = "width";
public static final String HEIGHT = "height";
public static final String TOP = "top";
public static final String BOTTOM = "bottom";
public static final String LEFT = "left";
public static final String RIGHT = "right";
public static final String ERASE_PROPERTY = "eraseProperty";
public static final String PHYSICAL_MEMORY = "physicalMemory";
public static final String HEAP_MEMORY = "heapMemory";
public static final String THREADS = "threads";
public static final String CPU_USAGE = "cpuUsage";
public static final String PEAK = "peak";
public static final String MB = "mb";
public static final String CALCULATOR_DIVIDE_BY_ZERO = "calculator.dividebyzero";
public static final String CALCULATOR_INVALID_VALUE = "calculator.invalid";
public static final String MULTICHOICE_MESSAGE = "multichoice.message";
public static final String MULTICHOICE_MESSAGE_PLURAL = "multichoice.message.plural";
/**
* Get a translated label
*
* @param key
* key to get
* @return the translated value of the key
*/
public static String getLabel(final String key) {
return ResourceManager.RSC.getString(key);
}
}
@@ -0,0 +1,509 @@
/*******************************************************************************
* Copyright (c) 2011 Laurent CARON All rights reserved. This program and the
* accompanying materials are made available under the terms of the Eclipse
* Public License v1.0 which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: Laurent CARON (laurent.caron at gmail dot com) - Initial
* implementation and API
*******************************************************************************/
package org.eclipse.nebula.widgets.opal.commons;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.PaletteData;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.graphics.Resource;
import org.eclipse.swt.graphics.Transform;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Monitor;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Widget;
/**
* This class is a singleton that provides useful methods
*/
@SuppressWarnings("nls")
public class SWTGraphicUtil {
/**
* Constructor
*/
private SWTGraphicUtil() {
}
/**
* Dispose safely any SWT resource when a widget is disposed
*
* @param widget widget attached to the resource
* @param resource the resource to dispose
*/
public static void addDisposer(final Widget widget, final Resource resource) {
widget.addDisposeListener(e -> {
SWTGraphicUtil.safeDispose(resource);
});
}
/**
* Dispose safely any SWT resource
*
* @param resource the resource to dispose
*/
public static void safeDispose(final Resource resource) {
if (resource != null && !resource.isDisposed())
resource.dispose();
}
/**
* Create a color that is disposed automatically
*
* @param r red component
* @param g green component
* @param b blue component
* @return the color
*/
public static Color getColorSafely(final int r, final int g, final int b) {
final Display display = Display.getCurrent();
final Color color = new Color(display, r, g, b);
display.addListener(SWT.Dispose, e -> {
if (!color.isDisposed())
color.dispose();
});
return color;
}
/**
* Loads an image and create a SWT Image corresponding to this file
*
* @param fileName file name of the image
* @return an image
* @see org.eclipse.swt.graphics.Image
*/
public static Image createImageFromFile(final String fileName) {
if (new File(fileName).exists())
return new Image(Display.getCurrent(), fileName);
else
return new Image(Display.getCurrent(), //
SWTGraphicUtil.class.getResourceAsStream(fileName));
}
/**
* Create a reflected image of a source Inspired by Daniel Spiewak work
* (http://www.eclipsezone.com/eclipse/forums/t91013.html)
*
* @param source source to be reflected
* @return the source image with a reflection
*/
public static Image createReflectedImage(final Image source) {
if (source == null)
return null;
if (source.isDisposed())
SWT.error(SWT.ERROR_WIDGET_DISPOSED);
// Create a new image
final Rectangle sourceBounds = source.getBounds();
final Image newImage = new Image(source.getDevice(), new Rectangle(0, 0, sourceBounds.width, (int) (sourceBounds.height * 1.5)));
final GC gc = new GC(newImage);
gc.setAdvanced(true);
gc.drawImage(source, 0, 0);
// Add the reflection
final Transform t = new Transform(source.getDevice());
t.setElements(1, 0, 0, -.5f, 0, sourceBounds.height + sourceBounds.height / 2);
gc.setTransform(t);
gc.drawImage(source, 0, 0);
t.dispose();
gc.dispose();
// And add the alpha mask
final ImageData imgData = newImage.getImageData();
final int width = imgData.width;
final int height = imgData.height;
final byte[] alphaData = new byte[height * width];
final byte[] noAlpha = new byte[width];
for (int x = 0; x < width; x++)
noAlpha[x] = (byte) 255;
for (int y = 0; y < height; y++) {
final byte[] alphaRow = new byte[width];
if (y < sourceBounds.height)
System.arraycopy(noAlpha, 0, alphaData, y * width, width);
else {
for (int x = 0; x < width; x++)
alphaRow[x] = (byte) (255 - 255 * y / height);
System.arraycopy(alphaRow, 0, alphaData, y * width, width);
}
}
imgData.alphaData = alphaData;
newImage.dispose();
return new Image(source.getDevice(), imgData);
}
/**
* Returns a new scaled image.
*
* @param source the image to be scaled
* @param newWidth new width of the image
* @param newHeight new height of the image
* @return a scaled image of the source
*/
public static Image resize(final Image source, final int newWidth, final int newHeight) {
if (source == null)
return null;
if (source.isDisposed())
SWT.error(SWT.ERROR_WIDGET_DISPOSED);
final Image scaledImage = new Image(source.getDevice(), newWidth, newHeight);
final GC gc = new GC(scaledImage);
gc.setAntialias(SWT.ON);
gc.setInterpolation(SWT.HIGH);
gc.drawImage(source, 0, 0, source.getBounds().width, source.getBounds().height, 0, 0, newWidth, newHeight);
gc.dispose();
return scaledImage;
}
/**
* Create a reflected and resized version of an image
*
* @param source source image to be scaled and reflected
* @param newWidth new width of the scaled image
* @param newHeight new height of the scaled image
* @return the resized and reflected image
*/
public static Image createReflectedResizedImage(final Image source, final int newWidth, final int newHeight) {
if (source == null)
return null;
if (source.isDisposed())
SWT.error(SWT.ERROR_WIDGET_DISPOSED);
final Image newImage = new Image(source.getDevice(), newWidth, (int) (newHeight * 1.5));
final GC gc = new GC(newImage);
gc.setAntialias(SWT.ON);
gc.setInterpolation(SWT.HIGH);
gc.drawImage(source, 0, 0, source.getBounds().width, source.getBounds().height, 0, 0, newWidth, newHeight);
// Add the reflection
final Transform t = new Transform(source.getDevice());
t.setElements(1, 0, 0, -.5f, 0, (float) (newHeight * 1.5));
gc.setTransform(t);
gc.drawImage(source, 0, 0, source.getBounds().width, source.getBounds().height, 0, 0, newWidth, newHeight);
t.dispose();
gc.dispose();
// And add the alpha mask
final ImageData imgData = newImage.getImageData();
final int width = imgData.width;
final int height = imgData.height;
final byte[] alphaData = new byte[height * width];
final byte[] noAlpha = new byte[width];
for (int x = 0; x < width; x++)
noAlpha[x] = (byte) 255;
for (int y = 0; y < height; y++) {
final byte[] alphaRow = new byte[width];
if (y < newHeight)
System.arraycopy(noAlpha, 0, alphaData, y * width, width);
else {
for (int x = 0; x < width; x++)
alphaRow[x] = (byte) (255 - 255 * y / height);
System.arraycopy(alphaRow, 0, alphaData, y * width, width);
}
}
imgData.alphaData = alphaData;
return new Image(source.getDevice(), imgData);
}
/**
* Center a shell on the primary monitor
*
* @param shell shell to center
*/
public static void centerShell(final Shell shell) {
final Monitor primary = shell.getDisplay()
.getPrimaryMonitor();
final Rectangle bounds = primary.getBounds();
final Rectangle rect = shell.getBounds();
final int x = bounds.x + (bounds.width - rect.width) / 2;
final int y = bounds.y + (bounds.height - rect.height) / 2;
shell.setLocation(x, y);
}
/**
* @param shell
* @return the bounds of the monitor on which the shell is running
*/
public static Rectangle getBoundsOfMonitorOnWhichShellIsDisplayed(final Shell shell) {
for (final Monitor monitor : shell.getDisplay()
.getMonitors()) {
final Rectangle monitorBounds = monitor.getBounds();
final Rectangle shellBounds = shell.getBounds();
if (monitorBounds.contains(shellBounds.x, shellBounds.y))
return monitorBounds;
}
final Monitor primary = shell.getDisplay()
.getPrimaryMonitor();
return primary.getBounds();
}
/**
* Apply a very basic pseudo-HTML formating to a text stored in a StyledText
* widget. Supported tags are <b>, <i>, <u> , <COLOR>, <backgroundcolor>, <size>
* and <BbrR/>
*
* @param styledText styled text that contains an HTML text
*/
public static void applyHTMLFormating(final StyledText styledText) {
try {
new HTMLStyledTextParser(styledText).parse();
} catch (final IOException e) {
e.printStackTrace();
}
}
/**
* @param originalImageData The ImageData to be average blurred. Transparency
* information will be ignored.
* @param radius the number of radius pixels to consider when blurring image.
* @return A blurred copy of the image data, or null if an error occured.
* @author Nicholas Rajendram
* @see "http://www.eclipse.org/articles/article.php?file=Article-SimpleImageEffectsForSWT/index.html"
*/
public static ImageData blur(final ImageData originalImageData, int radius) {
if (radius < 1)
return originalImageData;
// prepare new image data with 24-bit direct palette to hold blurred
// copy of image
final ImageData newImageData = new ImageData(originalImageData.width, originalImageData.height, 24, new PaletteData(0xFF, 0xFF00, 0xFF0000));
if (radius >= newImageData.height || radius >= newImageData.width)
radius = Math.min(newImageData.height, newImageData.width) - 1;
// initialize cache
final ArrayList<RGB[]> rowCache = new ArrayList<>();
// number of rows of imageData we cache
final int cacheSize = radius * 2 + 1 > newImageData.height ? newImageData.height : radius * 2 + 1;
int cacheStartIndex = 0; // which row of imageData the cache begins with
for (int row = 0; row < cacheSize; row++)
// row data is horizontally blurred before caching
rowCache.add(rowCache.size(), SWTGraphicUtil.blurRow(originalImageData, row, radius));
// sum red, green, and blue values separately for averaging
final RGB[] rowRGBSums = new RGB[newImageData.width];
final int[] rowRGBAverages = new int[newImageData.width];
int topSumBoundary = 0; // current top row of summed values scope
int targetRow = 0; // row with RGB averages to be determined
int bottomSumBoundary = 0; // current bottom row of summed values scope
int numRows = 0; // number of rows included in current summing scope
for (int i = 0; i < newImageData.width; i++)
rowRGBSums[i] = new RGB(0, 0, 0);
while (targetRow < newImageData.height) {
if (bottomSumBoundary < newImageData.height)
do {
// sum pixel RGB values for each column in our radius scope
for (int col = 0; col < newImageData.width; col++) {
rowRGBSums[col].red += rowCache.get(bottomSumBoundary - cacheStartIndex)[col].red;
rowRGBSums[col].green += rowCache.get(bottomSumBoundary - cacheStartIndex)[col].green;
rowRGBSums[col].blue += rowCache.get(bottomSumBoundary - cacheStartIndex)[col].blue;
}
numRows++;
bottomSumBoundary++; // move bottom scope boundary lower
if (bottomSumBoundary < newImageData.height && bottomSumBoundary - cacheStartIndex > radius * 2)
// grow cache
rowCache.add(rowCache.size(), SWTGraphicUtil.blurRow(originalImageData, bottomSumBoundary, radius));
} while (bottomSumBoundary <= radius); // to initialize
// rowRGBSums at start
if (targetRow - topSumBoundary > radius) {
// subtract values of top row from sums as scope of summed
// values moves down
for (int col = 0; col < newImageData.width; col++) {
rowRGBSums[col].red -= rowCache.get(topSumBoundary - cacheStartIndex)[col].red;
rowRGBSums[col].green -= rowCache.get(topSumBoundary - cacheStartIndex)[col].green;
rowRGBSums[col].blue -= rowCache.get(topSumBoundary - cacheStartIndex)[col].blue;
}
numRows--;
topSumBoundary++; // move top scope boundary lower
rowCache.remove(0); // remove top row which is out of summing
// scope
cacheStartIndex++;
}
// calculate each column's RGB-averaged pixel
for (int col = 0; col < newImageData.width; col++)
rowRGBAverages[col] = newImageData.palette.getPixel(new RGB(rowRGBSums[col].red / numRows, rowRGBSums[col].green / numRows, rowRGBSums[col].blue / numRows));
// replace original pixels
newImageData.setPixels(0, targetRow, newImageData.width, rowRGBAverages, 0);
targetRow++;
}
return newImageData;
}
/**
* Average blurs a given row of image data. Returns the blurred row as a matrix
* of separated RGB values.
*/
private static RGB[] blurRow(final ImageData originalImageData, final int row, final int radius) {
final RGB[] rowRGBAverages = new RGB[originalImageData.width];
final int[] lineData = new int[originalImageData.width];
originalImageData.getPixels(0, row, originalImageData.width, lineData, 0);
int r = 0, g = 0, b = 0; // sum red, green, and blue values separately
// for averaging
int leftSumBoundary = 0; // beginning index of summed values scope
int targetColumn = 0; // column of RGB average to be determined
int rightSumBoundary = 0; // ending index of summed values scope
int numCols = 0; // number of columns included in current summing scope
RGB rgb;
while (targetColumn < lineData.length) {
if (rightSumBoundary < lineData.length)
// sum RGB values for each pixel in our radius scope
do {
rgb = originalImageData.palette.getRGB(lineData[rightSumBoundary]);
r += rgb.red;
g += rgb.green;
b += rgb.blue;
numCols++;
rightSumBoundary++;
} while (rightSumBoundary <= radius); // to initialize summing
// scope at start
// subtract sum of left pixel as summing scope moves right
if (targetColumn - leftSumBoundary > radius) {
rgb = originalImageData.palette.getRGB(lineData[leftSumBoundary]);
r -= rgb.red;
g -= rgb.green;
b -= rgb.blue;
numCols--;
leftSumBoundary++;
}
// calculate RGB averages
rowRGBAverages[targetColumn] = new RGB(r / numCols, g / numCols, b / numCols);
targetColumn++;
}
return rowRGBAverages;
}
/**
* Enable all widgets of a control
*
* @param control control to enable/disable
*/
public static void enableAllChildrenWidgets(final Control control) {
if (control instanceof Composite)
for (final Control c : ((Composite) control).getChildren())
SWTGraphicUtil.enableAllChildrenWidgets(c);
boolean enable = true;
final Boolean previousState = (Boolean) control.getData(SWTGraphicUtil.class.toString() + "_enableState");
if (previousState != null)
enable = previousState;
control.setEnabled(enable);
}
/**
* Disable all widgets of a control
*
* @param control control to enable/disable
*/
public static void disableAllChildrenWidgets(final Control control) {
if (control instanceof Composite)
for (final Control c : ((Composite) control).getChildren())
SWTGraphicUtil.disableAllChildrenWidgets(c);
control.setData(SWTGraphicUtil.class.toString() + "_enableState", control.isEnabled());
control.setEnabled(false);
}
/**
* Build a font from a given control. Useful if we just want a bold label for
* example
*
* @param control control that handle the default font
* @param style new style
* @return a font with the given style
*/
public static Font buildFontFrom(final Control control, final int style) {
final Font temp = control.getFont();
final FontData[] fontData = temp.getFontData();
if (fontData == null || fontData.length == 0)
return temp;
return new Font(control.getDisplay(), fontData[0].getName(), fontData[0].getHeight(), style);
}
/**
* Build a font from a given control. Useful if we just want a bold label for
* example
*
* @param control control that handle the default font
* @param style new style
* @return a font with the given style
*/
public static Font buildFontFrom(final Control control, final int style, @SuppressWarnings("javadoc") final int size) {
final Font temp = control.getFont();
final FontData[] fontData = temp.getFontData();
if (fontData == null || fontData.length == 0)
return temp;
return new Font(control.getDisplay(), fontData[0].getName(), size, style);
}
/**
* @return <code>true</code> if the operating system is MacOS, false otherwise
*/
public static boolean isMacOS() {
final String OS = System.getProperty("os.name")
.toLowerCase();
return OS.indexOf("mac") >= 0;
}
/**
* @param control
* @param red
* @param green
* @param blue
* @return a color that will be disposed when <code>control</code> is disposed
*/
public static Color getDefaultColor(final Control control, final int red, final int green, final int blue) {
final Color defaultColor = new Color(control.getDisplay(), red, green, blue);
SWTGraphicUtil.addDisposer(control, defaultColor);
return defaultColor;
}
/**
* @param text
* @return the width of text
*/
public static int computeWidth(final String text) {
final GC gc = new GC(Display.getDefault());
final int width = gc.textExtent(text).x;
gc.dispose();
return width;
}
}
@@ -0,0 +1,47 @@
/*******************************************************************************
* Copyright (c) 2011 Laurent CARON.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Laurent CARON (laurent.caron at gmail dot com) - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.opal.commons;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
/**
* This class is an adapter for the SelectionListener. Both behaviours (DefaultSelected and Selected) are doing the same thing
*/
public abstract class SimpleSelectionAdapter implements SelectionListener {
/**
* @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
*/
@Override
public void widgetDefaultSelected(final SelectionEvent e) {
this.handle(e);
}
/**
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
@Override
public void widgetSelected(final SelectionEvent e) {
this.handle(e);
}
/**
* Sent when selection occurs in the control.
*
* @param e - an event containing information about the selection
*/
public abstract void handle(SelectionEvent e);
}
@@ -0,0 +1,92 @@
/*******************************************************************************
* Copyright (c) 2011 Laurent CARON
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Laurent CARON (laurent.caron at gmail dot com) - Initial implementation and API
*******************************************************************************/
package org.eclipse.nebula.widgets.opal.commons;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* This class provides useful String manipulation methods
*
*/
@SuppressWarnings("nls")
public class StringUtil {
/**
* Returns a "safe" string representation. If source is null, return an
* empty string
*
* @param source source string
* @return the string representation of the source (without space) if the
* source is not <code>null</code>, or an empty string otherwise
*/
public static String safeToString(final Object source) {
return source == null ? ""
: source.toString()
.trim();
}
/**
* Check if a string is empty or null
*
* @param source source string
* @return <code>true</code> is the string is empty or null,
* <code>false</code> otherwise
*/
public static boolean isEmpty(final String source) {
return source == null || source.trim()
.isEmpty();
}
/**
* Converts exception stack trace as string
*
* @param exception exception to convert
* @return a string that contains the exception
*/
public static final String stackStraceAsString(final Throwable exception) {
final StringWriter stringWriter = new StringWriter();
exception.printStackTrace(new PrintWriter(stringWriter));
return stringWriter.toString();
}
/**
* Insert a string in a middle of another string
*
* @param source source string
* @param newEntry string to insert into source
* @param position position to insert source
* @return the new string
*/
public static String insertString(final String source, final String newEntry, final int position) {
final StringBuilder sb = new StringBuilder();
sb.append(source.substring(0, position))
.append(newEntry)
.append(source.substring(position));
return sb.toString();
}
/**
* Remove a character in a String
*
* @param source source string
* @param position position of the character to remove
* @return the string without the character
*/
public static String removeCharAt(final String source, final int position) {
final StringBuilder sb = new StringBuilder();
if (position == source.length())
return source;
sb.append(source.substring(0, position))
.append(source.substring(position + 1));
return sb.toString();
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

@@ -0,0 +1,58 @@
Ok=OK
Cancel=Cancel
Close=Close
Yes=Yes
No=No
MoreDetails=More Details
FewerDetails=Fewer Details
Details=Details
Information=Information
Error=Error
Question=Question
Warning=Warning
Exception=Exception
Choice=Choice
Select=Select
Input=Input
ApplicationError=Application Error
megabytes=Mb
performGC=Perform GC
login=Login
name=Name
password=Password
rememberPassword=Remember password
loginFailed=Login failed
tipOfTheDay=Tip of the day
didYouKnow=Did you know...
showTipAtStartup=Show Tip at startup
previousTip=< Previous Tip
nextTip=Next Tip >
choose=Choose
preferences=Preferences
validURL=Please enter a valid URL
chooseDirectory=Please choose a directory
bold=bold
italic=italic
category.shortDescription = Toggle between Category view and Flat list view
description.shortDescription = Show/Hide the Description pane
sort.shortDescription = Sort Properties and Categories by Name
property=Property
value=Value
editProperty=Edit property
width=Width
height=Height
top=Top
bottom=Bottom
left=Left
right=Right
eraseProperty=Erase the value of the property
physicalMemory=Physical Memory
heapMemory=Heap Memory
threads=Threads
cpuUsage=CPU Usage
peak=Peak
mb=MB
calculator.dividebyzero=Cannot divide by zero !
calculator.invalid=Invalid input for function !
multichoice.message=The entry %s is invalid, please check it!
multichoice.message.plural=The entries %s are invalid, please check it!
@@ -0,0 +1,58 @@
OK=OK
Cancel=Abbrechen
Close=Schließen
Yes=Ja
No=Nein
MoreDetails=Weitere Details
FewerDetails=Weniger Details
Details=Details
Information=Information
Error=Fehler
Question=Frage
Warning=Warnung
Exception=Ausnahme
Choice=Auswahl
Select=Auswählen
Input=Eingabe
ApplicationError=Application Error
megabytes=Mb
performGC=Perform GC
login=Login
name=Name
password=Passwort
rememberPassword=Passwort merken
loginFailed=Login failed
tipOfTheDay=Tip of the day
didYouKnow=Did you know...
showTipAtStartup=Show Tip at startup
previousTip=< Previous Tip
nextTip=Next Tip >
choose=Choose
preferences=Preferences
validURL=Please enter a valid URL
chooseDirectory=Please choose a directory
bold=bold
italic=italic
category.shortDescription = Toggle between Category view and Flat list view
description.shortDescription = Show/Hide the Description pane
sort.shortDescription = Sort Properties and Categories by Name
property=Property
value=Value
editProperty=Edit property
width=Width
height=Height
top=Top
bottom=Bottom
left=Left
right=Right
eraseProperty=Erase the value of the property
physicalMemory=Physical Memory
heapMemory=Heap Memory
threads=Threads
cpuUsage=CPU Usage
peak=Peak
mb=MB
calculator.dividebyzero=Cannot divide by zero !
calculator.invalid=Invalid input for function !
multichoice.message=The entry %s is invalid, please check it!
multichoice.message.plural=The entries %s are invalid, please check it!
@@ -0,0 +1,58 @@
Ok=OK
Cancel=Cancelar
Close=Cerrar
Yes=
No=No
MoreDetails=Más detalles
FewerDetails=Pocos detalles
Details=Detalles
Information=Información
Error=Error
Question=Pregunta
Warning=Advertencia
Exception=Excepción
Choice=Elección
Select=Seleccione
Input=Entrada
ApplicationError=Error de la aplicación
megabytes=Mb
performGC=Ejecutar GC
login=Conexión
name=Nombre
password=Contraseña
rememberPassword=Recordar contraseña
loginFailed=Fallo en la conexión
tipOfTheDay=Consejo diario
didYouKnow=Sabias que...?
showTipAtStartup=Mostrar consejos al inicio
previousTip=<Consejo anterior
nextTip=Siguiente consejo>
choose=Elegir
preferences=Preferencias
validURL=Por favor, introduzca una URL válida
chooseDirectory=Por favor, escoge un directorio
bold=negrita
italic=cursiva
category.shortDescription = Toggle between Category view and Flat list view
description.shortDescription = Show/Hide the Description pane
sort.shortDescription = Sort Properties and Categories by Name
property=Property
value=Value
editProperty=Edit property
width=Width
height=Height
top=Top
bottom=Bottom
left=Left
right=Right
eraseProperty=Erase the value of the property
physicalMemory=Physical Memory
heapMemory=Heap Memory
threads=Threads
cpuUsage=CPU Usage
peak=Peak
mb=MB
calculator.dividebyzero=Cannot divide by zero !
calculator.invalid=Invalid input for function !
multichoice.message=The entry %s is invalid, please check it!
multichoice.message.plural=The entries %s are invalid, please check it!
@@ -0,0 +1,58 @@
OK=OK
Cancel=Annuler
Close=Fermer
Yes=Oui
No=Non
MoreDetails=Plus de détails
FewerDetails=Moins de détails
Details=Détails
Information=Information
Error=Erreur
Question=Question
Warning=Avertissement
Exception=Exception
Choice=Choix
Select=Sélection
Input=Entrée
ApplicationError=Erreur applicative
megabytes=Mo
performGC=Lancer le ramasse-miettes (GC)
login=Identification
name=Nom
password=Mot de passe
rememberPassword=Se souvenir de mon mot de passe
loginFailed=Echec de l'authentification
tipOfTheDay=Astuce du jour
didYouKnow=Le savez-vous ?
showTipAtStartup=Afficher les astuces au démarrage
previousTip=< Astuce précédente
nextTip=Astuce suivante >
choose=Choisir
preferences=Préférences
validURL=Merci de saisir une URL valide s'il vous plait
chooseDirectory=Veuillez choisir un répertoire
bold=gras
italic=italique
category.shortDescription = Alterner entre vue par Cat\u00e9gorie et liste
description.shortDescription = Afficher/Cacher le panneau de Description
sort.shortDescription = Trier les Propri\u00e9t\u00e9s et Cat\u00e9gories par Nom
property=Propriété
value=Valeur
editProperty=Edition de la valeur de la propriété
width=Largeur
height=Hauteur
top=Haut
bottom=Bas
left=Gauche
right=Droite
eraseProperty=Efface la valeur de cette propriété
physicalMemory=Mémoire physique
heapMemory=Mémoire Heap
threads=Threads
cpuUsage=Utilisation CPU
peak=Max
mb=Mo
calculator.dividebyzero=Division par zéro impossible !
calculator.invalid=Entrée invalide pour cette fonction !
multichoice.message=L'entrée %s n'est pas valide, merci de la v\u00e9rifier !
multichoice.message.plural=Les entr\u00e9es %s ne sont pas valides, merci de les v\u00e9rifier!
@@ -0,0 +1,58 @@
OK=OK
Cancel=Annulla
Close=Chiudi
Yes=Si
No=No
MoreDetails=Pi\u00F9 Dettagli
FewerDetails=Meno Dettagli
Details=Dettagli
Information=Informazione
Error=Errore
Question=Domanda
Warning=Avvertenza
Exception=Eccezione
Choice=Scelta
Select=Seleziona
Input=Input
ApplicationError=Errore di applicazione
megabytes=Mb
performGC=Perform GC
login=Accesso
name=Nome
password=Password
rememberPassword=Remember password
loginFailed=Login failed
tipOfTheDay=Tip of the day
didYouKnow=Did you know...
showTipAtStartup=Show Tip at startup
previousTip=< Previous Tip
nextTip=Next Tip >
choose=Choose
preferences=Preferences
validURL=Please enter a valid URL
chooseDirectory=Please choose a directory
bold=bold
italic=italic
category.shortDescription = Toggle between Category view and Flat list view
description.shortDescription = Show/Hide the Description pane
sort.shortDescription = Sort Properties and Categories by Name
property=Property
value=Value
editProperty=Edit property
width=Width
height=Height
top=Top
bottom=Bottom
left=Left
right=Right
eraseProperty=Erase the value of the property
physicalMemory=Physical Memory
heapMemory=Heap Memory
threads=Threads
cpuUsage=CPU Usage
peak=Peak
mb=MB
calculator.dividebyzero=Cannot divide by zero !
calculator.invalid=Invalid input for function !
multichoice.message=The entry %s is invalid, please check it!
multichoice.message.plural=The entries %s are invalid, please check it!
@@ -0,0 +1,58 @@
Ok=OK
Cancel=Annuleren
Close=Sluiten
Yes=Ja
No=Nee
MoreDetails=Meer info
FewerDetails=Minder info
Details=Info
Information=Informatie
Error=Fout
Question=Vraag
Warning=Waarschuwing
Exception=Exception
Choice=Kies
Select=Kies
Input=Invoer
ApplicationError=Fout in toepassing
megabytes=Mb
performGC=Voer GC uit
login=Login
name=Naam
password=Wachtwoord
rememberPassword=Wachtwoord onthouden
loginFailed=Inloggen mislukt
tipOfTheDay=Tip van de dag
didYouKnow=Wisu u dat...
showTipAtStartup=Tips weergeven bij opstarten
previousTip=< Vorige Tip
nextTip=Volgende Tip >
choose=Kies
preferences=Voorkeuren
validURL=Geef een geldige URL op
chooseDirectory=Kies een map
bold=vet
italic=cursief
category.shortDescription = Wissel tussen weergave per category en lijst weergave
description.shortDescription = Toon/Verberg omschrijving
sort.shortDescription = Sorteer eigenschappen en categorie\u00ebn op naam
property=Eigenschap
value=Waarde
editProperty=Bewerk eigenschap
width=Breedte
height=Hoogte
top=Bovenkant
bottom=Onderkant
left=Links
right=Rechts
eraseProperty=Wis de waarde van de eigenschap
physicalMemory=Physical Memory
heapMemory=Heap Memory
threads=Threads
cpuUsage=CPU Usage
peak=Peak
mb=MB
calculator.dividebyzero=Cannot divide by zero !
calculator.invalid=Invalid input for function !
multichoice.message=The entry %s is invalid, please check it!
multichoice.message.plural=The entries %s are invalid, please check it!
@@ -0,0 +1,58 @@
Ok=OK
Cancel=Anuluj
Close=Zamknij
Yes=Tak
No=Nie
MoreDetails=Więcej szczegółów
FewerDetails=Mniej szczegółów
Details=Szczegóły
Information=Informacja
Error=Błąd
Question=Pytanie
Warning=Ostrzeżenie
Exception=Wyjątek
Choice=Wybór
Select=Wybór
Input=Wprowadzanie
ApplicationError=Błąd aplikacji
megabytes=Mb
performGC=Wykonaj GC
login=Login
name=Nazwa
password=Hasło
rememberPassword=Zapamiętaj hasło
loginFailed=Logowanie nie powiodło się
tipOfTheDay=Porada dnia
didYouKnow=Czy wiesz, że...
showTipAtStartup=Wyświetl Poradę dnia przy starcie
previousTip=< Poprzednia Porada
nextTip=Następna Porada >
choose=Wybierz
preferences=Preferencje
validURL=Wpisz poprawny adres URL
chooseDirectory=Proszę wybrać katalog
bold=pogrubienie
italic=kursywa
category.shortDescription = Przełącz pomiędzy widokiem kategorii a widokiem płaskiej listy
description.shortDescription = Pokaż/Ukryj panel Opisu
sort.shortDescription = Sortuj Właściwości i Kategorie po Nazwie
property=Właściwość
value=Wartość
editProperty=Edytuj właściwość
width=Szerokość
height=Wysokość
top=Góra
bottom=Dół
left=Lewo
right=Prawo
eraseProperty=Wymaż wartość właściwości
physicalMemory=Pamięć Fizyczna
heapMemory=Sterta Pamięci
threads=Wątki
cpuUsage=Wykorzystanie CPU
peak=Pik
mb=MB
calculator.dividebyzero=Nie można dzielić przez zero !
calculator.invalid=Nieprawidłowe parametry funkcji !
multichoice.message=The entry %s is invalid, please check it!
multichoice.message.plural=The entries %s are invalid, please check it!
@@ -0,0 +1,58 @@
Ok=OK
Cancel=Cancelar
Close=Fechar
Yes=Sim
No=Não
MoreDetails=Mais detalhes
FewerDetails=Menos detalhes
Details=Detalhes
Information=Informação
Error=Erro
Question=Questão
Warning=Aviso
Exception=Exceção
Choice=Escolher
Select=Selecionar
Input=Entrar
ApplicationError=Erro da aplicação
megabytes=Mb
performGC=Perform GC
login=Login
name=Name
password=Password
rememberPassword=Remember password
loginFailed=Login failed
tipOfTheDay=Tip of the day
didYouKnow=Did you know...
showTipAtStartup=Show Tip at startup
previousTip=< Previous Tip
nextTip=Next Tip >
choose=Choose
preferences=Preferences
validURL=Please enter a valid URL
chooseDirectory=Please choose a directory
bold=bold
italic=italic
category.shortDescription = Toggle between Category view and Flat list view
description.shortDescription = Show/Hide the Description pane
sort.shortDescription = Sort Properties and Categories by Name
property=Property
value=Value
editProperty=Edit property
width=Width
height=Height
top=Top
bottom=Bottom
left=Left
right=Right
eraseProperty=Erase the value of the property
physicalMemory=Physical Memory
heapMemory=Heap Memory
threads=Threads
cpuUsage=CPU Usage
peak=Peak
mb=MB
calculator.dividebyzero=Cannot divide by zero !
calculator.invalid=Invalid input for function !
multichoice.message=The entry %s is invalid, please check it!
multichoice.message.plural=The entries %s are invalid, please check it!
@@ -0,0 +1,58 @@
Ok=\u786e\u5b9a
Cancel=\u653e\u5f03
Close=\u5173\u95ed
Yes=\u662f
No=\u5426
MoreDetails=\u8be6\u7ec6\u4fe1\u606f
FewerDetails=\u7b80\u660e\u4fe1\u606f
Details=\u4fe1\u606f
Information=\u4fe1\u606f
Error=\u9519\u8bef
Question=\u95ee\u9898
Warning=\u8b66\u544a
Exception=\u5f02\u5e38
Choice=\u9009\u9879
Select=\u9009\u62e9
Input=\u8f93\u5165
ApplicationError=Application Error
megabytes=Mb
performGC=Perform GC
login=Login
name=Name
password=Password
rememberPassword=Remember password
loginFailed=Login failed
tipOfTheDay=Tip of the day
didYouKnow=Did you know...
showTipAtStartup=Show Tip at startup
previousTip=< Previous Tip
nextTip=Next Tip >
choose=Choose
preferences=Preferences
validURL=Please enter a valid URL
chooseDirectory=Please choose a directory
bold=bold
italic=italic
category.shortDescription = Toggle between Category view and Flat list view
description.shortDescription = Show/Hide the Description pane
sort.shortDescription = Sort Properties and Categories by Name
property=Property
value=Value
editProperty=Edit property
width=Width
height=Height
top=Top
bottom=Bottom
left=Left
right=Right
eraseProperty=Erase the value of the property
physicalMemory=Physical Memory
heapMemory=Heap Memory
threads=Threads
cpuUsage=CPU Usage
peak=Peak
mb=MB
calculator.dividebyzero=Cannot divide by zero !
calculator.invalid=Invalid input for function !
multichoice.message=The entry %s is invalid, please check it!
multichoice.message.plural=The entries %s are invalid, please check it!