You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2021/02/17 14:19:09 UTC
[incubator-hop] branch master updated: HOP-2375 (#627)
This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hop.git
The following commit(s) were added to refs/heads/master by this push:
new 654c573 HOP-2375 (#627)
654c573 is described below
commit 654c573dd62d62a5768e99d6ba6c88dadd0c1a1f
Author: Matt Casters <ma...@gmail.com>
AuthorDate: Wed Feb 17 15:19:03 2021 +0100
HOP-2375 (#627)
* HOP-2375 : Support dark modes of operating systems
* HOP-2375 : Support dark modes of operating systems
* HOP-2375 : Support dark modes of operating systems
* HOP_2375 : Support dark modes of operating systems
---
.../org/apache/hop/pipeline/PipelinePainter.java | 2 +-
.../beam/src/main/samples/project-config.json | 10 +
.../googledrive/ui/GoogleAuthorizationDialog.java | 6 +-
.../org/apache/hop/core/SwtUniversalImageSvg.java | 118 +-
.../main/java/org/apache/hop/ui/core/PropsUi.java | 648 ++++++----
.../apache/hop/ui/core/dialog/ContextDialog.java | 2 +-
.../hop/ui/core/dialog/EnterOptionsDialog.java | 23 +-
.../apache/hop/ui/core/dialog/ShowHelpDialog.java | 2 +-
.../org/apache/hop/ui/core/gui/GuiResource.java | 1080 ++++++++--------
.../apache/hop/ui/hopgui/dialog/NotePadDialog.java | 12 +-
.../org/apache/hop/ui/i18n/editor/Translator.java | 1305 +++++++++++---------
.../org/apache/hop/ui/util/SwtSvgImageUtil.java | 10 +-
.../core/dialog/messages/messages_en_US.properties | 1 +
ui/src/main/resources/ui/images/data_orch.svg | 28 +-
14 files changed, 1747 insertions(+), 1500 deletions(-)
diff --git a/engine/src/main/java/org/apache/hop/pipeline/PipelinePainter.java b/engine/src/main/java/org/apache/hop/pipeline/PipelinePainter.java
index 38ed0b9..a31ef94 100644
--- a/engine/src/main/java/org/apache/hop/pipeline/PipelinePainter.java
+++ b/engine/src/main/java/org/apache/hop/pipeline/PipelinePainter.java
@@ -814,7 +814,7 @@ public class PipelinePainter extends BasePainter<PipelineHopMeta, TransformMeta>
gc.drawImage( EImage.EDIT, namePosition.x - 6, namePosition.y-2, magnification );
- gc.setBackground(240, 240, 240);
+ gc.setBackground(EColor.LIGHTGRAY);
gc.fillRoundRectangle(
namePosition.x - 8,
namePosition.y - 2,
diff --git a/plugins/engines/beam/src/main/samples/project-config.json b/plugins/engines/beam/src/main/samples/project-config.json
new file mode 100644
index 0000000..c9fa61d
--- /dev/null
+++ b/plugins/engines/beam/src/main/samples/project-config.json
@@ -0,0 +1,10 @@
+{
+ "metadataBaseFolder" : "${PROJECT_HOME}/metadata",
+ "unitTestsBasePath" : "${PROJECT_HOME}",
+ "dataSetsCsvFolder" : "${PROJECT_HOME}/datasets",
+ "enforcingExecutionInHome" : true,
+ "parentProjectName" : "base-project",
+ "config" : {
+ "variables" : [ ]
+ }
+}
\ No newline at end of file
diff --git a/plugins/vfs/googledrive/src/main/java/org/apache/hop/vfs/googledrive/ui/GoogleAuthorizationDialog.java b/plugins/vfs/googledrive/src/main/java/org/apache/hop/vfs/googledrive/ui/GoogleAuthorizationDialog.java
index f7caa83..ee78e79 100644
--- a/plugins/vfs/googledrive/src/main/java/org/apache/hop/vfs/googledrive/ui/GoogleAuthorizationDialog.java
+++ b/plugins/vfs/googledrive/src/main/java/org/apache/hop/vfs/googledrive/ui/GoogleAuthorizationDialog.java
@@ -109,7 +109,7 @@ public class GoogleAuthorizationDialog extends Dialog {
props.setLook(helpLabel);
helpLabel.setFont(new Font(display, "Open Sans Regular", 11, SWT.NORMAL));
- helpLabel.setForeground(new Color(display, 0, 94, 170));
+ helpLabel.setForeground(new Color(display, props.contrastColor(0, 94, 170)));
FormData helpLabelFormData = new FormData();
helpLabelFormData.left = new FormAttachment(0, 40);
helpLabelFormData.bottom = new FormAttachment(100, -27);
@@ -120,14 +120,14 @@ public class GoogleAuthorizationDialog extends Dialog {
helpLabel.addListener(
SWT.MouseEnter,
event -> {
- helpLabel.setForeground(new Color(display, 0, 0, 0));
+ helpLabel.setForeground(new Color(display, PropsUi.getInstance().contrastColor( 0, 0, 0)));
helpLabel.setCursor(new Cursor(display, SWT.CURSOR_HAND));
});
helpLabel.addListener(
SWT.MouseExit,
event -> {
- helpLabel.setForeground(new Color(display, 0, 94, 170));
+ helpLabel.setForeground(new Color(display, props.contrastColor( 0, 94, 170)));
});
Label cancelButton = new Label(dialog, SWT.NONE);
diff --git a/ui/src/main/java/org/apache/hop/core/SwtUniversalImageSvg.java b/ui/src/main/java/org/apache/hop/core/SwtUniversalImageSvg.java
index 836f84b..adc5212 100644
--- a/ui/src/main/java/org/apache/hop/core/SwtUniversalImageSvg.java
+++ b/ui/src/main/java/org/apache/hop/core/SwtUniversalImageSvg.java
@@ -17,20 +17,34 @@
package org.apache.hop.core;
+import org.apache.batik.anim.dom.SVGDOMImplementation;
import org.apache.batik.bridge.BridgeContext;
import org.apache.batik.bridge.DocumentLoader;
import org.apache.batik.bridge.GVTBuilder;
import org.apache.batik.bridge.UserAgentAdapter;
+import org.apache.batik.dom.util.DOMUtilities;
import org.apache.batik.ext.awt.image.codec.png.PNGRegistryEntry;
import org.apache.batik.ext.awt.image.spi.ImageTagRegistry;
import org.apache.batik.gvt.GraphicsNode;
+import org.apache.commons.lang.StringUtils;
import org.apache.hop.core.svg.SvgImage;
+import org.apache.hop.ui.core.PropsUi;
import org.eclipse.swt.graphics.Device;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.svg.SVGDocument;
+import org.w3c.dom.svg.SVGSVGElement;
import java.awt.*;
import java.awt.geom.Dimension2D;
import java.awt.image.BufferedImage;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
public class SwtUniversalImageSvg extends SwtUniversalImage {
private final GraphicsNode svgGraphicsNode;
@@ -39,44 +53,108 @@ public class SwtUniversalImageSvg extends SwtUniversalImage {
static {
// workaround due to known issue in batik 1.8 - https://issues.apache.org/jira/browse/BATIK-1125
ImageTagRegistry registry = ImageTagRegistry.getRegistry();
- registry.register( new PNGRegistryEntry() );
+ registry.register(new PNGRegistryEntry());
}
- public SwtUniversalImageSvg( SvgImage svg ) {
- // get GraphicsNode and size from svg document
+ public SwtUniversalImageSvg(SvgImage svg) {
UserAgentAdapter userAgentAdapter = new UserAgentAdapter();
- DocumentLoader documentLoader = new DocumentLoader( userAgentAdapter );
- BridgeContext ctx = new BridgeContext( userAgentAdapter, documentLoader );
GVTBuilder builder = new GVTBuilder();
- svgGraphicsNode = builder.build( ctx, svg.getDocument() );
- svgGraphicsSize = ctx.getDocumentSize();
+
+ if (PropsUi.getInstance().isDarkMode()) {
+ DOMImplementation domImplementation = SVGDOMImplementation.getDOMImplementation();
+ SVGDocument clonedDocument =
+ (SVGDocument) DOMUtilities.deepCloneDocument(svg.getDocument(), domImplementation);
+ SVGSVGElement root = clonedDocument.getRootElement();
+
+ Map<String, String> colorsMap = PropsUi.getInstance().getContrastingColorStrings();
+ List<String> tags = Arrays.asList("path", "fill", "bordercolor", "fillcolor", "style", "text", "polygon", "rect");
+
+ contrastColors(root, tags, colorsMap);
+
+ BridgeContext ctx = new BridgeContext(userAgentAdapter);
+ ctx.setDynamic(true);
+
+ svgGraphicsNode = builder.build(ctx, clonedDocument);
+ svgGraphicsSize = ctx.getDocumentSize();
+ } else {
+ // get GraphicsNode and size from svg document
+ DocumentLoader documentLoader = new DocumentLoader(userAgentAdapter);
+ BridgeContext ctx = new BridgeContext(userAgentAdapter, documentLoader);
+ svgGraphicsNode = builder.build(ctx, svg.getDocument());
+ svgGraphicsSize = ctx.getDocumentSize();
+ }
+ }
+
+ private void contrastColors(
+ SVGSVGElement root, List<String> tags, Map<String, String> colorsMap) {
+ for (String tag : tags) {
+
+ NodeList nodeList = root.getElementsByTagName(tag);
+
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node node = nodeList.item(i);
+ NamedNodeMap namedNodeMap = node.getAttributes();
+ for (int x = 0; x < namedNodeMap.getLength(); x++) {
+ Node namedNode = namedNodeMap.item(x);
+ String value = namedNode.getNodeValue();
+
+ boolean changed = false;
+
+ if (StringUtils.isNotEmpty(value)) {
+ String changedValue = value.toLowerCase();
+
+ for (String oldColor : colorsMap.keySet()) {
+ if (changedValue.contains(oldColor)) {
+ String newColor = colorsMap.get(oldColor);
+ changedValue = changedValue.replace(oldColor, newColor);
+ changed = true;
+ }
+ }
+ if (changed) {
+ namedNode.setNodeValue(changedValue);
+ }
+ }
+ }
+ }
+ }
}
@Override
- protected Image renderSimple( Device device ) {
- return renderSimple( device, (int) Math.round( svgGraphicsSize.getWidth() ), (int) Math.round( svgGraphicsSize.getHeight() ) );
+ protected Image renderSimple(Device device) {
+ return renderSimple(
+ device,
+ (int) Math.round(svgGraphicsSize.getWidth()),
+ (int) Math.round(svgGraphicsSize.getHeight()));
}
@Override
- protected Image renderSimple( Device device, int width, int height ) {
- BufferedImage area = SwingUniversalImage.createBitmap( width, height );
- Graphics2D gc = SwingUniversalImage.createGraphics( area );
- SwingUniversalImageSvg.render( gc, svgGraphicsNode, svgGraphicsSize, width / 2, height / 2, width, height, 0 );
+ protected Image renderSimple(Device device, int width, int height) {
+ BufferedImage area = SwingUniversalImage.createBitmap(width, height);
+ Graphics2D gc = SwingUniversalImage.createGraphics(area);
+ SwingUniversalImageSvg.render(
+ gc, svgGraphicsNode, svgGraphicsSize, width / 2, height / 2, width, height, 0);
gc.dispose();
- return swing2swt( device, area );
+ return swing2swt(device, area);
}
@Override
- protected Image renderRotated( Device device, int width, int height, double angleRadians ) {
- BufferedImage doubleArea = SwingUniversalImage.createDoubleBitmap( width, height );
+ protected Image renderRotated(Device device, int width, int height, double angleRadians) {
+ BufferedImage doubleArea = SwingUniversalImage.createDoubleBitmap(width, height);
- Graphics2D gc = SwingUniversalImage.createGraphics( doubleArea );
- SwingUniversalImageSvg.render( gc, svgGraphicsNode, svgGraphicsSize, doubleArea.getWidth() / 2, doubleArea
- .getHeight() / 2, width, height, angleRadians );
+ Graphics2D gc = SwingUniversalImage.createGraphics(doubleArea);
+ SwingUniversalImageSvg.render(
+ gc,
+ svgGraphicsNode,
+ svgGraphicsSize,
+ doubleArea.getWidth() / 2,
+ doubleArea.getHeight() / 2,
+ width,
+ height,
+ angleRadians);
gc.dispose();
- return swing2swt( device, doubleArea );
+ return swing2swt(device, doubleArea);
}
}
diff --git a/ui/src/main/java/org/apache/hop/ui/core/PropsUi.java b/ui/src/main/java/org/apache/hop/ui/core/PropsUi.java
index 03c08e3..c778d7d 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/PropsUi.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/PropsUi.java
@@ -29,6 +29,7 @@ import org.apache.hop.history.AuditState;
import org.apache.hop.ui.core.gui.GuiResource;
import org.apache.hop.ui.core.gui.HopNamespace;
import org.apache.hop.ui.core.gui.WindowProperty;
+import org.apache.hop.ui.core.widget.OsHelper;
import org.apache.hop.ui.hopgui.TextSizeUtilFacade;
import org.apache.hop.ui.util.EnvironmentUtils;
import org.eclipse.swt.SWT;
@@ -48,16 +49,19 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TableItem;
+import java.util.HashMap;
+import java.util.Map;
+
/**
- * We use Props to store all kinds of user interactive information such as the selected colors, fonts, positions of
- * windows, etc.
+ * We use Props to store all kinds of user interactive information such as the selected colors,
+ * fonts, positions of windows, etc.
*
* @author Matt
* @since 15-12-2003
*/
public class PropsUi extends Props {
- private static String OS = System.getProperty( "os.name" ).toLowerCase();
+ private static String OS = System.getProperty("os.name").toLowerCase();
private static final String NO = "N";
@@ -65,7 +69,8 @@ public class PropsUi extends Props {
private static double nativeZoomFactor;
- private static final String STRING_SHOW_COPY_OR_DISTRIBUTE_WARNING = "ShowCopyOrDistributeWarning";
+ private static final String STRING_SHOW_COPY_OR_DISTRIBUTE_WARNING =
+ "ShowCopyOrDistributeWarning";
private static final String SHOW_TOOL_TIPS = "ShowToolTips";
@@ -81,10 +86,14 @@ public class PropsUi extends Props {
private static final String USE_GLOBAL_FILE_BOOKMARKS = "UseGlobalFileBookmarks";
+ private static final String DARK_MODE = "DarkMode";
+
+ private Map<RGB, RGB> contrastingColors;
+
private static PropsUi instance;
public static PropsUi getInstance() {
- if ( instance == null ) {
+ if (instance == null) {
instance = new PropsUi();
}
return instance;
@@ -100,7 +109,8 @@ public class PropsUi extends Props {
// We take the default font and render it, calculate the height.
// Compare that to the standard small icon size of 16
//
- org.eclipse.swt.graphics.Point extent = TextSizeUtilFacade.textExtent("The quick brown fox jumped over the lazy dog!");
+ org.eclipse.swt.graphics.Point extent =
+ TextSizeUtilFacade.textExtent("The quick brown fox jumped over the lazy dog!");
nativeZoomFactor = (double) extent.y / (double) ConstUi.SMALL_ICON_SIZE;
}
@@ -112,182 +122,197 @@ public class PropsUi extends Props {
super.setDefault();
Display display = Display.getCurrent();
- if ( display != null ) {
+ populateContrastingColors();
+
+ if (!OsHelper.isWindows()) {
+ if (Display.isSystemDarkTheme()) {
+ setDarkMode(true);
+ setOSLookShown(true);
+ } else {
+ setDarkMode(false);
+ setOSLookShown(false);
+ }
+ }
+
+ if (display != null) {
FontData fontData = getFixedFont();
- setProperty( STRING_FONT_FIXED_NAME, fontData.getName() );
- setProperty( STRING_FONT_FIXED_SIZE, "" + fontData.getHeight() );
- setProperty( STRING_FONT_FIXED_STYLE, "" + fontData.getStyle() );
+ setProperty(STRING_FONT_FIXED_NAME, fontData.getName());
+ setProperty(STRING_FONT_FIXED_SIZE, "" + fontData.getHeight());
+ setProperty(STRING_FONT_FIXED_STYLE, "" + fontData.getStyle());
fontData = getDefaultFont();
- setProperty( STRING_FONT_DEFAULT_NAME, fontData.getName() );
- setProperty( STRING_FONT_DEFAULT_SIZE, "" + fontData.getHeight() );
- setProperty( STRING_FONT_DEFAULT_STYLE, "" + fontData.getStyle() );
+ setProperty(STRING_FONT_DEFAULT_NAME, fontData.getName());
+ setProperty(STRING_FONT_DEFAULT_SIZE, "" + fontData.getHeight());
+ setProperty(STRING_FONT_DEFAULT_STYLE, "" + fontData.getStyle());
fontData = getDefaultFont();
- setProperty( STRING_FONT_GRAPH_NAME, fontData.getName() );
- setProperty( STRING_FONT_GRAPH_SIZE, "" + fontData.getHeight() );
- setProperty( STRING_FONT_GRAPH_STYLE, "" + fontData.getStyle() );
+ setProperty(STRING_FONT_GRAPH_NAME, fontData.getName());
+ setProperty(STRING_FONT_GRAPH_SIZE, "" + fontData.getHeight());
+ setProperty(STRING_FONT_GRAPH_STYLE, "" + fontData.getStyle());
fontData = getDefaultFont();
- setProperty( STRING_FONT_NOTE_NAME, fontData.getName() );
- setProperty( STRING_FONT_NOTE_SIZE, "" + fontData.getHeight() );
- setProperty( STRING_FONT_NOTE_STYLE, "" + fontData.getStyle() );
+ setProperty(STRING_FONT_NOTE_NAME, fontData.getName());
+ setProperty(STRING_FONT_NOTE_SIZE, "" + fontData.getHeight());
+ setProperty(STRING_FONT_NOTE_STYLE, "" + fontData.getStyle());
RGB color = getBackgroundRGB();
- setProperty( STRING_BACKGROUND_COLOR_R, "" + color.red );
- setProperty( STRING_BACKGROUND_COLOR_G, "" + color.green );
- setProperty( STRING_BACKGROUND_COLOR_B, "" + color.blue );
+ setProperty(STRING_BACKGROUND_COLOR_R, "" + color.red);
+ setProperty(STRING_BACKGROUND_COLOR_G, "" + color.green);
+ setProperty(STRING_BACKGROUND_COLOR_B, "" + color.blue);
color = getGraphColorRGB();
- setProperty( STRING_GRAPH_COLOR_R, "" + color.red );
- setProperty( STRING_GRAPH_COLOR_G, "" + color.green );
- setProperty( STRING_GRAPH_COLOR_B, "" + color.blue );
+ setProperty(STRING_GRAPH_COLOR_R, "" + color.red);
+ setProperty(STRING_GRAPH_COLOR_G, "" + color.green);
+ setProperty(STRING_GRAPH_COLOR_B, "" + color.blue);
- setProperty( STRING_ICON_SIZE, "" + getIconSize() );
- setProperty( STRING_LINE_WIDTH, "" + getLineWidth() );
- setProperty( STRING_MAX_UNDO, "" + getMaxUndo() );
+ setProperty(STRING_ICON_SIZE, "" + getIconSize());
+ setProperty(STRING_LINE_WIDTH, "" + getLineWidth());
+ setProperty(STRING_MAX_UNDO, "" + getMaxUndo());
}
- setUseGlobalFileBookmarks( true );
+ setUseGlobalFileBookmarks(true);
}
- public void setFixedFont( FontData fd ) {
- setProperty( STRING_FONT_FIXED_NAME, fd.getName() );
- setProperty( STRING_FONT_FIXED_SIZE, "" + fd.getHeight() );
- setProperty( STRING_FONT_FIXED_STYLE, "" + fd.getStyle() );
+ public void setFixedFont(FontData fd) {
+ setProperty(STRING_FONT_FIXED_NAME, fd.getName());
+ setProperty(STRING_FONT_FIXED_SIZE, "" + fd.getHeight());
+ setProperty(STRING_FONT_FIXED_STYLE, "" + fd.getStyle());
}
public FontData getFixedFont() {
FontData def = getDefaultFontData();
- String name = getProperty( STRING_FONT_FIXED_NAME, "Monospaced" );
- int size = Const.toInt( getProperty( STRING_FONT_FIXED_SIZE ), def.getHeight() );
- int style = Const.toInt( getProperty( STRING_FONT_FIXED_STYLE ), def.getStyle() );
+ String name = getProperty(STRING_FONT_FIXED_NAME, "Monospaced");
+ int size = Const.toInt(getProperty(STRING_FONT_FIXED_SIZE), def.getHeight());
+ int style = Const.toInt(getProperty(STRING_FONT_FIXED_STYLE), def.getStyle());
- return new FontData( name, size, style );
+ return new FontData(name, size, style);
}
- public void setDefaultFont( FontData fd ) {
- if ( fd != null ) {
- setProperty( STRING_FONT_DEFAULT_NAME, fd.getName() );
- setProperty( STRING_FONT_DEFAULT_SIZE, "" + fd.getHeight() );
- setProperty( STRING_FONT_DEFAULT_STYLE, "" + fd.getStyle() );
+ public void setDefaultFont(FontData fd) {
+ if (fd != null) {
+ setProperty(STRING_FONT_DEFAULT_NAME, fd.getName());
+ setProperty(STRING_FONT_DEFAULT_SIZE, "" + fd.getHeight());
+ setProperty(STRING_FONT_DEFAULT_STYLE, "" + fd.getStyle());
}
}
public FontData getDefaultFont() {
FontData def = getDefaultFontData();
- if ( isOSLookShown() ) {
+ if (isOSLookShown()) {
return def;
}
- String name = getProperty( STRING_FONT_DEFAULT_NAME, def.getName() );
- int size = Const.toInt( getProperty( STRING_FONT_DEFAULT_SIZE ), def.getHeight() );
- int style = Const.toInt( getProperty( STRING_FONT_DEFAULT_STYLE ), def.getStyle() );
+ String name = getProperty(STRING_FONT_DEFAULT_NAME, def.getName());
+ int size = Const.toInt(getProperty(STRING_FONT_DEFAULT_SIZE), def.getHeight());
+ int style = Const.toInt(getProperty(STRING_FONT_DEFAULT_STYLE), def.getStyle());
- return new FontData( name, size, style );
+ return new FontData(name, size, style);
}
- public void setGraphFont( FontData fd ) {
- setProperty( STRING_FONT_GRAPH_NAME, fd.getName() );
- setProperty( STRING_FONT_GRAPH_SIZE, "" + fd.getHeight() );
- setProperty( STRING_FONT_GRAPH_STYLE, "" + fd.getStyle() );
+ public void setGraphFont(FontData fd) {
+ setProperty(STRING_FONT_GRAPH_NAME, fd.getName());
+ setProperty(STRING_FONT_GRAPH_SIZE, "" + fd.getHeight());
+ setProperty(STRING_FONT_GRAPH_STYLE, "" + fd.getStyle());
}
public FontData getGraphFont() {
FontData def = getDefaultFontData();
- String name = getProperty( STRING_FONT_GRAPH_NAME, def.getName() );
+ String name = getProperty(STRING_FONT_GRAPH_NAME, def.getName());
- int size = Const.toInt( getProperty( STRING_FONT_GRAPH_SIZE ), def.getHeight() );
+ int size = Const.toInt(getProperty(STRING_FONT_GRAPH_SIZE), def.getHeight());
// Correct the size with the native zoom factor...
//
- int correctedSize = (int) Math.round( size / PropsUi.getNativeZoomFactor() );
+ int correctedSize = (int) Math.round(size / PropsUi.getNativeZoomFactor());
- int style = Const.toInt( getProperty( STRING_FONT_GRAPH_STYLE ), def.getStyle() );
+ int style = Const.toInt(getProperty(STRING_FONT_GRAPH_STYLE), def.getStyle());
- return new FontData( name, correctedSize, style );
+ return new FontData(name, correctedSize, style);
}
- public void setNoteFont( FontData fd ) {
- setProperty( STRING_FONT_NOTE_NAME, fd.getName() );
- setProperty( STRING_FONT_NOTE_SIZE, "" + fd.getHeight() );
- setProperty( STRING_FONT_NOTE_STYLE, "" + fd.getStyle() );
+ public void setNoteFont(FontData fd) {
+ setProperty(STRING_FONT_NOTE_NAME, fd.getName());
+ setProperty(STRING_FONT_NOTE_SIZE, "" + fd.getHeight());
+ setProperty(STRING_FONT_NOTE_STYLE, "" + fd.getStyle());
}
public FontData getNoteFont() {
FontData def = getDefaultFontData();
- String name = getProperty( STRING_FONT_NOTE_NAME, def.getName() );
- String ssize = getProperty( STRING_FONT_NOTE_SIZE );
- String sstyle = getProperty( STRING_FONT_NOTE_STYLE );
+ String name = getProperty(STRING_FONT_NOTE_NAME, def.getName());
+ String ssize = getProperty(STRING_FONT_NOTE_SIZE);
+ String sstyle = getProperty(STRING_FONT_NOTE_STYLE);
- int size = Const.toInt( ssize, def.getHeight() );
- int style = Const.toInt( sstyle, def.getStyle() );
+ int size = Const.toInt(ssize, def.getHeight());
+ int style = Const.toInt(sstyle, def.getStyle());
- return new FontData( name, size, style );
+ return new FontData(name, size, style);
}
- public void setBackgroundRGB( RGB c ) {
- setProperty( STRING_BACKGROUND_COLOR_R, c != null ? "" + c.red : "" );
- setProperty( STRING_BACKGROUND_COLOR_G, c != null ? "" + c.green : "" );
- setProperty( STRING_BACKGROUND_COLOR_B, c != null ? "" + c.blue : "" );
+ public void setBackgroundRGB(RGB c) {
+ setProperty(STRING_BACKGROUND_COLOR_R, c != null ? "" + c.red : "");
+ setProperty(STRING_BACKGROUND_COLOR_G, c != null ? "" + c.green : "");
+ setProperty(STRING_BACKGROUND_COLOR_B, c != null ? "" + c.blue : "");
}
public RGB getBackgroundRGB() {
- int r = Const.toInt( getProperty( STRING_BACKGROUND_COLOR_R ), ConstUi.COLOR_BACKGROUND_RED ); // Defaut:
- int g = Const.toInt( getProperty( STRING_BACKGROUND_COLOR_G ), ConstUi.COLOR_BACKGROUND_GREEN );
- int b = Const.toInt( getProperty( STRING_BACKGROUND_COLOR_B ), ConstUi.COLOR_BACKGROUND_BLUE );
+ int r =
+ Const.toInt(
+ getProperty(STRING_BACKGROUND_COLOR_R), ConstUi.COLOR_BACKGROUND_RED); // Default:
+ int g = Const.toInt(getProperty(STRING_BACKGROUND_COLOR_G), ConstUi.COLOR_BACKGROUND_GREEN);
+ int b = Const.toInt(getProperty(STRING_BACKGROUND_COLOR_B), ConstUi.COLOR_BACKGROUND_BLUE);
- return new RGB( r, g, b );
+ return new RGB(r, g, b);
}
- public void setGraphColorRGB( RGB c ) {
- setProperty( STRING_GRAPH_COLOR_R, "" + c.red );
- setProperty( STRING_GRAPH_COLOR_G, "" + c.green );
- setProperty( STRING_GRAPH_COLOR_B, "" + c.blue );
+ public void setGraphColorRGB(RGB c) {
+ setProperty(STRING_GRAPH_COLOR_R, "" + c.red);
+ setProperty(STRING_GRAPH_COLOR_G, "" + c.green);
+ setProperty(STRING_GRAPH_COLOR_B, "" + c.blue);
}
public RGB getGraphColorRGB() {
- int r = Const.toInt( getProperty( STRING_GRAPH_COLOR_R ), ConstUi.COLOR_GRAPH_RED ); // default White
- int g = Const.toInt( getProperty( STRING_GRAPH_COLOR_G ), ConstUi.COLOR_GRAPH_GREEN );
- int b = Const.toInt( getProperty( STRING_GRAPH_COLOR_B ), ConstUi.COLOR_GRAPH_BLUE );
+ int r =
+ Const.toInt(getProperty(STRING_GRAPH_COLOR_R), ConstUi.COLOR_GRAPH_RED); // default White
+ int g = Const.toInt(getProperty(STRING_GRAPH_COLOR_G), ConstUi.COLOR_GRAPH_GREEN);
+ int b = Const.toInt(getProperty(STRING_GRAPH_COLOR_B), ConstUi.COLOR_GRAPH_BLUE);
- return new RGB( r, g, b );
+ return new RGB(r, g, b);
}
- public void setTabColorRGB( RGB c ) {
- setProperty( STRING_TAB_COLOR_R, "" + c.red );
- setProperty( STRING_TAB_COLOR_G, "" + c.green );
- setProperty( STRING_TAB_COLOR_B, "" + c.blue );
+ public void setTabColorRGB(RGB c) {
+ setProperty(STRING_TAB_COLOR_R, "" + c.red);
+ setProperty(STRING_TAB_COLOR_G, "" + c.green);
+ setProperty(STRING_TAB_COLOR_B, "" + c.blue);
}
public RGB getTabColorRGB() {
- int r = Const.toInt( getProperty( STRING_TAB_COLOR_R ), ConstUi.COLOR_TAB_RED ); // default White
- int g = Const.toInt( getProperty( STRING_TAB_COLOR_G ), ConstUi.COLOR_TAB_GREEN );
- int b = Const.toInt( getProperty( STRING_TAB_COLOR_B ), ConstUi.COLOR_TAB_BLUE );
+ int r = Const.toInt(getProperty(STRING_TAB_COLOR_R), ConstUi.COLOR_TAB_RED); // default White
+ int g = Const.toInt(getProperty(STRING_TAB_COLOR_G), ConstUi.COLOR_TAB_GREEN);
+ int b = Const.toInt(getProperty(STRING_TAB_COLOR_B), ConstUi.COLOR_TAB_BLUE);
- return new RGB( r, g, b );
+ return new RGB(r, g, b);
}
- public void setIconSize( int size ) {
- setProperty( STRING_ICON_SIZE, "" + size );
+ public void setIconSize(int size) {
+ setProperty(STRING_ICON_SIZE, "" + size);
}
public int getIconSize() {
- return Const.toInt( getProperty( STRING_ICON_SIZE ), ConstUi.ICON_SIZE );
+ return Const.toInt(getProperty(STRING_ICON_SIZE), ConstUi.ICON_SIZE);
}
- public void setZoomFactor( double factor ) {
- setProperty( STRING_ZOOM_FACTOR, Double.toString( factor ) );
+ public void setZoomFactor(double factor) {
+ setProperty(STRING_ZOOM_FACTOR, Double.toString(factor));
}
public double getZoomFactor() {
- String zoomFactorString = getProperty( STRING_ZOOM_FACTOR );
- if ( StringUtils.isNotEmpty( zoomFactorString ) ) {
- return Const.toDouble( zoomFactorString, nativeZoomFactor );
+ String zoomFactorString = getProperty(STRING_ZOOM_FACTOR);
+ if (StringUtils.isNotEmpty(zoomFactorString)) {
+ return Const.toDouble(zoomFactorString, nativeZoomFactor);
} else {
return nativeZoomFactor;
}
@@ -299,235 +324,255 @@ public class PropsUi extends Props {
* @return
*/
public int getMargin() {
- return (int) Math.round( getZoomFactor() * Const.MARGIN );
+ return (int) Math.round(getZoomFactor() * Const.MARGIN);
}
- public void setLineWidth( int width ) {
- setProperty( STRING_LINE_WIDTH, "" + width );
+ public void setLineWidth(int width) {
+ setProperty(STRING_LINE_WIDTH, "" + width);
}
public int getLineWidth() {
- return Const.toInt( getProperty( STRING_LINE_WIDTH ), ConstUi.LINE_WIDTH );
+ return Const.toInt(getProperty(STRING_LINE_WIDTH), ConstUi.LINE_WIDTH);
}
- public void setLastPipeline( String pipeline ) {
- setProperty( STRING_LAST_PREVIEW_PIPELINE, pipeline );
+ public void setLastPipeline(String pipeline) {
+ setProperty(STRING_LAST_PREVIEW_PIPELINE, pipeline);
}
public String getLastPipeline() {
- return getProperty( STRING_LAST_PREVIEW_PIPELINE, "" );
+ return getProperty(STRING_LAST_PREVIEW_PIPELINE, "");
}
- public void setLastPreview( String[] lastpreview, int[] transformsize ) {
- setProperty( STRING_LAST_PREVIEW_TRANSFORM, "" + lastpreview.length );
+ public void setLastPreview(String[] lastpreview, int[] transformsize) {
+ setProperty(STRING_LAST_PREVIEW_TRANSFORM, "" + lastpreview.length);
- for ( int i = 0; i < lastpreview.length; i++ ) {
- setProperty( STRING_LAST_PREVIEW_TRANSFORM + ( i + 1 ), lastpreview[ i ] );
- setProperty( STRING_LAST_PREVIEW_SIZE + ( i + 1 ), "" + transformsize[ i ] );
+ for (int i = 0; i < lastpreview.length; i++) {
+ setProperty(STRING_LAST_PREVIEW_TRANSFORM + (i + 1), lastpreview[i]);
+ setProperty(STRING_LAST_PREVIEW_SIZE + (i + 1), "" + transformsize[i]);
}
}
public String[] getLastPreview() {
- String snr = getProperty( STRING_LAST_PREVIEW_TRANSFORM );
- int nr = Const.toInt( snr, 0 );
- String[] lp = new String[ nr ];
- for ( int i = 0; i < nr; i++ ) {
- lp[ i ] = getProperty( STRING_LAST_PREVIEW_TRANSFORM + ( i + 1 ), "" );
+ String snr = getProperty(STRING_LAST_PREVIEW_TRANSFORM);
+ int nr = Const.toInt(snr, 0);
+ String[] lp = new String[nr];
+ for (int i = 0; i < nr; i++) {
+ lp[i] = getProperty(STRING_LAST_PREVIEW_TRANSFORM + (i + 1), "");
}
return lp;
}
public int[] getLastPreviewSize() {
- String snr = getProperty( STRING_LAST_PREVIEW_TRANSFORM );
- int nr = Const.toInt( snr, 0 );
- int[] si = new int[ nr ];
- for ( int i = 0; i < nr; i++ ) {
- si[ i ] = Const.toInt( getProperty( STRING_LAST_PREVIEW_SIZE + ( i + 1 ), "" ), 0 );
+ String snr = getProperty(STRING_LAST_PREVIEW_TRANSFORM);
+ int nr = Const.toInt(snr, 0);
+ int[] si = new int[nr];
+ for (int i = 0; i < nr; i++) {
+ si[i] = Const.toInt(getProperty(STRING_LAST_PREVIEW_SIZE + (i + 1), ""), 0);
}
return si;
}
public FontData getDefaultFontData() {
- return Display.getCurrent().getSystemFont().getFontData()[ 0 ];
+ return Display.getCurrent().getSystemFont().getFontData()[0];
}
- public void setMaxUndo( int max ) {
- setProperty( STRING_MAX_UNDO, "" + max );
+ public void setMaxUndo(int max) {
+ setProperty(STRING_MAX_UNDO, "" + max);
}
public int getMaxUndo() {
- return Const.toInt( getProperty( STRING_MAX_UNDO ), Const.MAX_UNDO );
+ return Const.toInt(getProperty(STRING_MAX_UNDO), Const.MAX_UNDO);
}
- public void setMiddlePct( int pct ) {
- setProperty( STRING_MIDDLE_PCT, "" + pct );
+ public void setMiddlePct(int pct) {
+ setProperty(STRING_MIDDLE_PCT, "" + pct);
}
public int getMiddlePct() {
- return Const.toInt( getProperty( STRING_MIDDLE_PCT ), Const.MIDDLE_PCT );
+ return Const.toInt(getProperty(STRING_MIDDLE_PCT), Const.MIDDLE_PCT);
}
- public void setScreen( WindowProperty windowProperty ) {
- AuditManager.storeState( LogChannel.UI, HopNamespace.getNamespace(), "shells", windowProperty.getName(), windowProperty.getStateProperties() );
+ public void setScreen(WindowProperty windowProperty) {
+ AuditManager.storeState(
+ LogChannel.UI,
+ HopNamespace.getNamespace(),
+ "shells",
+ windowProperty.getName(),
+ windowProperty.getStateProperties());
}
- public WindowProperty getScreen( String windowName ) {
- if ( windowName == null ) {
+ public WindowProperty getScreen(String windowName) {
+ if (windowName == null) {
return null;
}
- AuditState auditState = AuditManager.retrieveState(LogChannel.UI, HopNamespace.getNamespace(), "shells", windowName);
- if (auditState==null) {
+ AuditState auditState =
+ AuditManager.retrieveState(
+ LogChannel.UI, HopNamespace.getNamespace(), "shells", windowName);
+ if (auditState == null) {
return null;
}
return new WindowProperty(windowName, auditState.getStateMap());
}
-
- public void setOpenLastFile( boolean open ) {
- setProperty( STRING_OPEN_LAST_FILE, open ? YES : NO );
+ public void setOpenLastFile(boolean open) {
+ setProperty(STRING_OPEN_LAST_FILE, open ? YES : NO);
}
public boolean openLastFile() {
- String open = getProperty( STRING_OPEN_LAST_FILE );
- return !NO.equalsIgnoreCase( open );
+ String open = getProperty(STRING_OPEN_LAST_FILE);
+ return !NO.equalsIgnoreCase(open);
}
- public void setAutoSave( boolean autosave ) {
- setProperty( STRING_AUTO_SAVE, autosave ? YES : NO );
+ public void setAutoSave(boolean autosave) {
+ setProperty(STRING_AUTO_SAVE, autosave ? YES : NO);
}
public boolean getAutoSave() {
- String autosave = getProperty( STRING_AUTO_SAVE );
- return YES.equalsIgnoreCase( autosave ); // Default = OFF
+ String autosave = getProperty(STRING_AUTO_SAVE);
+ return YES.equalsIgnoreCase(autosave); // Default = OFF
}
- public void setSaveConfirmation( boolean saveconf ) {
- setProperty( STRING_SAVE_CONF, saveconf ? YES : NO );
+ public void setSaveConfirmation(boolean saveconf) {
+ setProperty(STRING_SAVE_CONF, saveconf ? YES : NO);
}
public boolean getSaveConfirmation() {
- String saveconf = getProperty( STRING_SAVE_CONF );
- return YES.equalsIgnoreCase( saveconf ); // Default = OFF
+ String saveconf = getProperty(STRING_SAVE_CONF);
+ return YES.equalsIgnoreCase(saveconf); // Default = OFF
}
- public void setAutoSplit( boolean autosplit ) {
- setProperty( STRING_AUTO_SPLIT, autosplit ? YES : NO );
+ public void setAutoSplit(boolean autosplit) {
+ setProperty(STRING_AUTO_SPLIT, autosplit ? YES : NO);
}
public boolean getAutoSplit() {
- String autosplit = getProperty( STRING_AUTO_SPLIT );
- return YES.equalsIgnoreCase( autosplit ); // Default = OFF
+ String autosplit = getProperty(STRING_AUTO_SPLIT);
+ return YES.equalsIgnoreCase(autosplit); // Default = OFF
}
- public void setAutoCollapseCoreObjectsTree( boolean autoCollapse ) {
- setProperty( STRING_AUTO_COLLAPSE_CORE_TREE, autoCollapse ? YES : NO );
+ public void setAutoCollapseCoreObjectsTree(boolean autoCollapse) {
+ setProperty(STRING_AUTO_COLLAPSE_CORE_TREE, autoCollapse ? YES : NO);
}
public boolean getAutoCollapseCoreObjectsTree() {
- String autoCollapse = getProperty( STRING_AUTO_COLLAPSE_CORE_TREE );
- return YES.equalsIgnoreCase( autoCollapse ); // Default = OFF
+ String autoCollapse = getProperty(STRING_AUTO_COLLAPSE_CORE_TREE);
+ return YES.equalsIgnoreCase(autoCollapse); // Default = OFF
}
- public void setExitWarningShown( boolean show ) {
- setProperty( STRING_SHOW_EXIT_WARNING, show ? YES : NO );
+ public void setExitWarningShown(boolean show) {
+ setProperty(STRING_SHOW_EXIT_WARNING, show ? YES : NO);
}
public boolean isShowCanvasGridEnabled() {
- String showCanvas = getProperty( STRING_SHOW_CANVAS_GRID, NO );
- return YES.equalsIgnoreCase( showCanvas ); // Default: don't show canvas grid
+ String showCanvas = getProperty(STRING_SHOW_CANVAS_GRID, NO);
+ return YES.equalsIgnoreCase(showCanvas); // Default: don't show canvas grid
}
- public void setShowCanvasGridEnabled( boolean anti ) {
- setProperty( STRING_SHOW_CANVAS_GRID, anti ? YES : NO );
+ public void setShowCanvasGridEnabled(boolean anti) {
+ setProperty(STRING_SHOW_CANVAS_GRID, anti ? YES : NO);
}
public boolean showExitWarning() {
- String show = getProperty( STRING_SHOW_EXIT_WARNING, YES );
- return YES.equalsIgnoreCase( show ); // Default: show repositories dialog at startup
+ String show = getProperty(STRING_SHOW_EXIT_WARNING, YES);
+ return YES.equalsIgnoreCase(show); // Default: show repositories dialog at startup
}
public boolean isOSLookShown() {
- String show = getProperty( STRING_SHOW_OS_LOOK, NO );
- return YES.equalsIgnoreCase( show ); // Default: don't show gray dialog boxes, show Hop look.
+ String show = getProperty(STRING_SHOW_OS_LOOK, NO);
+ return YES.equalsIgnoreCase(show); // Default: don't show gray dialog boxes, show Hop look.
}
- public void setOSLookShown( boolean show ) {
- setProperty( STRING_SHOW_OS_LOOK, show ? YES : NO );
+ public void setOSLookShown(boolean show) {
+ setProperty(STRING_SHOW_OS_LOOK, show ? YES : NO);
}
- public static void setGCFont( GC gc, Device device, FontData fontData ) {
- if ( Const.getSystemOs().startsWith( "Windows" ) ) {
- Font font = new Font( device, fontData );
- gc.setFont( font );
+ public static void setGCFont(GC gc, Device device, FontData fontData) {
+ if (Const.getSystemOs().startsWith("Windows")) {
+ Font font = new Font(device, fontData);
+ gc.setFont(font);
font.dispose();
} else {
- gc.setFont( device.getSystemFont() );
+ gc.setFont(device.getSystemFont());
}
}
- public void setLook( Control widget ) {
- if (widget instanceof Combo ) {
+ public void setLook(Control widget) {
+ if (widget instanceof Combo) {
return; // Just keep the default
}
- setLook( widget, WIDGET_STYLE_DEFAULT );
+ setLook(widget, WIDGET_STYLE_DEFAULT);
- if ( widget instanceof Composite ) {
- for ( Control child : ( (Composite) widget ).getChildren() ) {
- setLook( child );
+ if (widget instanceof Composite) {
+ for (Control child : ((Composite) widget).getChildren()) {
+ setLook(child);
}
}
}
- public void setLook( final Control control, int style ) {
- if ( this.isOSLookShown() && style != WIDGET_STYLE_FIXED ) {
+ public void setLook(final Control control, int style) {
+ if (this.isOSLookShown() && style != WIDGET_STYLE_FIXED) {
return;
}
final GuiResource gui = GuiResource.getInstance();
Font font = null;
Color background = null;
+ Color foreground = null;
- switch ( style ) {
+ switch (style) {
case WIDGET_STYLE_DEFAULT:
background = gui.getColorBackground();
- if ( control instanceof Group && OS.indexOf( "mac" ) > -1 ) {
- control.addPaintListener( paintEvent -> {
- paintEvent.gc.setBackground( gui.getColorBackground() );
- paintEvent.gc.fillRectangle( 2, 0, control.getBounds().width - 8, control.getBounds().height - 20 );
- } );
+ foreground = gui.getColorBlack();
+ if (control instanceof Group && OS.indexOf("mac") > -1) {
+ control.addPaintListener(
+ paintEvent -> {
+ paintEvent.gc.setForeground(gui.getColorBlack());
+ paintEvent.gc.setBackground(gui.getColorBackground());
+ paintEvent.gc.fillRectangle(
+ 2, 0, control.getBounds().width - 8, control.getBounds().height - 20);
+ });
}
font = null; // GuiResource.getInstance().getFontDefault();
break;
case WIDGET_STYLE_FIXED:
- if ( !this.isOSLookShown() ) {
+ if (!this.isOSLookShown()) {
+ foreground = gui.getColorBlack();
background = gui.getColorBackground();
}
font = gui.getFontFixed();
break;
case WIDGET_STYLE_TABLE:
+ foreground = gui.getColorBackground();
background = gui.getColorBackground();
font = null; // gui.getFontGrid();
break;
case WIDGET_STYLE_NOTEPAD:
+ foreground = gui.getColorBackground();
background = gui.getColorBackground();
font = gui.getFontNote();
break;
case WIDGET_STYLE_GRAPH:
+ foreground = gui.getColorBackground();
background = gui.getColorBackground();
font = gui.getFontGraph();
break;
case WIDGET_STYLE_TOOLBAR:
- background = GuiResource.getInstance().getColorDemoGray();
+ foreground = gui.getColorBackground();
+ if (PropsUi.instance.isDarkMode()) {
+ background = GuiResource.getInstance().getColorBackground();
+ } else {
+ background = GuiResource.getInstance().getColorDemoGray();
+ }
break;
case WIDGET_STYLE_TAB:
background = GuiResource.getInstance().getColorWhite();
CTabFolder tabFolder = (CTabFolder) control;
- tabFolder.setBorderVisible( true );
+ tabFolder.setBorderVisible(true);
// need to make a copy of the tab selection background color to get around PDI-13940
Color c = GuiResource.getInstance().getColorTab();
- Color tabColor = new Color( c.getDevice(), c.getRed(), c.getGreen(), c.getBlue() );
- tabFolder.setSelectionBackground( tabColor );
+ Color tabColor = new Color(c.getDevice(), c.getRed(), c.getGreen(), c.getBlue());
+ tabFolder.setSelectionBackground(tabColor);
break;
default:
background = gui.getColorBackground();
@@ -535,109 +580,130 @@ public class PropsUi extends Props {
break;
}
- if ( font != null && !font.isDisposed() ) {
- control.setFont( font );
+ if (font != null && !font.isDisposed()) {
+ control.setFont(font);
+ }
+
+ if (background != null && !background.isDisposed()) {
+ boolean setBackground = true;
+ if (control instanceof Button) {
+ Button b = (Button) control;
+ if ((b.getStyle() & SWT.PUSH) != 0) {
+ setBackground = false;
+ }
+ }
+ if (setBackground) {
+ control.setBackground(background);
+ }
}
- if ( background != null && !background.isDisposed() ) {
- if ( control instanceof Button ) {
+ if (foreground != null && !foreground.isDisposed()) {
+ boolean setForeground = true;
+ if (control instanceof Button) {
Button b = (Button) control;
- if ( ( b.getStyle() & SWT.PUSH ) != 0 ) {
- return;
+ if ((b.getStyle() & SWT.PUSH) != 0) {
+ setForeground = false;
}
}
- control.setBackground( background );
+ if (setForeground) {
+ control.setForeground(foreground);
+ }
}
}
- public static void setTableItemLook( TableItem item, Display disp ) {
- if ( !Const.getSystemOs().startsWith( "Windows" ) ) {
+ public static void setTableItemLook(TableItem item, Display disp) {
+ if (!Const.getSystemOs().startsWith("Windows")) {
return;
}
Color background = GuiResource.getInstance().getColorBackground();
- if ( background != null ) {
- item.setBackground( background );
+ if (background != null) {
+ item.setBackground(background);
}
}
- /**
- * @return Returns the display.
- */
+ /** @return Returns the display. */
public static Display getDisplay() {
return Display.getCurrent();
}
- public void setDefaultPreviewSize( int size ) {
- setProperty( STRING_DEFAULT_PREVIEW_SIZE, "" + size );
+ public void setDefaultPreviewSize(int size) {
+ setProperty(STRING_DEFAULT_PREVIEW_SIZE, "" + size);
}
public int getDefaultPreviewSize() {
- return Const.toInt( getProperty( STRING_DEFAULT_PREVIEW_SIZE ), 1000 );
+ return Const.toInt(getProperty(STRING_DEFAULT_PREVIEW_SIZE), 1000);
}
public boolean showCopyOrDistributeWarning() {
- String show = getProperty( STRING_SHOW_COPY_OR_DISTRIBUTE_WARNING, YES );
- return YES.equalsIgnoreCase( show );
+ String show = getProperty(STRING_SHOW_COPY_OR_DISTRIBUTE_WARNING, YES);
+ return YES.equalsIgnoreCase(show);
}
- public void setShowCopyOrDistributeWarning( boolean show ) {
- setProperty( STRING_SHOW_COPY_OR_DISTRIBUTE_WARNING, show ? YES : NO );
+ public void setShowCopyOrDistributeWarning(boolean show) {
+ setProperty(STRING_SHOW_COPY_OR_DISTRIBUTE_WARNING, show ? YES : NO);
}
- public void setDialogSize( Shell shell, String styleProperty ) {
- String prop = getProperty( styleProperty );
- if ( Utils.isEmpty( prop ) ) {
+ public void setDialogSize(Shell shell, String styleProperty) {
+ String prop = getProperty(styleProperty);
+ if (Utils.isEmpty(prop)) {
return;
}
- String[] xy = prop.split( "," );
- if ( xy.length != 2 ) {
+ String[] xy = prop.split(",");
+ if (xy.length != 2) {
return;
}
- shell.setSize( Integer.parseInt( xy[ 0 ] ), Integer.parseInt( xy[ 1 ] ) );
+ shell.setSize(Integer.parseInt(xy[0]), Integer.parseInt(xy[1]));
}
public boolean useDoubleClick() {
- return YES.equalsIgnoreCase( getProperty( USE_DOUBLE_CLICK_ON_CANVAS, YES) );
+ return YES.equalsIgnoreCase(getProperty(USE_DOUBLE_CLICK_ON_CANVAS, YES));
}
- public void setUseDoubleClickOnCanvas( boolean use ) {
- setProperty( USE_DOUBLE_CLICK_ON_CANVAS, use ? YES : NO );
+ public void setUseDoubleClickOnCanvas(boolean use) {
+ setProperty(USE_DOUBLE_CLICK_ON_CANVAS, use ? YES : NO);
}
public boolean useGlobalFileBookmarks() {
- return YES.equalsIgnoreCase( getProperty( USE_GLOBAL_FILE_BOOKMARKS, YES) );
+ return YES.equalsIgnoreCase(getProperty(USE_GLOBAL_FILE_BOOKMARKS, YES));
}
- public void setUseGlobalFileBookmarks( boolean use ) {
- setProperty( USE_GLOBAL_FILE_BOOKMARKS, use ? YES : NO );
+ public void setUseGlobalFileBookmarks(boolean use) {
+ setProperty(USE_GLOBAL_FILE_BOOKMARKS, use ? YES : NO);
}
+ public boolean isDarkMode() {
+ return YES.equalsIgnoreCase(getProperty(DARK_MODE, NO));
+ }
+
+ public void setDarkMode(boolean darkMode) {
+ setProperty(DARK_MODE, darkMode ? YES : NO);
+ }
public boolean showToolTips() {
- return YES.equalsIgnoreCase( getProperty( SHOW_TOOL_TIPS, YES ) );
+ return YES.equalsIgnoreCase(getProperty(SHOW_TOOL_TIPS, YES));
}
- public void setShowToolTips( boolean show ) {
- setProperty( SHOW_TOOL_TIPS, show ? YES : NO );
+ public void setShowToolTips(boolean show) {
+ setProperty(SHOW_TOOL_TIPS, show ? YES : NO);
}
public boolean isShowingHelpToolTips() {
- return YES.equalsIgnoreCase( getProperty( SHOW_HELP_TOOL_TIPS, YES ) );
+ return YES.equalsIgnoreCase(getProperty(SHOW_HELP_TOOL_TIPS, YES));
}
- public void setShowingHelpToolTips( boolean show ) {
- setProperty( SHOW_HELP_TOOL_TIPS, show ? YES : NO );
+ public void setShowingHelpToolTips(boolean show) {
+ setProperty(SHOW_HELP_TOOL_TIPS, show ? YES : NO);
}
public int getCanvasGridSize() {
- return Const.toInt( getProperty( CANVAS_GRID_SIZE, "16" ), 16 );
+ return Const.toInt(getProperty(CANVAS_GRID_SIZE, "16"), 16);
}
- public void setCanvasGridSize( int gridSize ) {
- setProperty( CANVAS_GRID_SIZE, Integer.toString( gridSize ) );
+ public void setCanvasGridSize(int gridSize) {
+ setProperty(CANVAS_GRID_SIZE, Integer.toString(gridSize));
}
/**
@@ -646,8 +712,8 @@ public class PropsUi extends Props {
* @param property the key for the software version
* @return an integer that represents the supported version for the software.
*/
- public int getSupportedVersion( String property ) {
- return Integer.parseInt( getProperty( property ) );
+ public int getSupportedVersion(String property) {
+ return Integer.parseInt(getProperty(property));
}
/**
@@ -656,29 +722,30 @@ public class PropsUi extends Props {
* @return 'true' if disabled 'false' otherwise.
*/
public boolean isBrowserEnvironmentCheckDisabled() {
- return "Y".equalsIgnoreCase( getProperty( DISABLE_BROWSER_ENVIRONMENT_CHECK, "N" ) );
+ return "Y".equalsIgnoreCase(getProperty(DISABLE_BROWSER_ENVIRONMENT_CHECK, "N"));
}
public boolean isLegacyPerspectiveMode() {
- return "Y".equalsIgnoreCase( getProperty( LEGACY_PERSPECTIVE_MODE, "N" ) );
+ return "Y".equalsIgnoreCase(getProperty(LEGACY_PERSPECTIVE_MODE, "N"));
}
- public static void setLocation( IGuiPosition guiElement, int x, int y ) {
- if ( x < 0 ) {
+ public static void setLocation(IGuiPosition guiElement, int x, int y) {
+ if (x < 0) {
x = 0;
}
- if ( y < 0 ) {
+ if (y < 0) {
y = 0;
}
- guiElement.setLocation( calculateGridPosition( new Point( x, y ) ) );
+ guiElement.setLocation(calculateGridPosition(new Point(x, y)));
}
- public static Point calculateGridPosition( Point p ) {
+ public static Point calculateGridPosition(Point p) {
int gridSize = PropsUi.getInstance().getCanvasGridSize();
- if ( gridSize > 1 ) {
+ if (gridSize > 1) {
// Snap to grid...
//
- return new Point( gridSize * Math.round( p.x / gridSize ), gridSize * Math.round( p.y / gridSize ) );
+ return new Point(
+ gridSize * Math.round(p.x / gridSize), gridSize * Math.round(p.y / gridSize));
} else {
// Normal draw
//
@@ -687,12 +754,12 @@ public class PropsUi extends Props {
}
public boolean isIndicateSlowPipelineTransformsEnabled() {
- String indicate = getProperty( STRING_INDICATE_SLOW_PIPELINE_TRANSFORMS, "Y" );
- return YES.equalsIgnoreCase( indicate );
+ String indicate = getProperty(STRING_INDICATE_SLOW_PIPELINE_TRANSFORMS, "Y");
+ return YES.equalsIgnoreCase(indicate);
}
- public void setIndicateSlowPipelineTransformsEnabled( boolean indicate ) {
- setProperty( STRING_INDICATE_SLOW_PIPELINE_TRANSFORMS, indicate ? YES : NO );
+ public void setIndicateSlowPipelineTransformsEnabled(boolean indicate) {
+ setProperty(STRING_INDICATE_SLOW_PIPELINE_TRANSFORMS, indicate ? YES : NO);
}
/**
@@ -704,12 +771,93 @@ public class PropsUi extends Props {
return nativeZoomFactor;
}
+ /** @param nativeZoomFactor The nativeZoomFactor to set */
+ public static void setNativeZoomFactor(double nativeZoomFactor) {
+ PropsUi.nativeZoomFactor = nativeZoomFactor;
+ }
+
+ private void populateContrastingColors() {
+ contrastingColors = new HashMap<>();
+ contrastingColors.put(toRGB("#000000"), toRGB("#ffffff"));
+ contrastingColors.put(toRGB("#0e3a5a"), toRGB("#c9e8fb"));
+
+ contrastingColors.put(toRGB("#f0f0f0"), toRGB("#0f0f0f"));
+ contrastingColors.put(toRGB("#e1e1e1"), toRGB("#303030"));
+ contrastingColors.put(toRGB("#646464"), toRGB("#707070"));
+
+ contrastingColors.put(toRGB("#ffd700"), toRGB("#0028ff"));
+
+ // Add all the inverse color mappings as well
+ //
+ Map<RGB, RGB> inverse = new HashMap<>();
+ contrastingColors.keySet().stream()
+ .forEach(key -> inverse.put(contrastingColors.get(key), key));
+ contrastingColors.putAll(inverse);
+ }
+
+ private RGB toRGB(String colorString) {
+ int red = Integer.valueOf(colorString.substring(1, 3), 16);
+ int green = Integer.valueOf(colorString.substring(3, 5), 16);
+ int blue = Integer.valueOf(colorString.substring(5, 7), 16);
+ return new RGB(red, green, blue);
+ }
+
/**
- * @param nativeZoomFactor The nativeZoomFactor to set
+ *
+ * @param rgb the color to contrast if the system is in "Dark Mode"
+ * @return The contrasted color
*/
- public static void setNativeZoomFactor( double nativeZoomFactor ) {
- PropsUi.nativeZoomFactor = nativeZoomFactor;
+ public RGB contrastColor(RGB rgb) {
+ if (PropsUi.getInstance().isDarkMode()) {
+ RGB contrastingRGB = contrastingColors.get(rgb);
+ if (contrastingRGB != null) {
+ return contrastingRGB;
+ }
+ // return new RGB(255-rgb.red, 255-rgb.green, 255-rgb.blue);
+ }
+ return rgb;
+ }
+
+
+ public RGB contrastColor( int r, int g, int b ) {
+ return contrastColor( new RGB(r,g,b) );
}
+ public Map<String, String> getContrastingColorStrings() {
+ Map<String, String> map = new HashMap<>();
+ for (RGB rgb : contrastingColors.keySet()) {
+ RGB contrastingRGB = contrastingColors.get(rgb);
+
+ // Lowercase
+ map.put(toColorString(rgb), toColorString(contrastingRGB));
+ // Uppercase
+ map.put(toColorString(rgb).toUpperCase(), toColorString(contrastingRGB));
+ }
+ return map;
+ }
+
+ private String toColorString(RGB rgb) {
+ String r = Integer.toString(rgb.red, 16);
+ r = r.length() == 1 ? "0" + r : r;
+ String g = Integer.toString(rgb.green, 16);
+ g = g.length() == 1 ? "0" + g : g;
+ String b = Integer.toString(rgb.blue, 16);
+ b = b.length() == 1 ? "0" + b : b;
+ return ("#" + r + g + b).toLowerCase();
+ }
+
+ /**
+ * Gets contrastingColors
+ *
+ * @return value of contrastingColors
+ */
+ public Map<RGB, RGB> getContrastingColors() {
+ return contrastingColors;
+ }
+
+ /** @param contrastingColors The contrastingColors to set */
+ public void setContrastingColors(Map<RGB, RGB> contrastingColors) {
+ this.contrastingColors = contrastingColors;
+ }
}
diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/ContextDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/ContextDialog.java
index 38f321a..f9e69be 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/dialog/ContextDialog.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/ContextDialog.java
@@ -298,7 +298,7 @@ public class ContextDialog extends Dialog {
//
iconSize = (int) Math.round(props.getZoomFactor() * props.getIconSize() * 0.75);
margin = (int) (Const.MARGIN * props.getZoomFactor());
- highlightColor = new Color(parent.getDisplay(), 201, 232, 251);
+ highlightColor = new Color(parent.getDisplay(), props.contrastColor(201, 232, 251));
}
public GuiAction open() {
diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterOptionsDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterOptionsDialog.java
index 47025d0..6f306ea 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterOptionsDialog.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterOptionsDialog.java
@@ -122,6 +122,8 @@ public class EnterOptionsDialog extends Dialog {
private Button wOriginalLook;
+ private Button wDarkMode;
+
private Button wShowCanvasGrid;
private Button wUseCache;
@@ -813,6 +815,24 @@ public class EnterOptionsDialog extends Dialog {
fdOriginalLook.right = new FormAttachment(100, 0);
wOriginalLook.setLayoutData(fdOriginalLook);
+ // Show original look
+ Label wlDarkMode = new Label(wLookComp, SWT.RIGHT);
+ wlDarkMode.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.DarkMode.Label"));
+ props.setLook(wlDarkMode);
+ FormData fdlDarkMode = new FormData();
+ fdlDarkMode.left = new FormAttachment(0, 0);
+ fdlDarkMode.top = new FormAttachment(wlOriginalLook, 2*margin);
+ fdlDarkMode.right = new FormAttachment(middle, -margin);
+ wlDarkMode.setLayoutData(fdlDarkMode);
+ wDarkMode = new Button(wLookComp, SWT.CHECK);
+ wDarkMode.setSelection( props.isDarkMode() );
+ props.setLook(wDarkMode);
+ FormData fdDarkMode = new FormData();
+ fdDarkMode.left = new FormAttachment(middle, 0);
+ fdDarkMode.top = new FormAttachment(wlDarkMode, 0, SWT.CENTER);
+ fdDarkMode.right = new FormAttachment(100, 0);
+ wDarkMode.setLayoutData(fdDarkMode);
+
// DefaultLocale line
Label wlDefaultLocale = new Label(wLookComp, SWT.RIGHT);
wlDefaultLocale.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.DefaultLocale.Label"));
@@ -820,7 +840,7 @@ public class EnterOptionsDialog extends Dialog {
FormData fdlDefaultLocale = new FormData();
fdlDefaultLocale.left = new FormAttachment(0, 0);
fdlDefaultLocale.right = new FormAttachment(middle, -margin);
- fdlDefaultLocale.top = new FormAttachment(wOriginalLook, margin);
+ fdlDefaultLocale.top = new FormAttachment(wlDarkMode, 2*margin);
wlDefaultLocale.setLayoutData(fdlDefaultLocale);
wDefaultLocale = new Combo(wLookComp, SWT.SINGLE | SWT.READ_ONLY | SWT.LEFT | SWT.BORDER);
wDefaultLocale.setItems(GlobalMessages.localeDescr);
@@ -1392,6 +1412,7 @@ public class EnterOptionsDialog extends Dialog {
props.setShowCanvasGridEnabled(wShowCanvasGrid.getSelection());
props.setExitWarningShown(wExitWarning.getSelection());
props.setOSLookShown(wOriginalLook.getSelection());
+ props.setDarkMode( wDarkMode.getSelection() );
props.setShowToolTips(wToolTip.getSelection());
props.setAutoCollapseCoreObjectsTree(wAutoCollapse.getSelection());
props.setShowingHelpToolTips(wHelpTip.getSelection());
diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/ShowHelpDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/ShowHelpDialog.java
index ae80aac..72d29e1 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/dialog/ShowHelpDialog.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/ShowHelpDialog.java
@@ -160,7 +160,7 @@ public class ShowHelpDialog extends Dialog {
fdtext.right = new FormAttachment(printToolBar, -MARGIN);
fdtext.left = new FormAttachment(navigateToolBar, MARGIN);
textURL.setLayoutData(fdtext);
- textURL.setForeground(new Color(display, 101, 101, 101));
+ textURL.setForeground(new Color(display, props.contrastColor( 101, 101, 101)));
// Browser
wBrowser = new Browser(shell, SWT.NONE);
diff --git a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiResource.java b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiResource.java
index 55477da..97976fc 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiResource.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiResource.java
@@ -1,4 +1,4 @@
-//CHECKSTYLE:FileLength:OFF
+// CHECKSTYLE:FileLength:OFF
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -18,7 +18,6 @@
package org.apache.hop.ui.core.gui;
-import org.apache.hop.core.Const;
import org.apache.hop.core.SwtUniversalImage;
import org.apache.hop.core.logging.ILogChannel;
import org.apache.hop.core.logging.LogChannel;
@@ -50,7 +49,7 @@ import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
+
import java.util.Collection;
import java.util.HashMap;
import java.util.Hashtable;
@@ -156,7 +155,6 @@ public class GuiResource {
private Map<String, SwtUniversalImage> imagesActions;
private Map<String, Image> imagesValueMeta;
-
private SwtUniversalImage imageLogo;
private SwtUniversalImage imageDisabledHop;
@@ -202,7 +200,7 @@ public class GuiResource {
private SwtUniversalImage imageInject;
private SwtUniversalImage imageBalance;
private SwtUniversalImage imageCheckpoint;
-
+
private Image imageEmpty;
private Image imageExpandAll;
private Image imageCollapseAll;
@@ -239,7 +237,7 @@ public class GuiResource {
private Image imageShowResults;
private Image imageHideResults;
private Image imageSearch;
- private Image imageRegEx;
+ private Image imageRegEx;
private Image imageAddAll;
private Image imageAddSingle;
private Image imageRemoveAll;
@@ -260,15 +258,14 @@ public class GuiResource {
private Image imageNew;
private Image imageDown;
private Image imageUp;
-
private Map<String, Image> imageMap;
private Map<RGB, Color> colorMap;
/**
- * GuiResource also contains the clipboard as it has to be allocated only once! I don't want to put it in a separate
- * singleton just for this one member.
+ * GuiResource also contains the clipboard as it has to be allocated only once! I don't want to
+ * put it in a separate singleton just for this one member.
*/
private Clipboard clipboard;
@@ -276,63 +273,71 @@ public class GuiResource {
this(Display.getCurrent());
}
- private GuiResource( Display display ) {
+ private GuiResource(Display display) {
this.display = display;
getResources();
- display.addListener( SWT.Dispose, event -> dispose( false ) );
+ display.addListener(SWT.Dispose, event -> dispose(false));
clipboard = null;
// Reload images as required by changes in the plugins
- PluginRegistry.getInstance().addPluginListener( TransformPluginType.class, new IPluginTypeListener() {
- @Override
- public void pluginAdded( Object serviceObject ) {
- loadTransformImages();
- }
-
- @Override
- public void pluginRemoved( Object serviceObject ) {
- loadTransformImages();
- }
-
- @Override
- public void pluginChanged( Object serviceObject ) {
- }
- } );
-
- PluginRegistry.getInstance().addPluginListener( ActionPluginType.class, new IPluginTypeListener() {
- @Override public void pluginAdded( Object serviceObject ) {
- // make sure we load up the images for any new actions that have been registered
- loadWorkflowActionImages();
- }
-
- @Override public void pluginRemoved( Object serviceObject ) {
- // rebuild the image map, in effect removing the image(s) for actions that have gone away
- loadWorkflowActionImages();
- }
-
- @Override public void pluginChanged( Object serviceObject ) {
- // nothing needed here
- }
- } );
-
+ PluginRegistry.getInstance()
+ .addPluginListener(
+ TransformPluginType.class,
+ new IPluginTypeListener() {
+ @Override
+ public void pluginAdded(Object serviceObject) {
+ loadTransformImages();
+ }
+
+ @Override
+ public void pluginRemoved(Object serviceObject) {
+ loadTransformImages();
+ }
+
+ @Override
+ public void pluginChanged(Object serviceObject) {}
+ });
+
+ PluginRegistry.getInstance()
+ .addPluginListener(
+ ActionPluginType.class,
+ new IPluginTypeListener() {
+ @Override
+ public void pluginAdded(Object serviceObject) {
+ // make sure we load up the images for any new actions that have been registered
+ loadWorkflowActionImages();
+ }
+
+ @Override
+ public void pluginRemoved(Object serviceObject) {
+ // rebuild the image map, in effect removing the image(s) for actions that have gone
+ // away
+ loadWorkflowActionImages();
+ }
+
+ @Override
+ public void pluginChanged(Object serviceObject) {
+ // nothing needed here
+ }
+ });
}
private static final ISingletonProvider PROVIDER;
+
static {
- PROVIDER = (ISingletonProvider) ImplementationLoader.newInstance( GuiResource.class );
+ PROVIDER = (ISingletonProvider) ImplementationLoader.newInstance(GuiResource.class);
}
+
public static final GuiResource getInstance() {
return (GuiResource) PROVIDER.getInstanceInternal();
}
- /**
- * reloads all colors, fonts and images.
- */
+ /** reloads all colors, fonts and images. */
public void reload() {
- dispose( true );
+ dispose(true);
getResources();
}
@@ -342,42 +347,43 @@ public class GuiResource {
imageMap = new HashMap<>();
colorMap = new HashMap<>();
- colorBackground = new ManagedColor( display, props.getBackgroundRGB() );
- colorGraph = new ManagedColor( display, props.getGraphColorRGB() );
- colorTab = new ManagedColor( display, props.getTabColorRGB() );
- colorSuccessGreen = new ManagedColor( display, 0, 139, 0 );
- colorRed = new ManagedColor( display, 255, 0, 0 );
- colorGreen = new ManagedColor( display, 0, 255, 0 );
- colorBlue = new ManagedColor( display, 0, 0, 255 );
- colorYellow = new ManagedColor( display, 255, 255, 0 );
- colorMagenta = new ManagedColor( display, 255, 0, 255 );
- colorPurpule = new ManagedColor( display, 128, 0, 128 );
- colorIndigo = new ManagedColor( display, 75, 0, 130 );
- colorOrange = new ManagedColor( display, 255, 165, 0 );
-
- colorBlueCustomGrid = new ManagedColor( display, 240, 248, 255 );
-
- colorWhite = new ManagedColor( display, 255, 255, 255 );
- colorDemoGray = new ManagedColor( display, 240, 240, 240 );
- colorLightGray = new ManagedColor( display, 225, 225, 225 );
- colorGray = new ManagedColor( display, 215, 215, 215 );
- colorDarkGray = new ManagedColor( display, 100, 100, 100 );
- colorBlack = new ManagedColor( display, 0, 0, 0 );
- colorLightBlue = new ManagedColor( display, 135, 206, 250 ); // light sky blue
-
- colorDirectory = new ManagedColor( display, 0, 0, 255 );
- colorHop = new ManagedColor( display, 188, 198, 82 );
- colorLight = new ManagedColor( display, 238, 248, 152 );
- colorCream = new ManagedColor( display, 248, 246, 231 );
-
- colorCrystalText = new ManagedColor( display, 61, 99, 128 );
-
- colorHopDefault = new ManagedColor( display, 61, 99, 128 );
-
- colorHopTrue = new ManagedColor( display, 12, 178, 15 );
-
- colorDeprecated = new ManagedColor( display, 246, 196, 56 );
-
+ colorBackground = new ManagedColor(display, props.contrastColor(props.getBackgroundRGB()));
+ colorGraph = new ManagedColor(display, props.contrastColor(props.getGraphColorRGB()));
+ colorTab = new ManagedColor(display, props.contrastColor(props.getTabColorRGB()));
+ colorSuccessGreen = new ManagedColor(display, props.contrastColor(0, 139, 0));
+ colorRed = new ManagedColor(display, props.contrastColor(255, 0, 0));
+ colorGreen = new ManagedColor(display, props.contrastColor(0, 255, 0));
+ colorBlue = new ManagedColor(display, props.contrastColor(0, 0, 255));
+ colorYellow = new ManagedColor(display, props.contrastColor(255, 255, 0));
+ colorMagenta = new ManagedColor(display, props.contrastColor(255, 0, 255));
+ colorPurpule = new ManagedColor(display, props.contrastColor(128, 0, 128));
+ colorIndigo = new ManagedColor(display, props.contrastColor(75, 0, 130));
+ colorOrange = new ManagedColor(display, props.contrastColor(255, 165, 0));
+
+ colorBlueCustomGrid = new ManagedColor(display, props.contrastColor(240, 248, 255));
+
+ colorWhite = new ManagedColor(display, props.contrastColor(255, 255, 255));
+ colorDemoGray = new ManagedColor(display, props.contrastColor(240, 240, 240));
+ colorLightGray = new ManagedColor(display, props.contrastColor(225, 225, 225));
+ colorGray = new ManagedColor(display, props.contrastColor(215, 215, 215));
+ colorDarkGray = new ManagedColor(display, props.contrastColor(100, 100, 100));
+ colorBlack = new ManagedColor(display, props.contrastColor(0, 0, 0));
+ colorLightBlue =
+ new ManagedColor(display, props.contrastColor(135, 206, 250)); // light sky blue
+
+ colorDirectory = new ManagedColor(display, props.contrastColor(0, 0, 255));
+ colorHop = new ManagedColor(display, props.contrastColor(188, 198, 82));
+ colorLight = new ManagedColor(display, props.contrastColor(238, 248, 152));
+ colorCream = new ManagedColor(display, props.contrastColor(248, 246, 231));
+
+ colorCrystalText = new ManagedColor(display, props.contrastColor(61, 99, 128));
+
+ colorHopDefault = new ManagedColor(display, props.contrastColor(61, 99, 128));
+
+ colorHopTrue = new ManagedColor(display, props.contrastColor(12, 178, 15));
+
+ colorDeprecated = new ManagedColor(display, props.contrastColor(246, 196, 56));
+
// Load all images from files...
loadFonts();
loadCommonImages();
@@ -386,7 +392,7 @@ public class GuiResource {
loadValueMetaImages();
}
- private void dispose( boolean reload ) {
+ private void dispose(boolean reload) {
// Colors
colorBackground.dispose();
colorGraph.dispose();
@@ -416,9 +422,9 @@ public class GuiResource {
colorLight.dispose();
colorCream.dispose();
- disposeColors( colorMap.values() );
+ disposeColors(colorMap.values());
- if ( !reload ) {
+ if (!reload) {
// display shutdown, clean up our mess
// Fonts
@@ -509,10 +515,10 @@ public class GuiResource {
imagePause.dispose();
imageRun.dispose();
imageStop.dispose();
- imageSearch.dispose();
+ imageSearch.dispose();
imageDown.dispose();
- imageUp.dispose();
-
+ imageUp.dispose();
+
imageArrowDefault.dispose();
imageArrowTrue.dispose();
imageArrowFalse.dispose();
@@ -520,63 +526,59 @@ public class GuiResource {
imageArrowDisabled.dispose();
imageArrowCandidate.dispose();
- disposeImage( imageNote );
- disposeImage( imageColor );
- disposeImage( imageEditOption );
- disposeImage( imageResetOption );
- disposeImage( imageShowLog );
- disposeImage( imageShowGrid );
- disposeImage( imageShowHistory );
- disposeImage( imageShowPerf );
- disposeImage( imageShow );
- disposeImage( imageHide );
- disposeImage( imageShowSelected );
- disposeImage( imageShowAll );
- disposeImage( imageClosePanel );
- disposeImage( imageMaximizePanel );
- disposeImage( imageMinimizePanel );
- disposeImage( imageShowErrorLines );
-
-
+ disposeImage(imageNote);
+ disposeImage(imageColor);
+ disposeImage(imageEditOption);
+ disposeImage(imageResetOption);
+ disposeImage(imageShowLog);
+ disposeImage(imageShowGrid);
+ disposeImage(imageShowHistory);
+ disposeImage(imageShowPerf);
+ disposeImage(imageShow);
+ disposeImage(imageHide);
+ disposeImage(imageShowSelected);
+ disposeImage(imageShowAll);
+ disposeImage(imageClosePanel);
+ disposeImage(imageMaximizePanel);
+ disposeImage(imageMinimizePanel);
+ disposeImage(imageShowErrorLines);
// big images
- disposeUniversalImages( imagesActions.values() );
- disposeUniversalImages( imagesTransforms.values() );
+ disposeUniversalImages(imagesActions.values());
+ disposeUniversalImages(imagesTransforms.values());
// Dispose of the images in the map
- disposeImages( imageMap.values() );
-
- disposeImages (imagesValueMeta.values() );
+ disposeImages(imageMap.values());
+
+ disposeImages(imagesValueMeta.values());
}
}
- private void disposeImages( Collection<Image> c ) {
- for ( Image image : c ) {
- disposeImage( image );
+ private void disposeImages(Collection<Image> c) {
+ for (Image image : c) {
+ disposeImage(image);
}
}
- private void disposeUniversalImages( Collection<SwtUniversalImage> c ) {
- for ( SwtUniversalImage image : c ) {
+ private void disposeUniversalImages(Collection<SwtUniversalImage> c) {
+ for (SwtUniversalImage image : c) {
image.dispose();
}
}
- private void disposeColors( Collection<Color> colors ) {
- for ( Color color : colors ) {
+ private void disposeColors(Collection<Color> colors) {
+ for (Color color : colors) {
color.dispose();
}
}
- private void disposeImage( Image image ) {
- if ( image != null && !image.isDisposed() ) {
+ private void disposeImage(Image image) {
+ if (image != null && !image.isDisposed()) {
image.dispose();
}
}
- /**
- * Load all transform images from files.
- */
+ /** Load all transform images from files. */
private void loadTransformImages() {
imagesTransforms.clear();
@@ -584,98 +586,123 @@ public class GuiResource {
//
PluginRegistry registry = PluginRegistry.getInstance();
- List<IPlugin> transforms = registry.getPlugins( TransformPluginType.class );
- for ( IPlugin transform : transforms ) {
- if ( imagesTransforms.get( transform.getIds()[ 0 ] ) != null ) {
+ List<IPlugin> transforms = registry.getPlugins(TransformPluginType.class);
+ for (IPlugin transform : transforms) {
+ if (imagesTransforms.get(transform.getIds()[0]) != null) {
continue;
}
SwtUniversalImage image = null;
String filename = transform.getImageFile();
try {
- ClassLoader classLoader = registry.getClassLoader( transform );
- image = SwtSvgImageUtil.getUniversalImage( display, classLoader, filename );
- } catch ( Throwable t ) {
- log.logError( "Error occurred loading image [" + filename + "] for plugin " + transform, t );
+ ClassLoader classLoader = registry.getClassLoader(transform);
+ image = SwtSvgImageUtil.getUniversalImage(display, classLoader, filename);
+ } catch (Throwable t) {
+ log.logError("Error occurred loading image [" + filename + "] for plugin " + transform, t);
} finally {
- if ( image == null ) {
- log.logError( "Unable to load image file [" + filename + "] for plugin " + transform );
- image = SwtSvgImageUtil.getMissingImage( display );
+ if (image == null) {
+ log.logError("Unable to load image file [" + filename + "] for plugin " + transform);
+ image = SwtSvgImageUtil.getMissingImage(display);
}
}
- imagesTransforms.put( transform.getIds()[ 0 ], image );
+ imagesTransforms.put(transform.getIds()[0], image);
}
}
private void loadFonts() {
PropsUi props = PropsUi.getInstance();
- fontGraph = new ManagedFont( display, props.getGraphFont() );
- fontNote = new ManagedFont( display, props.getNoteFont() );
- fontFixed = new ManagedFont( display, props.getFixedFont() );
+ fontGraph = new ManagedFont(display, props.getGraphFont());
+ fontNote = new ManagedFont(display, props.getNoteFont());
+ fontFixed = new ManagedFont(display, props.getFixedFont());
// Create a medium size version of the graph font
- FontData mediumFontData = new FontData( props.getGraphFont().getName(), (int) Math.round( props.getGraphFont().getHeight() * 1.2 ), props.getGraphFont().getStyle() );
- fontMedium = new ManagedFont( display, mediumFontData );
+ FontData mediumFontData =
+ new FontData(
+ props.getGraphFont().getName(),
+ (int) Math.round(props.getGraphFont().getHeight() * 1.2),
+ props.getGraphFont().getStyle());
+ fontMedium = new ManagedFont(display, mediumFontData);
// Create a medium bold size version of the graph font
- FontData mediumFontBoldData = new FontData( props.getGraphFont().getName(), (int) Math.round( props.getGraphFont().getHeight() * 1.2 ), props.getGraphFont().getStyle() | SWT.BOLD );
- fontMediumBold = new ManagedFont( display, mediumFontBoldData );
+ FontData mediumFontBoldData =
+ new FontData(
+ props.getGraphFont().getName(),
+ (int) Math.round(props.getGraphFont().getHeight() * 1.2),
+ props.getGraphFont().getStyle() | SWT.BOLD);
+ fontMediumBold = new ManagedFont(display, mediumFontBoldData);
// Create a large version of the graph font
- FontData largeFontData =new FontData( props.getGraphFont().getName(), mediumFontData.getHeight() + 2, props.getGraphFont().getStyle() );
- fontLarge = new ManagedFont( display, largeFontData );
+ FontData largeFontData =
+ new FontData(
+ props.getGraphFont().getName(),
+ mediumFontData.getHeight() + 2,
+ props.getGraphFont().getStyle());
+ fontLarge = new ManagedFont(display, largeFontData);
// Create a tiny version of the graph font
- FontData tinyFontData = new FontData( props.getGraphFont().getName(), mediumFontData.getHeight() - 2, props.getGraphFont().getStyle() );
- fontTiny = new ManagedFont( display, tinyFontData );
+ FontData tinyFontData =
+ new FontData(
+ props.getGraphFont().getName(),
+ mediumFontData.getHeight() - 2,
+ props.getGraphFont().getStyle());
+ fontTiny = new ManagedFont(display, tinyFontData);
// Create a small version of the graph font
- FontData smallFontData = new FontData( props.getGraphFont().getName(), mediumFontData.getHeight() - 1, props.getGraphFont().getStyle() );
- fontSmall = new ManagedFont( display, smallFontData );
+ FontData smallFontData =
+ new FontData(
+ props.getGraphFont().getName(),
+ mediumFontData.getHeight() - 1,
+ props.getGraphFont().getStyle());
+ fontSmall = new ManagedFont(display, smallFontData);
- FontData boldFontData = new FontData( props.getDefaultFontData().getName(), props.getDefaultFontData().getHeight(), props.getDefaultFontData().getStyle() | SWT.BOLD );
- fontBold = new ManagedFont( display, boldFontData );
+ FontData boldFontData =
+ new FontData(
+ props.getDefaultFontData().getName(),
+ props.getDefaultFontData().getHeight(),
+ props.getDefaultFontData().getStyle() | SWT.BOLD);
+ fontBold = new ManagedFont(display, boldFontData);
}
// load image from svg
//
- public Image loadAsResource( Display display, String location, int size ) {
- SwtUniversalImage img = SwtSvgImageUtil.getImageAsResource( display, location );
+ public Image loadAsResource(Display display, String location, int size) {
+ SwtUniversalImage img = SwtSvgImageUtil.getImageAsResource(display, location);
Image image;
- if ( size > 0 ) {
- int newSize = (int) Math.round( size * zoomFactor );
- image = new Image( display, img.getAsBitmapForSize( display, newSize, newSize ), SWT.IMAGE_COPY );
+ if (size > 0) {
+ int newSize = (int) Math.round(size * zoomFactor);
+ image = new Image(display, img.getAsBitmapForSize(display, newSize, newSize), SWT.IMAGE_COPY);
} else {
- image = new Image( display, img.getAsBitmap( display ), SWT.IMAGE_COPY );
+ image = new Image(display, img.getAsBitmap(display), SWT.IMAGE_COPY);
}
img.dispose();
return image;
}
// load image from svg
- public Image loadAsResource( Display display, String location, int width, int height ) {
- SwtUniversalImage img = SwtSvgImageUtil.getImageAsResource( display, location );
- int newWidth = (int) Math.round( width * zoomFactor );
- int newHeight = (int) Math.round( height * zoomFactor );
- Image image = new Image( display, img.getAsBitmapForSize( display, newWidth, newHeight ), SWT.IMAGE_COPY );
+ public Image loadAsResource(Display display, String location, int width, int height) {
+ SwtUniversalImage img = SwtSvgImageUtil.getImageAsResource(display, location);
+ int newWidth = (int) Math.round(width * zoomFactor);
+ int newHeight = (int) Math.round(height * zoomFactor);
+ Image image =
+ new Image(display, img.getAsBitmapForSize(display, newWidth, newHeight), SWT.IMAGE_COPY);
img.dispose();
return image;
}
private void loadCommonImages() {
-
// Icons 16x16 for buttons, toolbar items, tree items...
//
- imageEmpty = new Image( display, 16, 16 );
+ imageEmpty = new Image(display, 16, 16);
imageAdd = loadAsResource(display, "ui/images/add.svg", ConstUi.SMALL_ICON_SIZE);
imageAddAll = loadAsResource(display, "ui/images/add_all.svg", ConstUi.SMALL_ICON_SIZE);
imageAddSingle = loadAsResource(display, "ui/images/add_single.svg", ConstUi.SMALL_ICON_SIZE);
imageCalendar = loadAsResource(display, "ui/images/calendar.svg", ConstUi.SMALL_ICON_SIZE);
imageClosePanel = loadAsResource(display, "ui/images/close-panel.svg", ConstUi.SMALL_ICON_SIZE);
- imageCollapseAll = loadAsResource(display, "ui/images/collapse-all.svg", ConstUi.SMALL_ICON_SIZE);
+ imageCollapseAll =
+ loadAsResource(display, "ui/images/collapse-all.svg", ConstUi.SMALL_ICON_SIZE);
imageColor = loadAsResource(display, "ui/images/edit_option.svg", ConstUi.SMALL_ICON_SIZE);
imageCancel = loadAsResource(display, "ui/images/cancel.svg", ConstUi.SMALL_ICON_SIZE);
imageCopy = loadAsResource(display, "ui/images/copy.svg", ConstUi.SMALL_ICON_SIZE);
@@ -686,34 +713,45 @@ public class GuiResource {
imageExpandAll = loadAsResource(display, "ui/images/expand-all.svg", ConstUi.SMALL_ICON_SIZE);
imageLabel = loadAsResource(display, "ui/images/label.svg", ConstUi.SMALL_ICON_SIZE);
imageFunction = loadAsResource(display, "ui/images/function.svg", ConstUi.SMALL_ICON_SIZE);
- imageNavigateBack = loadAsResource(display, "ui/images/navigate-back.svg", ConstUi.SMALL_ICON_SIZE);
- imageNavigateForward = loadAsResource(display, "ui/images/navigate-forward.svg", ConstUi.SMALL_ICON_SIZE);
- imageNavigateUp = loadAsResource(display, "ui/images/navigate-up.svg", ConstUi.SMALL_ICON_SIZE);
+ imageNavigateBack =
+ loadAsResource(display, "ui/images/navigate-back.svg", ConstUi.SMALL_ICON_SIZE);
+ imageNavigateForward =
+ loadAsResource(display, "ui/images/navigate-forward.svg", ConstUi.SMALL_ICON_SIZE);
+ imageNavigateUp = loadAsResource(display, "ui/images/navigate-up.svg", ConstUi.SMALL_ICON_SIZE);
imageHelp = loadAsResource(display, "ui/images/help.svg", ConstUi.SMALL_ICON_SIZE);
imageHide = loadAsResource(display, "ui/images/hide.svg", ConstUi.SMALL_ICON_SIZE);
- imageHideResults = loadAsResource(display, "ui/images/hide-results.svg", ConstUi.SMALL_ICON_SIZE);
+ imageHideResults =
+ loadAsResource(display, "ui/images/hide-results.svg", ConstUi.SMALL_ICON_SIZE);
imageHome = loadAsResource(display, "ui/images/home.svg", ConstUi.SMALL_ICON_SIZE);
- imageMaximizePanel = loadAsResource(display, "ui/images/maximize-panel.svg", ConstUi.SMALL_ICON_SIZE);
- imageMinimizePanel = loadAsResource(display, "ui/images/minimize-panel.svg", ConstUi.SMALL_ICON_SIZE);
+ imageMaximizePanel =
+ loadAsResource(display, "ui/images/maximize-panel.svg", ConstUi.SMALL_ICON_SIZE);
+ imageMinimizePanel =
+ loadAsResource(display, "ui/images/minimize-panel.svg", ConstUi.SMALL_ICON_SIZE);
imageNew = loadAsResource(display, "ui/images/new.svg", ConstUi.SMALL_ICON_SIZE);
imageNote = loadAsResource(display, "ui/images/note.svg", ConstUi.SMALL_ICON_SIZE);
imagePrint = loadAsResource(display, "ui/images/print.svg", ConstUi.SMALL_ICON_SIZE);
imageRefresh = loadAsResource(display, "ui/images/refresh.svg", ConstUi.SMALL_ICON_SIZE);
imageRegEx = loadAsResource(display, "ui/images/regex.svg", ConstUi.SMALL_ICON_SIZE);
imageRemoveAll = loadAsResource(display, "ui/images/remove_all.svg", ConstUi.SMALL_ICON_SIZE);
- imageRemoveSingle = loadAsResource(display, "ui/images/remove_single.svg", ConstUi.SMALL_ICON_SIZE);
- imageResetOption = loadAsResource(display, "ui/images/reset_option.svg", ConstUi.SMALL_ICON_SIZE);
+ imageRemoveSingle =
+ loadAsResource(display, "ui/images/remove_single.svg", ConstUi.SMALL_ICON_SIZE);
+ imageResetOption =
+ loadAsResource(display, "ui/images/reset_option.svg", ConstUi.SMALL_ICON_SIZE);
imageSchema = loadAsResource(display, "ui/images/user.svg", ConstUi.SMALL_ICON_SIZE);
imageSearch = loadAsResource(display, "ui/images/search.svg", ConstUi.SMALL_ICON_SIZE);
imageShowAll = loadAsResource(display, "ui/images/show-all.svg", ConstUi.SMALL_ICON_SIZE);
- imageShowErrorLines = loadAsResource(display, "ui/images/show-error-lines.svg", ConstUi.SMALL_ICON_SIZE);
+ imageShowErrorLines =
+ loadAsResource(display, "ui/images/show-error-lines.svg", ConstUi.SMALL_ICON_SIZE);
imageShowGrid = loadAsResource(display, "ui/images/show-grid.svg", ConstUi.SMALL_ICON_SIZE);
- imageShowHistory = loadAsResource(display, "ui/images/show-history.svg", ConstUi.SMALL_ICON_SIZE);
+ imageShowHistory =
+ loadAsResource(display, "ui/images/show-history.svg", ConstUi.SMALL_ICON_SIZE);
imageShow = loadAsResource(display, "ui/images/show.svg", ConstUi.SMALL_ICON_SIZE);
imageShowLog = loadAsResource(display, "ui/images/show-log.svg", ConstUi.SMALL_ICON_SIZE);
imageShowPerf = loadAsResource(display, "ui/images/show-perf.svg", ConstUi.SMALL_ICON_SIZE);
- imageShowResults = loadAsResource(display, "ui/images/show-results.svg", ConstUi.SMALL_ICON_SIZE);
- imageShowSelected = loadAsResource(display, "ui/images/show-selected.svg", ConstUi.SMALL_ICON_SIZE);
+ imageShowResults =
+ loadAsResource(display, "ui/images/show-results.svg", ConstUi.SMALL_ICON_SIZE);
+ imageShowSelected =
+ loadAsResource(display, "ui/images/show-selected.svg", ConstUi.SMALL_ICON_SIZE);
imageSynonym = loadAsResource(display, "ui/images/view.svg", ConstUi.SMALL_ICON_SIZE);
imageTable = loadAsResource(display, "ui/images/table.svg", ConstUi.SMALL_ICON_SIZE);
imageUser = loadAsResource(display, "ui/images/user.svg", ConstUi.SMALL_ICON_SIZE);
@@ -729,74 +767,83 @@ public class GuiResource {
// Svg image
//
- imageLogo = SwtSvgImageUtil.getImageAsResource( display, "ui/images/logo_icon.svg" );
- imagePipeline = SwtSvgImageUtil.getImageAsResource( display, "ui/images/pipeline.svg" );
- imageWorkflow = SwtSvgImageUtil.getImageAsResource( display, "ui/images/workflow.svg" );
- imageServer = SwtSvgImageUtil.getImageAsResource( display, "ui/images/server.svg" );
- imagePreview = SwtSvgImageUtil.getImageAsResource( display, "ui/images/preview.svg" );
- imageTrue = SwtSvgImageUtil.getImageAsResource( display, "ui/images/true.svg" );
- imageFalse = SwtSvgImageUtil.getImageAsResource( display, "ui/images/false.svg" );
- imageVariable = SwtSvgImageUtil.getImageAsResource( display, "ui/images/variable.svg" );
- imageFile = SwtSvgImageUtil.getImageAsResource( display, "ui/images/file.svg" );
- imageFolder = SwtSvgImageUtil.getImageAsResource( display, "ui/images/folder.svg" );
- imagePartitionSchema = SwtSvgImageUtil.getImageAsResource( display, "ui/images/partition_schema.svg");
- imageConnection = SwtSvgImageUtil.getImageAsResource( display, "ui/images/database.svg" );
- imageData = SwtSvgImageUtil.getImageAsResource( display, "ui/images/data.svg" );
- imageEdit = SwtSvgImageUtil.getImageAsResource( display, "ui/images/edit.svg" );
- imageMissing = SwtSvgImageUtil.getImageAsResource( display, "ui/images/missing.svg" );
- imageDeprecated = SwtSvgImageUtil.getImageAsResource( display, "ui/images/deprecated.svg" );
- imageLocked = SwtSvgImageUtil.getImageAsResource( display, "ui/images/lock.svg" );
- imageBol = SwtSvgImageUtil.getImageAsResource( display, "ui/images/bol.svg" );
- imageClearText = SwtSvgImageUtil.getImageAsResource( display, "ui/images/clear-text.svg" );
- imageCopyRows = SwtSvgImageUtil.getImageAsResource( display, "ui/images/copy-rows.svg" );
- imageFailure = SwtSvgImageUtil.getImageAsResource( display, "ui/images/failure.svg" );
- imageSuccess = SwtSvgImageUtil.getImageAsResource( display, "ui/images/success.svg" );
- imageError = SwtSvgImageUtil.getImageAsResource( display, "ui/images/error.svg" );
- imageInfo = SwtSvgImageUtil.getImageAsResource( display, "ui/images/info.svg" );
- imageWarning = SwtSvgImageUtil.getImageAsResource( display, "ui/images/warning.svg" );
- imageEdit = SwtSvgImageUtil.getImageAsResource( display, "ui/images/edit.svg" );
- imageInput = SwtSvgImageUtil.getImageAsResource( display, "ui/images/input.svg" );
- imageOutput = SwtSvgImageUtil.getImageAsResource( display, "ui/images/output.svg" );
- imageTarget = SwtSvgImageUtil.getImageAsResource( display, "ui/images/target.svg" );
- imageContextMenu = SwtSvgImageUtil.getImageAsResource( display, "ui/images/context_menu.svg" );
- imageParallelHop = SwtSvgImageUtil.getImageAsResource( display, "ui/images/parallel-hop.svg" );
- imageUnconditionalHop = SwtSvgImageUtil.getImageAsResource( display, "ui/images/unconditional-hop.svg" );
- imageBusy = SwtSvgImageUtil.getImageAsResource( display, "ui/images/busy.svg" );
- imageInject = SwtSvgImageUtil.getImageAsResource( display, "ui/images/inject.svg" );
- imageBalance = SwtSvgImageUtil.getImageAsResource( display, "ui/images/scales.svg" );
- imageCheckpoint = SwtSvgImageUtil.getImageAsResource( display, "ui/images/checkpoint.svg" );
- imageArrow = SwtSvgImageUtil.getImageAsResource( display, "ui/images/arrow.svg" );
- imageFolderConnections = SwtSvgImageUtil.getImageAsResource( display, "ui/images/folder_connection.svg" );
- imageDisabledHop = SwtSvgImageUtil.getImageAsResource( display, "ui/images/DHOP.svg" );
+ imageLogo = SwtSvgImageUtil.getImageAsResource(display, "ui/images/logo_icon.svg");
+ imagePipeline = SwtSvgImageUtil.getImageAsResource(display, "ui/images/pipeline.svg");
+ imageWorkflow = SwtSvgImageUtil.getImageAsResource(display, "ui/images/workflow.svg");
+ imageServer = SwtSvgImageUtil.getImageAsResource(display, "ui/images/server.svg");
+ imagePreview = SwtSvgImageUtil.getImageAsResource(display, "ui/images/preview.svg");
+ imageTrue = SwtSvgImageUtil.getImageAsResource(display, "ui/images/true.svg");
+ imageFalse = SwtSvgImageUtil.getImageAsResource(display, "ui/images/false.svg");
+ imageVariable = SwtSvgImageUtil.getImageAsResource(display, "ui/images/variable.svg");
+ imageFile = SwtSvgImageUtil.getImageAsResource(display, "ui/images/file.svg");
+ imageFolder = SwtSvgImageUtil.getImageAsResource(display, "ui/images/folder.svg");
+ imagePartitionSchema =
+ SwtSvgImageUtil.getImageAsResource(display, "ui/images/partition_schema.svg");
+ imageConnection = SwtSvgImageUtil.getImageAsResource(display, "ui/images/database.svg");
+ imageData = SwtSvgImageUtil.getImageAsResource(display, "ui/images/data.svg");
+ imageEdit = SwtSvgImageUtil.getImageAsResource(display, "ui/images/edit.svg");
+ imageMissing = SwtSvgImageUtil.getImageAsResource(display, "ui/images/missing.svg");
+ imageDeprecated = SwtSvgImageUtil.getImageAsResource(display, "ui/images/deprecated.svg");
+ imageLocked = SwtSvgImageUtil.getImageAsResource(display, "ui/images/lock.svg");
+ imageBol = SwtSvgImageUtil.getImageAsResource(display, "ui/images/bol.svg");
+ imageClearText = SwtSvgImageUtil.getImageAsResource(display, "ui/images/clear-text.svg");
+ imageCopyRows = SwtSvgImageUtil.getImageAsResource(display, "ui/images/copy-rows.svg");
+ imageFailure = SwtSvgImageUtil.getImageAsResource(display, "ui/images/failure.svg");
+ imageSuccess = SwtSvgImageUtil.getImageAsResource(display, "ui/images/success.svg");
+ imageError = SwtSvgImageUtil.getImageAsResource(display, "ui/images/error.svg");
+ imageInfo = SwtSvgImageUtil.getImageAsResource(display, "ui/images/info.svg");
+ imageWarning = SwtSvgImageUtil.getImageAsResource(display, "ui/images/warning.svg");
+ imageEdit = SwtSvgImageUtil.getImageAsResource(display, "ui/images/edit.svg");
+ imageInput = SwtSvgImageUtil.getImageAsResource(display, "ui/images/input.svg");
+ imageOutput = SwtSvgImageUtil.getImageAsResource(display, "ui/images/output.svg");
+ imageTarget = SwtSvgImageUtil.getImageAsResource(display, "ui/images/target.svg");
+ imageContextMenu = SwtSvgImageUtil.getImageAsResource(display, "ui/images/context_menu.svg");
+ imageParallelHop = SwtSvgImageUtil.getImageAsResource(display, "ui/images/parallel-hop.svg");
+ imageUnconditionalHop =
+ SwtSvgImageUtil.getImageAsResource(display, "ui/images/unconditional-hop.svg");
+ imageBusy = SwtSvgImageUtil.getImageAsResource(display, "ui/images/busy.svg");
+ imageInject = SwtSvgImageUtil.getImageAsResource(display, "ui/images/inject.svg");
+ imageBalance = SwtSvgImageUtil.getImageAsResource(display, "ui/images/scales.svg");
+ imageCheckpoint = SwtSvgImageUtil.getImageAsResource(display, "ui/images/checkpoint.svg");
+ imageArrow = SwtSvgImageUtil.getImageAsResource(display, "ui/images/arrow.svg");
+ imageFolderConnections =
+ SwtSvgImageUtil.getImageAsResource(display, "ui/images/folder_connection.svg");
+ imageDisabledHop = SwtSvgImageUtil.getImageAsResource(display, "ui/images/DHOP.svg");
// Hop arrow
//
- imageArrowDefault = SwtSvgImageUtil.getImageAsResource( display, "ui/images/hop-arrow-default.svg" );
- imageArrowTrue = SwtSvgImageUtil.getImageAsResource( display, "ui/images/hop-arrow-true.svg" );
- imageArrowFalse = SwtSvgImageUtil.getImageAsResource( display, "ui/images/hop-arrow-false.svg" );
- imageArrowError = SwtSvgImageUtil.getImageAsResource( display, "ui/images/hop-arrow-error.svg" );
- imageArrowDisabled = SwtSvgImageUtil.getImageAsResource( display, "ui/images/hop-arrow-disabled.svg" );
- imageArrowCandidate = SwtSvgImageUtil.getImageAsResource( display, "ui/images/hop-arrow-candidate.svg" );
+ imageArrowDefault =
+ SwtSvgImageUtil.getImageAsResource(display, "ui/images/hop-arrow-default.svg");
+ imageArrowTrue = SwtSvgImageUtil.getImageAsResource(display, "ui/images/hop-arrow-true.svg");
+ imageArrowFalse = SwtSvgImageUtil.getImageAsResource(display, "ui/images/hop-arrow-false.svg");
+ imageArrowError = SwtSvgImageUtil.getImageAsResource(display, "ui/images/hop-arrow-error.svg");
+ imageArrowDisabled =
+ SwtSvgImageUtil.getImageAsResource(display, "ui/images/hop-arrow-disabled.svg");
+ imageArrowCandidate =
+ SwtSvgImageUtil.getImageAsResource(display, "ui/images/hop-arrow-candidate.svg");
}
public Image getImageLabel() {
- return imageLabel;}
+ return imageLabel;
+ }
public Image getImageDuplicate() {
- return imageDuplicate;}
+ return imageDuplicate;
+ }
public Image getImageCopy() {
- return imageCopy;}
+ return imageCopy;
+ }
public Image getImageFunction() {
- return imageFunction;}
+ return imageFunction;
+ }
public Image getImageEmpty() {
- return imageEmpty;}
+ return imageEmpty;
+ }
- /**
- * Load all transform images from files.
- */
+ /** Load all transform images from files. */
private void loadWorkflowActionImages() {
imagesActions = new Hashtable<>();
@@ -804,142 +851,124 @@ public class GuiResource {
//
PluginRegistry registry = PluginRegistry.getInstance();
- List<IPlugin> plugins = registry.getPlugins( ActionPluginType.class );
- for ( int i = 0; i < plugins.size(); i++ ) {
- IPlugin plugin = plugins.get( i );
+ List<IPlugin> plugins = registry.getPlugins(ActionPluginType.class);
+ for (int i = 0; i < plugins.size(); i++) {
+ IPlugin plugin = plugins.get(i);
SwtUniversalImage image = null;
String filename = plugin.getImageFile();
try {
- ClassLoader classLoader = registry.getClassLoader( plugin );
- image = SwtSvgImageUtil.getUniversalImage( display, classLoader, filename );
- } catch ( Throwable t ) {
- log.logError( "Error occurred loading image [" + filename + "] for plugin " + plugin.getIds()[ 0 ], t );
+ ClassLoader classLoader = registry.getClassLoader(plugin);
+ image = SwtSvgImageUtil.getUniversalImage(display, classLoader, filename);
+ } catch (Throwable t) {
+ log.logError(
+ "Error occurred loading image [" + filename + "] for plugin " + plugin.getIds()[0], t);
} finally {
- if ( image == null ) {
- log.logError( "Unable to load image [" + filename + "] for plugin " + plugin.getIds()[ 0 ] );
- image = SwtSvgImageUtil.getMissingImage( display );
+ if (image == null) {
+ log.logError("Unable to load image [" + filename + "] for plugin " + plugin.getIds()[0]);
+ image = SwtSvgImageUtil.getMissingImage(display);
}
}
- imagesActions.put( plugin.getIds()[ 0 ], image );
+ imagesActions.put(plugin.getIds()[0], image);
}
}
- /**
- * Load all IValueMeta images from files.
- */
+ /** Load all IValueMeta images from files. */
private void loadValueMetaImages() {
imagesValueMeta = new HashMap<>();
PluginRegistry registry = PluginRegistry.getInstance();
List<IPlugin> plugins = registry.getPlugins(ValueMetaPluginType.class);
for (IPlugin plugin : plugins) {
- Image image = null;
- try {
- ClassLoader classLoader = registry.getClassLoader( plugin );
- image = SwtSvgImageUtil.getImage(
- Display.getCurrent(),
- classLoader,
- plugin.getImageFile(),
- ConstUi.SMALL_ICON_SIZE,
- ConstUi.SMALL_ICON_SIZE);
- } catch (Throwable t) {
+ Image image = null;
+ try {
+ ClassLoader classLoader = registry.getClassLoader(plugin);
+ image =
+ SwtSvgImageUtil.getImage(
+ Display.getCurrent(),
+ classLoader,
+ plugin.getImageFile(),
+ ConstUi.SMALL_ICON_SIZE,
+ ConstUi.SMALL_ICON_SIZE);
+ } catch (Throwable t) {
+ log.logError(
+ "Error occurred loading image ["
+ + plugin.getImageFile()
+ + "] for plugin "
+ + plugin.getIds()[0],
+ t);
+ } finally {
+ if (image == null) {
log.logError(
- "Error occurred loading image [" + plugin.getImageFile() + "] for plugin " + plugin.getIds()[0],
- t);
- } finally {
- if (image == null) {
- log.logError(
- "Unable to load image [" + plugin.getImageFile() + "] for plugin " + plugin.getIds()[0]);
- image = this.imageLabel;
- }
+ "Unable to load image ["
+ + plugin.getImageFile()
+ + "] for plugin "
+ + plugin.getIds()[0]);
+ image = this.imageLabel;
}
+ }
- imagesValueMeta.put(plugin.getIds()[ 0 ], image);
+ imagesValueMeta.put(plugin.getIds()[0], image);
}
}
- /**
- * @return Returns the colorBackground.
- */
+ /** @return Returns the colorBackground. */
public Color getColorBackground() {
return colorBackground.getColor();
}
- /**
- * @return Returns the colorBlack.
- */
+ /** @return Returns the colorBlack. */
public Color getColorBlack() {
return colorBlack.getColor();
}
- /**
- * @return Returns the colorBlue.
- */
+ /** @return Returns the colorBlue. */
public Color getColorBlue() {
return colorBlue.getColor();
}
- /**
- * @return Returns the colorDarkGray.
- */
+ /** @return Returns the colorDarkGray. */
public Color getColorDarkGray() {
return colorDarkGray.getColor();
}
- /**
- * @return Returns the colorDemoGray.
- */
+ /** @return Returns the colorDemoGray. */
public Color getColorDemoGray() {
return colorDemoGray.getColor();
}
- /**
- * @return Returns the colorDirectory.
- */
+ /** @return Returns the colorDirectory. */
public Color getColorDirectory() {
return colorDirectory.getColor();
}
- /**
- * @return Returns the colorGraph.
- */
+ /** @return Returns the colorGraph. */
public Color getColorGraph() {
return colorGraph.getColor();
}
- /**
- * @return Returns the colorGray.
- */
+ /** @return Returns the colorGray. */
public Color getColorGray() {
return colorGray.getColor();
}
- /**
- * @return Returns the colorGreen.
- */
+ /** @return Returns the colorGreen. */
public Color getColorGreen() {
return colorGreen.getColor();
}
- /**
- * @return Returns the colorLightGray.
- */
+ /** @return Returns the colorLightGray. */
public Color getColorLightGray() {
return colorLightGray.getColor();
}
- /**
- * @return Returns the colorLightBlue.
- */
+ /** @return Returns the colorLightBlue. */
public Color getColorLightBlue() {
return colorLightBlue.getColor();
}
- /**
- * @return Returns the colorMagenta.
- */
+ /** @return Returns the colorMagenta. */
public Color getColorMagenta() {
return colorMagenta.getColor();
}
@@ -951,110 +980,82 @@ public class GuiResource {
public Color getColorIndigo() {
return colorIndigo.getColor();
}
-
- /**
- * @return Returns the colorOrange.
- */
+
+ /** @return Returns the colorOrange. */
public Color getColorOrange() {
return colorOrange.getColor();
}
- /**
- * @return Returns the colorSuccessGreen.
- */
+ /** @return Returns the colorSuccessGreen. */
public Color getColorSuccessGreen() {
return colorSuccessGreen.getColor();
}
- /**
- * @return Returns the colorRed.
- */
+ /** @return Returns the colorRed. */
public Color getColorRed() {
return colorRed.getColor();
}
- /**
- * @return Returns the colorBlueCustomGrid.
- */
+ /** @return Returns the colorBlueCustomGrid. */
public Color getColorBlueCustomGrid() {
return colorBlueCustomGrid.getColor();
}
- /**
- * @return Returns the colorTab.
- */
+ /** @return Returns the colorTab. */
public Color getColorTab() {
return colorTab.getColor();
}
- /**
- * @return Returns the colorWhite.
- */
+ /** @return Returns the colorWhite. */
public Color getColorWhite() {
return colorWhite.getColor();
}
- /**
- * @return Returns the colorYellow.
- */
+ /** @return Returns the colorYellow. */
public Color getColorYellow() {
return colorYellow.getColor();
}
- /**
- * @return Returns the fontFixed.
- */
+ /** @return Returns the fontFixed. */
public Font getFontFixed() {
return fontFixed.getFont();
}
- /**
- * @return Returns the fontGraph.
- */
+ /** @return Returns the fontGraph. */
public Font getFontGraph() {
return fontGraph.getFont();
}
- /**
- * @return Returns the fontNote.
- */
+ /** @return Returns the fontNote. */
public Font getFontNote() {
return fontNote.getFont();
}
- /**
- * @return Returns the imageBol.
- */
+ /** @return Returns the imageBol. */
public Image getImageBol() {
- return imageBol.getAsBitmapForSize( display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return imageBol.getAsBitmapForSize(display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
- /**
- * @return Returns the imageCalendar.
- */
+ /** @return Returns the imageCalendar. */
public Image getImageCalendar() {
return imageCalendar;
}
- /**
- * @return Returns the imageServer.
- */
+ /** @return Returns the imageServer. */
public Image getImageServer() {
- return imageServer.getAsBitmapForSize( display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return imageServer.getAsBitmapForSize(
+ display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
- /**
- * @return Returns the imageConnection.
- */
+ /** @return Returns the imageConnection. */
public Image getImageConnection() {
- return imageConnection.getAsBitmapForSize( display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return imageConnection.getAsBitmapForSize(
+ display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
- /**
- * @return Returns the imageConnection.
- */
+ /** @return Returns the imageConnection. */
public Image getImageData() {
- return imageData.getAsBitmapForSize( display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return imageData.getAsBitmapForSize(display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageConnection() {
@@ -1069,165 +1070,138 @@ public class GuiResource {
return imageAdd;
}
- /**
- * @return Returns the imageTable.
- */
+ /** @return Returns the imageTable. */
public Image getImageTable() {
return imageTable;
}
- /**
- * @return Returns the imageTable.
- */
+ /** @return Returns the imageTable. */
public Image getImagePreview() {
- return imagePreview.getAsBitmapForSize( display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return imagePreview.getAsBitmapForSize(
+ display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
- /**
- * @return Returns the imageSchema.
- */
+ /** @return Returns the imageSchema. */
public Image getImageSchema() {
return imageSchema;
}
- /**
- * @return Returns the imageSynonym.
- */
+ /** @return Returns the imageSynonym. */
public Image getImageSynonym() {
return imageSynonym;
}
- /**
- * @return Returns the imageView.
- */
+ /** @return Returns the imageView. */
public Image getImageNote() {
return imageNote;
}
- /**
- * @return Returns the imageColor.
- */
+ /** @return Returns the imageColor. */
public Image getImageColor() {
return imageColor;
}
- /**
- * @return Returns the imageMissing.
- */
+ /** @return Returns the imageMissing. */
public Image getImageMissing() {
- return imageMissing.getAsBitmapForSize( display, ConstUi.ICON_SIZE, ConstUi.ICON_SIZE );
+ return imageMissing.getAsBitmapForSize(display, ConstUi.ICON_SIZE, ConstUi.ICON_SIZE);
}
public SwtUniversalImage getSwtImageMissing() {
return imageMissing;
}
- /**
- * @return Returns the imageHop.
- */
+ /** @return Returns the imageHop. */
public Image getImageHop() {
- return imageLogo.getAsBitmapForSize( display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return imageLogo.getAsBitmapForSize(display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
- /**
- * @return Returns the imageDisabledHop.
- */
+ /** @return Returns the imageDisabledHop. */
public Image getImageDisabledHop() {
- return imageDisabledHop.getAsBitmapForSize( display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return imageDisabledHop.getAsBitmapForSize(
+ display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
- /**
- * @return Returns the imagesTransforms.
- */
+ /** @return Returns the imagesTransforms. */
public Map<String, SwtUniversalImage> getImagesTransforms() {
return imagesTransforms;
}
- /**
- * @return Returns the imagesActions.
- */
+ /** @return Returns the imagesActions. */
public Map<String, SwtUniversalImage> getImagesActions() {
return imagesActions;
}
-
+
/**
- * Return the image of the IValueMeta from plugin
- *
- * @return image
+ * Return the image of the IValueMeta from plugin
+ *
+ * @return image
*/
public Image getImage(IValueMeta valueMeta) {
- if ( valueMeta==null ) return this.imageLabel;
+ if (valueMeta == null) return this.imageLabel;
return imagesValueMeta.get(String.valueOf(valueMeta.getType()));
}
- /**
- * @return the fontLarge
- */
+ /** @return the fontLarge */
public Font getFontLarge() {
return fontLarge.getFont();
}
- /**
- * @return the tiny font
- */
+ /** @return the tiny font */
public Font getFontTiny() {
return fontTiny.getFont();
}
- /**
- * @return the small font
- */
+ /** @return the small font */
public Font getFontSmall() {
return fontSmall.getFont();
}
- /**
- * @return Returns the clipboard.
- */
+ /** @return Returns the clipboard. */
public Clipboard getNewClipboard() {
- if ( clipboard != null ) {
+ if (clipboard != null) {
clipboard.dispose();
clipboard = null;
}
- clipboard = new Clipboard( display );
+ clipboard = new Clipboard(display);
return clipboard;
}
- public void toClipboard( String cliptext ) {
- if ( cliptext == null ) {
+ public void toClipboard(String cliptext) {
+ if (cliptext == null) {
return;
}
getNewClipboard();
TextTransfer tran = TextTransfer.getInstance();
- clipboard.setContents( new String[] { cliptext }, new Transfer[] { tran } );
+ clipboard.setContents(new String[] {cliptext}, new Transfer[] {tran});
}
public String fromClipboard() {
getNewClipboard();
TextTransfer tran = TextTransfer.getInstance();
- return (String) clipboard.getContents( tran );
+ return (String) clipboard.getContents(tran);
}
public Font getFontBold() {
return fontBold.getFont();
}
- private Image getZoomedImaged( SwtUniversalImage universalImage, Device device, int width, int height) {
- return universalImage.getAsBitmapForSize( device, (int)(zoomFactor*width), (int)(zoomFactor*height) );
+ private Image getZoomedImaged(
+ SwtUniversalImage universalImage, Device device, int width, int height) {
+ return universalImage.getAsBitmapForSize(
+ device, (int) (zoomFactor * width), (int) (zoomFactor * height));
}
- /**
- * @return the imageVariable
- */
+ /** @return the imageVariable */
public Image getImageVariable() {
- return getZoomedImaged( imageVariable, display, 10, 10 );
+ return getZoomedImaged(imageVariable, display, 10, 10);
}
public Image getImagePipeline() {
- return getZoomedImaged( imagePipeline, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(
+ imagePipeline, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public Image getImageUser() {
@@ -1235,15 +1209,18 @@ public class GuiResource {
}
public Image getImageFolderConnections() {
- return getZoomedImaged( imagePipeline, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(
+ imagePipeline, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public Image getImagePartitionSchema() {
- return getZoomedImaged( imagePartitionSchema, display, ConstUi.MEDIUM_ICON_SIZE, ConstUi.MEDIUM_ICON_SIZE );
+ return getZoomedImaged(
+ imagePartitionSchema, display, ConstUi.MEDIUM_ICON_SIZE, ConstUi.MEDIUM_ICON_SIZE);
}
public Image getImageWorkflow() {
- return getZoomedImaged( imageWorkflow, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(
+ imageWorkflow, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public Image getEditOptionButton() {
@@ -1254,114 +1231,94 @@ public class GuiResource {
return imageResetOption;
}
- /**
- * @return the imageArrow
- */
+ /** @return the imageArrow */
public Image getImageArrow() {
- return getZoomedImaged( imageArrow, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(imageArrow, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageArrow() {
return imageArrow;
}
- /**
- * @return the imageArrow
- */
+ /** @return the imageArrow */
public Image getImageFolder() {
- return getZoomedImaged( imageFolder, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(imageFolder, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
- /**
- * @return the imageFile
- */
+ /** @return the imageFile */
public Image getImageFile() {
- return getZoomedImaged( imageFile, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
- }
-
- /**
- * @return the color
- */
+ return getZoomedImaged(imageFile, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
+ }
+
+ /** @return the color */
public Color getColorHop() {
return colorHop.getColor();
}
- /**
- * @return the imageLogoSmall
- */
+ /** @return the imageLogoSmall */
public Image getImageHopUi() {
- if(OsHelper.isMac()){
+ if (OsHelper.isMac()) {
return getZoomedImaged(imageLogo, display, 512, 512);
} else {
return getZoomedImaged(imageLogo, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
}
- /**
- * @return the colorLight
- */
+ /** @return the colorLight */
public Color getColorLight() {
return colorLight.getColor();
}
- /**
- * @return the colorCream
- */
+ /** @return the colorCream */
public Color getColorCream() {
return colorCream.getColor();
}
- /**
- * @return the default color of text in the Crystal theme
- */
+ /** @return the default color of text in the Crystal theme */
public Color getColorCrystalText() {
return colorCrystalText.getColor();
}
- /**
- * @return the default color the hop lines for default/unconditional
- */
+ /** @return the default color the hop lines for default/unconditional */
public Color getColorHopDefault() {
return colorHopDefault.getColor();
}
- /**
- * @return the default color the hop lines for the "OK" condition
- */
+ /** @return the default color the hop lines for the "OK" condition */
public Color getColorHopTrue() {
return colorHopTrue.getColor();
}
- /**
- * @return the default color the deprecated condition
- */
+ /** @return the default color the deprecated condition */
public Color getColorDeprecated() {
return colorDeprecated.getColor();
}
- public void drawGradient( Display display, GC gc, Rectangle rect, boolean vertical ) {
- if ( !vertical ) {
- gc.setForeground( display.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ) );
- gc.setBackground( GuiResource.getInstance().getColorHop() );
- gc.fillGradientRectangle( rect.x, rect.y, 2 * rect.width / 3, rect.height, vertical );
- gc.setForeground( GuiResource.getInstance().getColorHop() );
- gc.setBackground( display.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ) );
- gc.fillGradientRectangle( rect.x + 2 * rect.width / 3, rect.y, rect.width / 3 + 1, rect.height, vertical );
+ public void drawGradient(Display display, GC gc, Rectangle rect, boolean vertical) {
+ if (!vertical) {
+ gc.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ gc.setBackground(GuiResource.getInstance().getColorHop());
+ gc.fillGradientRectangle(rect.x, rect.y, 2 * rect.width / 3, rect.height, vertical);
+ gc.setForeground(GuiResource.getInstance().getColorHop());
+ gc.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ gc.fillGradientRectangle(
+ rect.x + 2 * rect.width / 3, rect.y, rect.width / 3 + 1, rect.height, vertical);
} else {
- gc.setForeground( display.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ) );
- gc.setBackground( GuiResource.getInstance().getColorHop() );
- gc.fillGradientRectangle( rect.x, rect.y, rect.width, 2 * rect.height / 3, vertical );
- gc.setForeground( GuiResource.getInstance().getColorHop() );
- gc.setBackground( display.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ) );
- gc.fillGradientRectangle( rect.x, rect.y + 2 * rect.height / 3, rect.width, rect.height / 3 + 1, vertical );
+ gc.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ gc.setBackground(GuiResource.getInstance().getColorHop());
+ gc.fillGradientRectangle(rect.x, rect.y, rect.width, 2 * rect.height / 3, vertical);
+ gc.setForeground(GuiResource.getInstance().getColorHop());
+ gc.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ gc.fillGradientRectangle(
+ rect.x, rect.y + 2 * rect.height / 3, rect.width, rect.height / 3 + 1, vertical);
}
}
- public static Point calculateControlPosition( Control control ) {
+ public static Point calculateControlPosition(Control control) {
// Calculate the exact location...
//
Rectangle r = control.getBounds();
- Point p = control.getParent().toDisplay( r.x, r.y );
+ Point p = control.getParent().toDisplay(r.x, r.y);
return p;
@@ -1379,100 +1336,72 @@ public class GuiResource {
*/
}
- /**
- * @return the fontMedium
- */
+ /** @return the fontMedium */
public Font getFontMedium() {
return fontMedium.getFont();
}
- /**
- * @return the fontMediumBold
- */
+ /** @return the fontMediumBold */
public Font getFontMediumBold() {
return fontMediumBold.getFont();
}
- /**
- * @return the imageShowLog
- */
+ /** @return the imageShowLog */
public Image getImageShowLog() {
return imageShowLog;
}
- /**
- * @return the imageShowGrid
- */
+ /** @return the imageShowGrid */
public Image getImageShowGrid() {
return imageShowGrid;
}
- /**
- * @return the imageShowHistory
- */
+ /** @return the imageShowHistory */
public Image getImageShowHistory() {
return imageShowHistory;
}
- /**
- * @return the imageShowPerf
- */
+ /** @return the imageShowPerf */
public Image getImageShowPerf() {
return imageShowPerf;
}
- /**
- * @return the "hide" image
- */
+ /** @return the "hide" image */
public Image getImageHide() {
return imageHide;
}
- /**
- * @return the "show" image
- */
+ /** @return the "show" image */
public Image getImageShow() {
return imageShow;
}
- /**
- * @return the "show selected" image
- */
+ /** @return the "show selected" image */
public Image getImageShowSelected() {
return imageShowSelected;
}
- /**
- * @return the "show all" image
- */
+ /** @return the "show all" image */
public Image getImageShowAll() {
return imageShowAll;
}
- /**
- * @return the close panel image
- */
+ /** @return the close panel image */
public Image getImageClosePanel() {
return imageClosePanel;
}
- /**
- * @return the maximize panel image
- */
+ /** @return the maximize panel image */
public Image getImageMaximizePanel() {
return imageMaximizePanel;
}
- /**
- * @return the minimize panel image
- */
+ /** @return the minimize panel image */
public Image getImageMinimizePanel() {
return imageMinimizePanel;
}
- /**
- * @return the show error lines image
- */
+ /** @return the show error lines image */
public Image getImageShowErrorLines() {
return imageShowErrorLines;
}
@@ -1486,7 +1415,8 @@ public class GuiResource {
}
public Image getImageClearText() {
- return getZoomedImaged( imageClearText, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(
+ imageClearText, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public Image getImageExpandAll() {
@@ -1502,7 +1432,8 @@ public class GuiResource {
}
public Image getImageCopyHop() {
- return getZoomedImaged( imageCopyRows, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(
+ imageCopyRows, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageCopyRows() {
@@ -1510,7 +1441,7 @@ public class GuiResource {
}
public Image getImageError() {
- return getZoomedImaged( imageError, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(imageError, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageError() {
@@ -1518,7 +1449,7 @@ public class GuiResource {
}
public Image getImageInfo() {
- return getZoomedImaged( imageInfo, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(imageInfo, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageInfo() {
@@ -1526,7 +1457,7 @@ public class GuiResource {
}
public Image getImageWarning() {
- return getZoomedImaged( imageWarning, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(imageWarning, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageWarning() {
@@ -1536,9 +1467,10 @@ public class GuiResource {
public SwtUniversalImage getSwtImageDeprecated() {
return imageDeprecated;
}
-
+
public Image getImageDeprecated() {
- return getZoomedImaged( imageDeprecated, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(
+ imageDeprecated, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public Image getImageNew() {
@@ -1546,7 +1478,7 @@ public class GuiResource {
}
public Image getImageEdit() {
- return getZoomedImaged( imageEdit, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(imageEdit, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageEdit() {
@@ -1566,7 +1498,7 @@ public class GuiResource {
}
public Image getImageInput() {
- return getZoomedImaged( imageInput, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(imageInput, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageInput() {
@@ -1574,7 +1506,7 @@ public class GuiResource {
}
public Image getImageOutput() {
- return getZoomedImaged( imageOutput, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(imageOutput, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageOutput() {
@@ -1582,7 +1514,7 @@ public class GuiResource {
}
public Image getImageTarget() {
- return getZoomedImaged( imageTarget, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(imageTarget, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageTarget() {
@@ -1590,7 +1522,7 @@ public class GuiResource {
}
public Image getImageLocked() {
- return getZoomedImaged( imageLocked, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(imageLocked, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageLocked() {
@@ -1598,15 +1530,15 @@ public class GuiResource {
}
/**
- * Loads an image from a location once. The second time, the image comes from a cache. Because of this, it's important
- * to never dispose of the image you get from here. (easy!) The images are automatically disposed when the application
- * ends.
+ * Loads an image from a location once. The second time, the image comes from a cache. Because of
+ * this, it's important to never dispose of the image you get from here. (easy!) The images are
+ * automatically disposed when the application ends.
*
* @param location the location of the image resource to load
* @return the loaded image
*/
- public Image getImage( String location ) {
- return getImage( location, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ public Image getImage(String location) {
+ return getImage(location, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
/**
@@ -1632,7 +1564,9 @@ public class GuiResource {
SwtUniversalImage svg = SwtSvgImageUtil.getImage(display, location);
int realWidth = (int) Math.round(zoomFactor * width);
int realHeight = (int) Math.round(zoomFactor * height);
- image = new Image(display, svg.getAsBitmapForSize(display, realWidth, realHeight), SWT.IMAGE_COPY);
+ image =
+ new Image(
+ display, svg.getAsBitmapForSize(display, realWidth, realHeight), SWT.IMAGE_COPY);
svg.dispose();
imageMap.put(key, image);
}
@@ -1658,7 +1592,7 @@ public class GuiResource {
builder.append('|');
builder.append(height);
String key = builder.toString();
-
+
Image image = imageMap.get(key);
if (image == null) {
SwtUniversalImage svg = SwtSvgImageUtil.getUniversalImage(display, classLoader, location);
@@ -1669,66 +1603,62 @@ public class GuiResource {
return image;
}
- public Color getColor( int red, int green, int blue ) {
- RGB rgb = new RGB( red, green, blue );
- Color color = colorMap.get( rgb );
- if ( color == null ) {
- color = new Color( display, rgb );
- colorMap.put( rgb, color );
+ public Color getColor(int red, int green, int blue) {
+ RGB rgb = new RGB(red, green, blue);
+ Color color = colorMap.get(rgb);
+ if (color == null) {
+ color = new Color(display, rgb);
+ colorMap.put(rgb, color);
}
return color;
}
/**
- * @return The image map used to cache images loaded from certain location using getImage(String location);
+ * @return The image map used to cache images loaded from certain location using getImage(String
+ * location);
*/
public Map<String, Image> getImageMap() {
return imageMap;
}
- /**
- * @return the imageTrue
- */
+ /** @return the imageTrue */
public Image getImageTrue() {
- return getZoomedImaged( imageTrue, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(imageTrue, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageTrue() {
return imageTrue;
}
- /**
- * @return the imageFalse
- */
+ /** @return the imageFalse */
public Image getImageFalse() {
- return getZoomedImaged( imageFalse, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(imageFalse, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
-
+
public SwtUniversalImage getSwtImageFalse() {
return imageFalse;
}
public Image getImageFailure() {
- return getZoomedImaged( imageFailure, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(imageFailure, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
-
+
public SwtUniversalImage getSwtImageFailure() {
return imageFailure;
}
public Image getImageSuccess() {
- return getZoomedImaged( imageSuccess, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(imageSuccess, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
-
+
public SwtUniversalImage getSwtImageSuccess() {
return imageSuccess;
}
-
- /**
- * @return the imageContextMenu
- */
+
+ /** @return the imageContextMenu */
public Image getImageContextMenu() {
- return getZoomedImaged( imageContextMenu, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(
+ imageContextMenu, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageContextMenu() {
@@ -1736,7 +1666,8 @@ public class GuiResource {
}
public Image getImageParallelHop() {
- return getZoomedImaged( imageParallelHop, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(
+ imageParallelHop, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageParallelHop() {
@@ -1744,7 +1675,8 @@ public class GuiResource {
}
public Image getImageUnconditionalHop() {
- return getZoomedImaged( imageUnconditionalHop, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(
+ imageUnconditionalHop, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageUnconditionalHop() {
@@ -1752,7 +1684,7 @@ public class GuiResource {
}
public Image getImageBusy() {
- return getZoomedImaged( imageBusy, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(imageBusy, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageBusy() {
@@ -1760,7 +1692,7 @@ public class GuiResource {
}
public Image getImageInject() {
- return getZoomedImaged( imageInject, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(imageInject, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageInject() {
@@ -1768,7 +1700,7 @@ public class GuiResource {
}
public Image getImageBalance() {
- return getZoomedImaged( imageBalance, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(imageBalance, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageBalance() {
@@ -1776,7 +1708,8 @@ public class GuiResource {
}
public Image getImageCheckpoint() {
- return getZoomedImaged( imageCheckpoint, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE );
+ return getZoomedImaged(
+ imageCheckpoint, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}
public SwtUniversalImage getSwtImageCheckpoint() {
@@ -1790,11 +1723,11 @@ public class GuiResource {
public Image getImageDown() {
return imageDown;
}
-
+
public Image getImageUp() {
return imageUp;
}
-
+
public Image getImageAddAll() {
return imageAddAll;
}
@@ -1822,7 +1755,7 @@ public class GuiResource {
public Image getImageNavigateUp() {
return imageNavigateUp;
}
-
+
public Image getImageRefresh() {
return imageRefresh;
}
@@ -1846,7 +1779,7 @@ public class GuiResource {
public SwtUniversalImage getSwtImageArrowFalse() {
return imageArrowFalse;
}
-
+
public SwtUniversalImage getSwtImageArrowError() {
return imageArrowError;
}
@@ -1888,7 +1821,7 @@ public class GuiResource {
/**
* Gets image run 16x16
- *
+ *
* @see {@link GuiResource#getImageStop}, {@link GuiResource#getImagePause}
* @return image
*/
@@ -1898,7 +1831,7 @@ public class GuiResource {
/**
* Gets image stop 16x16
- *
+ *
* @see {@link GuiResource#getImageRun}, {@link GuiResource#getImagePause}
* @return image
*/
@@ -1907,7 +1840,7 @@ public class GuiResource {
}
/**
- * Gets imageToolbarView
+ * Gets imageToolbarView
*
* @return value of imageToolbarView
*/
@@ -1923,5 +1856,4 @@ public class GuiResource {
public Image getImageSearch() {
return imageSearch;
}
-
}
diff --git a/ui/src/main/java/org/apache/hop/ui/hopgui/dialog/NotePadDialog.java b/ui/src/main/java/org/apache/hop/ui/hopgui/dialog/NotePadDialog.java
index 961be14..33f77ce 100644
--- a/ui/src/main/java/org/apache/hop/ui/hopgui/dialog/NotePadDialog.java
+++ b/ui/src/main/java/org/apache/hop/ui/hopgui/dialog/NotePadDialog.java
@@ -538,13 +538,13 @@ public class NotePadDialog extends Dialog {
wFontBold.setSelection( notePadMeta.isFontBold() );
wFontItalic.setSelection( notePadMeta.isFontItalic() );
fontColor =
- new Color( shell.getDisplay(), new RGB(
+ new Color( shell.getDisplay(), props.contrastColor(
notePadMeta.getFontColorRed(), notePadMeta.getFontColorGreen(), notePadMeta.getFontColorBlue() ) );
bgColor =
- new Color( shell.getDisplay(), new RGB( notePadMeta.getBackGroundColorRed(), notePadMeta
+ new Color( shell.getDisplay(), props.contrastColor( notePadMeta.getBackGroundColorRed(), notePadMeta
.getBackGroundColorGreen(), notePadMeta.getBackGroundColorBlue() ) );
borderColor =
- new Color( shell.getDisplay(), new RGB( notePadMeta.getBorderColorRed(), notePadMeta
+ new Color( shell.getDisplay(), props.contrastColor( notePadMeta.getBorderColorRed(), notePadMeta
.getBorderColorGreen(), notePadMeta.getBorderColorBlue() ) );
} else {
wFontName.setText( props.getNoteFont().getName() );
@@ -553,15 +553,15 @@ public class NotePadDialog extends Dialog {
wFontItalic.setSelection( false );
fontColor =
new Color(
- shell.getDisplay(), new RGB(
+ shell.getDisplay(), props.contrastColor(
NotePadMeta.COLOR_RGB_BLACK_RED, NotePadMeta.COLOR_RGB_BLACK_GREEN,
NotePadMeta.COLOR_RGB_BLACK_BLUE ) );
bgColor =
- new Color( shell.getDisplay(), new RGB(
+ new Color( shell.getDisplay(), props.contrastColor(
NotePadMeta.COLOR_RGB_DEFAULT_BG_RED, NotePadMeta.COLOR_RGB_DEFAULT_BG_GREEN,
NotePadMeta.COLOR_RGB_DEFAULT_BG_BLUE ) );
borderColor =
- new Color( shell.getDisplay(), new RGB(
+ new Color( shell.getDisplay(), props.contrastColor(
NotePadMeta.COLOR_RGB_DEFAULT_BORDER_RED, NotePadMeta.COLOR_RGB_DEFAULT_BORDER_GREEN,
NotePadMeta.COLOR_RGB_DEFAULT_BORDER_BLUE ) );
}
diff --git a/ui/src/main/java/org/apache/hop/ui/i18n/editor/Translator.java b/ui/src/main/java/org/apache/hop/ui/i18n/editor/Translator.java
index 7986d1a..0c6797d 100644
--- a/ui/src/main/java/org/apache/hop/ui/i18n/editor/Translator.java
+++ b/ui/src/main/java/org/apache/hop/ui/i18n/editor/Translator.java
@@ -90,21 +90,17 @@ public class Translator {
private static final String TRANSLATOR_NAMESPACE = "hop-translator";
- public static final String APP_NAME = BaseMessages.getString( PKG, "i18nDialog.ApplicationName" );
+ public static final String APP_NAME = BaseMessages.getString(PKG, "i18nDialog.ApplicationName");
private Display display;
private Shell shell;
private ILogChannel log;
private PropsUi props;
- /**
- * The crawler that can find and contain all the keys in the source code
- */
+ /** The crawler that can find and contain all the keys in the source code */
private MessagesSourceCrawler crawler;
- /**
- * The translations store containing all the translations for all keys, locale, packages
- */
+ /** The translations store containing all the translations for all keys, locale, packages */
private TranslationsStore store;
private SashForm sashform;
@@ -115,7 +111,6 @@ public class Translator {
private String selectedLocale;
private String selectedMessagesPackage;
-
private Text wReferenceLocale;
private Text wSelectedSourceFolder;
private Text wSelectedPackage;
@@ -127,7 +122,6 @@ public class Translator {
private Text wBundleFile;
private Text wSource;
-
private Button wReload;
private Button wClose;
private Button wApply;
@@ -162,120 +156,135 @@ public class Translator {
private String selectedSourceFolder;
private java.util.List<String> filesToAvoid;
- public Translator( Display display ) {
+ public Translator(Display display) {
this.display = display;
- this.log = new LogChannel( APP_NAME );
+ this.log = new LogChannel(APP_NAME);
this.props = PropsUi.getInstance();
this.filesToAvoid = new ArrayList<>();
}
- public boolean showKey( String key, String messagesPackage ) {
- return !key.startsWith( "System." ) || messagesPackage.equals( BaseMessages.class.getPackage().getName() );
+ public boolean showKey(String key, String messagesPackage) {
+ return !key.startsWith("System.")
+ || messagesPackage.equals(BaseMessages.class.getPackage().getName());
}
public void readFiles() throws HopFileException {
- log.logBasic( BaseMessages.getString( PKG, "i18n.Log.ScanningSourceDirectories" ) );
+ log.logBasic(BaseMessages.getString(PKG, "i18n.Log.ScanningSourceDirectories"));
try {
// Find and read read all the messages files in the root folder
//
- BundlesStore bundlesStore = new BundlesStore( rootFolder );
+ BundlesStore bundlesStore = new BundlesStore(rootFolder);
bundlesStore.findAllMessagesBundles();
// Find all the source directories in the root folder and crawl through them
//
- crawler = new MessagesSourceCrawler( log, rootFolder, bundlesStore );
- crawler.setFilesToAvoid( filesToAvoid );
+ crawler = new MessagesSourceCrawler(log, rootFolder, bundlesStore);
+ crawler.setFilesToAvoid(filesToAvoid);
crawler.crawl();
// Convenience class to look up and manage things
//
- store = new TranslationsStore( log, localeList, referenceLocale, crawler.getSourcePackageOccurrences(), bundlesStore );
+ store =
+ new TranslationsStore(
+ log,
+ localeList,
+ referenceLocale,
+ crawler.getSourcePackageOccurrences(),
+ bundlesStore);
// Keep some statistics
//
Map<String, int[]> folderKeyCounts = new HashMap<>();
Map<String, Integer> nrKeysPerFolder = new HashMap<>();
- for ( String sourceFolder : sourceDirectories ) {
- folderKeyCounts.put( sourceFolder, new int[ localeList.size() ] );
+ for (String sourceFolder : sourceDirectories) {
+ folderKeyCounts.put(sourceFolder, new int[localeList.size()]);
}
- for ( String sourceFolder : sourceDirectories ) {
+ for (String sourceFolder : sourceDirectories) {
- int[] keyCounts = folderKeyCounts.get( sourceFolder );
+ int[] keyCounts = folderKeyCounts.get(sourceFolder);
int nrKeys = 0;
- for ( int i = 0; i < localeList.size(); i++ ) {
- String locale = localeList.get( i );
+ for (int i = 0; i < localeList.size(); i++) {
+ String locale = localeList.get(i);
// Count the number of keys available in that locale...
//
- for ( KeyOccurrence keyOccurrence : crawler.getKeyOccurrences( sourceFolder ) ) {
+ for (KeyOccurrence keyOccurrence : crawler.getKeyOccurrences(sourceFolder)) {
// We don't want the system keys, just the regular ones.
//
- if ( showKey( keyOccurrence.getKey(), keyOccurrence.getMessagesPackage() ) ) {
+ if (showKey(keyOccurrence.getKey(), keyOccurrence.getMessagesPackage())) {
String value =
- store.lookupKeyValue( locale, keyOccurrence.getMessagesPackage(), keyOccurrence.getKey() );
- if ( !Utils.isEmpty( value ) ) {
- keyCounts[ i ]++;
+ store.lookupKeyValue(
+ locale, keyOccurrence.getMessagesPackage(), keyOccurrence.getKey());
+ if (!Utils.isEmpty(value)) {
+ keyCounts[i]++;
}
- if ( locale.equals( referenceLocale ) ) {
+ if (locale.equals(referenceLocale)) {
nrKeys++;
}
}
}
}
- nrKeysPerFolder.put( sourceFolder, new Integer( nrKeys ) );
+ nrKeysPerFolder.put(sourceFolder, new Integer(nrKeys));
}
- DecimalFormat pctFormat = new DecimalFormat( "#00.00" );
- DecimalFormat nrFormat = new DecimalFormat( "00" );
+ DecimalFormat pctFormat = new DecimalFormat("#00.00");
+ DecimalFormat nrFormat = new DecimalFormat("00");
- for ( String sourceFolder : sourceDirectories ) {
- System.out.println( "-------------------------------------" );
- System.out.println( "Folder: " + sourceFolder );
- System.out.println( "-------------------------------------" );
+ for (String sourceFolder : sourceDirectories) {
+ System.out.println("-------------------------------------");
+ System.out.println("Folder: " + sourceFolder);
+ System.out.println("-------------------------------------");
- int nrKeys = nrKeysPerFolder.get( sourceFolder );
- System.out.println( BaseMessages.getString( PKG, "i18n.Log.NumberOfKeysFound", "" + nrKeys ) );
+ int nrKeys = nrKeysPerFolder.get(sourceFolder);
+ System.out.println(BaseMessages.getString(PKG, "i18n.Log.NumberOfKeysFound", "" + nrKeys));
- int[] keyCounts = folderKeyCounts.get( sourceFolder );
+ int[] keyCounts = folderKeyCounts.get(sourceFolder);
- String[] locales = localeList.toArray( new String[ localeList.size() ] );
- for ( int i = 0; i < locales.length; i++ ) {
- for ( int j = 0; j < locales.length - 1; j++ ) {
- if ( keyCounts[ j ] < keyCounts[ j + 1 ] ) {
- int c = keyCounts[ j ];
- keyCounts[ j ] = keyCounts[ j + 1 ];
- keyCounts[ j + 1 ] = c;
+ String[] locales = localeList.toArray(new String[localeList.size()]);
+ for (int i = 0; i < locales.length; i++) {
+ for (int j = 0; j < locales.length - 1; j++) {
+ if (keyCounts[j] < keyCounts[j + 1]) {
+ int c = keyCounts[j];
+ keyCounts[j] = keyCounts[j + 1];
+ keyCounts[j + 1] = c;
- String l = locales[ j ];
- locales[ j ] = locales[ j + 1 ];
- locales[ j + 1 ] = l;
+ String l = locales[j];
+ locales[j] = locales[j + 1];
+ locales[j + 1] = l;
}
}
}
- for ( int i = 0; i < locales.length; i++ ) {
- double donePct = 100 * (double) keyCounts[ i ] / nrKeys;
- int missingKeys = nrKeys - keyCounts[ i ];
+ for (int i = 0; i < locales.length; i++) {
+ double donePct = 100 * (double) keyCounts[i] / nrKeys;
+ int missingKeys = nrKeys - keyCounts[i];
String statusKeys =
- "# "
- + nrFormat.format( i + 1 ) + " : " + locales[ i ] + " : " + pctFormat.format( donePct ) + "% "
- + BaseMessages.getString( PKG, "i18n.Log.CompleteKeys", keyCounts[ i ] )
- + ( missingKeys != 0 ? BaseMessages.getString( PKG, "i18n.Log.MissingKeys", missingKeys ) : "" );
- System.out.println( statusKeys );
+ "# "
+ + nrFormat.format(i + 1)
+ + " : "
+ + locales[i]
+ + " : "
+ + pctFormat.format(donePct)
+ + "% "
+ + BaseMessages.getString(PKG, "i18n.Log.CompleteKeys", keyCounts[i])
+ + (missingKeys != 0
+ ? BaseMessages.getString(PKG, "i18n.Log.MissingKeys", missingKeys)
+ : "");
+ System.out.println(statusKeys);
}
}
- } catch ( Exception e ) {
- throw new HopFileException( BaseMessages.getString( PKG, "i18n.Log.UnableToGetFiles", sourceDirectories
- .toString() ), e );
-
+ } catch (Exception e) {
+ throw new HopFileException(
+ BaseMessages.getString(PKG, "i18n.Log.UnableToGetFiles", sourceDirectories.toString()),
+ e);
}
}
- public void loadConfiguration( String configFile, String sourceFolder ) throws Exception {
+ public void loadConfiguration(String configFile, String sourceFolder) throws Exception {
// What are the locale to handle?
//
this.rootFolder = sourceFolder;
@@ -283,133 +292,141 @@ public class Translator {
localeList = new ArrayList<>();
sourceDirectories = new ArrayList<>();
- FileObject file = HopVfs.getFileObject( configFile );
- if ( file.exists() ) {
+ FileObject file = HopVfs.getFileObject(configFile);
+ if (file.exists()) {
try {
- Document doc = XmlHandler.loadXmlFile( file );
- Node configNode = XmlHandler.getSubNode( doc, "translator-config" );
+ Document doc = XmlHandler.loadXmlFile(file);
+ Node configNode = XmlHandler.getSubNode(doc, "translator-config");
- referenceLocale = XmlHandler.getTagValue( configNode, "reference-locale" );
- singleMessagesFile = XmlHandler.getTagValue( configNode, "single-messages-file" );
+ referenceLocale = XmlHandler.getTagValue(configNode, "reference-locale");
+ singleMessagesFile = XmlHandler.getTagValue(configNode, "single-messages-file");
- Node localeListNode = XmlHandler.getSubNode( configNode, "locale-list" );
- int nrLocale = XmlHandler.countNodes( localeListNode, "locale" );
- if ( nrLocale > 0 ) {
+ Node localeListNode = XmlHandler.getSubNode(configNode, "locale-list");
+ int nrLocale = XmlHandler.countNodes(localeListNode, "locale");
+ if (nrLocale > 0) {
localeList.clear();
}
- for ( int i = 0; i < nrLocale; i++ ) {
- Node localeNode = XmlHandler.getSubNodeByNr( localeListNode, "locale", i );
- String locale = XmlHandler.getNodeValue( localeNode );
- localeList.add( locale );
+ for (int i = 0; i < nrLocale; i++) {
+ Node localeNode = XmlHandler.getSubNodeByNr(localeListNode, "locale", i);
+ String locale = XmlHandler.getNodeValue(localeNode);
+ localeList.add(locale);
}
- Node filesToAvoidNode = XmlHandler.getSubNode( configNode, "files-to-avoid" );
- java.util.List<Node> filesNodes = XmlHandler.getNodes( filesToAvoidNode, "filename" );
+ Node filesToAvoidNode = XmlHandler.getSubNode(configNode, "files-to-avoid");
+ java.util.List<Node> filesNodes = XmlHandler.getNodes(filesToAvoidNode, "filename");
filesToAvoid = new ArrayList<>();
- for ( Node fileNode : filesNodes ) {
- filesToAvoid.add( XmlHandler.getNodeValue( fileNode ) );
+ for (Node fileNode : filesNodes) {
+ filesToAvoid.add(XmlHandler.getNodeValue(fileNode));
}
- } catch ( Exception e ) {
- log.logError( "Translator", "Error reading translator.xml", e );
+ } catch (Exception e) {
+ log.logError("Translator", "Error reading translator.xml", e);
}
}
}
public void open() {
- shell = new Shell( display );
- shell.setLayout( new FillLayout() );
- shell.setText( APP_NAME );
- shell.setImage( GuiResource.getInstance().getImageHopUi() );
+ shell = new Shell(display);
+ shell.setLayout(new FillLayout());
+ shell.setText(APP_NAME);
+ shell.setImage(GuiResource.getInstance().getImageHopUi());
try {
readFiles();
- } catch ( Exception e ) {
+ } catch (Exception e) {
new ErrorDialog(
- shell, "Error reading translations", "There was an unexpected error reading the translations", e );
+ shell,
+ "Error reading translations",
+ "There was an unexpected error reading the translations",
+ e);
}
// Put something on the screen
- sashform = new SashForm( shell, SWT.HORIZONTAL );
- sashform.setLayout( new FormLayout() );
+ sashform = new SashForm(shell, SWT.HORIZONTAL);
+ sashform.setLayout(new FormLayout());
addLists();
addGrid();
addListeners();
- sashform.setWeights( new int[] { 30, 70 } );
- sashform.setVisible( true );
+ sashform.setWeights(new int[] {30, 70});
+ sashform.setVisible(true);
shell.pack();
refresh();
- wPackages.optWidth( true );
- wPackages.getTable().getColumn( 1 ).setWidth( 1 );
+ wPackages.optWidth(true);
+ wPackages.getTable().getColumn(1).setWidth(1);
- BaseTransformDialog.setSize( shell);
+ BaseTransformDialog.setSize(shell);
shell.open();
}
private void addListeners() {
// In case someone dares to press the [X] in the corner ;-)
- shell.addShellListener( new ShellAdapter() {
- public void shellClosed( ShellEvent e ) {
- e.doit = quitFile();
- }
- } );
-
- wReload.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent arg0 ) {
- int[] idx = wPackages.table.getSelectionIndices();
- reload();
- wPackages.table.setSelection( idx );
- }
- } );
-
- wZip.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent arg0 ) {
- saveFilesToZip();
- }
- } );
+ shell.addShellListener(
+ new ShellAdapter() {
+ public void shellClosed(ShellEvent e) {
+ e.doit = quitFile();
+ }
+ });
+
+ wReload.addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent arg0) {
+ int[] idx = wPackages.table.getSelectionIndices();
+ reload();
+ wPackages.table.setSelection(idx);
+ }
+ });
- wClose.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent arg0 ) {
- quitFile();
- }
- } );
+ wZip.addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent arg0) {
+ saveFilesToZip();
+ }
+ });
+ wClose.addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent arg0) {
+ quitFile();
+ }
+ });
}
public void reload() {
try {
- shell.setCursor( display.getSystemCursor( SWT.CURSOR_WAIT ) );
+ shell.setCursor(display.getSystemCursor(SWT.CURSOR_WAIT));
readFiles();
- shell.setCursor( null );
+ shell.setCursor(null);
refresh();
- } catch ( Exception e ) {
- new ErrorDialog( shell, "Error loading data", "There was an unexpected error re-loading the data", e );
+ } catch (Exception e) {
+ new ErrorDialog(
+ shell, "Error loading data", "There was an unexpected error re-loading the data", e);
}
}
public boolean quitFile() {
java.util.List<BundleFile> changedBundleFiles = store.getChangedBundleFiles();
- if ( changedBundleFiles.size() > 0 ) {
- MessageBox mb = new MessageBox( shell, SWT.YES | SWT.NO | SWT.ICON_WARNING );
- mb.setMessage( BaseMessages.getString( PKG, "i18nDialog.ChangedFilesWhenExit", changedBundleFiles.size()
- + "" ) );
- mb.setText( BaseMessages.getString( PKG, "i18nDialog.Warning" ) );
+ if (changedBundleFiles.size() > 0) {
+ MessageBox mb = new MessageBox(shell, SWT.YES | SWT.NO | SWT.ICON_WARNING);
+ mb.setMessage(
+ BaseMessages.getString(
+ PKG, "i18nDialog.ChangedFilesWhenExit", changedBundleFiles.size() + ""));
+ mb.setText(BaseMessages.getString(PKG, "i18nDialog.Warning"));
int answer = mb.open();
- if ( answer == SWT.NO ) {
+ if (answer == SWT.NO) {
return false;
}
}
- WindowProperty winprop = new WindowProperty( shell );
- props.setScreen( winprop );
+ WindowProperty winprop = new WindowProperty(shell);
+ props.setScreen(winprop);
shell.dispose();
display.dispose();
@@ -417,77 +434,103 @@ public class Translator {
}
private void addLists() {
- Composite composite = new Composite( sashform, SWT.NONE );
- props.setLook( composite );
+ Composite composite = new Composite(sashform, SWT.NONE);
+ props.setLook(composite);
FormLayout formLayout = new FormLayout();
formLayout.marginHeight = Const.FORM_MARGIN;
formLayout.marginWidth = Const.FORM_MARGIN;
- composite.setLayout( formLayout );
+ composite.setLayout(formLayout);
- wLocale = new List( composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL );
+ wLocale = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
FormData fdLocale = new FormData();
- fdLocale.left = new FormAttachment( 0, 0 );
- fdLocale.right = new FormAttachment( 100, 0 );
- fdLocale.top = new FormAttachment( 0, 0 );
- fdLocale.bottom = new FormAttachment( 10, 0 );
- wLocale.setLayoutData( fdLocale );
-
- ColumnInfo[] colinfo = new ColumnInfo[] {
- new ColumnInfo( BaseMessages.getString( PKG, "i18nDialog.SourceFolder" ), ColumnInfo.COLUMN_TYPE_TEXT, false, true ),
- new ColumnInfo( BaseMessages.getString( PKG, "i18nDialog.Packagename" ), ColumnInfo.COLUMN_TYPE_TEXT, false, true ), };
-
- wPackages = new TableView( new Variables(), composite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, colinfo, 1, true, null, props );
+ fdLocale.left = new FormAttachment(0, 0);
+ fdLocale.right = new FormAttachment(100, 0);
+ fdLocale.top = new FormAttachment(0, 0);
+ fdLocale.bottom = new FormAttachment(10, 0);
+ wLocale.setLayoutData(fdLocale);
+
+ ColumnInfo[] colinfo =
+ new ColumnInfo[] {
+ new ColumnInfo(
+ BaseMessages.getString(PKG, "i18nDialog.SourceFolder"),
+ ColumnInfo.COLUMN_TYPE_TEXT,
+ false,
+ true),
+ new ColumnInfo(
+ BaseMessages.getString(PKG, "i18nDialog.Packagename"),
+ ColumnInfo.COLUMN_TYPE_TEXT,
+ false,
+ true),
+ };
+
+ wPackages =
+ new TableView(
+ new Variables(),
+ composite,
+ SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER,
+ colinfo,
+ 1,
+ true,
+ null,
+ props);
FormData fdPackages = new FormData();
- fdPackages.left = new FormAttachment( 0, 0 );
- fdPackages.right = new FormAttachment( 100, 0 );
- fdPackages.top = new FormAttachment( wLocale, props.getMargin() );
- fdPackages.bottom = new FormAttachment( 100, 0 );
- wPackages.setLayoutData( fdPackages );
- wPackages.setSortable( false );
+ fdPackages.left = new FormAttachment(0, 0);
+ fdPackages.right = new FormAttachment(100, 0);
+ fdPackages.top = new FormAttachment(wLocale, props.getMargin());
+ fdPackages.bottom = new FormAttachment(100, 0);
+ wPackages.setLayoutData(fdPackages);
+ wPackages.setSortable(false);
FormData fdComposite = new FormData();
- fdComposite.left = new FormAttachment( 0, 0 );
- fdComposite.right = new FormAttachment( 100, 0 );
- fdComposite.top = new FormAttachment( 0, 0 );
- fdComposite.bottom = new FormAttachment( 100, 0 );
- composite.setLayoutData( fdComposite );
+ fdComposite.left = new FormAttachment(0, 0);
+ fdComposite.right = new FormAttachment(100, 0);
+ fdComposite.top = new FormAttachment(0, 0);
+ fdComposite.bottom = new FormAttachment(100, 0);
+ composite.setLayoutData(fdComposite);
// Add a selection listener.
- wLocale.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- refreshGrid();
- }
- } );
- wPackages.table.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- refreshGrid();
- }
- } );
+ wLocale.addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ refreshGrid();
+ }
+ });
+ wPackages.table.addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ refreshGrid();
+ }
+ });
composite.layout();
}
private void addGrid() {
- Composite composite = new Composite( sashform, SWT.NONE );
- props.setLook( composite );
+ Composite composite = new Composite(sashform, SWT.NONE);
+ props.setLook(composite);
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
- composite.setLayout( formLayout );
-
- wReload = new Button( composite, SWT.NONE );
- wReload.setText( BaseMessages.getString( PKG, "i18nDialog.Reload" ) );
- wSave = new Button( composite, SWT.NONE );
- wSave.setText( BaseMessages.getString( PKG, "i18nDialog.Save" ) );
- wZip = new Button( composite, SWT.NONE );
- wZip.setText( BaseMessages.getString( PKG, "i18nDialog.Zip" ) );
- wZip.setToolTipText( BaseMessages.getString( PKG, "i18nDialog.Zip.Tip" ) );
- wClose = new Button( composite, SWT.NONE );
- wClose.setText( BaseMessages.getString( PKG, "i18nDialog.Close" ) );
+ composite.setLayout(formLayout);
+
+ wReload = new Button(composite, SWT.NONE);
+ wReload.setText(BaseMessages.getString(PKG, "i18nDialog.Reload"));
+ wSave = new Button(composite, SWT.NONE);
+ wSave.setText(BaseMessages.getString(PKG, "i18nDialog.Save"));
+ wZip = new Button(composite, SWT.NONE);
+ wZip.setText(BaseMessages.getString(PKG, "i18nDialog.Zip"));
+ wZip.setToolTipText(BaseMessages.getString(PKG, "i18nDialog.Zip.Tip"));
+ wClose = new Button(composite, SWT.NONE);
+ wClose.setText(BaseMessages.getString(PKG, "i18nDialog.Close"));
BaseTransformDialog.positionBottomButtons(
- composite, new Button[] { wReload, wSave, wZip, wClose, }, props.getMargin() * 3, null );
+ composite,
+ new Button[] {
+ wReload, wSave, wZip, wClose,
+ },
+ props.getMargin() * 3,
+ null);
/*
* wSearchG = new Button(composite, SWT.PUSH); wSearchG.setText(" Search &key "); FormData fdSearchG = new
@@ -502,376 +545,391 @@ public class Translator {
int left = 25;
int middle = 40;
- wAll = new Button( composite, SWT.CHECK );
- wAll.setText( BaseMessages.getString( PKG, "i18nDialog.ShowAllkeys" ) );
- props.setLook( wAll );
+ wAll = new Button(composite, SWT.CHECK);
+ wAll.setText(BaseMessages.getString(PKG, "i18nDialog.ShowAllkeys"));
+ props.setLook(wAll);
FormData fdAll = new FormData();
- fdAll.left = new FormAttachment( 0, 0 );
- fdAll.right = new FormAttachment( left, 0 );
- fdAll.bottom = new FormAttachment( wClose, -props.getMargin() );
- wAll.setLayoutData( fdAll );
-
- Label wlTodo = new Label( composite, SWT.LEFT );
- props.setLook( wlTodo );
- wlTodo.setText( BaseMessages.getString( PKG, "i18nDialog.ToDoList" ) );
+ fdAll.left = new FormAttachment(0, 0);
+ fdAll.right = new FormAttachment(left, 0);
+ fdAll.bottom = new FormAttachment(wClose, -props.getMargin());
+ wAll.setLayoutData(fdAll);
+
+ Label wlTodo = new Label(composite, SWT.LEFT);
+ props.setLook(wlTodo);
+ wlTodo.setText(BaseMessages.getString(PKG, "i18nDialog.ToDoList"));
FormData fdlTodo = new FormData();
- fdlTodo.left = new FormAttachment( 0, 0 );
- fdlTodo.right = new FormAttachment( left, 0 );
- fdlTodo.top = new FormAttachment( 0, 0 );
- wlTodo.setLayoutData( fdlTodo );
+ fdlTodo.left = new FormAttachment(0, 0);
+ fdlTodo.right = new FormAttachment(left, 0);
+ fdlTodo.top = new FormAttachment(0, 0);
+ wlTodo.setLayoutData(fdlTodo);
- wTodo = new List( composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL );
+ wTodo = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
FormData fdTodo = new FormData();
- fdTodo.left = new FormAttachment( 0, 0 );
- fdTodo.right = new FormAttachment( left, 0 );
- fdTodo.top = new FormAttachment( wlTodo, props.getMargin() );
- fdTodo.bottom = new FormAttachment( wAll, -props.getMargin() );
- wTodo.setLayoutData( fdTodo );
+ fdTodo.left = new FormAttachment(0, 0);
+ fdTodo.right = new FormAttachment(left, 0);
+ fdTodo.top = new FormAttachment(wlTodo, props.getMargin());
+ fdTodo.bottom = new FormAttachment(wAll, -props.getMargin());
+ wTodo.setLayoutData(fdTodo);
Control lastControl = wlTodo;
// The reference locale
//
- Label wlReferenceLocale = new Label( composite, SWT.RIGHT );
- wlReferenceLocale.setText( BaseMessages.getString( PKG, "i18nDialog.TranslationReferenceLocale" ) );
- props.setLook( wlReferenceLocale );
+ Label wlReferenceLocale = new Label(composite, SWT.RIGHT);
+ wlReferenceLocale.setText(BaseMessages.getString(PKG, "i18nDialog.TranslationReferenceLocale"));
+ props.setLook(wlReferenceLocale);
FormData fdlReferenceLocale = new FormData();
- fdlReferenceLocale.left = new FormAttachment( left, props.getMargin() );
- fdlReferenceLocale.right = new FormAttachment( middle, 0 );
- fdlReferenceLocale.top = new FormAttachment( lastControl, props.getMargin() );
- wlReferenceLocale.setLayoutData( fdlReferenceLocale );
+ fdlReferenceLocale.left = new FormAttachment(left, props.getMargin());
+ fdlReferenceLocale.right = new FormAttachment(middle, 0);
+ fdlReferenceLocale.top = new FormAttachment(lastControl, props.getMargin());
+ wlReferenceLocale.setLayoutData(fdlReferenceLocale);
- wReferenceLocale = new Text( composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL );
- props.setLook( wReferenceLocale );
+ wReferenceLocale = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ props.setLook(wReferenceLocale);
FormData fdReferenceLocale = new FormData();
- fdReferenceLocale.left = new FormAttachment( middle, props.getMargin() );
- fdReferenceLocale.right = new FormAttachment( 100, 0 );
- fdReferenceLocale.top = new FormAttachment( wlReferenceLocale, 0, SWT.CENTER );
- wReferenceLocale.setLayoutData( fdReferenceLocale );
- wReferenceLocale.setEditable( false );
- wReferenceLocale.setText( Const.NVL(referenceLocale, "") );
+ fdReferenceLocale.left = new FormAttachment(middle, props.getMargin());
+ fdReferenceLocale.right = new FormAttachment(100, 0);
+ fdReferenceLocale.top = new FormAttachment(wlReferenceLocale, 0, SWT.CENTER);
+ wReferenceLocale.setLayoutData(fdReferenceLocale);
+ wReferenceLocale.setEditable(false);
+ wReferenceLocale.setText(Const.NVL(referenceLocale, ""));
lastControl = wReferenceLocale;
-
+
// The selected source folder
//
- Label wlSelectedSourceFolder = new Label( composite, SWT.RIGHT );
- wlSelectedSourceFolder.setText( BaseMessages.getString( PKG, "i18nDialog.TranslationSelectedSourceFolder" ) );
- props.setLook( wlSelectedSourceFolder );
+ Label wlSelectedSourceFolder = new Label(composite, SWT.RIGHT);
+ wlSelectedSourceFolder.setText(
+ BaseMessages.getString(PKG, "i18nDialog.TranslationSelectedSourceFolder"));
+ props.setLook(wlSelectedSourceFolder);
FormData fdlSelectedSourceFolder = new FormData();
- fdlSelectedSourceFolder.left = new FormAttachment( left, props.getMargin() );
- fdlSelectedSourceFolder.right = new FormAttachment( middle, 0 );
- fdlSelectedSourceFolder.top = new FormAttachment( lastControl, props.getMargin() );
- wlSelectedSourceFolder.setLayoutData( fdlSelectedSourceFolder );
+ fdlSelectedSourceFolder.left = new FormAttachment(left, props.getMargin());
+ fdlSelectedSourceFolder.right = new FormAttachment(middle, 0);
+ fdlSelectedSourceFolder.top = new FormAttachment(lastControl, props.getMargin());
+ wlSelectedSourceFolder.setLayoutData(fdlSelectedSourceFolder);
- wSelectedSourceFolder = new Text( composite, SWT.SINGLE | SWT.LEFT );
- props.setLook( wSelectedSourceFolder );
+ wSelectedSourceFolder = new Text(composite, SWT.SINGLE | SWT.LEFT);
+ props.setLook(wSelectedSourceFolder);
FormData fdSelectedSourceFolder = new FormData();
- fdSelectedSourceFolder.left = new FormAttachment( middle, props.getMargin() );
- fdSelectedSourceFolder.right = new FormAttachment( 100, 0 );
- fdSelectedSourceFolder.top = new FormAttachment( wlSelectedSourceFolder, 0, SWT.CENTER );
- wSelectedSourceFolder.setLayoutData( fdSelectedSourceFolder );
- wSelectedSourceFolder.setEditable( false );
+ fdSelectedSourceFolder.left = new FormAttachment(middle, props.getMargin());
+ fdSelectedSourceFolder.right = new FormAttachment(100, 0);
+ fdSelectedSourceFolder.top = new FormAttachment(wlSelectedSourceFolder, 0, SWT.CENTER);
+ wSelectedSourceFolder.setLayoutData(fdSelectedSourceFolder);
+ wSelectedSourceFolder.setEditable(false);
lastControl = wSelectedSourceFolder;
-
+
// The selected package
//
- Label wlSelectedPackage = new Label( composite, SWT.RIGHT );
- wlSelectedPackage.setText( BaseMessages.getString( PKG, "i18nDialog.TranslationSelectedPackage" ) );
- props.setLook( wlSelectedPackage );
+ Label wlSelectedPackage = new Label(composite, SWT.RIGHT);
+ wlSelectedPackage.setText(BaseMessages.getString(PKG, "i18nDialog.TranslationSelectedPackage"));
+ props.setLook(wlSelectedPackage);
FormData fdlSelectedPackage = new FormData();
- fdlSelectedPackage.left = new FormAttachment( left, props.getMargin() );
- fdlSelectedPackage.right = new FormAttachment( middle, 0 );
- fdlSelectedPackage.top = new FormAttachment( lastControl, props.getMargin() );
- wlSelectedPackage.setLayoutData( fdlSelectedPackage );
+ fdlSelectedPackage.left = new FormAttachment(left, props.getMargin());
+ fdlSelectedPackage.right = new FormAttachment(middle, 0);
+ fdlSelectedPackage.top = new FormAttachment(lastControl, props.getMargin());
+ wlSelectedPackage.setLayoutData(fdlSelectedPackage);
- wSelectedPackage = new Text( composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL );
- props.setLook( wSelectedPackage );
+ wSelectedPackage = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ props.setLook(wSelectedPackage);
FormData fdSelectedPackage = new FormData();
- fdSelectedPackage.left = new FormAttachment( middle, props.getMargin() );
- fdSelectedPackage.right = new FormAttachment( 100, 0 );
- fdSelectedPackage.top = new FormAttachment( wlSelectedPackage, 0, SWT.CENTER );
- wSelectedPackage.setLayoutData( fdSelectedPackage );
- wSelectedPackage.setEditable( false );
+ fdSelectedPackage.left = new FormAttachment(middle, props.getMargin());
+ fdSelectedPackage.right = new FormAttachment(100, 0);
+ fdSelectedPackage.top = new FormAttachment(wlSelectedPackage, 0, SWT.CENTER);
+ wSelectedPackage.setLayoutData(fdSelectedPackage);
+ wSelectedPackage.setEditable(false);
lastControl = wSelectedPackage;
-
-
// The key
//
- Label wlKey = new Label( composite, SWT.RIGHT );
- wlKey.setText( BaseMessages.getString( PKG, "i18nDialog.TranslationKey" ) );
- props.setLook( wlKey );
+ Label wlKey = new Label(composite, SWT.RIGHT);
+ wlKey.setText(BaseMessages.getString(PKG, "i18nDialog.TranslationKey"));
+ props.setLook(wlKey);
FormData fdlKey = new FormData();
- fdlKey.left = new FormAttachment( left, props.getMargin() );
- fdlKey.right = new FormAttachment( middle, 0 );
- fdlKey.top = new FormAttachment( lastControl, props.getMargin() );
- wlKey.setLayoutData( fdlKey );
+ fdlKey.left = new FormAttachment(left, props.getMargin());
+ fdlKey.right = new FormAttachment(middle, 0);
+ fdlKey.top = new FormAttachment(lastControl, props.getMargin());
+ wlKey.setLayoutData(fdlKey);
- wKey = new Text( composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL );
- props.setLook( wKey );
+ wKey = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ props.setLook(wKey);
FormData fdKey = new FormData();
- fdKey.left = new FormAttachment( middle, props.getMargin() );
- fdKey.right = new FormAttachment( 100, 0 );
- fdKey.top = new FormAttachment( wlKey, 0, SWT.CENTER );
- wKey.setLayoutData( fdKey );
- wKey.setEditable( false );
+ fdKey.left = new FormAttachment(middle, props.getMargin());
+ fdKey.right = new FormAttachment(100, 0);
+ fdKey.top = new FormAttachment(wlKey, 0, SWT.CENTER);
+ wKey.setLayoutData(fdKey);
+ wKey.setEditable(false);
lastControl = wKey;
// The Main translation
//
- Label wlMain = new Label( composite, SWT.RIGHT );
- wlMain.setText( BaseMessages.getString( PKG, "i18nDialog.MainTranslation" ) );
- props.setLook( wlMain );
+ Label wlMain = new Label(composite, SWT.RIGHT);
+ wlMain.setText(BaseMessages.getString(PKG, "i18nDialog.MainTranslation"));
+ props.setLook(wlMain);
FormData fdlMain = new FormData();
- fdlMain.left = new FormAttachment( left, props.getMargin() );
- fdlMain.right = new FormAttachment( middle, 0 );
- fdlMain.top = new FormAttachment( wKey, props.getMargin() );
- wlMain.setLayoutData( fdlMain );
+ fdlMain.left = new FormAttachment(left, props.getMargin());
+ fdlMain.right = new FormAttachment(middle, 0);
+ fdlMain.top = new FormAttachment(wKey, props.getMargin());
+ wlMain.setLayoutData(fdlMain);
- wMain = new Text( composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL );
- props.setLook( wMain );
+ wMain = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ props.setLook(wMain);
FormData fdMain = new FormData();
- fdMain.left = new FormAttachment( middle, props.getMargin() );
- fdMain.right = new FormAttachment( 100, 0 );
- fdMain.top = new FormAttachment( wKey, props.getMargin() );
- fdMain.bottom = new FormAttachment( wKey, 250 + props.getMargin() );
- wMain.setLayoutData( fdMain );
- wMain.setEditable( false );
-
- wSearch = new Button( composite, SWT.PUSH );
- wSearch.setText( BaseMessages.getString( PKG, "i18nDialog.Search" ) );
+ fdMain.left = new FormAttachment(middle, props.getMargin());
+ fdMain.right = new FormAttachment(100, 0);
+ fdMain.top = new FormAttachment(wKey, props.getMargin());
+ fdMain.bottom = new FormAttachment(wKey, 250 + props.getMargin());
+ wMain.setLayoutData(fdMain);
+ wMain.setEditable(false);
+
+ wSearch = new Button(composite, SWT.PUSH);
+ wSearch.setText(BaseMessages.getString(PKG, "i18nDialog.Search"));
FormData fdSearch = new FormData();
- fdSearch.left = new FormAttachment( left, 3*props.getMargin() );
- fdSearch.right = new FormAttachment( middle, -props.getMargin() * 2 );
- fdSearch.top = new FormAttachment( wMain, 0, SWT.CENTER );
- wSearch.setLayoutData( fdSearch );
+ fdSearch.left = new FormAttachment(left, 3 * props.getMargin());
+ fdSearch.right = new FormAttachment(middle, -props.getMargin() * 2);
+ fdSearch.top = new FormAttachment(wMain, 0, SWT.CENTER);
+ wSearch.setLayoutData(fdSearch);
- wNext = new Button( composite, SWT.PUSH );
- wNext.setText( BaseMessages.getString( PKG, "i18nDialog.Next" ) );
+ wNext = new Button(composite, SWT.PUSH);
+ wNext.setText(BaseMessages.getString(PKG, "i18nDialog.Next"));
FormData fdNext = new FormData();
- fdNext.left = new FormAttachment( left, 3*props.getMargin() );
- fdNext.right = new FormAttachment( middle, -props.getMargin() * 2 );
- fdNext.top = new FormAttachment( wSearch, props.getMargin() * 2 );
- wNext.setLayoutData( fdNext );
+ fdNext.left = new FormAttachment(left, 3 * props.getMargin());
+ fdNext.right = new FormAttachment(middle, -props.getMargin() * 2);
+ fdNext.top = new FormAttachment(wSearch, props.getMargin() * 2);
+ wNext.setLayoutData(fdNext);
// A few lines of source code at the bottom...
//
- Label wlSource = new Label( composite, SWT.RIGHT );
- wlSource.setText( BaseMessages.getString( PKG, "i18nDialog.LineOfSourceCode" ) );
- props.setLook( wlSource );
+ Label wlSource = new Label(composite, SWT.RIGHT);
+ wlSource.setText(BaseMessages.getString(PKG, "i18nDialog.LineOfSourceCode"));
+ props.setLook(wlSource);
FormData fdlSource = new FormData();
- fdlSource.left = new FormAttachment( left, props.getMargin() );
- fdlSource.right = new FormAttachment( middle, 0 );
- fdlSource.top = new FormAttachment( wClose, -300 - props.getMargin() );
- wlSource.setLayoutData( fdlSource );
+ fdlSource.left = new FormAttachment(left, props.getMargin());
+ fdlSource.right = new FormAttachment(middle, 0);
+ fdlSource.top = new FormAttachment(wClose, -300 - props.getMargin());
+ wlSource.setLayoutData(fdlSource);
- wSource = new Text( composite, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL );
- props.setLook( wSource );
+ wSource = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
+ props.setLook(wSource);
FormData fdSource = new FormData();
- fdSource.left = new FormAttachment( middle, props.getMargin() );
- fdSource.right = new FormAttachment( 100, 0 );
- fdSource.top = new FormAttachment( wClose, -300 - props.getMargin() );
- fdSource.bottom = new FormAttachment( wClose, -props.getMargin() );
- wSource.setLayoutData( fdSource );
- wSource.setEditable( false );
+ fdSource.left = new FormAttachment(middle, props.getMargin());
+ fdSource.right = new FormAttachment(100, 0);
+ fdSource.top = new FormAttachment(wClose, -300 - props.getMargin());
+ fdSource.bottom = new FormAttachment(wClose, -props.getMargin());
+ wSource.setLayoutData(fdSource);
+ wSource.setEditable(false);
// The source file (java)
//
- Label wlSourceFile = new Label( composite, SWT.RIGHT );
- wlSourceFile.setText( BaseMessages.getString( PKG, "i18nDialog.SourceFile" ) );
- props.setLook( wlSourceFile );
+ Label wlSourceFile = new Label(composite, SWT.RIGHT);
+ wlSourceFile.setText(BaseMessages.getString(PKG, "i18nDialog.SourceFile"));
+ props.setLook(wlSourceFile);
FormData fdlSourceFile = new FormData();
- fdlSourceFile.left = new FormAttachment( left, props.getMargin() );
- fdlSourceFile.right = new FormAttachment( middle, 0 );
- fdlSourceFile.bottom = new FormAttachment( wSource, - 2* props.getMargin(), SWT.TOP );
- wlSourceFile.setLayoutData( fdlSourceFile );
+ fdlSourceFile.left = new FormAttachment(left, props.getMargin());
+ fdlSourceFile.right = new FormAttachment(middle, 0);
+ fdlSourceFile.bottom = new FormAttachment(wSource, -2 * props.getMargin(), SWT.TOP);
+ wlSourceFile.setLayoutData(fdlSourceFile);
- wSourceFile = new Text( composite, SWT.SINGLE | SWT.BORDER );
- props.setLook( wSourceFile );
+ wSourceFile = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ props.setLook(wSourceFile);
FormData fdSourceFile = new FormData();
- fdSourceFile.left = new FormAttachment( middle, props.getMargin() );
- fdSourceFile.right = new FormAttachment( 100, 0 );
- fdSourceFile.top = new FormAttachment( wlSourceFile, 0, SWT.CENTER );
- wSourceFile.setLayoutData( fdSourceFile );
- wSourceFile.setEditable( false );
-
+ fdSourceFile.left = new FormAttachment(middle, props.getMargin());
+ fdSourceFile.right = new FormAttachment(100, 0);
+ fdSourceFile.top = new FormAttachment(wlSourceFile, 0, SWT.CENTER);
+ wSourceFile.setLayoutData(fdSourceFile);
+ wSourceFile.setEditable(false);
+
// The bundle file (messages*.properties)
//
- Label wlBundleFile = new Label( composite, SWT.RIGHT );
- wlBundleFile.setText( BaseMessages.getString( PKG, "i18nDialog.BundleFile" ) );
- props.setLook( wlBundleFile );
+ Label wlBundleFile = new Label(composite, SWT.RIGHT);
+ wlBundleFile.setText(BaseMessages.getString(PKG, "i18nDialog.BundleFile"));
+ props.setLook(wlBundleFile);
FormData fdlBundleFile = new FormData();
- fdlBundleFile.left = new FormAttachment( left, props.getMargin() );
- fdlBundleFile.right = new FormAttachment( middle, 0 );
- fdlBundleFile.bottom = new FormAttachment( wSourceFile, - props.getMargin() );
- wlBundleFile.setLayoutData( fdlBundleFile );
+ fdlBundleFile.left = new FormAttachment(left, props.getMargin());
+ fdlBundleFile.right = new FormAttachment(middle, 0);
+ fdlBundleFile.bottom = new FormAttachment(wSourceFile, -props.getMargin());
+ wlBundleFile.setLayoutData(fdlBundleFile);
- wBundleFile = new Text( composite, SWT.SINGLE | SWT.BORDER );
- props.setLook( wBundleFile );
+ wBundleFile = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ props.setLook(wBundleFile);
FormData fdBundleFile = new FormData();
- fdBundleFile.left = new FormAttachment( middle, props.getMargin() );
- fdBundleFile.right = new FormAttachment( 100, 0 );
- fdBundleFile.top = new FormAttachment( wlBundleFile, 0, SWT.CENTER );
- wBundleFile.setLayoutData( fdBundleFile );
- wBundleFile.setEditable( false );
-
+ fdBundleFile.left = new FormAttachment(middle, props.getMargin());
+ fdBundleFile.right = new FormAttachment(100, 0);
+ fdBundleFile.top = new FormAttachment(wlBundleFile, 0, SWT.CENTER);
+ wBundleFile.setLayoutData(fdBundleFile);
+ wBundleFile.setEditable(false);
// The translation
//
- Label wlValue = new Label( composite, SWT.RIGHT );
- wlValue.setText( BaseMessages.getString( PKG, "i18nDialog.Translation" ) );
- wlValue.setFont( GuiResource.getInstance().getFontBold());
- props.setLook( wlValue );
+ Label wlValue = new Label(composite, SWT.RIGHT);
+ wlValue.setText(BaseMessages.getString(PKG, "i18nDialog.Translation"));
+ wlValue.setFont(GuiResource.getInstance().getFontBold());
+ props.setLook(wlValue);
FormData fdlValue = new FormData();
- fdlValue.left = new FormAttachment( left, props.getMargin() );
- fdlValue.right = new FormAttachment( middle, 0 );
- fdlValue.top = new FormAttachment( wMain, props.getMargin() );
- wlValue.setLayoutData( fdlValue );
-
- wValue = new Text( composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL );
- props.setLook( wValue );
- wValue.setFont( GuiResource.getInstance().getFontBold());
+ fdlValue.left = new FormAttachment(left, props.getMargin());
+ fdlValue.right = new FormAttachment(middle, 0);
+ fdlValue.top = new FormAttachment(wMain, props.getMargin());
+ wlValue.setLayoutData(fdlValue);
+
+ wValue = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ props.setLook(wValue);
+ wValue.setFont(GuiResource.getInstance().getFontBold());
FormData fdValue = new FormData();
- fdValue.left = new FormAttachment( middle, props.getMargin() );
- fdValue.right = new FormAttachment( 100, 0 );
- fdValue.top = new FormAttachment( wMain, props.getMargin() );
- fdValue.bottom = new FormAttachment( wBundleFile, -props.getMargin() );
- wValue.setLayoutData( fdValue );
- wValue.setEditable( true );
-
- wApply = new Button( composite, SWT.PUSH );
- wApply.setText( BaseMessages.getString( PKG, "i18nDialog.Apply" ) );
+ fdValue.left = new FormAttachment(middle, props.getMargin());
+ fdValue.right = new FormAttachment(100, 0);
+ fdValue.top = new FormAttachment(wMain, props.getMargin());
+ fdValue.bottom = new FormAttachment(wBundleFile, -props.getMargin());
+ wValue.setLayoutData(fdValue);
+ wValue.setEditable(true);
+
+ wApply = new Button(composite, SWT.PUSH);
+ wApply.setText(BaseMessages.getString(PKG, "i18nDialog.Apply"));
FormData fdApply = new FormData();
- fdApply.left = new FormAttachment( left, 3*props.getMargin() );
- fdApply.right = new FormAttachment( middle, -props.getMargin() * 2 );
- fdApply.top = new FormAttachment( wValue, 0, SWT.CENTER );
- wApply.setLayoutData( fdApply );
- wApply.setEnabled( false );
-
- wRevert = new Button( composite, SWT.PUSH );
- wRevert.setText( BaseMessages.getString( PKG, "i18nDialog.Revert" ) );
+ fdApply.left = new FormAttachment(left, 3 * props.getMargin());
+ fdApply.right = new FormAttachment(middle, -props.getMargin() * 2);
+ fdApply.top = new FormAttachment(wValue, 0, SWT.CENTER);
+ wApply.setLayoutData(fdApply);
+ wApply.setEnabled(false);
+
+ wRevert = new Button(composite, SWT.PUSH);
+ wRevert.setText(BaseMessages.getString(PKG, "i18nDialog.Revert"));
FormData fdRevert = new FormData();
- fdRevert.left = new FormAttachment( left, 3*props.getMargin() );
- fdRevert.right = new FormAttachment( middle, -props.getMargin() * 2 );
- fdRevert.top = new FormAttachment( wApply, props.getMargin() * 2 );
- wRevert.setLayoutData( fdRevert );
- wRevert.setEnabled( false );
-
- wSearchV = new Button( composite, SWT.PUSH );
- wSearchV.setText( BaseMessages.getString( PKG, "i18nDialog.Search" ) );
+ fdRevert.left = new FormAttachment(left, 3 * props.getMargin());
+ fdRevert.right = new FormAttachment(middle, -props.getMargin() * 2);
+ fdRevert.top = new FormAttachment(wApply, props.getMargin() * 2);
+ wRevert.setLayoutData(fdRevert);
+ wRevert.setEnabled(false);
+
+ wSearchV = new Button(composite, SWT.PUSH);
+ wSearchV.setText(BaseMessages.getString(PKG, "i18nDialog.Search"));
FormData fdSearchV = new FormData();
- fdSearchV.left = new FormAttachment( left, 3*props.getMargin() );
- fdSearchV.right = new FormAttachment( middle, -props.getMargin() * 2 );
- fdSearchV.top = new FormAttachment( wRevert, props.getMargin() * 4 );
- wSearchV.setLayoutData( fdSearchV );
+ fdSearchV.left = new FormAttachment(left, 3 * props.getMargin());
+ fdSearchV.right = new FormAttachment(middle, -props.getMargin() * 2);
+ fdSearchV.top = new FormAttachment(wRevert, props.getMargin() * 4);
+ wSearchV.setLayoutData(fdSearchV);
- wNextV = new Button( composite, SWT.PUSH );
- wNextV.setText( BaseMessages.getString( PKG, "i18nDialog.Next" ) );
+ wNextV = new Button(composite, SWT.PUSH);
+ wNextV.setText(BaseMessages.getString(PKG, "i18nDialog.Next"));
FormData fdNextV = new FormData();
- fdNextV.left = new FormAttachment( left, 3*props.getMargin() );
- fdNextV.right = new FormAttachment( middle, -props.getMargin() * 2 );
- fdNextV.top = new FormAttachment( wSearchV, props.getMargin() * 2 );
- wNextV.setLayoutData( fdNextV );
-
- wAll.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- refreshGrid();
- }
- } );
+ fdNextV.left = new FormAttachment(left, 3 * props.getMargin());
+ fdNextV.right = new FormAttachment(middle, -props.getMargin() * 2);
+ fdNextV.top = new FormAttachment(wSearchV, props.getMargin() * 2);
+ wNextV.setLayoutData(fdNextV);
+
+ wAll.addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ refreshGrid();
+ }
+ });
- wTodo.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- // If someone clicks on the todo list, we set the appropriate values
- //
- if ( wTodo.getSelectionCount() == 1 ) {
+ wTodo.addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ // If someone clicks on the todo list, we set the appropriate values
+ //
+ if (wTodo.getSelectionCount() == 1) {
- String key = wTodo.getSelection()[ 0 ];
+ String key = wTodo.getSelection()[0];
- showKeySelection( key );
- }
- }
- } );
-
- wValue.addModifyListener( e -> {
- // The main value got changed...
- // Capture this automatically
- //
- lastValueChanged = true;
- lastValue = wValue.getText();
+ showKeySelection(key);
+ }
+ }
+ });
- wApply.setEnabled( true );
- wRevert.setEnabled( true );
- } );
+ wValue.addModifyListener(
+ e -> {
+ // The main value got changed...
+ // Capture this automatically
+ //
+ lastValueChanged = true;
+ lastValue = wValue.getText();
- wApply.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- applyChangedValue();
- }
- } );
+ wApply.setEnabled(true);
+ wRevert.setEnabled(true);
+ });
- wRevert.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- revertChangedValue();
- }
- } );
+ wApply.addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ applyChangedValue();
+ }
+ });
- wSave.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent event ) {
- saveFiles();
- }
- } );
+ wRevert.addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ revertChangedValue();
+ }
+ });
- wSearch.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- search( referenceLocale );
- }
- } );
+ wSave.addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ saveFiles();
+ }
+ });
- wNext.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- searchAgain( referenceLocale );
- }
- } );
+ wSearch.addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ search(referenceLocale);
+ }
+ });
- wSearchV.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- search( selectedLocale );
- }
- } );
+ wNext.addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ searchAgain(referenceLocale);
+ }
+ });
- wNextV.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- searchAgain( selectedLocale );
- }
- } );
+ wSearchV.addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ search(selectedLocale);
+ }
+ });
+ wNextV.addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ searchAgain(selectedLocale);
+ }
+ });
}
protected boolean saveFiles() {
java.util.List<BundleFile> changedBundleFiles = store.getChangedBundleFiles();
- if ( changedBundleFiles.size() > 0 ) {
+ if (changedBundleFiles.size() > 0) {
StringBuilder msg = new StringBuilder();
- for ( BundleFile bundleFile : changedBundleFiles ) {
+ for (BundleFile bundleFile : changedBundleFiles) {
String filename = bundleFile.getFilename();
- msg.append( bundleFile.getFilename() );
- if ( !new File( filename ).exists() ) {
- msg.append( " (NEW!)" );
+ msg.append(bundleFile.getFilename());
+ if (!new File(filename).exists()) {
+ msg.append(" (NEW!)");
}
- msg.append( Const.CR );
+ msg.append(Const.CR);
}
EnterTextDialog dialog =
- new EnterTextDialog( shell, BaseMessages.getString( PKG, "i18nDialog.ChangedFiles" ), BaseMessages
- .getString( PKG, "i18nDialog.ChangedMessagesFiles" ), msg.toString() );
- if ( dialog.open() != null ) {
+ new EnterTextDialog(
+ shell,
+ BaseMessages.getString(PKG, "i18nDialog.ChangedFiles"),
+ BaseMessages.getString(PKG, "i18nDialog.ChangedMessagesFiles"),
+ msg.toString());
+ if (dialog.open() != null) {
try {
- for ( BundleFile bundleFile : changedBundleFiles ) {
+ for (BundleFile bundleFile : changedBundleFiles) {
bundleFile.write();
- log.logBasic( BaseMessages.getString( PKG, "i18n.Log.SavedMessagesFile", bundleFile.getFilename() ) );
+ log.logBasic(
+ BaseMessages.getString(
+ PKG, "i18n.Log.SavedMessagesFile", bundleFile.getFilename()));
}
- } catch ( HopException e ) {
- new ErrorDialog( shell, BaseMessages.getString( PKG, "i18n.UnexpectedError" ),
- "There was an error saving the changed messages files:", e );
+ } catch (HopException e) {
+ new ErrorDialog(
+ shell,
+ BaseMessages.getString(PKG, "i18n.UnexpectedError"),
+ "There was an error saving the changed messages files:",
+ e);
return false;
}
return true;
@@ -884,74 +942,84 @@ public class Translator {
// TODO: disable the button if nothing changed.
return true;
}
-
}
protected void saveFilesToZip() {
- if ( saveFiles() ) {
- java.util.List<BundleFile> bundleFiles = store.findBundleFiles( selectedLocale, null );
- if ( bundleFiles.size() > 0 ) {
+ if (saveFiles()) {
+ java.util.List<BundleFile> bundleFiles = store.findBundleFiles(selectedLocale, null);
+ if (bundleFiles.size() > 0) {
StringBuilder msg = new StringBuilder();
- for ( BundleFile bundleFile : bundleFiles ) {
+ for (BundleFile bundleFile : bundleFiles) {
// Find the main locale variation for this messages store...
//
- BundleFile mainLocaleMessagesStore = store.findMainBundleFile( bundleFile.getPackageName() );
+ BundleFile mainLocaleMessagesStore =
+ store.findMainBundleFile(bundleFile.getPackageName());
String filename = bundleFile.getFilename();
- msg.append( filename ).append( Const.CR );
+ msg.append(filename).append(Const.CR);
}
// Ask for the target filename if we're still here...
// Keep this FileDialog as is
//
- String zipFilename = BaseDialog.presentFileDialog( shell,
- new String[] { "*.zip", "*" },
- new String[] {
- BaseMessages.getString( PKG, "System.FileType.ZIPFiles" ),
- BaseMessages.getString( PKG, "System.FileType.AllFiles" ) },
- true );
- if ( zipFilename != null ) {
+ String zipFilename =
+ BaseDialog.presentFileDialog(
+ shell,
+ new String[] {"*.zip", "*"},
+ new String[] {
+ BaseMessages.getString(PKG, "System.FileType.ZIPFiles"),
+ BaseMessages.getString(PKG, "System.FileType.AllFiles")
+ },
+ true);
+ if (zipFilename != null) {
try {
- ZipOutputStream out = new ZipOutputStream( new FileOutputStream( zipFilename ) );
- byte[] buf = new byte[ 1024 ];
- for ( BundleFile bundleFile : bundleFiles ) {
- FileInputStream in = new FileInputStream( bundleFile.getFilename() );
- out.putNextEntry( new ZipEntry( bundleFile.getFilename() ) );
+ ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFilename));
+ byte[] buf = new byte[1024];
+ for (BundleFile bundleFile : bundleFiles) {
+ FileInputStream in = new FileInputStream(bundleFile.getFilename());
+ out.putNextEntry(new ZipEntry(bundleFile.getFilename()));
int len;
- while ( ( len = in.read( buf ) ) > 0 ) {
- out.write( buf, 0, len );
+ while ((len = in.read(buf)) > 0) {
+ out.write(buf, 0, len);
}
out.closeEntry();
in.close();
}
out.close();
- } catch ( Exception e ) {
+ } catch (Exception e) {
new ErrorDialog(
- shell, BaseMessages.getString( PKG, "i18n.UnexpectedError" ),
- "There was an error saving the changed messages files:", e );
+ shell,
+ BaseMessages.getString(PKG, "i18n.UnexpectedError"),
+ "There was an error saving the changed messages files:",
+ e);
}
}
}
}
}
- protected void search( String searchLocale ) {
+ protected void search(String searchLocale) {
// Ask for the search string...
//
EnterStringDialog dialog =
- new EnterStringDialog( shell, Const.NVL( searchString, "" ), BaseMessages.getString(
- PKG, "i18nDialog.SearchKey" ), BaseMessages.getString( PKG, "i18nDialog.SearchLocale1" )
- + " '" + Const.NVL( searchLocale, "" ) + "' "
- + BaseMessages.getString( PKG, "i18nDialog.SearchLocale2" ) );
+ new EnterStringDialog(
+ shell,
+ Const.NVL(searchString, ""),
+ BaseMessages.getString(PKG, "i18nDialog.SearchKey"),
+ BaseMessages.getString(PKG, "i18nDialog.SearchLocale1")
+ + " '"
+ + Const.NVL(searchLocale, "")
+ + "' "
+ + BaseMessages.getString(PKG, "i18nDialog.SearchLocale2"));
searchString = dialog.open();
lastFoundKey = null;
- searchAgain( searchLocale );
+ searchAgain(searchLocale);
}
- protected void searchAgain( String searchLocale ) {
- if ( searchString != null ) {
+ protected void searchAgain(String searchLocale) {
+ if (searchString != null) {
// We want to search for key in the list here...
// That means we'll enter a String to search for in the values
@@ -965,82 +1033,82 @@ public class Translator {
// package
//
java.util.List<BundleFile> mainLocaleBundleFiles =
- store.findBundleFiles( searchLocale, selectedMessagesPackage );
- for ( BundleFile bundleFile : mainLocaleBundleFiles ) {
- for ( String key : bundleFile.getContents().keySet() ) {
- String value = bundleFile.getContents().get( key );
+ store.findBundleFiles(searchLocale, selectedMessagesPackage);
+ for (BundleFile bundleFile : mainLocaleBundleFiles) {
+ for (String key : bundleFile.getContents().keySet()) {
+ String value = bundleFile.getContents().get(key);
String upperValue = value.toUpperCase();
- if ( upperValue.indexOf( upperSearchString ) >= 0 ) {
+ if (upperValue.indexOf(upperSearchString) >= 0) {
// OK, we found a key worthy of our attention...
//
- if ( lastKeyFound ) {
- int index = wTodo.indexOf( key );
- if ( index >= 0 ) {
+ if (lastKeyFound) {
+ int index = wTodo.indexOf(key);
+ if (index >= 0) {
lastFoundKey = key;
- wTodo.setSelection( index );
- showKeySelection( wTodo.getSelection()[ 0 ] );
+ wTodo.setSelection(index);
+ showKeySelection(wTodo.getSelection()[0]);
return;
}
}
- if ( key.equals( lastFoundKey ) ) {
+ if (key.equals(lastFoundKey)) {
lastKeyFound = true;
}
}
}
}
}
-
}
- protected void showKeySelection( String key ) {
+ protected void showKeySelection(String key) {
- wSelectedSourceFolder.setText( Const.NVL(selectedSourceFolder, "") );
- wSelectedPackage.setText( Const.NVL(selectedMessagesPackage, "") );
- wReferenceLocale.setText( Const.NVL(referenceLocale, "") );
+ wSelectedSourceFolder.setText(Const.NVL(selectedSourceFolder, ""));
+ wSelectedPackage.setText(Const.NVL(selectedMessagesPackage, ""));
+ wReferenceLocale.setText(Const.NVL(referenceLocale, ""));
- if ( !key.equals( selectedKey ) ) {
+ if (!key.equals(selectedKey)) {
applyChangedValue();
}
- if ( selectedLocale != null && key != null && selectedMessagesPackage != null ) {
- String mainValue = store.lookupKeyValue( referenceLocale, selectedMessagesPackage, key );
- String value = store.lookupKeyValue( selectedLocale, selectedMessagesPackage, key );
- KeyOccurrence keyOccurrence = crawler.getKeyOccurrence( key, selectedMessagesPackage );
+ if (selectedLocale != null && key != null && selectedMessagesPackage != null) {
+ String mainValue = store.lookupKeyValue(referenceLocale, selectedMessagesPackage, key);
+ String value = store.lookupKeyValue(selectedLocale, selectedMessagesPackage, key);
+ KeyOccurrence keyOccurrence = crawler.getKeyOccurrence(key, selectedMessagesPackage);
- wKey.setText( key );
- wMain.setText( Const.NVL( mainValue, "" ) );
- wValue.setText( Const.NVL( value, "" ) );
- wSource.setText( Const.NVL( keyOccurrence.getSourceLine(), "" ) );
+ wKey.setText(key);
+ wMain.setText(Const.NVL(mainValue, ""));
+ wValue.setText(Const.NVL(value, ""));
+ wSource.setText(Const.NVL(keyOccurrence.getSourceLine(), ""));
- String javaFilename = stripRootFolder( HopVfs.getFilename( keyOccurrence.getFileObject() ));
- wSourceFile.setText( Const.NVL(javaFilename, "") );
+ String javaFilename = stripRootFolder(HopVfs.getFilename(keyOccurrence.getFileObject()));
+ wSourceFile.setText(Const.NVL(javaFilename, ""));
String bundleFilename = "";
- BundleFile file = store.getBundleStore().findBundleFile(selectedMessagesPackage, selectedLocale);
- if (file!=null) {
+ BundleFile file =
+ store.getBundleStore().findBundleFile(selectedMessagesPackage, selectedLocale);
+ if (file != null) {
bundleFilename = stripRootFolder(file.getFilename());
}
- wBundleFile.setText( Const.NVL(bundleFilename, "") );
+ wBundleFile.setText(Const.NVL(bundleFilename, ""));
// Focus on the entry field
// Put the cursor all the way at the back
//
wValue.setFocus();
- wValue.setSelection( wValue.getText().length() );
+ wValue.setSelection(wValue.getText().length());
wValue.showSelection();
wValue.clearSelection();
selectedKey = key;
lastValueChanged = false;
- wApply.setEnabled( false );
- wRevert.setEnabled( false );
+ wApply.setEnabled(false);
+ wRevert.setEnabled(false);
}
}
- private String stripRootFolder( String filename ) {
- if (filename!=null && filename.startsWith( rootFolder )) {
- return filename.substring( rootFolder.length());
+ private String stripRootFolder(String filename) {
+ if (filename != null && filename.startsWith(rootFolder)) {
+ return filename.substring(rootFolder.length());
}
return filename;
}
@@ -1050,44 +1118,51 @@ public class Translator {
applyChangedValue();
wTodo.removeAll();
- wKey.setText( "" );
- wMain.setText( "" );
- wValue.setText( "" );
- wSource.setText( "" );
-
- selectedLocale = wLocale.getSelectionCount() == 0 ? null : wLocale.getSelection()[ 0 ];
- selectedSourceFolder = wPackages.table.getSelectionCount() == 0 ? null : wPackages.table.getSelection()[ 0 ].getText( 1 );
- selectedMessagesPackage = wPackages.table.getSelectionCount() == 0 ? null : wPackages.table.getSelection()[ 0 ].getText( 2 );
+ wKey.setText("");
+ wMain.setText("");
+ wValue.setText("");
+ wSource.setText("");
+
+ selectedLocale = wLocale.getSelectionCount() == 0 ? null : wLocale.getSelection()[0];
+ selectedSourceFolder =
+ wPackages.table.getSelectionCount() == 0
+ ? null
+ : wPackages.table.getSelection()[0].getText(1);
+ selectedMessagesPackage =
+ wPackages.table.getSelectionCount() == 0
+ ? null
+ : wPackages.table.getSelection()[0].getText(2);
refreshPackages();
// Only continue with a locale & a messages package, otherwise we won't
// budge ;-)
//
- if ( selectedLocale != null && selectedSourceFolder != null && selectedMessagesPackage != null ) {
+ if (selectedLocale != null && selectedSourceFolder != null && selectedMessagesPackage != null) {
// Get the list of keys that need a translation...
//
- java.util.List<KeyOccurrence> todo = getTodoList( selectedLocale, selectedMessagesPackage, selectedSourceFolder, false );
- String[] todoItems = new String[ todo.size() ];
- for ( int i = 0; i < todoItems.length; i++ ) {
- todoItems[ i ] = todo.get( i ).getKey();
+ java.util.List<KeyOccurrence> todo =
+ getTodoList(selectedLocale, selectedMessagesPackage, selectedSourceFolder, false);
+ String[] todoItems = new String[todo.size()];
+ for (int i = 0; i < todoItems.length; i++) {
+ todoItems[i] = todo.get(i).getKey();
}
- wTodo.setItems( todoItems );
+ wTodo.setItems(todoItems);
}
}
- private java.util.List<KeyOccurrence> getTodoList( String locale, String messagesPackage, String sourceFolder,
- boolean strict ) {
+ private java.util.List<KeyOccurrence> getTodoList(
+ String locale, String messagesPackage, String sourceFolder, boolean strict) {
// Get the list of keys that need a translation...
//
- java.util.List<KeyOccurrence> keys = crawler.getOccurrencesForPackage( messagesPackage );
+ java.util.List<KeyOccurrence> keys = crawler.getOccurrencesForPackage(messagesPackage);
java.util.List<KeyOccurrence> todo = new ArrayList<>();
- for ( KeyOccurrence keyOccurrence : keys ) {
+ for (KeyOccurrence keyOccurrence : keys) {
// Avoid the System keys. Those are taken care off in a different package
//
- if ( showKey( keyOccurrence.getKey(), keyOccurrence.getMessagesPackage() ) ) {
- String value = store.lookupKeyValue( locale, messagesPackage, keyOccurrence.getKey() );
- if ( Utils.isEmpty( value ) || ( wAll.getSelection() && !strict ) ) {
- todo.add( keyOccurrence );
+ if (showKey(keyOccurrence.getKey(), keyOccurrence.getMessagesPackage())) {
+ String value = store.lookupKeyValue(locale, messagesPackage, keyOccurrence.getKey());
+ if (Utils.isEmpty(value) || (wAll.getSelection() && !strict)) {
+ todo.add(keyOccurrence);
}
}
}
@@ -1100,37 +1175,40 @@ public class Translator {
//
int todoIndex = wTodo.getSelectionIndex();
- if ( selectedKey != null
- && selectedLocale != null && selectedMessagesPackage != null && lastValueChanged
- && selectedSourceFolder != null ) {
+ if (selectedKey != null
+ && selectedLocale != null
+ && selectedMessagesPackage != null
+ && lastValueChanged
+ && selectedSourceFolder != null) {
// Store the last modified value
//
- if ( !Utils.isEmpty( lastValue ) ) {
- store.storeValue( selectedLocale, selectedSourceFolder, selectedMessagesPackage, selectedKey, lastValue );
+ if (!Utils.isEmpty(lastValue)) {
+ store.storeValue(
+ selectedLocale, selectedSourceFolder, selectedMessagesPackage, selectedKey, lastValue);
lastValueChanged = false;
- if ( !wAll.getSelection() ) {
- wTodo.remove( selectedKey );
- if ( wTodo.getSelectionIndex() < 0 ) {
+ if (!wAll.getSelection()) {
+ wTodo.remove(selectedKey);
+ if (wTodo.getSelectionIndex() < 0) {
// Select the next one in the list...
- if ( todoIndex > wTodo.getItemCount() ) {
+ if (todoIndex > wTodo.getItemCount()) {
todoIndex = wTodo.getItemCount() - 1;
}
- if ( todoIndex >= 0 && todoIndex < wTodo.getItemCount() ) {
- wTodo.setSelection( todoIndex );
- showKeySelection( wTodo.getSelection()[ 0 ] );
+ if (todoIndex >= 0 && todoIndex < wTodo.getItemCount()) {
+ wTodo.setSelection(todoIndex);
+ showKeySelection(wTodo.getSelection()[0]);
} else {
refreshGrid();
}
} else {
- showKeySelection( wTodo.getSelection()[ 0 ] );
+ showKeySelection(wTodo.getSelection()[0]);
}
}
}
lastValue = null;
- wApply.setEnabled( false );
- wRevert.setEnabled( false );
+ wApply.setEnabled(false);
+ wRevert.setEnabled(false);
}
}
@@ -1151,58 +1229,64 @@ public class Translator {
// OK, we have a distinct list of packages to work with...
wPackages.table.removeAll();
- Map<String, Map<String, java.util.List<KeyOccurrence>>> sourceMessagesPackages = crawler.getSourcePackageOccurrences();
+ Map<String, Map<String, java.util.List<KeyOccurrence>>> sourceMessagesPackages =
+ crawler.getSourcePackageOccurrences();
// Sort the source folders...
//
java.util.List<String> sourceFolders = new ArrayList<>(sourceMessagesPackages.keySet());
- Collections.sort( sourceFolders);
- for ( String sourceFolder : sourceFolders ) {
- Map<String, java.util.List<KeyOccurrence>> messagesPackages = sourceMessagesPackages.get( sourceFolder );
- java.util.List<String> packageNames = new ArrayList<>( messagesPackages.keySet() );
- Collections.sort( packageNames );
+ Collections.sort(sourceFolders);
+ for (String sourceFolder : sourceFolders) {
+ Map<String, java.util.List<KeyOccurrence>> messagesPackages =
+ sourceMessagesPackages.get(sourceFolder);
+ java.util.List<String> packageNames = new ArrayList<>(messagesPackages.keySet());
+ Collections.sort(packageNames);
- for ( String packageName : packageNames ) {
+ for (String packageName : packageNames) {
- TableItem item = new TableItem( wPackages.table, SWT.NONE );
- item.setText( 1, sourceFolder );
- item.setText( 2, packageName );
+ TableItem item = new TableItem(wPackages.table, SWT.NONE);
+ item.setText(1, sourceFolder);
+ item.setText(2, packageName);
// count the number of keys for the package that are NOT yet translated...
//
- if ( selectedLocale != null ) {
+ if (selectedLocale != null) {
// Check if there is a bundle file for this package.
// If not we'll paint it in light red
//
- BundleFile bundleFile = store.getBundleStore().findBundleFile( packageName, selectedLocale );
- if (bundleFile==null) {
- item.setBackground( new Color(shell.getDisplay(), 230, 150, 150 ) );
+ BundleFile bundleFile =
+ store.getBundleStore().findBundleFile(packageName, selectedLocale);
+ if (bundleFile == null) {
+ item.setBackground(new Color(shell.getDisplay(), 230, 150, 150));
} else {
- java.util.List<KeyOccurrence> todo = getTodoList( selectedLocale, packageName, sourceFolder, true );
- if ( todo.size() > 50 ) {
- item.setBackground( new Color( shell.getDisplay(), 150, 150, 150 ) ); // dark gray
- } else if ( todo.size() > 25 ) {
- item.setBackground( new Color( shell.getDisplay(), 170, 170, 170 ) );
- } else if ( todo.size() > 10 ) {
- item.setBackground( new Color( shell.getDisplay(), 190, 190, 190 ) );
- } else if ( todo.size() > 5 ) {
- item.setBackground( new Color( shell.getDisplay(), 210, 210, 210 ) );
- } else if ( todo.size() > 0 ) {
- item.setBackground( new Color( shell.getDisplay(), 230, 230, 230 ) ); // light gray
+ java.util.List<KeyOccurrence> todo =
+ getTodoList(selectedLocale, packageName, sourceFolder, true);
+ if (todo.size() > 50) {
+ item.setBackground(
+ new Color(shell.getDisplay(), props.contrastColor(150, 150, 150))); // dark gray
+ } else if (todo.size() > 25) {
+ item.setBackground(new Color(shell.getDisplay(), props.contrastColor(170, 170, 170)));
+ } else if (todo.size() > 10) {
+ item.setBackground(new Color(shell.getDisplay(), props.contrastColor(190, 190, 190)));
+ } else if (todo.size() > 5) {
+ item.setBackground(new Color(shell.getDisplay(), props.contrastColor(210, 210, 210)));
+ } else if (todo.size() > 0) {
+ item.setBackground(
+ new Color(shell.getDisplay(), props.contrastColor(230, 230, 230))); // light gray
}
}
}
}
- if ( messagesPackages.size() == 0 ) {
- new TableItem( wPackages.table, SWT.NONE );
+ if (messagesPackages.size() == 0) {
+ new TableItem(wPackages.table, SWT.NONE);
} else {
wPackages.setRowNums();
}
}
- if ( index >= 0 ) {
- wPackages.table.setSelection( index );
+ if (index >= 0) {
+ wPackages.table.setSelection(index);
wPackages.table.showSelection();
}
}
@@ -1210,46 +1294,45 @@ public class Translator {
public void refreshLocale() {
// OK, we have a distinct list of locale to work with...
wLocale.removeAll();
- wLocale.setItems( localeList.toArray( new String[ localeList.size() ] ) );
+ wLocale.setItems(localeList.toArray(new String[localeList.size()]));
}
public String toString() {
return APP_NAME;
}
- public static void main( String[] args ) throws Exception {
+ public static void main(String[] args) throws Exception {
- if ( args.length != 2 ) {
- System.err.println( "Usage: Translator <translator.xml> <path-to-source>" );
- System.err.println( "Example:" );
- System.err.println( "sh hop-translator.sh translator.xml /home/john/git/hop/" );
- System.exit( 1 );
+ if (args.length != 2) {
+ System.err.println("Usage: Translator <translator.xml> <path-to-source>");
+ System.err.println("Example:");
+ System.err.println("sh hop-translator.sh translator.xml /home/john/git/hop/");
+ System.exit(1);
}
HopClientEnvironment.init();
- String configFile = args[ 0 ];
- String sourceFolder = args[ 1 ];
+ String configFile = args[0];
+ String sourceFolder = args[1];
Display display = new Display();
- ILogChannel log = new LogChannel( APP_NAME );
+ ILogChannel log = new LogChannel(APP_NAME);
- HopNamespace.setNamespace( TRANSLATOR_NAMESPACE );
+ HopNamespace.setNamespace(TRANSLATOR_NAMESPACE);
- Translator translator = new Translator( display );
- translator.loadConfiguration( configFile, sourceFolder );
+ Translator translator = new Translator(display);
+ translator.loadConfiguration(configFile, sourceFolder);
translator.open();
try {
- while ( !display.isDisposed() ) {
- if ( !display.readAndDispatch() ) {
+ while (!display.isDisposed()) {
+ if (!display.readAndDispatch()) {
display.sleep();
}
}
- } catch ( Throwable e ) {
- log.logError( BaseMessages.getString( PKG, "i18n.UnexpectedError", e.getMessage() ) );
- log.logError( Const.getStackTracker( e ) );
+ } catch (Throwable e) {
+ log.logError(BaseMessages.getString(PKG, "i18n.UnexpectedError", e.getMessage()));
+ log.logError(Const.getStackTracker(e));
}
}
-
}
diff --git a/ui/src/main/java/org/apache/hop/ui/util/SwtSvgImageUtil.java b/ui/src/main/java/org/apache/hop/ui/util/SwtSvgImageUtil.java
index 0e124ba..2b459c1 100644
--- a/ui/src/main/java/org/apache/hop/ui/util/SwtSvgImageUtil.java
+++ b/ui/src/main/java/org/apache/hop/ui/util/SwtSvgImageUtil.java
@@ -77,9 +77,9 @@ public class SwtSvgImageUtil {
// RAP only allows painting on the Canvas widget
if (!EnvironmentUtils.getInstance().isWeb()) {
GC gc = new GC(img);
- gc.setForeground(new Color(display, 0, 0, 0));
+ gc.setForeground(new Color(display, PropsUi.getInstance().contrastColor(0, 0, 0)));
gc.drawRectangle(4, 4, ConstUi.ICON_SIZE - 8, ConstUi.ICON_SIZE - 8);
- gc.setForeground(new Color(display, 255, 0, 0));
+ gc.setForeground(new Color(display, PropsUi.getInstance().contrastColor(255, 0, 0)));
gc.drawLine(4, 4, ConstUi.ICON_SIZE - 4, ConstUi.ICON_SIZE - 4);
gc.drawLine(ConstUi.ICON_SIZE - 4, 4, 4, ConstUi.ICON_SIZE - 4);
gc.dispose();
@@ -92,9 +92,9 @@ public class SwtSvgImageUtil {
*/
private static SwtUniversalImage getImageAsResourceInternal( Display display, String location ) {
SwtUniversalImage result = null;
- if ( result == null ) {
- result = loadFromCurrentClasspath( display, location );
- }
+
+ result = loadFromCurrentClasspath( display, location );
+
if ( result == null ) {
result = loadFromBasedVFS( display, location );
}
diff --git a/ui/src/main/resources/org/apache/hop/ui/core/dialog/messages/messages_en_US.properties b/ui/src/main/resources/org/apache/hop/ui/core/dialog/messages/messages_en_US.properties
index f3ed3bc..379eb8e 100644
--- a/ui/src/main/resources/org/apache/hop/ui/core/dialog/messages/messages_en_US.properties
+++ b/ui/src/main/resources/org/apache/hop/ui/core/dialog/messages/messages_en_US.properties
@@ -60,6 +60,7 @@ SQLStatementDialog.Log.Error=Error\: {0}
GetQueryFieldsProgressDialog.Error.Title=Error getting information
EnterListDialog.Title=Enter list
EnterPrintDialog.BottomMargin.Label=Bottom margin (inch)\:
+EnterOptionsDialog.DarkMode.Label=Dark mode?
EnterOptionsDialog.DefaultLocale.Label=Preferred Language\:
BrowserEnvironmentWarningDialog.Message.Windows=Unfortunately, your browser is not supported.\nFor the best experience, we recommend that you\nupdate to the latest version of Internet Explorer.
EnterPrintDialog.Title=Print pages
diff --git a/ui/src/main/resources/ui/images/data_orch.svg b/ui/src/main/resources/ui/images/data_orch.svg
index 08b46c1..aea07b5 100644
--- a/ui/src/main/resources/ui/images/data_orch.svg
+++ b/ui/src/main/resources/ui/images/data_orch.svg
@@ -2,13 +2,8 @@
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Layer_1"
x="0px"
@@ -16,28 +11,7 @@
viewBox="0 0 16 16"
enable-background="new 0 0 16 16"
xml:space="preserve"
- sodipodi:docname="pipeline.svg"
- inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><metadata
- id="metadata9"><rdf:RDF><cc:Work
- rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
- id="defs7" /><sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10"
- gridtolerance="10"
- guidetolerance="10"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:window-width="640"
- inkscape:window-height="480"
- id="namedview5"
- showgrid="false"
- inkscape:zoom="102.61621"
- inkscape:cx="5.3298566"
- inkscape:cy="8"
- inkscape:current-layer="Layer_1" />
+ >
<polygon
points="4.4,8 1,8 1,8.4 4.3,8.4 3.1,11.7 12.4,8.4 15,8.4 15,8 12.6,8 3.1,4.6 "
id="polygon2"