Externalized strings

This commit is contained in:
Eyck Jentzsch 2017-01-23 22:53:14 +01:00
parent a052c6aa3b
commit d0be3b0ca2
31 changed files with 321 additions and 188 deletions

View File

@ -64,7 +64,7 @@ public class E4LifeCycle {
eventBroker.subscribe(UIEvents.UILifeCycle.ACTIVATE, new EventHandler() { eventBroker.subscribe(UIEvents.UILifeCycle.ACTIVATE, new EventHandler() {
@Override @Override
public void handleEvent(Event event) { public void handleEvent(Event event) {
MPart part = (MPart) event.getProperty("ChangedElement"); MPart part = (MPart) event.getProperty("ChangedElement"); //$NON-NLS-1$
if(part!=null){ if(part!=null){
IEclipseContext ctx = part.getContext(); IEclipseContext ctx = part.getContext();
OpenViewHandler openViewHandler= new OpenViewHandler(); OpenViewHandler openViewHandler= new OpenViewHandler();
@ -115,7 +115,7 @@ public class E4LifeCycle {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
boolean first=true; boolean first=true;
for(String token:tokens){ for(String token:tokens){
if(!first) sb.append(","); if(!first) sb.append(","); //$NON-NLS-1$
sb.append(token); sb.append(token);
first=false; first=false;
} }
@ -143,14 +143,14 @@ public class E4LifeCycle {
*/ */
public void openViewForFile(String name){ public void openViewForFile(String name){
File file = new File(name); File file = new File(name);
MPart part = partService.createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); MPart part = partService.createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
part.setLabel(file.getName()); part.setLabel(file.getName());
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
partStack.getChildren().add(part); partStack.getChildren().add(part);
partService.showPart(part, PartState.ACTIVATE); partService.showPart(part, PartState.ACTIVATE);
IEclipseContext ctx=part.getContext(); IEclipseContext ctx=part.getContext();
ctx.modify("input", file); ctx.modify("input", file); //$NON-NLS-1$
ctx.declareModifiable("input"); ctx.declareModifiable("input"); //$NON-NLS-1$
} }
} }
} }

View File

@ -0,0 +1,66 @@
package com.minres.scviewer.e4.application;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "com.minres.scviewer.e4.application.messages"; //$NON-NLS-1$
public static String AboutDialog_0;
public static String AboutDialog_1;
public static String DesignBrowser_12;
public static String DesignBrowser_16;
public static String DesignBrowser_2;
public static String DesignBrowser_4;
public static String DesignBrowser_8;
public static String LoadingWaveformDb_0;
public static String LoadStoreSettingsHandler_2;
public static String LoadStoreSettingsHandler_3;
public static String OpenHandler_0;
public static String QuitHandler_0;
public static String QuitHandler_1;
public static String RelationTypeToolControl_0;
public static String RelationTypeToolControl_1;
public static String ResourceManager_0;
public static String SCViewerPreferencesPage_0;
public static String StatusBarControl_1;
public static String StatusBarControl_2;
public static String StatusBarControl_3;
public static String StatusBarControl_4;
public static String SWTResourceManager_0;
public static String TransactionDetails_0;
public static String TransactionDetails_1;
public static String TransactionDetails_10;
public static String TransactionDetails_11;
public static String TransactionDetails_12;
public static String TransactionDetails_13;
public static String TransactionDetails_16;
public static String TransactionDetails_19;
public static String TransactionDetails_2;
public static String TransactionDetails_20;
public static String TransactionDetails_21;
public static String TransactionDetails_3;
public static String TransactionDetails_4;
public static String WaveformPreferencesPage_1;
public static String WaveformViewer_15;
public static String WaveformViewer_16;
public static String WaveformViewer_17;
public static String WaveformViewer_18;
public static String WaveformViewer_19;
public static String WaveformViewer_20;
public static String WaveformViewer_21;
public static String WaveformViewer_37;
public static String WaveformViewer_38;
public static String WaveformViewer_39;
public static String WaveStatusBarControl_10;
public static String WaveStatusBarControl_12;
public static String WaveStatusBarControl_5;
public static String WaveStatusBarControl_6;
public static String WaveStatusBarControl_7;
public static String WaveStatusBarControl_8;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
private Messages() {
}
}

View File

@ -54,7 +54,7 @@ public class NavigateContribution {
WaveformViewer waveformViewerPart = (WaveformViewer) part.getObject(); WaveformViewer waveformViewerPart = (WaveformViewer) part.getObject();
RelationType relationTypeFilter = waveformViewerPart.getRelationTypeFilter(); RelationType relationTypeFilter = waveformViewerPart.getRelationTypeFilter();
MCommand command = modelService.findElements(application, MCommand command = modelService.findElements(application,
"com.minres.scviewer.e4.application.command.setrelationtype", MCommand.class, null).get(0); "com.minres.scviewer.e4.application.command.setrelationtype", MCommand.class, null).get(0); //$NON-NLS-1$
MCommandParameter commandParameter = command.getParameters().get(0); MCommandParameter commandParameter = command.getParameters().get(0);
for(RelationType relationType:waveformViewerPart.getAllRelationTypes()){ for(RelationType relationType:waveformViewerPart.getAllRelationTypes()){
// MDirectMenuItem dynamicItem = modelService.createModelElement(MDirectMenuItem.class); // MDirectMenuItem dynamicItem = modelService.createModelElement(MDirectMenuItem.class);
@ -69,15 +69,15 @@ public class NavigateContribution {
MParameter parameter=modelService.createModelElement(MParameter.class); MParameter parameter=modelService.createModelElement(MParameter.class);
parameter.setName(commandParameter.getElementId()); parameter.setName(commandParameter.getElementId());
parameter.setValue(relationType.getName()); parameter.setValue(relationType.getName());
parameter.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application"); parameter.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application"); //$NON-NLS-1$
MHandledMenuItem handledMenuItem= modelService.createModelElement(MHandledMenuItem.class); MHandledMenuItem handledMenuItem= modelService.createModelElement(MHandledMenuItem.class);
handledMenuItem.setLabel(relationType.getName()); handledMenuItem.setLabel(relationType.getName());
if(relationTypeFilter.equals(relationType)){ if(relationTypeFilter.equals(relationType)){
handledMenuItem.setEnabled(false); handledMenuItem.setEnabled(false);
handledMenuItem.setIconURI("platform:/plugin/com.minres.scviewer.e4.application/icons/tick.png"); handledMenuItem.setIconURI("platform:/plugin/com.minres.scviewer.e4.application/icons/tick.png"); //$NON-NLS-1$
}else }else
handledMenuItem.setIconURI("platform:/plugin/com.minres.scviewer.e4.application/icons/empty.png"); handledMenuItem.setIconURI("platform:/plugin/com.minres.scviewer.e4.application/icons/empty.png"); //$NON-NLS-1$
handledMenuItem.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application"); handledMenuItem.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application"); //$NON-NLS-1$
handledMenuItem.setCommand(command); handledMenuItem.setCommand(command);
handledMenuItem.getParameters().add(parameter); handledMenuItem.getParameters().add(parameter);
items.add(handledMenuItem); items.add(handledMenuItem);

View File

@ -31,6 +31,7 @@ import org.eclipse.swt.widgets.Composite;
import com.minres.scviewer.database.ITx; import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.RelationType; import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.e4.application.Messages;
import com.minres.scviewer.e4.application.parts.PartListener; import com.minres.scviewer.e4.application.parts.PartListener;
import com.minres.scviewer.e4.application.parts.WaveformViewer; import com.minres.scviewer.e4.application.parts.WaveformViewer;
@ -49,7 +50,7 @@ public class RelationTypeToolControl extends PartListener implements ISelectionC
WaveformViewer waveformViewerPart; WaveformViewer waveformViewerPart;
/** The dummy. */ /** The dummy. */
RelationType dummy = RelationType.create("------------"); RelationType dummy = RelationType.create(Messages.RelationTypeToolControl_0);
/** /**
* Instantiates a new relation type tool control. * Instantiates a new relation type tool control.
@ -72,7 +73,7 @@ public class RelationTypeToolControl extends PartListener implements ISelectionC
comboViewer = new ComboViewer(parent, SWT.NONE); comboViewer = new ComboViewer(parent, SWT.NONE);
Combo comboBox = comboViewer.getCombo(); Combo comboBox = comboViewer.getCombo();
comboBox.setBounds(0, 0, 26, 22); comboBox.setBounds(0, 0, 26, 22);
comboBox.setText("Select"); comboBox.setText(Messages.RelationTypeToolControl_1);
comboViewer.setContentProvider(new ArrayContentProvider()); comboViewer.setContentProvider(new ArrayContentProvider());
comboViewer.setInput(new RelationType[] {dummy}); comboViewer.setInput(new RelationType[] {dummy});
comboViewer.setSelection(new StructuredSelection(dummy)); comboViewer.setSelection(new StructuredSelection(dummy));

View File

@ -21,7 +21,7 @@ public class AboutHandler {
@Execute @Execute
public void execute(Shell shell, MApplication app, MWindow window, EModelService ms /*@Named("mdialog01.dialog.0") MDialog dialog*/) { public void execute(Shell shell, MApplication app, MWindow window, EModelService ms /*@Named("mdialog01.dialog.0") MDialog dialog*/) {
MDialog dialog = (MDialog) ms.find("com.minres.scviewer.e4.application.dialog.aboutscviewer", app); MDialog dialog = (MDialog) ms.find("com.minres.scviewer.e4.application.dialog.aboutscviewer", app); //$NON-NLS-1$
dialog.setToBeRendered(true); dialog.setToBeRendered(true);
dialog.setToBeRendered(false); dialog.setToBeRendered(false);
} }

View File

@ -29,8 +29,8 @@ import com.minres.scviewer.e4.application.parts.DesignBrowser;
public class AddWaveformHandler { public class AddWaveformHandler {
public final static String PARAM_WHERE_ID="com.minres.scviewer.e4.application.command.addwaveform.where"; public final static String PARAM_WHERE_ID="com.minres.scviewer.e4.application.command.addwaveform.where"; //$NON-NLS-1$
public final static String PARAM_ALL_ID="com.minres.scviewer.e4.application.command.addwaveform.all"; public final static String PARAM_ALL_ID="com.minres.scviewer.e4.application.command.addwaveform.all"; //$NON-NLS-1$
@Inject @Optional DesignBrowser designBrowser; @Inject @Optional DesignBrowser designBrowser;
@ -40,8 +40,8 @@ public class AddWaveformHandler {
@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection) { @Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection) {
if(designBrowser==null) designBrowser = getListPart( partService); if(designBrowser==null) designBrowser = getListPart( partService);
if(designBrowser==null || designBrowser.getActiveWaveformViewerPart()==null) return false; if(designBrowser==null || designBrowser.getActiveWaveformViewerPart()==null) return false;
Boolean before = "before".equalsIgnoreCase(where); Boolean before = "before".equalsIgnoreCase(where); //$NON-NLS-1$
if("true".equalsIgnoreCase(all)) if("true".equalsIgnoreCase(all)) //$NON-NLS-1$
return designBrowser.getFilteredChildren().length>0 && return designBrowser.getFilteredChildren().length>0 &&
(!before || ((IStructuredSelection)designBrowser.getActiveWaveformViewerPart().getSelection()).size()>0); (!before || ((IStructuredSelection)designBrowser.getActiveWaveformViewerPart().getSelection()).size()>0);
else else
@ -57,7 +57,7 @@ public class AddWaveformHandler {
if(designBrowser!=null && selection.size()>0){ if(designBrowser!=null && selection.size()>0){
List<?> sel=selection.toList(); List<?> sel=selection.toList();
designBrowser.getActiveWaveformViewerPart().addStreamsToList(sel.toArray(new IWaveform<?>[]{}), designBrowser.getActiveWaveformViewerPart().addStreamsToList(sel.toArray(new IWaveform<?>[]{}),
"before".equalsIgnoreCase(where)); "before".equalsIgnoreCase(where)); //$NON-NLS-1$
} }
} }

View File

@ -22,10 +22,11 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.minres.scviewer.e4.application.Messages;
import com.minres.scviewer.e4.application.parts.WaveformViewer; import com.minres.scviewer.e4.application.parts.WaveformViewer;
public class LoadStoreSettingsHandler { public class LoadStoreSettingsHandler {
static final String PARAMETER_ID="com.minres.scviewer.e4.application.commandparameter.loadStore"; static final String PARAMETER_ID="com.minres.scviewer.e4.application.commandparameter.loadStore"; //$NON-NLS-1$
@CanExecute @CanExecute
public boolean canExecute(EPartService partService) { public boolean canExecute(EPartService partService) {
@ -37,10 +38,10 @@ public class LoadStoreSettingsHandler {
@Execute @Execute
public void execute(@Named(PARAMETER_ID) String param, Shell shell, MApplication app, EModelService modelService, public void execute(@Named(PARAMETER_ID) String param, Shell shell, MApplication app, EModelService modelService,
EPartService partService){ EPartService partService){
boolean load = "load".equals(param); boolean load = "load".equals(param); //$NON-NLS-1$
FileDialog dialog = new FileDialog(shell, load?SWT.OPEN:SWT.SAVE); FileDialog dialog = new FileDialog(shell, load?SWT.OPEN:SWT.SAVE);
dialog.setFilterExtensions (new String []{"*.scview"}); dialog.setFilterExtensions (new String []{Messages.LoadStoreSettingsHandler_2});
if(!load) dialog.setFileName("SCViewer.scview"); if(!load) dialog.setFileName(Messages.LoadStoreSettingsHandler_3);
String res = dialog.open(); String res = dialog.open();
MPart part = partService.getActivePart(); MPart part = partService.getActivePart();
if(res!=null && part!=null){ if(res!=null && part!=null){

View File

@ -26,7 +26,7 @@ import com.minres.scviewer.e4.application.parts.WaveformViewer;
public class MoveWaveformHandler { public class MoveWaveformHandler {
static final String PARAMETER_ID="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir"; static final String PARAMETER_ID="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir"; //$NON-NLS-1$
@CanExecute @CanExecute
public Boolean canExecute(ESelectionService selectionService){ public Boolean canExecute(ESelectionService selectionService){
@ -43,9 +43,9 @@ public class MoveWaveformHandler {
MPart part = partService.getActivePart(); MPart part = partService.getActivePart();
Object obj = part.getObject(); Object obj = part.getObject();
if(obj instanceof WaveformViewer){ if(obj instanceof WaveformViewer){
if("up".equalsIgnoreCase(param)) if("up".equalsIgnoreCase(param)) //$NON-NLS-1$
((WaveformViewer)obj).moveSelected(-1); ((WaveformViewer)obj).moveSelected(-1);
else if("down".equalsIgnoreCase(param)) else if("down".equalsIgnoreCase(param)) //$NON-NLS-1$
((WaveformViewer)obj).moveSelected(1); ((WaveformViewer)obj).moveSelected(1);
} }
} }

View File

@ -27,7 +27,7 @@ import com.minres.scviewer.e4.application.parts.WaveformViewer;
public class NavigateEvent { public class NavigateEvent {
final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir"; final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir"; //$NON-NLS-1$
@CanExecute @CanExecute
public Boolean canExecute(ESelectionService selectionService){ public Boolean canExecute(ESelectionService selectionService){
@ -46,9 +46,9 @@ public class NavigateEvent {
MPart part = partService.getActivePart(); MPart part = partService.getActivePart();
Object obj = part.getObject(); Object obj = part.getObject();
if(obj instanceof WaveformViewer){ if(obj instanceof WaveformViewer){
if("next".equalsIgnoreCase(param)) if("next".equalsIgnoreCase(param)) //$NON-NLS-1$
((WaveformViewer)obj).moveCursor(GotoDirection.NEXT); ((WaveformViewer)obj).moveCursor(GotoDirection.NEXT);
else if("prev".equalsIgnoreCase(param)) else if("prev".equalsIgnoreCase(param)) //$NON-NLS-1$
((WaveformViewer)obj).moveCursor(GotoDirection.PREV); ((WaveformViewer)obj).moveCursor(GotoDirection.PREV);
} }
} }

View File

@ -26,7 +26,7 @@ import com.minres.scviewer.e4.application.parts.WaveformViewer;
public class NavigateTrans { public class NavigateTrans {
final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir"; final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir"; //$NON-NLS-1$
@CanExecute @CanExecute
public Boolean canExecute(ESelectionService selectionService){ public Boolean canExecute(ESelectionService selectionService){
@ -43,9 +43,9 @@ public class NavigateTrans {
MPart part = partService.getActivePart(); MPart part = partService.getActivePart();
Object obj = part.getObject(); Object obj = part.getObject();
if(obj instanceof WaveformViewer){ if(obj instanceof WaveformViewer){
if("next".equalsIgnoreCase(param)) if("next".equalsIgnoreCase(param)) //$NON-NLS-1$
((WaveformViewer)obj).moveSelection(GotoDirection.NEXT); ((WaveformViewer)obj).moveSelection(GotoDirection.NEXT);
else if("prev".equalsIgnoreCase(param)) else if("prev".equalsIgnoreCase(param)) //$NON-NLS-1$
((WaveformViewer)obj).moveSelection(GotoDirection.PREV); ((WaveformViewer)obj).moveSelection(GotoDirection.PREV);
} }
} }

View File

@ -23,13 +23,15 @@ import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.minres.scviewer.e4.application.Messages;
public class OpenHandler { public class OpenHandler {
@Execute @Execute
public void execute(Shell shell, MApplication app, EModelService modelService, EPartService partService){ public void execute(Shell shell, MApplication app, EModelService modelService, EPartService partService){
FileDialog dialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI); FileDialog dialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
// dialog.setFilterExtensions (new String []{"vcd", "txdb", "txlog"}); // dialog.setFilterExtensions (new String []{"vcd", "txdb", "txlog"});
dialog.setFilterExtensions (new String []{"*.vcd;*.txdb;*.txlog"}); dialog.setFilterExtensions (new String []{Messages.OpenHandler_0});
dialog.open(); dialog.open();
String path = dialog.getFilterPath(); String path = dialog.getFilterPath();
for(String fileName: dialog.getFileNames()){ for(String fileName: dialog.getFileNames()){
@ -38,19 +40,19 @@ public class OpenHandler {
// MPart part = MBasicFactory.INSTANCE.createPart(); // MPart part = MBasicFactory.INSTANCE.createPart();
// part.setLabel(fileName); // part.setLabel(fileName);
// part.setContributionURI("bundleclass://com.minres.scviewer.e4.application/"+ WaveformViewerPart.class.getName()); // part.setContributionURI("bundleclass://com.minres.scviewer.e4.application/"+ WaveformViewerPart.class.getName());
MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
part.setLabel(file.getName()); part.setLabel(file.getName());
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
partStack.getChildren().add(part); partStack.getChildren().add(part);
partService.showPart(part, PartState.ACTIVATE); partService.showPart(part, PartState.ACTIVATE);
// Object o = part.getObject(); // Object o = part.getObject();
// if(o instanceof WaveformViewerPart) // if(o instanceof WaveformViewerPart)
// ((WaveformViewerPart)o).setPartInput(file); // ((WaveformViewerPart)o).setPartInput(file);
IEclipseContext ctx=part.getContext(); IEclipseContext ctx=part.getContext();
ctx.modify("input", file); ctx.modify("input", file); //$NON-NLS-1$
ctx.declareModifiable("input"); ctx.declareModifiable("input"); //$NON-NLS-1$
} }

View File

@ -15,12 +15,14 @@ import org.eclipse.e4.ui.workbench.IWorkbench;
import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.minres.scviewer.e4.application.Messages;
public class QuitHandler { public class QuitHandler {
@Execute @Execute
public void execute(IWorkbench workbench, Shell shell){ public void execute(IWorkbench workbench, Shell shell){
if (MessageDialog.openConfirm(shell, "Confirmation", if (MessageDialog.openConfirm(shell, Messages.QuitHandler_0,
"Do you want to exit?")) { Messages.QuitHandler_1)) {
workbench.close(); workbench.close();
} }
} }

View File

@ -20,7 +20,7 @@ import org.eclipse.e4.ui.workbench.modeling.EPartService;
import com.minres.scviewer.e4.application.parts.WaveformViewer; import com.minres.scviewer.e4.application.parts.WaveformViewer;
public class SetRelationTypeHandler { public class SetRelationTypeHandler {
final static String PARAMTER_ID="com.minres.scviewer.e4.application.commandparameter.relationName"; final static String PARAMTER_ID="com.minres.scviewer.e4.application.commandparameter.relationName"; //$NON-NLS-1$
@Execute @Execute
public void execute(@Named(PARAMTER_ID) String relationName, EPartService partService) { public void execute(@Named(PARAMTER_ID) String relationName, EPartService partService) {

View File

@ -22,7 +22,7 @@ import org.eclipse.e4.ui.workbench.modeling.EPartService;
*/ */
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
public class ThemeSetHandler { public class ThemeSetHandler {
final static String PARAMTER_ID = "com.minres.scviewer.e4.application.command.theme.parameter.id"; final static String PARAMTER_ID = "com.minres.scviewer.e4.application.command.theme.parameter.id"; //$NON-NLS-1$
@CanExecute @CanExecute
public boolean canExecute(EPartService partService) { public boolean canExecute(EPartService partService) {

View File

@ -22,7 +22,7 @@ import com.minres.scviewer.e4.application.parts.WaveformViewer;
public class ZoomHandler { public class ZoomHandler {
final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level"; final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level"; //$NON-NLS-1$
@CanExecute @CanExecute
public boolean canExecute(EPartService partService) { public boolean canExecute(EPartService partService) {
@ -36,11 +36,11 @@ public class ZoomHandler {
if(obj instanceof WaveformViewer){ if(obj instanceof WaveformViewer){
WaveformViewer waveformViewerPart = (WaveformViewer) obj; WaveformViewer waveformViewerPart = (WaveformViewer) obj;
int zoomLevel = waveformViewerPart.getZoomLevel(); int zoomLevel = waveformViewerPart.getZoomLevel();
if("in".equalsIgnoreCase(level)) if("in".equalsIgnoreCase(level)) //$NON-NLS-1$
waveformViewerPart.setZoomLevel(zoomLevel-1); waveformViewerPart.setZoomLevel(zoomLevel-1);
else if("out".equalsIgnoreCase(level)) else if("out".equalsIgnoreCase(level)) //$NON-NLS-1$
waveformViewerPart.setZoomLevel(zoomLevel+1); waveformViewerPart.setZoomLevel(zoomLevel+1);
else if("fit".equalsIgnoreCase(level)) else if("fit".equalsIgnoreCase(level)) //$NON-NLS-1$
waveformViewerPart.setZoomFit(); waveformViewerPart.setZoomFit();
} }

View File

@ -32,13 +32,15 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.ProgressBar; import org.eclipse.swt.widgets.ProgressBar;
import org.osgi.service.prefs.PreferencesService; import org.osgi.service.prefs.PreferencesService;
import com.minres.scviewer.e4.application.Messages;
/** /**
* The Class StatusBarControl. * The Class StatusBarControl.
*/ */
public class StatusBarControl { public class StatusBarControl {
/** The Constant STATUS_UPDATE. */ /** The Constant STATUS_UPDATE. */
public static final String STATUS_UPDATE="StatusUpdate"; public static final String STATUS_UPDATE="StatusUpdate"; //$NON-NLS-1$
/** The model service. */ /** The model service. */
@Inject EModelService modelService; @Inject EModelService modelService;
@ -194,7 +196,7 @@ public class StatusBarControl {
progressBar.setMaximum(progressBar.getMaximum() + totalWork); progressBar.setMaximum(progressBar.getMaximum() + totalWork);
} }
runningTasks++; runningTasks++;
progressBar.setToolTipText("Currently running: " + runningTasks + "\nLast task: " + name); progressBar.setToolTipText(Messages.StatusBarControl_1 + runningTasks + Messages.StatusBarControl_2 + name);
} }
}); });
} }
@ -266,9 +268,9 @@ public class StatusBarControl {
public void run() { public void run() {
runningTasks--; runningTasks--;
if (runningTasks > 0){ // --- some tasks are still running --- if (runningTasks > 0){ // --- some tasks are still running ---
progressBar.setToolTipText("Currently running: " + runningTasks); progressBar.setToolTipText(Messages.StatusBarControl_3 + runningTasks);
} else { // --- all tasks are done (a reset of selection could also be done) --- } else { // --- all tasks are done (a reset of selection could also be done) ---
progressBar.setToolTipText("No background progress running."); progressBar.setToolTipText(Messages.StatusBarControl_4);
} }
} }
}); });

View File

@ -27,22 +27,24 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import com.minres.scviewer.e4.application.Messages;
/** /**
* The Class WaveStatusBarControl. * The Class WaveStatusBarControl.
*/ */
public class WaveStatusBarControl extends StatusBarControl { public class WaveStatusBarControl extends StatusBarControl {
/** The Constant ZOOM_LEVEL. */ /** The Constant ZOOM_LEVEL. */
public static final String ZOOM_LEVEL="ZoomLevelUpdate"; public static final String ZOOM_LEVEL="ZoomLevelUpdate"; //$NON-NLS-1$
/** The Constant CURSOR_TIME. */ /** The Constant CURSOR_TIME. */
public static final String CURSOR_TIME="CursorPosUpdate"; public static final String CURSOR_TIME="CursorPosUpdate"; //$NON-NLS-1$
/** The Constant MARKER_TIME. */ /** The Constant MARKER_TIME. */
public static final String MARKER_TIME="MarkerPosUpdate"; public static final String MARKER_TIME="MarkerPosUpdate"; //$NON-NLS-1$
/** The Constant MARKER_DIFF. */ /** The Constant MARKER_DIFF. */
public static final String MARKER_DIFF="MarlerDiffUpdate"; public static final String MARKER_DIFF="MarlerDiffUpdate"; //$NON-NLS-1$
/** The model service. */ /** The model service. */
@Inject @Inject
@ -75,7 +77,7 @@ public class WaveStatusBarControl extends StatusBarControl {
super(); super();
this.labelString = labelString; this.labelString = labelString;
this.width=width; this.width=width;
content=""; content=""; //$NON-NLS-1$
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -124,10 +126,10 @@ public class WaveStatusBarControl extends StatusBarControl {
@Inject @Inject
public WaveStatusBarControl(UISynchronize sync) { public WaveStatusBarControl(UISynchronize sync) {
super(sync); super(sync);
cursorContribution = new TextContributionItem("C:", 80); cursorContribution = new TextContributionItem(Messages.WaveStatusBarControl_5, 80);
markerContribution = new TextContributionItem("M:", 80); markerContribution = new TextContributionItem(Messages.WaveStatusBarControl_6, 80);
markerDiffContribution = new TextContributionItem("C-M:", 80); markerDiffContribution = new TextContributionItem(Messages.WaveStatusBarControl_7, 80);
zoomContribution = new TextContributionItem("Z:", 80); zoomContribution = new TextContributionItem(Messages.WaveStatusBarControl_8, 80);
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,cursorContribution); manager.appendToGroup(StatusLineManager.BEGIN_GROUP,cursorContribution);
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerContribution); manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerContribution);
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerDiffContribution); manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerDiffContribution);
@ -144,13 +146,13 @@ public class WaveStatusBarControl extends StatusBarControl {
if(manager!=null && selection!=null){ if(manager!=null && selection!=null){
switch(selection.size()){ switch(selection.size()){
case 0: case 0:
manager.setMessage(""); manager.setMessage(""); //$NON-NLS-1$
break; break;
case 1: case 1:
manager.setMessage(selection.getFirstElement().getClass().getSimpleName()+" selected"); manager.setMessage(selection.getFirstElement().getClass().getSimpleName()+Messages.WaveStatusBarControl_10);
break; break;
default: default:
manager.setMessage(""+selection.size()+" Elements"); manager.setMessage(""+selection.size()+Messages.WaveStatusBarControl_12); //$NON-NLS-1$
break; break;
} }
} }

View File

@ -0,0 +1,52 @@
AboutDialog_0=\nSCViewer - a SystemC waveform viewer\n\nVersion: 1.2\n
AboutDialog_1=\nCopyright (c) 2015,2016,2017 MINRES Technologies GmbH and others.\n\nAll rights reserved. MINRES and the MINRES logo are trademarks of MINRES Technologies GmbH, http://www.minres.com/. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html\n\nParts of the software are governed by the Apache License Version 2.0 available at http://www.apache.org/licenses/. These are namely org.apache.jdbm and org.sqlite JDBC driver\n\nSources code is hosted at GitHub: https://github.com/minres/SCViewer\n
DesignBrowser_12=Append all after
DesignBrowser_16=Insert all before
DesignBrowser_2=Enter text to filter waveforms
DesignBrowser_4=Append after
DesignBrowser_8=Insert before
LoadingWaveformDb_0=Database loading...
LoadStoreSettingsHandler_2=*.scview
LoadStoreSettingsHandler_3=SCViewer.scview
OpenHandler_0=*.vcd;*.txdb;*.txlog
QuitHandler_0=Confirmation
QuitHandler_1=Do you want to exit?
RelationTypeToolControl_0=------------
RelationTypeToolControl_1=Select
ResourceManager_0=Wrong decorate corner
SCViewerPreferencesPage_0=Check for changed database
StatusBarControl_1=Currently running:
StatusBarControl_2=\nLast task:
StatusBarControl_3=Currently running:
StatusBarControl_4=No background progress running.
SWTResourceManager_0=Wrong decorate corner
TransactionDetails_0=Enter text to filter
TransactionDetails_1=Name
TransactionDetails_10=Properties
TransactionDetails_11=Attributes
TransactionDetails_12=Incoming relations
TransactionDetails_13=Outgoing relations
TransactionDetails_16=String
TransactionDetails_19=Start time
TransactionDetails_2=Type
TransactionDetails_20=Time
TransactionDetails_21=End time
TransactionDetails_3=Value
TransactionDetails_4=Relation
WaveformPreferencesPage_1=Color for
WaveformViewer_15=Database Load Job
WaveformViewer_16=Loading
WaveformViewer_17=Database re-load
WaveformViewer_18=Would you like to reload the database?
WaveformViewer_19=vcd
WaveformViewer_20=txdb
WaveformViewer_21=txlog
WaveformViewer_37=Database open
WaveformViewer_38=Would you like to open the adjacent database
WaveformViewer_39=\ as well?
WaveStatusBarControl_10=\ selected
WaveStatusBarControl_12=\ Elements
WaveStatusBarControl_5=C:
WaveStatusBarControl_6=M:
WaveStatusBarControl_7=C-M:
WaveStatusBarControl_8=Z:

View File

@ -40,24 +40,18 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.wb.swt.ResourceManager; import org.eclipse.wb.swt.ResourceManager;
import org.eclipse.wb.swt.SWTResourceManager; import org.eclipse.wb.swt.SWTResourceManager;
import com.minres.scviewer.e4.application.Messages;
/** /**
* The Class AboutDialog. * The Class AboutDialog.
*/ */
public class AboutDialog extends Dialog { public class AboutDialog extends Dialog {
/** The product title. */ /** The product title. */
private String productTitle= private String productTitle=Messages.AboutDialog_0;
"\nSCViewer - a SystemC waveform viewer\n\nVersion: 1.0\n";
/** The copyright text. */ /** The copyright text. */
private String copyrightText="\nCopyright (c) 2015 MINRES Technologies GmbH and others.\n"+ private String copyrightText=Messages.AboutDialog_1;
"\n"+
"All rights reserved. MINRES and the MINRES logo are trademarks of MINRES Technologies GmbH, http://www.minres.com/ . "+
"This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 "+
"which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html\n\n"+
"Parts of the software are governed by the Apache License Version 2.0 available at http://www.apache.org/licenses/. "+
"These are namely org.apache.jdbm and org.sqlite JDBC driver\n"+
"\n\nSources code is hosted at GitHub: https://github.com/minres/SCViewer\n";
/** /**
* Create the dialog. * Create the dialog.
@ -86,8 +80,8 @@ public class AboutDialog extends Dialog {
composite.setLayout(new GridLayout(2, false)); composite.setLayout(new GridLayout(2, false));
final Color white=SWTResourceManager.getColor(SWT.COLOR_WHITE); final Color white=SWTResourceManager.getColor(SWT.COLOR_WHITE);
final Image scviewerLogo=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/SCViewer_logo.png"); final Image scviewerLogo=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/SCViewer_logo.png"); //$NON-NLS-1$ //$NON-NLS-2$
final Image minresLogo=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/Minres_logo.png"); final Image minresLogo=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/Minres_logo.png"); //$NON-NLS-1$ //$NON-NLS-2$
Canvas canvas = new Canvas(composite,SWT.NO_REDRAW_RESIZE); Canvas canvas = new Canvas(composite,SWT.NO_REDRAW_RESIZE);
GridData gd_canvas = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); GridData gd_canvas = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
@ -117,7 +111,7 @@ public class AboutDialog extends Dialog {
styleRange.fontStyle = SWT.BOLD; styleRange.fontStyle = SWT.BOLD;
styledText.setStyleRange(styleRange); styledText.setStyleRange(styleRange);
///^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/ ///^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
Pattern pattern = Pattern.compile("https?:\\/\\/([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w\\.-]*)*\\/?"); Pattern pattern = Pattern.compile("https?:\\/\\/([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w\\.-]*)*\\/?"); //$NON-NLS-1$
// in case you would like to ignore case sensitivity, // in case you would like to ignore case sensitivity,
// you could use this statement: // you could use this statement:
// Pattern pattern = Pattern.compile("\\s+", Pattern.CASE_INSENSITIVE); // Pattern pattern = Pattern.compile("\\s+", Pattern.CASE_INSENSITIVE);

View File

@ -68,6 +68,7 @@ import com.minres.scviewer.database.IHierNode;
import com.minres.scviewer.database.ITx; import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb; import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.e4.application.Messages;
import com.minres.scviewer.e4.application.handlers.AddWaveformHandler; import com.minres.scviewer.e4.application.handlers.AddWaveformHandler;
import com.minres.scviewer.e4.application.provider.TxDbContentProvider; import com.minres.scviewer.e4.application.provider.TxDbContentProvider;
import com.minres.scviewer.e4.application.provider.TxDbLabelProvider; import com.minres.scviewer.e4.application.provider.TxDbLabelProvider;
@ -79,7 +80,7 @@ import com.minres.scviewer.e4.application.provider.TxDbLabelProvider;
public class DesignBrowser { public class DesignBrowser {
/** The Constant POPUP_ID. */ /** The Constant POPUP_ID. */
private static final String POPUP_ID="com.minres.scviewer.e4.application.parts.DesignBrowser.popupmenu"; private static final String POPUP_ID="com.minres.scviewer.e4.application.parts.DesignBrowser.popupmenu"; //$NON-NLS-1$
/** The event broker. */ /** The event broker. */
@Inject IEventBroker eventBroker; @Inject IEventBroker eventBroker;
@ -124,7 +125,7 @@ public class DesignBrowser {
private PropertyChangeListener treeViewerPCL = new PropertyChangeListener() { private PropertyChangeListener treeViewerPCL = new PropertyChangeListener() {
@Override @Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
if("CHILDS".equals(evt.getPropertyName())){ if("CHILDS".equals(evt.getPropertyName())){ //$NON-NLS-1$
treeViewer.getTree().getDisplay().asyncExec(new Runnable() { treeViewer.getTree().getDisplay().asyncExec(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -215,7 +216,7 @@ public class DesignBrowser {
parent.setLayout(new GridLayout(1, false)); parent.setLayout(new GridLayout(1, false));
nameFilter = new Text(parent, SWT.BORDER); nameFilter = new Text(parent, SWT.BORDER);
nameFilter.setMessage("Enter text to filter waveforms"); nameFilter.setMessage(Messages.DesignBrowser_2);
nameFilter.addModifyListener(new ModifyListener() { nameFilter.addModifyListener(new ModifyListener() {
@Override @Override
public void modifyText(ModifyEvent e) { public void modifyText(ModifyEvent e) {
@ -237,7 +238,7 @@ public class DesignBrowser {
@Override @Override
public void doubleClick(DoubleClickEvent event) { public void doubleClick(DoubleClickEvent event) {
AddWaveformHandler myHandler = new AddWaveformHandler(); AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "after", false); Object result = runCommand(myHandler, CanExecute.class, "after", false); //$NON-NLS-1$
if(result!=null && (Boolean)result) if(result!=null && (Boolean)result)
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx); ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
} }
@ -258,14 +259,14 @@ public class DesignBrowser {
toolBar.setBounds(0, 0, 87, 20); toolBar.setBounds(0, 0, 87, 20);
appendItem = new ToolItem(toolBar, SWT.NONE); appendItem = new ToolItem(toolBar, SWT.NONE);
appendItem.setToolTipText("Append after"); appendItem.setToolTipText(Messages.DesignBrowser_4);
appendItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_wave.png")); appendItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_wave.png")); //$NON-NLS-1$ //$NON-NLS-2$
appendItem.setEnabled(false); appendItem.setEnabled(false);
appendItem.addSelectionListener(new SelectionAdapter() { appendItem.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
AddWaveformHandler myHandler = new AddWaveformHandler(); AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "after", false); Object result = runCommand(myHandler, CanExecute.class, "after", false); //$NON-NLS-1$
if(result!=null && (Boolean)result) if(result!=null && (Boolean)result)
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx); ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
} }
@ -273,14 +274,14 @@ public class DesignBrowser {
}); });
insertItem = new ToolItem(toolBar, SWT.NONE); insertItem = new ToolItem(toolBar, SWT.NONE);
insertItem.setToolTipText("Insert before"); insertItem.setToolTipText(Messages.DesignBrowser_8);
insertItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_wave.png")); insertItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_wave.png")); //$NON-NLS-1$ //$NON-NLS-2$
insertItem.setEnabled(false); insertItem.setEnabled(false);
insertItem.addSelectionListener(new SelectionAdapter() { insertItem.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
AddWaveformHandler myHandler = new AddWaveformHandler(); AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "before", false); Object result = runCommand(myHandler, CanExecute.class, "before", false); //$NON-NLS-1$
if(result!=null && (Boolean)result) if(result!=null && (Boolean)result)
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx); ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
} }
@ -288,8 +289,8 @@ public class DesignBrowser {
new ToolItem(toolBar, SWT.SEPARATOR); new ToolItem(toolBar, SWT.SEPARATOR);
appendAllItem = new ToolItem(toolBar, SWT.NONE); appendAllItem = new ToolItem(toolBar, SWT.NONE);
appendAllItem.setToolTipText("Append all after"); appendAllItem.setToolTipText(Messages.DesignBrowser_12);
appendAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_all_waves.png")); appendAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_all_waves.png")); //$NON-NLS-1$ //$NON-NLS-2$
appendAllItem.setEnabled(false); appendAllItem.setEnabled(false);
new ToolItem(toolBar, SWT.SEPARATOR); new ToolItem(toolBar, SWT.SEPARATOR);
@ -301,7 +302,7 @@ public class DesignBrowser {
Object oldSel=selectionService.getSelection(); Object oldSel=selectionService.getSelection();
selectionService.setSelection(new StructuredSelection(all)); selectionService.setSelection(new StructuredSelection(all));
AddWaveformHandler myHandler = new AddWaveformHandler(); AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "after", false); Object result = runCommand(myHandler, CanExecute.class, "after", false); //$NON-NLS-1$
if(result!=null && (Boolean)result) if(result!=null && (Boolean)result)
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx); ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
selectionService.setSelection(oldSel); selectionService.setSelection(oldSel);
@ -309,8 +310,8 @@ public class DesignBrowser {
} }
}); });
insertAllItem = new ToolItem(toolBar, SWT.NONE); insertAllItem = new ToolItem(toolBar, SWT.NONE);
insertAllItem.setToolTipText("Insert all before"); insertAllItem.setToolTipText(Messages.DesignBrowser_16);
insertAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_all_waves.png")); insertAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_all_waves.png")); //$NON-NLS-1$ //$NON-NLS-2$
insertAllItem.setEnabled(false); insertAllItem.setEnabled(false);
insertAllItem.addSelectionListener(new SelectionAdapter() { insertAllItem.addSelectionListener(new SelectionAdapter() {
@Override @Override
@ -320,7 +321,7 @@ public class DesignBrowser {
Object oldSel=selectionService.getSelection(); Object oldSel=selectionService.getSelection();
selectionService.setSelection(new StructuredSelection(all)); selectionService.setSelection(new StructuredSelection(all));
AddWaveformHandler myHandler = new AddWaveformHandler(); AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "before", false); Object result = runCommand(myHandler, CanExecute.class, "before", false); //$NON-NLS-1$
if(result!=null && (Boolean)result) if(result!=null && (Boolean)result)
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx); ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
selectionService.setSelection(oldSel); selectionService.setSelection(oldSel);
@ -400,13 +401,13 @@ public class DesignBrowser {
if(txTableViewer!=null && !insertItem.isDisposed() && !appendItem.isDisposed() && if(txTableViewer!=null && !insertItem.isDisposed() && !appendItem.isDisposed() &&
!appendAllItem.isDisposed() && !insertAllItem.isDisposed()){ !appendAllItem.isDisposed() && !insertAllItem.isDisposed()){
AddWaveformHandler myHandler = new AddWaveformHandler(); AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "after", false); Object result = runCommand(myHandler, CanExecute.class, "after", false); //$NON-NLS-1$
appendItem.setEnabled(result instanceof Boolean && (Boolean)result); appendItem.setEnabled(result instanceof Boolean && (Boolean)result);
result = runCommand(myHandler, CanExecute.class, "after", true); result = runCommand(myHandler, CanExecute.class, "after", true); //$NON-NLS-1$
appendAllItem.setEnabled(result instanceof Boolean && (Boolean)result); appendAllItem.setEnabled(result instanceof Boolean && (Boolean)result);
result = runCommand(myHandler, CanExecute.class, "before", false); result = runCommand(myHandler, CanExecute.class, "before", false); //$NON-NLS-1$
insertItem.setEnabled(result instanceof Boolean && (Boolean)result); insertItem.setEnabled(result instanceof Boolean && (Boolean)result);
result = runCommand(myHandler, CanExecute.class, "before", true); result = runCommand(myHandler, CanExecute.class, "before", true); //$NON-NLS-1$
insertAllItem.setEnabled(result instanceof Boolean && (Boolean)result); insertAllItem.setEnabled(result instanceof Boolean && (Boolean)result);
} }
} }
@ -425,7 +426,7 @@ public class DesignBrowser {
* @param s the new search text * @param s the new search text
*/ */
public void setSearchText(String s) { public void setSearchText(String s) {
this.searchString = ".*" + s + ".*"; this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@ -10,10 +10,11 @@ import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb; import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformEvent; import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.RelationType; import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.e4.application.Messages;
public class LoadingWaveformDb implements IWaveformDb { public class LoadingWaveformDb implements IWaveformDb {
private final String label = "Database loading..."; private final String label = Messages.LoadingWaveformDb_0;
@Override @Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {

View File

@ -55,6 +55,7 @@ import org.eclipse.swt.widgets.Tree;
import com.minres.scviewer.database.ITx; import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.ITxAttribute; import com.minres.scviewer.database.ITxAttribute;
import com.minres.scviewer.database.ITxRelation; import com.minres.scviewer.database.ITxRelation;
import com.minres.scviewer.e4.application.Messages;
import com.minres.scviewer.e4.application.provider.TxPropertiesLabelProvider; import com.minres.scviewer.e4.application.provider.TxPropertiesLabelProvider;
/** /**
@ -107,7 +108,7 @@ public class TransactionDetails {
parent.setLayout(new GridLayout(1, false)); parent.setLayout(new GridLayout(1, false));
nameFilter = new Text(parent, SWT.BORDER); nameFilter = new Text(parent, SWT.BORDER);
nameFilter.setMessage("Enter text to filter"); nameFilter.setMessage(Messages.TransactionDetails_0);
nameFilter.addModifyListener(new ModifyListener() { nameFilter.addModifyListener(new ModifyListener() {
@Override @Override
public void modifyText(ModifyEvent e) { public void modifyText(ModifyEvent e) {
@ -133,7 +134,7 @@ public class TransactionDetails {
tree.setLayoutData(new GridData(GridData.FILL_BOTH)); tree.setLayoutData(new GridData(GridData.FILL_BOTH));
// Add the name column // Add the name column
col1 = new TreeViewerColumn(treeViewer, SWT.NONE); col1 = new TreeViewerColumn(treeViewer, SWT.NONE);
col1.getColumn().setText("Name"); col1.getColumn().setText(Messages.TransactionDetails_1);
col1.getColumn().setResizable(true); col1.getColumn().setResizable(true);
col1.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.NAME))); col1.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.NAME)));
col1.getColumn().addSelectionListener(new SelectionAdapter() { col1.getColumn().addSelectionListener(new SelectionAdapter() {
@ -144,7 +145,7 @@ public class TransactionDetails {
}); });
// Add the type column // Add the type column
col2 = new TreeViewerColumn(treeViewer, SWT.NONE); col2 = new TreeViewerColumn(treeViewer, SWT.NONE);
col2.getColumn().setText("Type"); col2.getColumn().setText(Messages.TransactionDetails_2);
col2.getColumn().setResizable(true); col2.getColumn().setResizable(true);
col2.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.TYPE))); col2.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.TYPE)));
col2.getColumn().addSelectionListener(new SelectionAdapter() { col2.getColumn().addSelectionListener(new SelectionAdapter() {
@ -155,7 +156,7 @@ public class TransactionDetails {
}); });
// Add the value column // Add the value column
col3 = new TreeViewerColumn(treeViewer, SWT.NONE); col3 = new TreeViewerColumn(treeViewer, SWT.NONE);
col3.getColumn().setText("Value"); col3.getColumn().setText(Messages.TransactionDetails_3);
col3.getColumn().setResizable(true); col3.getColumn().setResizable(true);
col3.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.VALUE))); col3.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.VALUE)));
col3.getColumn().addSelectionListener(new SelectionAdapter() { col3.getColumn().addSelectionListener(new SelectionAdapter() {
@ -282,8 +283,8 @@ public class TransactionDetails {
*/ */
String txToString(ITx tx){ String txToString(ITx tx){
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("tx#").append(tx.getId()).append("[").append(timeToString(tx.getBeginTime())). sb.append("tx#").append(tx.getId()).append("[").append(timeToString(tx.getBeginTime())). //$NON-NLS-1$ //$NON-NLS-2$
append(" - ").append(timeToString(tx.getEndTime())).append("]"); append(" - ").append(timeToString(tx.getEndTime())).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
return sb.toString(); return sb.toString();
} }
@ -369,7 +370,7 @@ public class TransactionDetails {
* @param s the new search text * @param s the new search text
*/ */
public void setSearchText(String s) { public void setSearchText(String s) {
this.searchString = ".*" + s + ".*"; this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -427,12 +428,12 @@ PROPS, /** The attrs. */
*/ */
public String toString(){ public String toString(){
switch(type){ switch(type){
case PROPS: return "Properties"; case PROPS: return Messages.TransactionDetails_10;
case ATTRS: return "Attributes"; case ATTRS: return Messages.TransactionDetails_11;
case IN_REL: return "Incoming relations"; case IN_REL: return Messages.TransactionDetails_12;
case OUT_REL: return "Outgoing relations"; case OUT_REL: return Messages.TransactionDetails_13;
} }
return ""; return ""; //$NON-NLS-1$
} }
} }
@ -476,10 +477,10 @@ PROPS, /** The attrs. */
TreeNode propertyHolder=(TreeNode) element; TreeNode propertyHolder=(TreeNode) element;
if(propertyHolder.type == Type.PROPS){ if(propertyHolder.type == Type.PROPS){
return new Object[][]{ return new Object[][]{
{"Name", "String", propertyHolder.element.getStream().getFullName()}, {Messages.TransactionDetails_1, Messages.TransactionDetails_16, propertyHolder.element.getStream().getFullName()},
{"Type", "String", propertyHolder.element.getGenerator().getName()}, {Messages.TransactionDetails_2, Messages.TransactionDetails_16, propertyHolder.element.getGenerator().getName()},
{"Start time", "Time", timeToString(propertyHolder.element.getBeginTime())}, {Messages.TransactionDetails_19, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getBeginTime())},
{"End time", "Time", timeToString(propertyHolder.element.getEndTime())} {Messages.TransactionDetails_21, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getEndTime())}
}; };
}else if(propertyHolder.type == Type.ATTRS) }else if(propertyHolder.type == Type.ATTRS)
return propertyHolder.element.getAttributes().toArray(); return propertyHolder.element.getAttributes().toArray();
@ -561,7 +562,7 @@ PROPS, /** The attrs. */
ITxAttribute attribute = (ITxAttribute) element; ITxAttribute attribute = (ITxAttribute) element;
return new StyledString(attribute.getName()); return new StyledString(attribute.getName());
}else if (element instanceof ITxRelation) { }else if (element instanceof ITxRelation) {
return new StyledString("Relation"); return new StyledString(Messages.TransactionDetails_4);
}else if(element instanceof Object[]){ }else if(element instanceof Object[]){
Object[] elements = (Object[]) element; Object[] elements = (Object[]) element;
return new StyledString(elements[field].toString()); return new StyledString(elements[field].toString());
@ -575,7 +576,7 @@ PROPS, /** The attrs. */
Object[] elements = (Object[]) element; Object[] elements = (Object[]) element;
return new StyledString(elements[field].toString()); return new StyledString(elements[field].toString());
}else }else
return new StyledString(""); return new StyledString(""); //$NON-NLS-1$
default: default:
if (element instanceof ITxAttribute) { if (element instanceof ITxAttribute) {
ITxAttribute attribute = (ITxAttribute) element; ITxAttribute attribute = (ITxAttribute) element;
@ -586,7 +587,7 @@ PROPS, /** The attrs. */
} else if(element instanceof ITx){ } else if(element instanceof ITx){
return new StyledString(txToString((ITx) element)); return new StyledString(txToString((ITx) element));
}else }else
return new StyledString(""); return new StyledString(""); //$NON-NLS-1$
} }
} }
} }

View File

@ -72,6 +72,7 @@ import com.minres.scviewer.database.ui.ICursor;
import com.minres.scviewer.database.ui.IWaveformViewer; import com.minres.scviewer.database.ui.IWaveformViewer;
import com.minres.scviewer.database.ui.TrackEntry; import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.database.ui.WaveformColors; import com.minres.scviewer.database.ui.WaveformColors;
import com.minres.scviewer.e4.application.Messages;
import com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl; import com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl;
import com.minres.scviewer.e4.application.internal.util.FileMonitor; import com.minres.scviewer.e4.application.internal.util.FileMonitor;
import com.minres.scviewer.e4.application.internal.util.IFileChangeListener; import com.minres.scviewer.e4.application.internal.util.IFileChangeListener;
@ -86,25 +87,25 @@ import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
public class WaveformViewer implements IFileChangeListener, IPreferenceChangeListener { public class WaveformViewer implements IFileChangeListener, IPreferenceChangeListener {
/** The Constant ACTIVE_WAVEFORMVIEW. */ /** The Constant ACTIVE_WAVEFORMVIEW. */
public static final String ACTIVE_WAVEFORMVIEW = "Active_Waveform_View"; public static final String ACTIVE_WAVEFORMVIEW = "Active_Waveform_View"; //$NON-NLS-1$
/** The Constant ADD_WAVEFORM. */ /** The Constant ADD_WAVEFORM. */
public static final String ADD_WAVEFORM = "AddWaveform"; public static final String ADD_WAVEFORM = "AddWaveform"; //$NON-NLS-1$
/** The Constant DATABASE_FILE. */ /** The Constant DATABASE_FILE. */
protected static final String DATABASE_FILE = "DATABASE_FILE"; protected static final String DATABASE_FILE = "DATABASE_FILE"; //$NON-NLS-1$
/** The Constant SHOWN_WAVEFORM. */ /** The Constant SHOWN_WAVEFORM. */
protected static final String SHOWN_WAVEFORM = "SHOWN_WAVEFORM"; protected static final String SHOWN_WAVEFORM = "SHOWN_WAVEFORM"; //$NON-NLS-1$
/** The Constant SHOWN_CURSOR. */ /** The Constant SHOWN_CURSOR. */
protected static final String SHOWN_CURSOR = "SHOWN_CURSOR"; protected static final String SHOWN_CURSOR = "SHOWN_CURSOR"; //$NON-NLS-1$
/** The Constant ZOOM_LEVEL. */ /** The Constant ZOOM_LEVEL. */
protected static final String ZOOM_LEVEL = "ZOOM_LEVEL"; protected static final String ZOOM_LEVEL = "ZOOM_LEVEL"; //$NON-NLS-1$
/** The Constant BASE_LINE_TIME. */ /** The Constant BASE_LINE_TIME. */
protected static final String BASE_LINE_TIME = "BASE_LINE_TIME"; protected static final String BASE_LINE_TIME = "BASE_LINE_TIME"; //$NON-NLS-1$
/** The Constant FILE_CHECK_INTERVAL. */ /** The Constant FILE_CHECK_INTERVAL. */
protected static final long FILE_CHECK_INTERVAL = 60000; protected static final long FILE_CHECK_INTERVAL = 60000;
@ -116,7 +117,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
public static final String ID = "com.minres.scviewer.ui.TxEditorPart"; //$NON-NLS-1$ public static final String ID = "com.minres.scviewer.ui.TxEditorPart"; //$NON-NLS-1$
/** The Constant WAVE_ACTION_ID. */ /** The Constant WAVE_ACTION_ID. */
public static final String WAVE_ACTION_ID = "com.minres.scviewer.ui.action.AddToWave"; public static final String WAVE_ACTION_ID = "com.minres.scviewer.ui.action.AddToWave"; //$NON-NLS-1$
/** The factory. */ /** The factory. */
WaveformViewerFactory factory = new WaveformViewerFactory(); WaveformViewerFactory factory = new WaveformViewerFactory();
@ -193,7 +194,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
database.addPropertyChangeListener(new PropertyChangeListener() { database.addPropertyChangeListener(new PropertyChangeListener() {
@Override @Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
if ("WAVEFORMS".equals(evt.getPropertyName())) { if ("WAVEFORMS".equals(evt.getPropertyName())) { //$NON-NLS-1$
myParent.getDisplay().syncExec(new Runnable() { myParent.getDisplay().syncExec(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -236,8 +237,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
checkForUpdates = prefs.getBoolean(PreferenceConstants.DATABASE_RELOAD, true); checkForUpdates = prefs.getBoolean(PreferenceConstants.DATABASE_RELOAD, true);
filesToLoad = new ArrayList<File>(); filesToLoad = new ArrayList<File>();
persistedState = part.getPersistedState(); persistedState = part.getPersistedState();
Integer files = persistedState.containsKey(DATABASE_FILE + "S") Integer files = persistedState.containsKey(DATABASE_FILE + "S") //$NON-NLS-1$
? Integer.parseInt(persistedState.get(DATABASE_FILE + "S")) : 0; ? Integer.parseInt(persistedState.get(DATABASE_FILE + "S")) : 0; //$NON-NLS-1$
for (int i = 0; i < files; i++) { for (int i = 0; i < files; i++) {
filesToLoad.add(new File(persistedState.get(DATABASE_FILE + i))); filesToLoad.add(new File(persistedState.get(DATABASE_FILE + i)));
} }
@ -245,11 +246,11 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
loadDatabase(persistedState); loadDatabase(persistedState);
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]); eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]);
menuService.registerContextMenu(waveformPane.getNameControl(), menuService.registerContextMenu(waveformPane.getNameControl(),
"com.minres.scviewer.e4.application.popupmenu.namecontext"); "com.minres.scviewer.e4.application.popupmenu.namecontext"); //$NON-NLS-1$
menuService.registerContextMenu(waveformPane.getValueControl(), menuService.registerContextMenu(waveformPane.getValueControl(),
"com.minres.scviewer.e4.application.popupmenu.namecontext"); "com.minres.scviewer.e4.application.popupmenu.namecontext"); //$NON-NLS-1$
menuService.registerContextMenu(waveformPane.getWaveformControl(), menuService.registerContextMenu(waveformPane.getWaveformControl(),
"com.minres.scviewer.e4.application.popupmenu.wavecontext"); "com.minres.scviewer.e4.application.popupmenu.wavecontext"); //$NON-NLS-1$
ePartService.addPartListener(new PartListener() { ePartService.addPartListener(new PartListener() {
@Override @Override
public void partActivated(MPart part) { public void partActivated(MPart part) {
@ -288,7 +289,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
DefaultValuesInitializer initializer = new DefaultValuesInitializer(); DefaultValuesInitializer initializer = new DefaultValuesInitializer();
HashMap<WaveformColors, RGB> colorPref = new HashMap<>(); HashMap<WaveformColors, RGB> colorPref = new HashMap<>();
for (WaveformColors c : WaveformColors.values()) { for (WaveformColors c : WaveformColors.values()) {
String prefValue = prefs.get(c.name() + "_COLOR", String prefValue = prefs.get(c.name() + "_COLOR", //$NON-NLS-1$
StringConverter.asString(initializer.colors[c.ordinal()].getRGB())); StringConverter.asString(initializer.colors[c.ordinal()].getRGB()));
RGB rgb = StringConverter.asRGB(prefValue); RGB rgb = StringConverter.asRGB(prefValue);
colorPref.put(c, rgb); colorPref.put(c, rgb);
@ -303,7 +304,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
*/ */
protected void loadDatabase(final Map<String, String> state) { protected void loadDatabase(final Map<String, String> state) {
fileMonitor.removeFileChangeListener(this); fileMonitor.removeFileChangeListener(this);
Job job = new Job("Database Load Job") { Job job = new Job(Messages.WaveformViewer_15) {
@Override @Override
protected IStatus run(IProgressMonitor monitor) { protected IStatus run(IProgressMonitor monitor) {
// convert to SubMonitor and set total number of work units // convert to SubMonitor and set total number of work units
@ -311,7 +312,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
try { try {
subMonitor.worked(1); subMonitor.worked(1);
for (File file : filesToLoad) { for (File file : filesToLoad) {
subMonitor.setTaskName("Loading "+file.getName()); subMonitor.setTaskName(Messages.WaveformViewer_16+file.getName());
database.load(file); database.load(file);
database.addPropertyChangeListener(waveformPane); database.addPropertyChangeListener(waveformPane);
subMonitor.worked(1); subMonitor.worked(1);
@ -358,8 +359,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
display.asyncExec(new Runnable() { display.asyncExec(new Runnable() {
@Override @Override
public void run() { public void run() {
if (MessageDialog.openQuestion(display.getActiveShell(), "Database re-load", if (MessageDialog.openQuestion(display.getActiveShell(), Messages.WaveformViewer_17,
"Would you like to reload the database?")) { Messages.WaveformViewer_18)) {
Map<String, String> state = new HashMap<>(); Map<String, String> state = new HashMap<>();
saveWaveformViewerState(state); saveWaveformViewerState(state);
waveformPane.getStreamList().clear(); waveformPane.getStreamList().clear();
@ -387,15 +388,15 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
filesToLoad.add(file); filesToLoad.add(file);
try { try {
String ext = getFileExtension(file.getName()); String ext = getFileExtension(file.getName());
if ("vcd".equals(ext.toLowerCase())) { if (Messages.WaveformViewer_19.equals(ext.toLowerCase())) {
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "txdb")))) { if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_20)))) {
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "txdb"))); filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_20)));
} else if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "txlog")))) { } else if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_21)))) {
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "txlog"))); filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_21)));
} }
} else if ("txdb".equals(ext.toLowerCase()) || "txlog".equals(ext.toLowerCase())) { } else if (Messages.WaveformViewer_20.equals(ext.toLowerCase()) || Messages.WaveformViewer_21.equals(ext.toLowerCase())) {
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "vcd")))) { if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_19)))) {
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "vcd"))); filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_19)));
} }
} }
} catch (IOException e) { // silently ignore any error } catch (IOException e) { // silently ignore any error
@ -423,7 +424,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
public void saveState(MPart part) { public void saveState(MPart part) {
// save changes // save changes
Map<String, String> persistedState = part.getPersistedState(); Map<String, String> persistedState = part.getPersistedState();
persistedState.put(DATABASE_FILE + "S", Integer.toString(filesToLoad.size())); persistedState.put(DATABASE_FILE + "S", Integer.toString(filesToLoad.size())); //$NON-NLS-1$
Integer index = 0; Integer index = 0;
for (File file : filesToLoad) { for (File file : filesToLoad) {
persistedState.put(DATABASE_FILE + index, file.getAbsolutePath()); persistedState.put(DATABASE_FILE + index, file.getAbsolutePath());
@ -434,7 +435,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
public void saveState(String fileName){ public void saveState(String fileName){
Map<String, String> persistedState = new HashMap<>(); Map<String, String> persistedState = new HashMap<>();
persistedState.put(DATABASE_FILE + "S", Integer.toString(filesToLoad.size())); persistedState.put(DATABASE_FILE + "S", Integer.toString(filesToLoad.size())); //$NON-NLS-1$
Integer index = 0; Integer index = 0;
for (File file : filesToLoad) { for (File file : filesToLoad) {
persistedState.put(DATABASE_FILE + index, file.getAbsolutePath()); persistedState.put(DATABASE_FILE + index, file.getAbsolutePath());
@ -445,7 +446,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
props.putAll(persistedState); props.putAll(persistedState);
try { try {
FileOutputStream out = new FileOutputStream(fileName); FileOutputStream out = new FileOutputStream(fileName);
props.store(out, "Written by SCViewer"); props.store(out, "Written by SCViewer"); //$NON-NLS-1$
out.close(); out.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
@ -473,14 +474,14 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
*/ */
protected void saveWaveformViewerState(Map<String, String> persistedState) { protected void saveWaveformViewerState(Map<String, String> persistedState) {
Integer index; Integer index;
persistedState.put(SHOWN_WAVEFORM + "S", Integer.toString(waveformPane.getStreamList().size())); persistedState.put(SHOWN_WAVEFORM + "S", Integer.toString(waveformPane.getStreamList().size())); //$NON-NLS-1$
index = 0; index = 0;
for (TrackEntry trackEntry : waveformPane.getStreamList()) { for (TrackEntry trackEntry : waveformPane.getStreamList()) {
persistedState.put(SHOWN_WAVEFORM + index, trackEntry.waveform.getFullName()); persistedState.put(SHOWN_WAVEFORM + index, trackEntry.waveform.getFullName());
index++; index++;
} }
List<ICursor> cursors = waveformPane.getCursorList(); List<ICursor> cursors = waveformPane.getCursorList();
persistedState.put(SHOWN_CURSOR + "S", Integer.toString(cursors.size())); persistedState.put(SHOWN_CURSOR + "S", Integer.toString(cursors.size())); //$NON-NLS-1$
index = 0; index = 0;
for (ICursor cursor : cursors) { for (ICursor cursor : cursors) {
persistedState.put(SHOWN_CURSOR + index, Long.toString(cursor.getTime())); persistedState.put(SHOWN_CURSOR + index, Long.toString(cursor.getTime()));
@ -496,7 +497,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
* @param state the state * @param state the state
*/ */
protected void restoreWaveformViewerState(Map<String, String> state) { protected void restoreWaveformViewerState(Map<String, String> state) {
Integer waves = state.containsKey(SHOWN_WAVEFORM+"S") ? Integer.parseInt(state.get(SHOWN_WAVEFORM + "S")):0; Integer waves = state.containsKey(SHOWN_WAVEFORM+"S") ? Integer.parseInt(state.get(SHOWN_WAVEFORM + "S")):0; //$NON-NLS-1$ //$NON-NLS-2$
List<TrackEntry> res = new LinkedList<>(); List<TrackEntry> res = new LinkedList<>();
for (int i = 0; i < waves; i++) { for (int i = 0; i < waves; i++) {
IWaveform<? extends IWaveformEvent> waveform = database.getStreamByName(state.get(SHOWN_WAVEFORM + i)); IWaveform<? extends IWaveformEvent> waveform = database.getStreamByName(state.get(SHOWN_WAVEFORM + i));
@ -505,7 +506,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
} }
if (res.size() > 0) if (res.size() > 0)
waveformPane.getStreamList().addAll(res); waveformPane.getStreamList().addAll(res);
Integer cursorLength = state.containsKey(SHOWN_CURSOR+"S")?Integer.parseInt(state.get(SHOWN_CURSOR + "S")):0; Integer cursorLength = state.containsKey(SHOWN_CURSOR+"S")?Integer.parseInt(state.get(SHOWN_CURSOR + "S")):0; //$NON-NLS-1$ //$NON-NLS-2$
List<ICursor> cursors = waveformPane.getCursorList(); List<ICursor> cursors = waveformPane.getCursorList();
if (cursorLength == cursors.size()) { if (cursorLength == cursors.size()) {
for (int i = 0; i < cursorLength; i++) { for (int i = 0; i < cursorLength; i++) {
@ -567,8 +568,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
* @return true, if successful * @return true, if successful
*/ */
protected boolean askIfToLoad(File txFile) { protected boolean askIfToLoad(File txFile) {
if (txFile.exists() && MessageDialog.openQuestion(myParent.getDisplay().getActiveShell(), "Database open", if (txFile.exists() && MessageDialog.openQuestion(myParent.getDisplay().getActiveShell(), Messages.WaveformViewer_37,
"Would you like to open the adjacent database " + txFile.getName() + " as well?")) { Messages.WaveformViewer_38 + txFile.getName() + Messages.WaveformViewer_39)) {
return true; return true;
} }
return false; return false;
@ -584,10 +585,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
protected static String renameFileExtension(String source, String newExt) { protected static String renameFileExtension(String source, String newExt) {
String target; String target;
String currentExt = getFileExtension(source); String currentExt = getFileExtension(source);
if (currentExt.equals("")) { if (currentExt.equals("")) { //$NON-NLS-1$
target = source + "." + newExt; target = source + "." + newExt; //$NON-NLS-1$
} else { } else {
target = source.replaceFirst(Pattern.quote("." + currentExt) + "$", Matcher.quoteReplacement("." + newExt)); target = source.replaceFirst(Pattern.quote("." + currentExt) + "$", Matcher.quoteReplacement("." + newExt)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} }
return target; return target;
} }
@ -599,7 +600,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
* @return the file extension * @return the file extension
*/ */
protected static String getFileExtension(String f) { protected static String getFileExtension(String f) {
String ext = ""; String ext = ""; //$NON-NLS-1$
int i = f.lastIndexOf('.'); int i = f.lastIndexOf('.');
if (i > 0 && i < f.length() - 1) { if (i > 0 && i < f.length() - 1) {
ext = f.substring(i + 1); ext = f.substring(i + 1);

View File

@ -65,7 +65,7 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
store.setDefault(PreferenceConstants.DATABASE_RELOAD, true); store.setDefault(PreferenceConstants.DATABASE_RELOAD, true);
for (WaveformColors c : WaveformColors.values()) { for (WaveformColors c : WaveformColors.values()) {
store.setDefault(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); store.setDefault(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
} }
} }

View File

@ -16,64 +16,64 @@ package com.minres.scviewer.e4.application.preferences;
public class PreferenceConstants { public class PreferenceConstants {
/** The Constant PREFERENCES_SCOPE. */ /** The Constant PREFERENCES_SCOPE. */
public static final String PREFERENCES_SCOPE="com.minres.scviewer.e4.application"; public static final String PREFERENCES_SCOPE="com.minres.scviewer.e4.application"; //$NON-NLS-1$
/** The Constant DATABASE_RELOAD. */ /** The Constant DATABASE_RELOAD. */
public static final String DATABASE_RELOAD="databaseReload"; public static final String DATABASE_RELOAD="databaseReload"; //$NON-NLS-1$
/** The Constant LINE_COLOR. */ /** The Constant LINE_COLOR. */
public static final String LINE_COLOR="LINE_COLOR"; public static final String LINE_COLOR="LINE_COLOR"; //$NON-NLS-1$
/** The Constant LINE_HIGHLITE_COLOR. */ /** The Constant LINE_HIGHLITE_COLOR. */
public static final String LINE_HIGHLITE_COLOR="LINE_HIGHLITE_COLOR"; public static final String LINE_HIGHLITE_COLOR="LINE_HIGHLITE_COLOR"; //$NON-NLS-1$
/** The Constant TRACK_BG_EVEN_COLOR. */ /** The Constant TRACK_BG_EVEN_COLOR. */
public static final String TRACK_BG_EVEN_COLOR="TRACK_BG_EVEN_COLOR"; public static final String TRACK_BG_EVEN_COLOR="TRACK_BG_EVEN_COLOR"; //$NON-NLS-1$
/** The Constant TRACK_BG_ODD_COLOR. */ /** The Constant TRACK_BG_ODD_COLOR. */
public static final String TRACK_BG_ODD_COLOR="TRACK_BG_ODD_COLOR"; public static final String TRACK_BG_ODD_COLOR="TRACK_BG_ODD_COLOR"; //$NON-NLS-1$
/** The Constant TRACK_BG_HIGHLITE_COLOR. */ /** The Constant TRACK_BG_HIGHLITE_COLOR. */
public static final String TRACK_BG_HIGHLITE_COLOR="TRACK_BG_HIGHLITE_COLOR"; public static final String TRACK_BG_HIGHLITE_COLOR="TRACK_BG_HIGHLITE_COLOR"; //$NON-NLS-1$
/** The Constant TX_BG_COLOR. */ /** The Constant TX_BG_COLOR. */
public static final String TX_BG_COLOR="TX_BG_COLOR"; public static final String TX_BG_COLOR="TX_BG_COLOR"; //$NON-NLS-1$
/** The Constant TX_BG_HIGHLITE_COLOR. */ /** The Constant TX_BG_HIGHLITE_COLOR. */
public static final String TX_BG_HIGHLITE_COLOR="TX_BG_HIGHLITE_COLOR"; public static final String TX_BG_HIGHLITE_COLOR="TX_BG_HIGHLITE_COLOR"; //$NON-NLS-1$
/** The Constant TX_BORDER_COLOR. */ /** The Constant TX_BORDER_COLOR. */
public static final String TX_BORDER_COLOR="TX_BORDER_COLOR"; public static final String TX_BORDER_COLOR="TX_BORDER_COLOR"; //$NON-NLS-1$
/** The Constant SIGNAL0_COLOR. */ /** The Constant SIGNAL0_COLOR. */
public static final String SIGNAL0_COLOR="SIGNAL0_COLOR"; public static final String SIGNAL0_COLOR="SIGNAL0_COLOR"; //$NON-NLS-1$
/** The Constant SIGNAL1_COLOR. */ /** The Constant SIGNAL1_COLOR. */
public static final String SIGNAL1_COLOR="SIGNAL1_COLOR"; public static final String SIGNAL1_COLOR="SIGNAL1_COLOR"; //$NON-NLS-1$
/** The Constant SIGNALZ_COLOR. */ /** The Constant SIGNALZ_COLOR. */
public static final String SIGNALZ_COLOR="SIGNALZ_COLOR"; public static final String SIGNALZ_COLOR="SIGNALZ_COLOR"; //$NON-NLS-1$
/** The Constant SIGNALX_COLOR. */ /** The Constant SIGNALX_COLOR. */
public static final String SIGNALX_COLOR="SIGNALX_COLOR"; public static final String SIGNALX_COLOR="SIGNALX_COLOR"; //$NON-NLS-1$
/** The Constant SIGNAL_TEXT_COLOR. */ /** The Constant SIGNAL_TEXT_COLOR. */
public static final String SIGNAL_TEXT_COLOR="SIGNAL_TEXT_COLOR"; public static final String SIGNAL_TEXT_COLOR="SIGNAL_TEXT_COLOR"; //$NON-NLS-1$
/** The Constant CURSOR_COLOR. */ /** The Constant CURSOR_COLOR. */
public static final String CURSOR_COLOR="CURSOR_COLOR"; public static final String CURSOR_COLOR="CURSOR_COLOR"; //$NON-NLS-1$
/** The Constant CURSOR_DRAG_COLOR. */ /** The Constant CURSOR_DRAG_COLOR. */
public static final String CURSOR_DRAG_COLOR="CURSOR_DRAG_COLOR"; public static final String CURSOR_DRAG_COLOR="CURSOR_DRAG_COLOR"; //$NON-NLS-1$
/** The Constant CURSOR_TEXT_COLOR. */ /** The Constant CURSOR_TEXT_COLOR. */
public static final String CURSOR_TEXT_COLOR="CURSOR_TEXT_COLOR"; public static final String CURSOR_TEXT_COLOR="CURSOR_TEXT_COLOR"; //$NON-NLS-1$
/** The Constant MARKER_COLOR. */ /** The Constant MARKER_COLOR. */
public static final String MARKER_COLOR="MARKER_COLOR"; public static final String MARKER_COLOR="MARKER_COLOR"; //$NON-NLS-1$
/** The Constant MARKER_TEXT_COLOR. */ /** The Constant MARKER_TEXT_COLOR. */
public static final String MARKER_TEXT_COLOR="MARKER_TEXT_COLOR"; public static final String MARKER_TEXT_COLOR="MARKER_TEXT_COLOR"; //$NON-NLS-1$
} }

View File

@ -13,6 +13,8 @@ package com.minres.scviewer.e4.application.preferences;
import org.eclipse.jface.preference.BooleanFieldEditor; import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage; import org.eclipse.jface.preference.FieldEditorPreferencePage;
import com.minres.scviewer.e4.application.Messages;
/** /**
* The Class SCViewerPreferencesPage showing the SCViewer top preferences. * The Class SCViewerPreferencesPage showing the SCViewer top preferences.
@ -32,7 +34,7 @@ public class SCViewerPreferencesPage extends FieldEditorPreferencePage {
@Override @Override
protected void createFieldEditors() { protected void createFieldEditors() {
addField(new BooleanFieldEditor(PreferenceConstants.DATABASE_RELOAD, "Check for changed database", addField(new BooleanFieldEditor(PreferenceConstants.DATABASE_RELOAD, Messages.SCViewerPreferencesPage_0,
getFieldEditorParent())); getFieldEditorParent()));
} }

View File

@ -14,6 +14,7 @@ import org.eclipse.jface.preference.ColorFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage; import org.eclipse.jface.preference.FieldEditorPreferencePage;
import com.minres.scviewer.database.ui.WaveformColors; import com.minres.scviewer.database.ui.WaveformColors;
import com.minres.scviewer.e4.application.Messages;
/** /**
* The WaveformView preference page to show the colors to use. * The WaveformView preference page to show the colors to use.
@ -34,7 +35,7 @@ public class WaveformPreferencesPage extends FieldEditorPreferencePage {
protected void createFieldEditors() { protected void createFieldEditors() {
for (WaveformColors c : WaveformColors.values()) { for (WaveformColors c : WaveformColors.values()) {
addField(new ColorFieldEditor(c.name() + "_COLOR", "Color for " + c.name().toLowerCase(), addField(new ColorFieldEditor(c.name() + "_COLOR", Messages.WaveformPreferencesPage_1 + c.name().toLowerCase(), //$NON-NLS-1$
getFieldEditorParent())); getFieldEditorParent()));
} }
} }

View File

@ -42,12 +42,12 @@ public class TxDbLabelProvider implements ILabelProvider {
*/ */
public TxDbLabelProvider() { public TxDbLabelProvider() {
super(); super();
loadinDatabase=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database_go.png"); loadinDatabase=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database_go.png"); //$NON-NLS-1$ //$NON-NLS-2$
database=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database.png"); database=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database.png"); //$NON-NLS-1$ //$NON-NLS-2$
stream=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/stream.png"); stream=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/stream.png"); //$NON-NLS-1$ //$NON-NLS-2$
folder=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/folder.png"); folder=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/folder.png"); //$NON-NLS-1$ //$NON-NLS-2$
signal=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/signal.png"); signal=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/signal.png"); //$NON-NLS-1$ //$NON-NLS-2$
wave=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/wave.png"); wave=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/wave.png"); //$NON-NLS-1$ //$NON-NLS-2$
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@ -80,7 +80,7 @@ public class TxPropertiesLabelProvider implements ITableLabelProvider {
@Override @Override
public String getColumnText(Object element, int columnIndex) { public String getColumnText(Object element, int columnIndex) {
ITxAttribute attribute = (ITxAttribute) element; ITxAttribute attribute = (ITxAttribute) element;
String text = ""; String text = ""; //$NON-NLS-1$
switch (columnIndex) { switch (columnIndex) {
case TransactionDetails.COLUMN_FIRST: case TransactionDetails.COLUMN_FIRST:
text = attribute.getName(); text = attribute.getName();

View File

@ -28,6 +28,8 @@ import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.graphics.Rectangle;
import org.osgi.framework.Bundle; import org.osgi.framework.Bundle;
import com.minres.scviewer.e4.application.Messages;
/** /**
* Utility class for managing OS resources associated with SWT/JFace controls such as colors, fonts, images, * Utility class for managing OS resources associated with SWT/JFace controls such as colors, fonts, images,
* etc. * etc.
@ -124,7 +126,7 @@ public class ResourceManager extends SWTResourceManager {
*/ */
public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) { public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) {
if (corner <= 0 || corner >= LAST_CORNER_KEY) { if (corner <= 0 || corner >= LAST_CORNER_KEY) {
throw new IllegalArgumentException("Wrong decorate corner"); throw new IllegalArgumentException(Messages.ResourceManager_0);
} }
Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner]; Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner];
if (cornerDecoratedImageMap == null) { if (cornerDecoratedImageMap == null) {

View File

@ -28,6 +28,8 @@ import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import com.minres.scviewer.e4.application.Messages;
/** /**
* Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc. * Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc.
* <p> * <p>
@ -232,7 +234,7 @@ public class SWTResourceManager {
*/ */
public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) { public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) {
if (corner <= 0 || corner >= LAST_CORNER_KEY) { if (corner <= 0 || corner >= LAST_CORNER_KEY) {
throw new IllegalArgumentException("Wrong decorate corner"); throw new IllegalArgumentException(Messages.SWTResourceManager_0);
} }
Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner]; Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner];
if (cornerDecoratedImageMap == null) { if (cornerDecoratedImageMap == null) {