externalize string in HelpDialog class
This commit is contained in:
parent
452a28362e
commit
66f365d38d
|
@ -82,6 +82,14 @@ public class Messages extends NLS {
|
||||||
public static String cursor;
|
public static String cursor;
|
||||||
public static String cursor_drag;
|
public static String cursor_drag;
|
||||||
public static String cursor_text;
|
public static String cursor_text;
|
||||||
|
public static String HelpDialog_0;
|
||||||
|
public static String HelpDialog_1;
|
||||||
|
public static String HelpDialog_2;
|
||||||
|
public static String HelpDialog_3;
|
||||||
|
public static String HelpDialog_4;
|
||||||
|
public static String HelpDialog_5;
|
||||||
|
public static String HelpDialog_6;
|
||||||
|
public static String HelpDialog_7;
|
||||||
public static String marker;
|
public static String marker;
|
||||||
public static String marker_text;
|
public static String marker_text;
|
||||||
public static String rel_arrow;
|
public static String rel_arrow;
|
||||||
|
|
|
@ -76,6 +76,14 @@ signal_nan=Signal NaN Value
|
||||||
cursor=Cursor
|
cursor=Cursor
|
||||||
cursor_drag=dragged Cursor
|
cursor_drag=dragged Cursor
|
||||||
cursor_text=Cursor Text
|
cursor_text=Cursor Text
|
||||||
|
HelpDialog_0=Back
|
||||||
|
HelpDialog_1=Forward
|
||||||
|
HelpDialog_2=Stop
|
||||||
|
HelpDialog_3=Refresh
|
||||||
|
HelpDialog_4=Go
|
||||||
|
HelpDialog_5=Address
|
||||||
|
HelpDialog_6=https://git.minres.com/VP-Tools/SCViewer/src/branch/master/README.md\#key-shortcuts
|
||||||
|
HelpDialog_7=Could not instantiate Browser:
|
||||||
marker=Marker
|
marker=Marker
|
||||||
marker_text=Marker TExt
|
marker_text=Marker TExt
|
||||||
rel_arrow=Relation arrow
|
rel_arrow=Relation arrow
|
||||||
|
|
|
@ -24,6 +24,8 @@ import org.eclipse.swt.widgets.Text;
|
||||||
import org.eclipse.swt.widgets.ToolBar;
|
import org.eclipse.swt.widgets.ToolBar;
|
||||||
import org.eclipse.swt.widgets.ToolItem;
|
import org.eclipse.swt.widgets.ToolItem;
|
||||||
|
|
||||||
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
|
||||||
public class HelpDialog extends Dialog {
|
public class HelpDialog extends Dialog {
|
||||||
/**
|
/**
|
||||||
* Create the dialog.
|
* Create the dialog.
|
||||||
|
@ -61,22 +63,22 @@ public class HelpDialog extends Dialog {
|
||||||
container.setLayout(gridLayout);
|
container.setLayout(gridLayout);
|
||||||
ToolBar toolbar = new ToolBar(container, SWT.NONE);
|
ToolBar toolbar = new ToolBar(container, SWT.NONE);
|
||||||
ToolItem itemBack = new ToolItem(toolbar, SWT.PUSH);
|
ToolItem itemBack = new ToolItem(toolbar, SWT.PUSH);
|
||||||
itemBack.setText("Back");
|
itemBack.setText(Messages.HelpDialog_0);
|
||||||
ToolItem itemForward = new ToolItem(toolbar, SWT.PUSH);
|
ToolItem itemForward = new ToolItem(toolbar, SWT.PUSH);
|
||||||
itemForward.setText("Forward");
|
itemForward.setText(Messages.HelpDialog_1);
|
||||||
ToolItem itemStop = new ToolItem(toolbar, SWT.PUSH);
|
ToolItem itemStop = new ToolItem(toolbar, SWT.PUSH);
|
||||||
itemStop.setText("Stop");
|
itemStop.setText(Messages.HelpDialog_2);
|
||||||
ToolItem itemRefresh = new ToolItem(toolbar, SWT.PUSH);
|
ToolItem itemRefresh = new ToolItem(toolbar, SWT.PUSH);
|
||||||
itemRefresh.setText("Refresh");
|
itemRefresh.setText(Messages.HelpDialog_3);
|
||||||
ToolItem itemGo = new ToolItem(toolbar, SWT.PUSH);
|
ToolItem itemGo = new ToolItem(toolbar, SWT.PUSH);
|
||||||
itemGo.setText("Go");
|
itemGo.setText(Messages.HelpDialog_4);
|
||||||
|
|
||||||
GridData data = new GridData();
|
GridData data = new GridData();
|
||||||
data.horizontalSpan = 3;
|
data.horizontalSpan = 3;
|
||||||
toolbar.setLayoutData(data);
|
toolbar.setLayoutData(data);
|
||||||
|
|
||||||
Label labelAddress = new Label(container, SWT.NONE);
|
Label labelAddress = new Label(container, SWT.NONE);
|
||||||
labelAddress.setText("Address");
|
labelAddress.setText(Messages.HelpDialog_5);
|
||||||
|
|
||||||
final Text location = new Text(container, SWT.BORDER);
|
final Text location = new Text(container, SWT.BORDER);
|
||||||
data = new GridData();
|
data = new GridData();
|
||||||
|
@ -112,15 +114,15 @@ public class HelpDialog extends Dialog {
|
||||||
Listener listener = event -> {
|
Listener listener = event -> {
|
||||||
ToolItem item = (ToolItem) event.widget;
|
ToolItem item = (ToolItem) event.widget;
|
||||||
String string = item.getText();
|
String string = item.getText();
|
||||||
if (string.equals("Back"))
|
if (string.equals(Messages.HelpDialog_0))
|
||||||
browser.back();
|
browser.back();
|
||||||
else if (string.equals("Forward"))
|
else if (string.equals(Messages.HelpDialog_1))
|
||||||
browser.forward();
|
browser.forward();
|
||||||
else if (string.equals("Stop"))
|
else if (string.equals(Messages.HelpDialog_2))
|
||||||
browser.stop();
|
browser.stop();
|
||||||
else if (string.equals("Refresh"))
|
else if (string.equals(Messages.HelpDialog_3))
|
||||||
browser.refresh();
|
browser.refresh();
|
||||||
else if (string.equals("Go"))
|
else if (string.equals(Messages.HelpDialog_4))
|
||||||
browser.setUrl(location.getText());
|
browser.setUrl(location.getText());
|
||||||
};
|
};
|
||||||
browser.addProgressListener(new ProgressListener() {
|
browser.addProgressListener(new ProgressListener() {
|
||||||
|
@ -147,9 +149,9 @@ public class HelpDialog extends Dialog {
|
||||||
itemGo.addListener(SWT.Selection, listener);
|
itemGo.addListener(SWT.Selection, listener);
|
||||||
location.addListener(SWT.DefaultSelection, e -> browser.setUrl(location.getText()));
|
location.addListener(SWT.DefaultSelection, e -> browser.setUrl(location.getText()));
|
||||||
|
|
||||||
browser.setUrl("https://git.minres.com/VP-Tools/SCViewer/src/branch/master/README.md#key-shortcuts");
|
browser.setUrl(Messages.HelpDialog_6);
|
||||||
} catch (SWTError e) {
|
} catch (SWTError e) {
|
||||||
System.out.println("Could not instantiate Browser: " + e.getMessage());
|
System.out.println(Messages.HelpDialog_7 + e.getMessage());
|
||||||
}
|
}
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue