From: Tuukka Lehtonen Date: Wed, 28 Nov 2018 14:55:17 +0000 (+0200) Subject: Externalize strings in org.simantics.debug.ui X-Git-Tag: v1.43.0~136^2~239 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=59724aa55a75a4efc3ec17e3b4a4ef62f463526e;p=simantics%2Fplatform.git Externalize strings in org.simantics.debug.ui gitlab #210 Change-Id: Ie9366b4ce9f0530df946bed292a918fc7f6ac7f3 --- diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebugger.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebugger.java index c3b3ab8b9..46d31fabe 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebugger.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebugger.java @@ -44,6 +44,7 @@ import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.resource.ColorDescriptor; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.resource.LocalResourceManager; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.SWTError; import org.eclipse.swt.browser.Browser; @@ -138,9 +139,9 @@ public class GraphDebugger extends Composite { void historyChanged(); } - private static final String STATEMENT_PART_SEPARATOR = ","; - private final static String DEFAULT_DEBUGGER_CSS_FILE = "debugger.css"; - private final static String DEFAULT_DEBUGGER_CSS_PATH = "css/" + DEFAULT_DEBUGGER_CSS_FILE; + private static final String STATEMENT_PART_SEPARATOR = ","; //$NON-NLS-1$ + private final static String DEFAULT_DEBUGGER_CSS_FILE = "debugger.css"; //$NON-NLS-1$ + private final static String DEFAULT_DEBUGGER_CSS_PATH = "css/" + DEFAULT_DEBUGGER_CSS_FILE; //$NON-NLS-1$ private static int RESOURCE_NAME_MAX_LENGTH = 1000; private static int RESOURCE_VALUE_MAX_SIZE = 16384; @@ -213,7 +214,7 @@ public class GraphDebugger extends Composite { */ public GraphDebugger(Composite parent, int style, final Session session, Resource resource) { super(parent, style); - Assert.isNotNull(session, "session is null"); + Assert.isNotNull(session, "session is null"); //$NON-NLS-1$ this.session = session; this.currentElement = resource; this.resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent); @@ -235,7 +236,7 @@ public class GraphDebugger extends Composite { * When given to setStatus, indicates that the message shouldn't be touched * since null has a different meaning. */ - private static final String DONT_TOUCH = "DONT_TOUCH"; + private static final String DONT_TOUCH = "DONT_TOUCH"; //$NON-NLS-1$ protected void setStatus(String message, String error) { IStatusLineManager status = WorkbenchUtils.getStatusLine(site); @@ -269,7 +270,7 @@ public class GraphDebugger extends Composite { if (!css.exists()) { URL url = FileLocator.find(Activator.getDefault().getBundle(), new Path(DEFAULT_DEBUGGER_CSS_PATH), null); if (url == null) - throw new FileNotFoundException("Could not find '" + DEFAULT_DEBUGGER_CSS_PATH + "' in bundle '" + Activator.PLUGIN_ID + "'"); + throw new FileNotFoundException("Could not find '" + DEFAULT_DEBUGGER_CSS_PATH + "' in bundle '" + Activator.PLUGIN_ID + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ cssPath = FileUtils.copyResource(url, css, true).toURI().toString(); } else { cssPath = css.toURI().toString(); @@ -281,7 +282,7 @@ public class GraphDebugger extends Composite { } } - private static final String PROMPT_TEXT = "Enter resource ID (RID) or URI"; + private static final String PROMPT_TEXT = Messages.GraphDebugger_EnterResourceIDorURI; public void createResourceText(final Composite parent) { final Text text = new Text(parent, SWT.BORDER); @@ -292,7 +293,7 @@ public class GraphDebugger extends Composite { text.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { - if (text.getText().trim().equals("")) { + if (text.getText().trim().equals("")) { //$NON-NLS-1$ text.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY)); text.setText(PROMPT_TEXT); } @@ -301,7 +302,7 @@ public class GraphDebugger extends Composite { public void focusGained(FocusEvent e) { if (text.getText().trim().equals(PROMPT_TEXT)) { text.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_BLACK)); - text.setText(""); + text.setText(""); //$NON-NLS-1$ } text.selectAll(); } @@ -317,7 +318,7 @@ public class GraphDebugger extends Composite { }); final Button button = new Button(parent, SWT.FLAT); - button.setText("&Lookup"); + button.setText(Messages.GraphDebugger_Lookup); button.setEnabled(false); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(false, false).applyTo(button); @@ -349,7 +350,7 @@ public class GraphDebugger extends Composite { @Override public void modifyText(ModifyEvent e) { String input = text.getText().trim(); - if (!input.equals(PROMPT_TEXT) && !input.equals("")) + if (!input.equals(PROMPT_TEXT) && !input.equals("")) //$NON-NLS-1$ button.setEnabled(true); else button.setEnabled(false); @@ -362,21 +363,21 @@ public class GraphDebugger extends Composite { input = input.trim(); SerialisationSupport support = session.getService(SerialisationSupport.class); - if (input.startsWith("$")) { + if (input.startsWith("$")) { //$NON-NLS-1$ try { Resource r = support.getResource(Long.parseLong(input.substring(1))); changeLocation(r); } catch (NumberFormatException e1) { // Ignore, may happen for crap input - setStatus(DONT_TOUCH, "Invalid '$'-prefixed input, expected resource ID"); + setStatus(DONT_TOUCH, Messages.GraphDebugger_StatusInvalidPrefixedInput); } catch (Exception e1) { ErrorLogger.defaultLogError(e1); - setStatus(DONT_TOUCH, "Resource ID lookup failed. See Error Log."); + setStatus(DONT_TOUCH, Messages.GraphDebugger_StatusResourceIDFailed); } return; } - String[] parts = input.split("-"); + String[] parts = input.split("-"); //$NON-NLS-1$ if (parts.length == 1) { try { @@ -390,10 +391,10 @@ public class GraphDebugger extends Composite { } } catch (NumberFormatException e1) { // Ignore, may happen for crap input - setStatus(DONT_TOUCH, "Invalid input, expected transient resource ID"); + setStatus(DONT_TOUCH, Messages.GraphDebugger_StatusInvalidInput); } catch (Exception e1) { ErrorLogger.defaultLogError(e1); - setStatus(DONT_TOUCH, "Transient resource ID lookup failed. See Error Log."); + setStatus(DONT_TOUCH, Messages.GraphDebugger_StatusTransientResourceID); } } else if (parts.length == 2) { try { @@ -404,10 +405,10 @@ public class GraphDebugger extends Composite { changeLocation(r); } catch (NumberFormatException e1) { // Ignore, may happen for crap input - setStatus(DONT_TOUCH, "Invalid input, expected index & cluster IDs"); + setStatus(DONT_TOUCH, Messages.GraphDebugger_StatusInvalidInputExpectIdxClusterIds); } catch (Exception e1) { ErrorLogger.defaultLogError(e1); - setStatus(DONT_TOUCH, "Index & cluster -based lookup failed. See Error Log."); + setStatus(DONT_TOUCH, Messages.GraphDebugger_StatusIndexLookpuFailed); } } @@ -415,7 +416,7 @@ public class GraphDebugger extends Composite { try { // First check that the input really is a proper URI. String uri = input; - if (!input.equals("http:/") && input.endsWith("/")) + if (!input.equals("http:/") && input.endsWith("/")) //$NON-NLS-1$ //$NON-NLS-2$ uri = input.substring(0, input.length() - 1); new URI(uri); Resource r = session.syncRequest( Queries.resource( uri ) ); @@ -425,20 +426,20 @@ public class GraphDebugger extends Composite { // Ignore, this is not a proper URI at all. } catch (ResourceNotFoundException e1) { // Ok, this was an URI, but no resource was found. - setStatus(DONT_TOUCH, "Resource for URI '" + input + "' not found"); + setStatus(DONT_TOUCH, NLS.bind( Messages.GraphDebugger_StatusResourceforURI , input )); return; } catch (DatabaseException e1) { - setStatus(DONT_TOUCH, "URI lookup failed. See Error Log."); + setStatus(DONT_TOUCH, Messages.GraphDebugger_StatusURIlookupFailed); ErrorLogger.defaultLogError(e1); } - setStatus(DONT_TOUCH, "Invalid input, resource ID or URI expected"); + setStatus(DONT_TOUCH, Messages.GraphDebugger_StatusInvalidInputResIdORURIExpected); } public Label createDropLabel(Composite parent) { final Label label = new Label(parent, SWT.BORDER); label.setAlignment(SWT.CENTER); - label.setText("Drag a resource here to examine it in this debugger!"); + label.setText(Messages.GraphDebugger_LabelDragResource); label.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY)); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(SWT.DEFAULT, 20).span(2, 1).grab(true, false).applyTo(label); @@ -537,29 +538,29 @@ public class GraphDebugger extends Composite { @Override public void changing(LocationEvent event) { String location = event.location; - if (location.startsWith("simantics:browser")) - location = "about:" + location.substring(17); + if (location.startsWith("simantics:browser")) //$NON-NLS-1$ + location = "about:" + location.substring(17); //$NON-NLS-1$ //System.out.println("changing: location=" + location); // Do not follow links that are meant as actions that are // handled below. event.doit = false; - if ("about:blank".equals(location)) { + if ("about:blank".equals(location)) { //$NON-NLS-1$ // Just changing to the same old blank url is ok since it // allows the browser to refresh itself. event.doit = true; } - if (location.startsWith("about:-link")) { - String target = location.replace("about:-link", ""); + if (location.startsWith("about:-link")) { //$NON-NLS-1$ + String target = location.replace("about:-link", ""); //$NON-NLS-1$ //$NON-NLS-2$ Resource element = links.getRight(target); if (element == currentElement) { event.doit = false; return; } changeLocation(element); - } else if (location.startsWith("about:-remove")) { - String target = location.replace("about:-remove", ""); + } else if (location.startsWith("about:-remove")) { //$NON-NLS-1$ + String target = location.replace("about:-remove", ""); //$NON-NLS-1$ //$NON-NLS-2$ String n[] = target.split(STATEMENT_PART_SEPARATOR); if (n.length != 3) return; @@ -571,10 +572,10 @@ public class GraphDebugger extends Composite { // Make sure this is what the use wants. MessageDialog md = new MessageDialog( getShell(), - "Confirm action...", + Messages.GraphDebugger_ConfirmActionsDots, null, - "This action will remove the selected statement.\nAre you sure you want to proceed with this action?", - MessageDialog.QUESTION, new String[] { "Cancel", "Continue" }, 0); + Messages.GraphDebugger_ConfirmActionsDotsMsg, + MessageDialog.QUESTION, new String[] { Messages.GraphDebugger_Cancel, Messages.GraphDebugger_Continue }, 0); if (md.open() != 1) { return; } @@ -602,8 +603,8 @@ public class GraphDebugger extends Composite { }, parameter -> refreshBrowser() ); - } else if (location.startsWith("about:-edit-value")) { - String target = location.replace("about:-edit-value", ""); + } else if (location.startsWith("about:-edit-value")) { //$NON-NLS-1$ + String target = location.replace("about:-edit-value", ""); //$NON-NLS-1$ //$NON-NLS-2$ final Resource o = links.getRight(target); session.asyncRequest(new ReadRequest() { @@ -620,7 +621,7 @@ public class GraphDebugger extends Composite { public void run() { InputDialog dialog = new InputDialog( getShell(), - "Edit Value", + Messages.GraphDebugger_EditValue, null, previousValue, new IInputValidator() { @@ -660,7 +661,7 @@ public class GraphDebugger extends Composite { { Label label = new Label(composite, SWT.NONE); label.moveAbove(getText()); - label.setText("Input new property value. For numeric vector values, separate numbers with comma (',')."); + label.setText(Messages.GraphDebugger_InputNewPropertyValue); GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); @@ -797,48 +798,48 @@ public class GraphDebugger extends Composite { if (o instanceof byte[]) { byte[] arr = (byte[]) o; byte[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH); - return truncated("byte", Arrays.toString(arr2), arr.length); + return truncated("byte", Arrays.toString(arr2), arr.length); //$NON-NLS-1$ } else if (o instanceof int[]) { int[] arr = (int[]) o; int[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH); - return truncated("int", Arrays.toString(arr2), arr.length); + return truncated("int", Arrays.toString(arr2), arr.length); //$NON-NLS-1$ } else if (o instanceof long[]) { long[] arr = (long[]) o; long[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH); - return truncated("long", Arrays.toString(arr2), arr.length); + return truncated("long", Arrays.toString(arr2), arr.length); //$NON-NLS-1$ } else if (o instanceof float[]) { float[] arr = (float[]) o; float[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH); - return truncated("float", Arrays.toString(arr2), arr.length); + return truncated("float", Arrays.toString(arr2), arr.length); //$NON-NLS-1$ } else if (o instanceof double[]) { double[] arr = (double[]) o; double[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH); - return truncated("double", Arrays.toString(arr2), arr.length); + return truncated("double", Arrays.toString(arr2), arr.length); //$NON-NLS-1$ } else if (o instanceof boolean[]) { boolean[] arr = (boolean[]) o; boolean[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH); - return truncated("boolean", Arrays.toString(arr2), arr.length); + return truncated("boolean", Arrays.toString(arr2), arr.length); //$NON-NLS-1$ } else if (o instanceof Object[]) { Object[] arr = (Object[]) o; Object[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH); - return truncated("Object", Arrays.toString(arr2), arr.length); + return truncated("Object", Arrays.toString(arr2), arr.length); //$NON-NLS-1$ } else { - return "Unknown big array " + o.getClass(); + return "Unknown big array " + o.getClass(); //$NON-NLS-1$ } } else { - return o.getClass().getComponentType() + "[" + length + "] = " + ObjectUtils.toString(o); + return o.getClass().getComponentType() + "[" + length + "] = " + ObjectUtils.toString(o); //$NON-NLS-1$ //$NON-NLS-2$ } } return null; } protected String truncated(String type, String string, int originalLength) { - return type + "[" + RESOURCE_NAME_MAX_LENGTH + "/" + originalLength + "] = " + string; + return type + "[" + RESOURCE_NAME_MAX_LENGTH + "/" + originalLength + "] = " + string; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } public static String htmlEscape(String s) { - return s.replace("&", "&").replace("<", "<").replace(">", ">").replace("\n", "
"); + return s.replace("&", "&").replace("<", "<").replace(">", ">").replace("\n", "
"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ } /** @@ -876,7 +877,7 @@ public class GraphDebugger extends Composite { // Object v = graph.getValue(r, b); // Serializer s = Bindings.getSerializerUnchecked(b); // int size = s.getSize(v); - name = "Approx. " + valueSize + " byte literal of type " + type.toSingleLineString(); + name = "Approx. " + valueSize + " byte literal of type " + type.toSingleLineString(); //$NON-NLS-1$ //$NON-NLS-2$ } else { Binding b = Bindings.getBinding(type); Object v = graph.getValue(r, b); @@ -896,7 +897,7 @@ public class GraphDebugger extends Composite { } if(name.isEmpty()) { - name = ""; + name = ""; //$NON-NLS-1$ } } @@ -914,7 +915,7 @@ public class GraphDebugger extends Composite { //if(name.isEmpty()) name = DebugUtils.getSafeLabel(graph, r); if (name.isEmpty()) - name = ""; + name = ""; //$NON-NLS-1$ } // ClusteringSupport support = graph.getSession().getService(ClusteringSupport.class); // if(name == null) @@ -956,36 +957,36 @@ public class GraphDebugger extends Composite { // Don't know how I encountered this but it seems to be possible in some cases.. // Resource obj = graph.getSingleObject(r, L0.HasObject); Resource obj = graph.getPossibleObject(r, L0.HasObject); - String tmp = htmlEscape( (pred == null ? "No predicate ?" : getResourceName(graph, pred)) + " -> " + (obj == null ? "No object ?" : getResourceName(graph, obj)) + " (Assertion)" ); + String tmp = htmlEscape( (pred == null ? "No predicate ?" : getResourceName(graph, pred)) + " -> " + (obj == null ? "No object ?" : getResourceName(graph, obj)) + " (Assertion)" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ name = tmp.substring(0, Math.min(80, tmp.length())); } else { String resourceName = getResourceName(graph, r); - if(resourceName.equals("Inverse")) { + if(resourceName.equals("Inverse")) { //$NON-NLS-1$ Resource inverse = graph.getPossibleInverse(r); if(inverse != null && graph.hasStatement(inverse, L0.ConsistsOf, r)) - resourceName = getResourceName(graph, inverse) + "/Inverse"; + resourceName = getResourceName(graph, inverse) + "/Inverse"; //$NON-NLS-1$ } String tmp = htmlEscape( resourceName ); name = tmp.substring(0, Math.min(80, tmp.length())); } } catch (OutOfMemoryError e) { - name = "OutOfMemoryError"; + name = "OutOfMemoryError"; //$NON-NLS-1$ } - String ret = "" + String ret = "" //$NON-NLS-1$ //$NON-NLS-2$ + name - + ""; + + ""; //$NON-NLS-1$ if (graph.isInstanceOf(r, L0.Literal)) { - ret += " " - + "(edit)" - + ""; + ret += " " //$NON-NLS-1$ //$NON-NLS-2$ + + "(edit)" //$NON-NLS-1$ + + ""; //$NON-NLS-1$ } return ret; } private String getStatementRemoveRef(Resource s, Resource p, Resource o) { - return "X"; + return "X"; //$NON-NLS-1$ } private void updatePred(StringBuffer content, ReadGraph graph, Resource subj, Resource pred, List stats) throws DatabaseException { @@ -1002,7 +1003,7 @@ public class GraphDebugger extends Composite { // Make a note if the statement was acquired. if(!stmSubject.equals(subj)) { - objects[i][3] = " (in " + getResourceRef(graph, stmSubject) + ")"; + objects[i][3] = " (in " + getResourceRef(graph, stmSubject) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -1016,39 +1017,39 @@ public class GraphDebugger extends Composite { // Output table rows for (int i = 0; i < objects.length; ++i) { - content.append(""); + content.append(""); //$NON-NLS-1$ // Predicate column if (i == 0) - content.append("").append(getResourceRef(graph, pred)).append(""); + content.append("").append(getResourceRef(graph, pred)).append(""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ // Object column - if (objects[i][3] == null) content.append(""); - else content.append(""); + if (objects[i][3] == null) content.append(""); //$NON-NLS-1$ + else content.append(""); //$NON-NLS-1$ content.append(objects[i][2]); if (objects[i][3] != null) content.append(objects[i][3]); - content.append(""); + content.append(""); //$NON-NLS-1$ VirtualGraphSupport vgs = graph.getService(VirtualGraphSupport.class); VirtualGraph vg = vgs.getGraph(graph, subj, pred, links.getRight(objects[i][0])); if(vg != null) { - content.append("").append(vg.toString()).append(""); + content.append("").append(vg.toString()).append(""); //$NON-NLS-1$ //$NON-NLS-2$ } else { - content.append("DB"); + content.append("DB"); //$NON-NLS-1$ } // Statement remove -link column // Only allowed for non-acquired statements. if (objects[i][3] == null) { - content.append(""); + content.append(""); //$NON-NLS-1$ content.append(getStatementRemoveRef(subj, pred, links.getRight(objects[i][0]))); - content.append(""); + content.append(""); //$NON-NLS-1$ } - content.append(""); + content.append(""); //$NON-NLS-1$ } } @@ -1057,13 +1058,13 @@ public class GraphDebugger extends Composite { // Generate output content from statements String ref = getResourceRef(graph, tag); - content.append(""); - content.append("").append(ref).append(""); + content.append(""); //$NON-NLS-1$ + content.append("").append(ref).append(""); //$NON-NLS-1$ //$NON-NLS-2$ //content.append("" + name + ""); - content.append(""); + content.append(""); //$NON-NLS-1$ content.append(getStatementRemoveRef(subj, tag, subj)); - content.append(""); - content.append(""); + content.append(""); //$NON-NLS-1$ + content.append(""); //$NON-NLS-1$ } @@ -1101,15 +1102,15 @@ public class GraphDebugger extends Composite { try { cur = OrderedSetUtils.next(graph, subj, cur); } catch(DatabaseException e) { - list.add("BROKEN ORDERED SET:
" + e.getMessage() + ""); + list.add("BROKEN ORDERED SET:
" + e.getMessage() + ""); //$NON-NLS-1$ //$NON-NLS-2$ Resource inv = graph.getPossibleInverse(subj); for(Statement stat : graph.getStatements(cur, L0.IsRelatedTo)) { if(stat.getSubject().equals(cur)) { if(stat.getPredicate().equals(subj)) { - list.add("next " + getResourceRef(graph, stat.getObject())); + list.add("next " + getResourceRef(graph, stat.getObject())); //$NON-NLS-1$ } else if(stat.getPredicate().equals(inv)) { - list.add("prev " + getResourceRef(graph, stat.getObject())); + list.add("prev " + getResourceRef(graph, stat.getObject())); //$NON-NLS-1$ } } } @@ -1122,15 +1123,15 @@ public class GraphDebugger extends Composite { // Output table rows for (int i = 0; i < list.size() ; ++i) { - content.append(""); + content.append(""); //$NON-NLS-1$ // Predicate column if (i == 0) - content.append("Ordered Set Elements"); + content.append("Ordered Set Elements"); //$NON-NLS-1$ //$NON-NLS-2$ // Object column - content.append(""); + content.append(""); //$NON-NLS-1$ content.append(list.get(i)); - content.append(""); + content.append(""); //$NON-NLS-1$ // Statement remove -link column // Only allowed for non-acquired statements. @@ -1139,7 +1140,7 @@ public class GraphDebugger extends Composite { content.append(getStatementRemoveRef(subj, pred, links.getRight(objects[i][0]))); content.append(""); }*/ - content.append(""); + content.append(""); //$NON-NLS-1$ } } @@ -1158,15 +1159,15 @@ public class GraphDebugger extends Composite { // Output table rows for (int i = 0; i < list.size() ; ++i) { - content.append(""); + content.append(""); //$NON-NLS-1$ // Predicate column if (i == 0) - content.append("Linked List Elements"); + content.append("Linked List Elements"); //$NON-NLS-1$ //$NON-NLS-2$ // Object column - content.append(""); + content.append(""); //$NON-NLS-1$ content.append(list.get(i)); - content.append("DB"); + content.append("DB"); //$NON-NLS-1$ // Statement remove -link column // Only allowed for non-acquired statements. @@ -1175,7 +1176,7 @@ public class GraphDebugger extends Composite { content.append(getStatementRemoveRef(subj, pred, links.getRight(objects[i][0]))); content.append(""); }*/ - content.append(""); + content.append(""); //$NON-NLS-1$ } } @@ -1186,11 +1187,11 @@ public class GraphDebugger extends Composite { StringBuffer content = new StringBuffer(); // Generate HTML -page - content.append("\n\n") + content.append("\n\n") //$NON-NLS-1$ .append(getHead()) - .append("\n\n") - .append("\n") - .append("
\n\n"); + .append("\n\n") //$NON-NLS-1$ + .append("\n") //$NON-NLS-1$ + .append("
\n\n"); //$NON-NLS-1$ for (Resource r : resources) { if (r == null) @@ -1201,14 +1202,14 @@ public class GraphDebugger extends Composite { uri = graph.syncRequest(new ResourceToPossibleURI(r)); } catch (Exception e) { ErrorLogger.defaultLogError(e); - uri = "Cannot get URI: " + e.getMessage(); + uri = "Cannot get URI: " + e.getMessage(); //$NON-NLS-1$ } // Top DIV - content.append("
\n"); - content.append("\n"); + content.append("
\n"); //$NON-NLS-1$ + content.append("
\n"); //$NON-NLS-1$ if (uri != null) { - content.append("\n"); + content.append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ } XSupport xs = graph.getService(XSupport.class); @@ -1226,57 +1227,57 @@ public class GraphDebugger extends Composite { obj = statement.getObject(); map.add(predicate, new Resource[] {subject, obj}); } catch (Throwable e) { - ErrorLogger.defaultLogError("Cannot find statement " + subject + " " + predicate + " " + obj, e); + ErrorLogger.defaultLogError("Cannot find statement " + subject + " " + predicate + " " + obj, e); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } SerialisationSupport ss = graph.getSession().getService(SerialisationSupport.class); ClusteringSupport support = graph.getSession().getService(ClusteringSupport.class); - content.append(""); + content.append(""); //$NON-NLS-1$ if (immutable) - content.append(""); - content.append("\n"); + content.append(""); //$NON-NLS-1$ + content.append("\n"); //$NON-NLS-1$ boolean isClusterSet = support.isClusterSet(r); Resource parentSet = support.getClusterSetOfCluster(r); String parentSetURI = parentSet != null ? graph.getPossibleURI(parentSet) : null; - content.append(""); + content.append(""); //$NON-NLS-1$ if (isClusterSet) - content.append(""); - content.append("\n"); + content.append(""); //$NON-NLS-1$ + content.append("\n"); //$NON-NLS-1$ // If the resource has a value, show it. String resourceValue = getResourceValue(graph, r); if (resourceValue != null) { content - .append("\n"); + .append("\n"); //$NON-NLS-1$ } // Close #top - content.append("
URI").append(uri).append("
URI").append(uri).append("
Identifiers"); - content.append("") - .append(" RID = $").append(r.getResourceId()) - .append(" Resource Key = ").append(ss.getTransientId(r)) - .append(" CID = ").append(support.getCluster(r)); - content.append("
Identifiers"); //$NON-NLS-1$ + content.append("") //$NON-NLS-1$ + .append(" RID = $").append(r.getResourceId()) //$NON-NLS-1$ + .append(" Resource Key = ").append(ss.getTransientId(r)) //$NON-NLS-1$ + .append(" CID = ").append(support.getCluster(r)); //$NON-NLS-1$ + content.append("[IMMUTABLE]
[IMMUTABLE]
Clustering"); - content.append(""); + content.append("
Clustering"); //$NON-NLS-1$ + content.append(""); //$NON-NLS-1$ if(parentSetURI != null) - content.append(" Containing cluster set = ").append(parentSetURI); + content.append(" Containing cluster set = ").append(parentSetURI); //$NON-NLS-1$ else if (parentSet != null) - content.append(" Containing cluster set = ").append(parentSet.toString()); + content.append(" Containing cluster set = ").append(parentSet.toString()); //$NON-NLS-1$ else - content.append(" Not in any cluster set "); + content.append(" Not in any cluster set "); //$NON-NLS-1$ - content.append("[CLUSTER SET]
[CLUSTER SET]
Attached value") + .append("
Attached value") //$NON-NLS-1$ .append(htmlEscape(resourceValue)) - .append("
\n"); - content.append("
\n"); + content.append("\n"); //$NON-NLS-1$ + content.append("
\n"); //$NON-NLS-1$ - content.append("\n
\n"); - content.append("\n") - .append("") - .append(""); + content.append("\n
\n"); //$NON-NLS-1$ + content.append("
PredicateObjectGraph
Basic information
\n") //$NON-NLS-1$ + .append("") //$NON-NLS-1$ + .append(""); //$NON-NLS-1$ boolean isOrderedSet = graph.isInstanceOf(r, L0.OrderedSet); boolean isLinkedList = graph.isInstanceOf(r, L0.List); @@ -1291,7 +1292,7 @@ public class GraphDebugger extends Composite { updatePred(content, graph, r, pred, map.remove(pred)); // TAGS - content.append(""); + content.append(""); //$NON-NLS-1$ for(Statement stm : statements) { if(stm.getSubject().equals(stm.getObject())) { updateTag(content, graph, r, stm.getPredicate()); @@ -1300,7 +1301,7 @@ public class GraphDebugger extends Composite { } // ORDERED SETS - content.append(""); + content.append(""); //$NON-NLS-1$ for(Statement stm : statements) { Resource predicate = stm.getPredicate(); if(graph.isInstanceOf(stm.getPredicate(), L0.OrderedSet)) { @@ -1320,7 +1321,7 @@ public class GraphDebugger extends Composite { } // IS RELATED TO - content.append(""); + content.append(""); //$NON-NLS-1$ // ELEMENTS OF ORDERED SET if(isOrderedSet) { @@ -1328,7 +1329,7 @@ public class GraphDebugger extends Composite { try { updateOrderedSet(content, graph, r); } catch (ValidationException e) { - content.append(""); + content.append(""); //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -1338,7 +1339,7 @@ public class GraphDebugger extends Composite { try { updateLinkedList(content, graph, r); } catch (ValidationException e) { - content.append(""); + content.append(""); //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -1348,7 +1349,7 @@ public class GraphDebugger extends Composite { for(Resource pred : preds) { String str = htmlEscape( getResourceName(graph, pred) ); if(str == null) - str = ""; + str = ""; //$NON-NLS-1$ strmap.put(pred, str); } Arrays.sort(preds, new Comparator() { @@ -1362,17 +1363,17 @@ public class GraphDebugger extends Composite { updatePred(content, graph, r, pred, map.get(pred)); // OTHER STATEMENTS - content.append(""); + content.append(""); //$NON-NLS-1$ for(Resource pred : preds) if(!graph.isSubrelationOf(pred, L0.IsRelatedTo)) updatePred(content, graph, r, pred, map.get(pred)); - content.append("
PredicateObjectGraph
Basic information
Tags
Tags
Ordered Sets
Ordered Sets
Is Related To
Is Related To
BROKEN ORDERED SET:
").append(e.getMessage()).append("
BROKEN ORDERED SET:
").append(e.getMessage()).append("
BROKEN LINKED LIST:
").append(e.getMessage()).append("
BROKEN LINKED LIST:
").append(e.getMessage()).append("
Other statements
Other statements
\n"); + content.append("\n"); //$NON-NLS-1$ } // Close #data - content.append("
\n\n"); + content.append("
\n\n"); //$NON-NLS-1$ // Close #mainContent - content.append("\n"); - content.append("\n\n"); + content.append("\n"); //$NON-NLS-1$ + content.append("\n\n"); //$NON-NLS-1$ // Update content final String finalContent = content.toString(); @@ -1409,7 +1410,7 @@ public class GraphDebugger extends Composite { Serializer s = Bindings.getSerializerUnchecked(b); int size = s.getSize(v); if (size > RESOURCE_VALUE_MAX_SIZE) { - return "Approx. " + size + " byte literal of type " + type.toSingleLineString(); + return "Approx. " + size + " byte literal of type " + type.toSingleLineString(); //$NON-NLS-1$ //$NON-NLS-2$ } else { return b.toString(v, false); } @@ -1434,7 +1435,7 @@ public class GraphDebugger extends Composite { return NameUtils.getSafeName(g, r); } catch(Throwable throwable) { ErrorLogger.defaultLogError(throwable); - return ""+throwable.getClass().getName()+" "+throwable.getMessage()+""; + return ""+throwable.getClass().getName()+" "+throwable.getMessage()+""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } @@ -1531,9 +1532,9 @@ public class GraphDebugger extends Composite { // } private String getHead() { - String result = ""; + String result = ""; //$NON-NLS-1$ if (cssPath != null) { - result = ""; + result = ""; //$NON-NLS-1$ //$NON-NLS-2$ } return result; } diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebuggerEditor.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebuggerEditor.java index 8cabe2948..890036afc 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebuggerEditor.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebuggerEditor.java @@ -38,7 +38,7 @@ import org.simantics.utils.ui.LayoutUtils; public class GraphDebuggerEditor extends ResourceEditorPart { - public static final String EDITOR_ID = "org.simantics.debug.graphDebuggerEditor"; + public static final String EDITOR_ID = "org.simantics.debug.graphDebuggerEditor"; //$NON-NLS-1$ private GraphDebugger debugger; private IAction backAction; @@ -120,8 +120,8 @@ public class GraphDebuggerEditor extends ResourceEditorPart { class RefreshAction extends Action { public RefreshAction() { - super("Refresh", BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif")); - setToolTipText("Refresh"); + super(Messages.GraphDebuggerEditor_Refresh, BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif")); //$NON-NLS-2$ + setToolTipText(Messages.GraphDebuggerEditor_RefreshTT); } @Override public void run() { @@ -131,8 +131,8 @@ public class GraphDebuggerEditor extends ResourceEditorPart { class FindAction extends Action { public FindAction() { - super("Find", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_blue.png")); - setToolTipText("Find Resource"); + super(Messages.GraphDebuggerEditor_Find, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_blue.png")); //$NON-NLS-2$ + setToolTipText(Messages.GraphDebuggerEditor_FindTT); } @Override public void run() { @@ -142,8 +142,8 @@ public class GraphDebuggerEditor extends ResourceEditorPart { class AddStatementAction extends Action { public AddStatementAction() { - super("AddStatement", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); - setToolTipText("Add Statement Between Existing Resources"); + super(Messages.GraphDebuggerEditor_AddStatement, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); //$NON-NLS-2$ + setToolTipText(Messages.GraphDebuggerEditor_AddStatementTT); } @Override public void run() { @@ -157,8 +157,8 @@ public class GraphDebuggerEditor extends ResourceEditorPart { class AddResourceAction extends Action { public AddResourceAction() { - super("AddResource", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); - setToolTipText("Add New Related Resource"); + super(Messages.GraphDebuggerEditor_AddResource, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); //$NON-NLS-2$ + setToolTipText(Messages.GraphDebuggerEditor_AddResourceTT); } @Override public void run() { @@ -172,8 +172,8 @@ public class GraphDebuggerEditor extends ResourceEditorPart { class BackAction extends Action { public BackAction() { - super("Back", Action.AS_PUSH_BUTTON); - setToolTipText("Back"); + super(Messages.GraphDebuggerEditor_Back, Action.AS_PUSH_BUTTON); + setToolTipText(Messages.GraphDebuggerEditor_BackTT); setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK)); setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED)); } @@ -186,8 +186,8 @@ public class GraphDebuggerEditor extends ResourceEditorPart { class ForwardAction extends Action { public ForwardAction() { - super("Forward", Action.AS_PUSH_BUTTON); - setToolTipText("Forward"); + super(Messages.GraphDebuggerEditor_Forward, Action.AS_PUSH_BUTTON); + setToolTipText(Messages.GraphDebuggerEditor_ForwardTT); setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD)); setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED)); } diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebuggerView.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebuggerView.java index 7d9d67b2a..b7b71da99 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebuggerView.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebuggerView.java @@ -38,7 +38,7 @@ import org.simantics.utils.ui.LayoutUtils; public class GraphDebuggerView extends ViewPart { - public static final String VIEW_ID = "org.simantics.debug.graphDebugger"; + public static final String VIEW_ID = "org.simantics.debug.graphDebugger"; //$NON-NLS-1$ // private final boolean DEFAULT_RECYCLE_VIEW = true; @@ -139,8 +139,8 @@ public class GraphDebuggerView extends ViewPart { // class RefreshAction extends Action { public RefreshAction() { - super("Refresh", BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif")); - setToolTipText("Refresh"); + super(Messages.GraphDebuggerView_Refresh, BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif")); //$NON-NLS-2$ + setToolTipText(Messages.GraphDebuggerView_Refresh); } @Override public void run() { @@ -150,8 +150,8 @@ public class GraphDebuggerView extends ViewPart { class BackAction extends Action { public BackAction() { - super("Back", Action.AS_PUSH_BUTTON); - setToolTipText("Back"); + super(Messages.GraphDebuggerView_Back, Action.AS_PUSH_BUTTON); + setToolTipText(Messages.GraphDebuggerView_BackTT); setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK)); setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED)); } @@ -163,8 +163,8 @@ public class GraphDebuggerView extends ViewPart { class ForwardAction extends Action { public ForwardAction() { - super("Forward", Action.AS_PUSH_BUTTON); - setToolTipText("Forward"); + super(Messages.GraphDebuggerView_Forward, Action.AS_PUSH_BUTTON); + setToolTipText(Messages.GraphDebuggerView_ForwardTT); setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD)); setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED)); } @@ -176,8 +176,8 @@ public class GraphDebuggerView extends ViewPart { class HomeAction extends Action { public HomeAction() { - super("Home", Action.AS_PUSH_BUTTON); - setToolTipText("Navigate to root library"); + super(Messages.GraphDebuggerView_Home, Action.AS_PUSH_BUTTON); + setToolTipText(Messages.GraphDebuggerView_HomeTT); setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_HOME_NAV)); setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_HOME_NAV_DISABLED)); } @@ -189,8 +189,8 @@ public class GraphDebuggerView extends ViewPart { class FindAction extends Action { public FindAction() { - super("Find", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_blue.png")); - setToolTipText("Find Resource"); + super(Messages.GraphDebuggerView_Find, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_blue.png")); //$NON-NLS-2$ + setToolTipText(Messages.GraphDebuggerView_FindTT); } @Override public void run() { @@ -200,8 +200,8 @@ public class GraphDebuggerView extends ViewPart { class AddStatementAction extends Action { public AddStatementAction() { - super("AddStatement", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); - setToolTipText("Add Statement Between Existing Resources"); + super(Messages.GraphDebuggerView_AddStatement, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); //$NON-NLS-2$ + setToolTipText(Messages.GraphDebuggerView_AddStatementTT); } @Override public void run() { @@ -215,8 +215,8 @@ public class GraphDebuggerView extends ViewPart { class AddResourceAction extends Action { public AddResourceAction() { - super("AddResource", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); - setToolTipText("Add New Related Resource"); + super(Messages.GraphDebuggerView_AddResource, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); //$NON-NLS-2$ + setToolTipText(Messages.GraphDebuggerView_AddResourceTT); } @Override public void run() { diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/Messages.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/Messages.java index dbf553d67..a3e100b01 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/Messages.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/Messages.java @@ -24,9 +24,66 @@ import org.eclipse.osgi.util.NLS; public class Messages extends NLS { - public static String Name_adaption_problem; - public static String Name_formulation_problem; + public static String GraphDebugger_Cancel; + public static String GraphDebugger_ConfirmActionsDots; + public static String GraphDebugger_ConfirmActionsDotsMsg; + public static String GraphDebugger_Continue; + public static String GraphDebugger_EditValue; + public static String GraphDebugger_EnterResourceIDorURI; + public static String GraphDebugger_InputNewPropertyValue; + public static String GraphDebugger_LabelDragResource; + public static String GraphDebugger_Lookup; + public static String GraphDebugger_StatusIndexLookpuFailed; + public static String GraphDebugger_StatusInvalidInput; + public static String GraphDebugger_StatusInvalidInputExpectIdxClusterIds; + public static String GraphDebugger_StatusInvalidInputResIdORURIExpected; + public static String GraphDebugger_StatusInvalidPrefixedInput; + public static String GraphDebugger_StatusResourceforURI; + public static String GraphDebugger_StatusResourceIDFailed; + public static String GraphDebugger_StatusTransientResourceID; + public static String GraphDebugger_StatusURIlookupFailed; + public static String GraphDebuggerEditor_AddResource; + public static String GraphDebuggerEditor_AddResourceTT; + public static String GraphDebuggerEditor_AddStatement; + public static String GraphDebuggerEditor_AddStatementTT; + public static String GraphDebuggerEditor_Back; + public static String GraphDebuggerEditor_BackTT; + public static String GraphDebuggerEditor_Find; + public static String GraphDebuggerEditor_FindTT; + public static String GraphDebuggerEditor_Forward; + public static String GraphDebuggerEditor_ForwardTT; + public static String GraphDebuggerEditor_Refresh; + public static String GraphDebuggerEditor_RefreshTT; + public static String GraphDebuggerView_AddResource; + public static String GraphDebuggerView_AddResourceTT; + public static String GraphDebuggerView_AddStatement; + public static String GraphDebuggerView_AddStatementTT; + public static String GraphDebuggerView_Back; + public static String GraphDebuggerView_BackTT; + public static String GraphDebuggerView_Find; + public static String GraphDebuggerView_FindTT; + public static String GraphDebuggerView_Forward; + public static String GraphDebuggerView_ForwardTT; + public static String GraphDebuggerView_Home; + public static String GraphDebuggerView_HomeTT; + public static String GraphDebuggerView_Refresh; + public static String SearchResourceDialog_ActivatorResourceLabelProviderFailed; + public static String SearchResourceDialog_EnterNameResURIOrId; + public static String SearchResourceDialog_SeperatorLblPreviouslySelected; + public static String SearchResourceDialog_ShowInBrowser; + public static String SessionDebuggerView_ActivatorUnexpectedException; + public static String SessionDebuggerView_ActivatorUnexpectedIOException; + public static String SessionDebuggerView_Shell; + public static String SessionDebuggerView_WroteCommand; + public static String VariableDebugger_DragResourceToDebugger; + public static String VariableDebugger_Lookup; + public static String VariableDebugger_TextToolTip; + public static String VariableDebuggerView_Back; + public static String VariableDebuggerView_Forward; + public static String VariableDebuggerView_Home; + public static String VariableDebuggerView_HomeTT; + public static String VariableDebuggerView_Refresh; private static final String BUNDLE_NAME = "org.simantics.debug.ui.messages"; //$NON-NLS-1$ static { diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/ResourceSearch.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/ResourceSearch.java index 743cf4b6a..0032a98fb 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/ResourceSearch.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/ResourceSearch.java @@ -167,7 +167,7 @@ public class ResourceSearch extends ReadRequest { public void run(ReadGraph g) { try { if (!asyncListening && resFoundQueue!=null) resFoundQueue.g = g; - Resource root = g.getResource("http:/"); + Resource root = g.getResource("http:/"); //$NON-NLS-1$ Layer0 L0 = Layer0.getInstance(g); LinkedList queue = new LinkedList(); queue.add(root); diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SearchResourceDialog.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SearchResourceDialog.java index 4eca4e550..8532be1ae 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SearchResourceDialog.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SearchResourceDialog.java @@ -85,13 +85,13 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog { */ private static final int DEFAULT_MAX_INDEX_HITS = 1000; - private static final Pattern ID_PATTERN = Pattern.compile("\\$([0-9]+)"); + private static final Pattern ID_PATTERN = Pattern.compile("\\$([0-9]+)"); //$NON-NLS-1$ private static final String SEARCH_RESOURCE_DIALOG = "SearchResourceDialog"; //$NON-NLS-1$ private static final int SHOW_IN_BROWSER_ID = IDialogConstants.CLIENT_ID + 1; - private static final String SHOW_IN_BROWSER_LABEL = "Show In Browser"; + private static final String SHOW_IN_BROWSER_LABEL = Messages.SearchResourceDialog_ShowInBrowser; private Session session; @SuppressWarnings("unused") @@ -103,7 +103,7 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog { @Override public String getText(Object element) { if (element == null) - return "null"; + return "null"; //$NON-NLS-1$ // This may happen if multiple choice is enabled if (element instanceof String) return (String) element; @@ -117,15 +117,15 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog { String name = NameUtils.getSafeName(g, r); String uri = DebugUtils.getPossibleRootRelativePath(g, r); return - "[" + r.getResourceId() + "] - " + "[" + r.getResourceId() + "] - " //$NON-NLS-1$ //$NON-NLS-2$ + name - + (uri != null ? " - " : "") - + (uri != null ? uri : ""); + + (uri != null ? " - " : "") //$NON-NLS-1$ //$NON-NLS-2$ + + (uri != null ? uri : ""); //$NON-NLS-1$ } }); } catch (DatabaseException e) { - Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Resource label provider failed unexpectedly.", e)); - return ""; + Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.SearchResourceDialog_ActivatorResourceLabelProviderFailed, e)); + return ""; //$NON-NLS-1$ } } }; @@ -137,7 +137,7 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog { @Override public String getText(Object element) { if (element==null) - return "null"; + return "null"; //$NON-NLS-1$ return element.toString(); } @Override @@ -162,19 +162,19 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog { this.session = s; this.selection = selection; this.labelProvider = new ElementLabelProvider(shell.getDisplay()); - setMessage("Enter name, resource URI or ID"); + setMessage(Messages.SearchResourceDialog_EnterNameResURIOrId); setListLabelProvider(labelProvider); setDetailsLabelProvider(detailsLabelProvider); setTitle(title); //setInitialPattern("*", FilteredItemsSelectionDialog.FULL_SELECTION); setSelectionHistory(new ResourceSelectionHistory()); - setSeparatorLabel("Previously selected above, others below"); + setSeparatorLabel(Messages.SearchResourceDialog_SeperatorLblPreviouslySelected); } @Override protected void configureShell(Shell shell) { this.resourceManager = new LocalResourceManager(JFaceResources.getResources(), shell); - setImage((Image) resourceManager.get(BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_blue.png"))); + setImage((Image) resourceManager.get(BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_blue.png"))); //$NON-NLS-1$ super.configureShell(shell); } @@ -221,16 +221,16 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog { try { return DebugUtils.getSafeLabel(g, r); } catch (Exception ex) { - System.out.println("Exception thrown from restoreItemFromMemento"); + System.out.println("Exception thrown from restoreItemFromMemento"); //$NON-NLS-1$ } } catch (Throwable t) {} - return "" + r.getResourceId(); + return "" + r.getResourceId(); //$NON-NLS-1$ } }); if (name==null) return null; return new LabeledResource(name, r); } catch (NumberFormatException | DatabaseException e) { - LOGGER.info("Search memento restoration failed.", e); + LOGGER.info("Search memento restoration failed.", e); //$NON-NLS-1$ return null; } } @@ -266,7 +266,7 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog { public ItemsFilterWithSearchResults() { final String pattern = getPattern(); - final boolean findUris = pattern.trim().startsWith("http:/"); + final boolean findUris = pattern.trim().startsWith("http:/"); //$NON-NLS-1$ final long referencedResourceId = referencedResourceId(pattern); final boolean findIds = referencedResourceId != 0; @@ -307,8 +307,8 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog { IResourceFilter rf = resourceFilter; String filter = getFilterForResourceFilter(rf); if (!filter.isEmpty()) - filter += " AND "; - filter += "Name:" + pattern + "*"; + filter += " AND "; //$NON-NLS-1$ + filter += "Name:" + pattern + "*"; //$NON-NLS-1$ //$NON-NLS-2$ Layer0 L0 = Layer0.getInstance(graph); @@ -438,7 +438,7 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog { @SuppressWarnings("unchecked") @Override public String getElementName(Object item) { - return ((Container)item).get().getResourceId()+""; + return ((Container)item).get().getResourceId()+""; //$NON-NLS-1$ //return item.toString(); } @@ -464,12 +464,12 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog { private String getFilterForResourceFilter(IResourceFilter filter) { if (filter == null || filter == ResourceSearch.FILTER_ALL) - return ""; + return ""; //$NON-NLS-1$ if (filter == ResourceSearch.FILTER_RELATIONS) - return "Types:Relation"; + return "Types:Relation"; //$NON-NLS-1$ if (filter == ResourceSearch.FILTER_TYPES) - return "Types:Type"; - return ""; + return "Types:Type"; //$NON-NLS-1$ + return ""; //$NON-NLS-1$ } } diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SessionDebugger.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SessionDebugger.java index 820f5d602..fcbc93234 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SessionDebugger.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SessionDebugger.java @@ -65,7 +65,7 @@ public class SessionDebugger extends Composite { */ public SessionDebugger(Composite parent, int style, final Session session) { super(parent, style); - Assert.isNotNull(session, "session is null"); + Assert.isNotNull(session, "session is null"); //$NON-NLS-1$ this.session = session; updater = new MergingGraphRequestProcessor(session, 100); diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SessionDebuggerView.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SessionDebuggerView.java index 0e0363fa8..1426afa6d 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SessionDebuggerView.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SessionDebuggerView.java @@ -22,6 +22,7 @@ import java.util.Set; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.browser.Browser; import org.eclipse.swt.custom.CTabFolder; @@ -51,7 +52,7 @@ import org.simantics.views.swt.SimanticsView; @SuppressWarnings("deprecation") public class SessionDebuggerView extends SimanticsView { - public static final String VIEW_ID = "org.simantics.debug.sessionDebugger"; + public static final String VIEW_ID = "org.simantics.debug.sessionDebugger"; //$NON-NLS-1$ private CTabFolder folder; private Text commandLine; @@ -63,7 +64,7 @@ public class SessionDebuggerView extends SimanticsView { @Override protected Set getBrowseContexts() { - return Collections.singleton(""); + return Collections.singleton(""); //$NON-NLS-1$ } private CTabItem createItem(int index, CTabFolder folder, Control control) { @@ -101,14 +102,14 @@ public class SessionDebuggerView extends SimanticsView { if (historyPosition < 0) { return; } else if (historyPosition == 0) { - commandLine.setText(""); + commandLine.setText(""); //$NON-NLS-1$ historyPosition = -1; } else { commandLine.setText(history.get(--historyPosition)); } } else if (e.keyCode == SWT.ESC) { historyPosition = -1; - commandLine.setText(""); + commandLine.setText(""); //$NON-NLS-1$ } else if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) { applyCommand(commandLine.getText()); } @@ -116,7 +117,7 @@ public class SessionDebuggerView extends SimanticsView { }); CTabItem shellItem = createItem(0, folder, shell); - shellItem.setText("Shell"); + shellItem.setText(Messages.SessionDebuggerView_Shell); // SessionDebugger deprecated = new SessionDebugger(folder, SWT.NONE, Simantics.getSession()); // deprecated.initializeUI(); @@ -140,7 +141,7 @@ public class SessionDebuggerView extends SimanticsView { } catch (DatabaseException e) { Activator.getDefault().getLog().log( new Status(IStatus.ERROR, Activator.PLUGIN_ID, - "Unexpected exception while applying command " + command, e)); + Messages.SessionDebuggerView_ActivatorUnexpectedException + command, e)); } } @@ -152,16 +153,16 @@ public class SessionDebuggerView extends SimanticsView { Path p = (Path) output; long size = Files.size(p); if (size < (1L << 16)) { - terminal.addFirst(new String(Files.readAllBytes(p), "UTF-8")); + terminal.addFirst(new String(Files.readAllBytes(p), "UTF-8")); //$NON-NLS-1$ } - terminal.addFirst("Wrote command '" + command + "' output to file " + p); + terminal.addFirst(NLS.bind(Messages.SessionDebuggerView_WroteCommand ,new Object[] { command , p})); } catch (IOException e) { Activator.getDefault().getLog().log( new Status(IStatus.ERROR, Activator.PLUGIN_ID, - "Unexpected I/O exception while applying command " + command, e)); + NLS.bind(Messages.SessionDebuggerView_ActivatorUnexpectedIOException , new Object[]{ command, e}))); } } else { - throw new IllegalArgumentException("Unsupported output argument type " + output); + throw new IllegalArgumentException("Unsupported output argument type " + output); //$NON-NLS-1$ } if (terminal.size() > 10) terminal.removeLast(); @@ -176,7 +177,7 @@ public class SessionDebuggerView extends SimanticsView { private void apply(String command, Object data) { if (data instanceof String) { SWTUtils.asyncExec(commandLine, () -> { - commandLine.setText(""); + commandLine.setText(""); //$NON-NLS-1$ addHistory(command, data); console.setText(formatTerminal()); }); @@ -184,33 +185,33 @@ public class SessionDebuggerView extends SimanticsView { SWTUtils.asyncExec(commandLine, () -> { try { addHistory(command, dumpListenerReport((ListenerReport) data)); - commandLine.setText(""); + commandLine.setText(""); //$NON-NLS-1$ console.setText(formatTerminal()); } catch (IOException e) { Activator.getDefault().getLog().log( new Status(IStatus.ERROR, Activator.PLUGIN_ID, - "Unexpected I/O exception while applying command " + command, e)); + Messages.SessionDebuggerView_ActivatorUnexpectedIOException + command, e)); } }); } } private Path dumpListenerReport(ListenerReport data) throws IOException { - File f = Simantics.getTempfile("debug", "listenerReport"); - try (PrintStream out = new PrintStream(f, "UTF-8")) { - out.print("
");
+        File f = Simantics.getTempfile("debug", "listenerReport"); //$NON-NLS-1$ //$NON-NLS-2$
+        try (PrintStream out = new PrintStream(f, "UTF-8")) { //$NON-NLS-1$
+            out.print("
"); //$NON-NLS-1$
             data.print(out);
-            out.print("
"); + out.print("
"); //$NON-NLS-1$ } return f.toPath(); } private String formatTerminal() { StringBuilder b = new StringBuilder(); - b.append("\n"); + b.append("\n"); //$NON-NLS-1$ for (String s : terminal) - b.append(s).append("
\n"); - b.append(""); + b.append(s).append("
\n"); //$NON-NLS-1$ + b.append(""); //$NON-NLS-1$ return b.toString(); } diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebugger.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebugger.java index 9c02bbe2a..697a58939 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebugger.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebugger.java @@ -102,12 +102,12 @@ public class VariableDebugger extends Composite { void historyChanged(); } - private final static String DEFAULT_DEBUGGER_CSS_FILE = "debugger.css"; - private final static String DEFAULT_DEBUGGER_CSS_PATH = "css/" + DEFAULT_DEBUGGER_CSS_FILE; + private final static String DEFAULT_DEBUGGER_CSS_FILE = "debugger.css"; //$NON-NLS-1$ + private final static String DEFAULT_DEBUGGER_CSS_PATH = "css/" + DEFAULT_DEBUGGER_CSS_FILE; //$NON-NLS-1$ private static int RESOURCE_NAME_MAX_LENGTH = 1000; - private final Charset utf8 = Charset.forName("UTF-8"); + private final Charset utf8 = Charset.forName("UTF-8"); //$NON-NLS-1$ private final LocalResourceManager resourceManager; @@ -157,7 +157,7 @@ public class VariableDebugger extends Composite { if (!browser.isDisposed()) browser.setText(content); if (!updateTriggerCounter.isDisposed()) - updateTriggerCounter.setText(updateCount + "/" + triggerCounter); + updateTriggerCounter.setText(updateCount + "/" + triggerCounter); //$NON-NLS-1$ } }); } @@ -181,7 +181,7 @@ public class VariableDebugger extends Composite { */ public VariableDebugger(Composite parent, int style, final Session session, String initialURI) { super(parent, style); - Assert.isNotNull(session, "session is null"); + Assert.isNotNull(session, "session is null"); //$NON-NLS-1$ this.session = session; this.currentElement = initialURI; this.resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent); @@ -222,7 +222,7 @@ public class VariableDebugger extends Composite { if (!css.exists()) { URL url = FileLocator.find(Activator.getDefault().getBundle(), new Path(DEFAULT_DEBUGGER_CSS_PATH), null); if (url == null) - throw new FileNotFoundException("Could not find '" + DEFAULT_DEBUGGER_CSS_PATH + "' in bundle '" + Activator.PLUGIN_ID + "'"); + throw new FileNotFoundException("Could not find '" + DEFAULT_DEBUGGER_CSS_PATH + "' in bundle '" + Activator.PLUGIN_ID + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ cssPath = FileUtils.copyResource(url, css, true).toURI().toString(); } else { cssPath = css.toURI().toString(); @@ -238,7 +238,7 @@ public class VariableDebugger extends Composite { public Label createDropLabel(Composite parent) { final Label label = new Label(parent, SWT.BORDER | SWT.FLAT); label.setAlignment(SWT.CENTER); - label.setText(" Drag a resource or a variable here to examine it in this debugger! "); + label.setText(Messages.VariableDebugger_DragResourceToDebugger); label.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY)); GridData data = new GridData(SWT.LEFT, SWT.FILL, false, false); label.setLayoutData(data); @@ -316,7 +316,7 @@ public class VariableDebugger extends Composite { text.setLayoutData(data); Button button = new Button(parent, SWT.NONE); - button.setText("Lookup"); + button.setText(Messages.VariableDebugger_Lookup); GridData data2 = new GridData(SWT.FILL, SWT.FILL, false, false); button.setLayoutData(data2); @@ -347,7 +347,7 @@ public class VariableDebugger extends Composite { protected Text createUpdateTriggerCounter(Composite parent) { Text label = new Text(parent, SWT.BORDER | SWT.FLAT); label.setEditable(false); - label.setToolTipText("Amount of Screen/Listener Updates Received for Shown Variable"); + label.setToolTipText(Messages.VariableDebugger_TextToolTip); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL) .grab(false, false).hint(32, SWT.DEFAULT).applyTo(label); updateTriggerCounter = label; @@ -385,21 +385,21 @@ public class VariableDebugger extends Composite { @Override public void changing(LocationEvent event) { String location = event.location; - if (location.startsWith("simantics:browser")) - location = "about:" + location.substring(17); + if (location.startsWith("simantics:browser")) //$NON-NLS-1$ + location = "about:" + location.substring(17); //$NON-NLS-1$ //System.out.println("changing: location=" + location); // Do not follow links that are meant as actions that are // handled below. event.doit = false; - if ("about:blank".equals(location)) { + if ("about:blank".equals(location)) { //$NON-NLS-1$ // Just changing to the same old blank url is ok since it // allows the browser to refresh itself. event.doit = true; } - if (location.startsWith("about:-link")) { - String target = location.replace("about:-link", ""); + if (location.startsWith("about:-link")) { //$NON-NLS-1$ + String target = location.replace("about:-link", ""); //$NON-NLS-1$ //$NON-NLS-2$ try { byte[] bytes = Base64.decode(target); String url = new String(bytes, utf8); @@ -411,8 +411,8 @@ public class VariableDebugger extends Composite { } catch (IOException e) { ErrorLogger.defaultLogError(e); } - } else if (location.startsWith("about:-remove")) { - } else if (location.startsWith("about:-edit-value")) { + } else if (location.startsWith("about:-remove")) { //$NON-NLS-1$ + } else if (location.startsWith("about:-edit-value")) { //$NON-NLS-1$ } } }); @@ -508,43 +508,43 @@ public class VariableDebugger extends Composite { if (o instanceof byte[]) { byte[] arr = (byte[]) o; byte[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH); - return truncated("byte", Arrays.toString(arr2), arr.length); + return truncated("byte", Arrays.toString(arr2), arr.length); //$NON-NLS-1$ } else if (o instanceof int[]) { int[] arr = (int[]) o; int[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH); - return truncated("int", Arrays.toString(arr2), arr.length); + return truncated("int", Arrays.toString(arr2), arr.length); //$NON-NLS-1$ } else if (o instanceof long[]) { long[] arr = (long[]) o; long[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH); - return truncated("long", Arrays.toString(arr2), arr.length); + return truncated("long", Arrays.toString(arr2), arr.length); //$NON-NLS-1$ } else if (o instanceof float[]) { float[] arr = (float[]) o; float[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH); - return truncated("float", Arrays.toString(arr2), arr.length); + return truncated("float", Arrays.toString(arr2), arr.length); //$NON-NLS-1$ } else if (o instanceof double[]) { double[] arr = (double[]) o; double[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH); - return truncated("double", Arrays.toString(arr2), arr.length); + return truncated("double", Arrays.toString(arr2), arr.length); //$NON-NLS-1$ } else if (o instanceof boolean[]) { boolean[] arr = (boolean[]) o; boolean[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH); - return truncated("boolean", Arrays.toString(arr2), arr.length); + return truncated("boolean", Arrays.toString(arr2), arr.length); //$NON-NLS-1$ } else if (o instanceof Object[]) { Object[] arr = (Object[]) o; Object[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH); - return truncated("Object", Arrays.toString(arr2), arr.length); + return truncated("Object", Arrays.toString(arr2), arr.length); //$NON-NLS-1$ } else { - return "Unknown big array " + o.getClass(); + return "Unknown big array " + o.getClass(); //$NON-NLS-1$ } } else { - return o.getClass().getComponentType() + "[" + length + "] = " + ObjectUtils.toString(o); + return o.getClass().getComponentType() + "[" + length + "] = " + ObjectUtils.toString(o); //$NON-NLS-1$ //$NON-NLS-2$ } } return null; } protected String truncated(String type, String string, int originalLength) { - return type + "[" + RESOURCE_NAME_MAX_LENGTH + "/" + originalLength + "] = " + string; + return type + "[" + RESOURCE_NAME_MAX_LENGTH + "/" + originalLength + "] = " + string; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } protected String getVariableName(ReadGraph graph, Variable r) { @@ -563,7 +563,7 @@ public class VariableDebugger extends Composite { for(VariableConnectionPointDescriptor v : c.getConnectionPointDescriptors(graph, null)) { result.add(v.getRelativeRVI(graph, base)); } - return "c " + result.toString(); + return "c " + result.toString(); //$NON-NLS-1$ } else if (clazz.isArray()) { if(int[].class == clazz) { return Arrays.toString((int[])o); @@ -591,10 +591,10 @@ public class VariableDebugger extends Composite { Object value = r.getValue(graph); if(value instanceof Resource) return getResourceRef(graph, (Resource)value); else if (value instanceof Variable) return getVariableRef(graph, (Variable)value); - else return value != null ? getValue(graph, r, value) : "null"; + else return value != null ? getValue(graph, r, value) : "null"; //$NON-NLS-1$ } catch (Throwable e) { try { - Logger.defaultLogError("getValue " + r.getURI(graph), e); + Logger.defaultLogError("getValue " + r.getURI(graph), e); //$NON-NLS-1$ } catch (DatabaseException e1) { Logger.defaultLogError(e1); } @@ -605,7 +605,7 @@ public class VariableDebugger extends Composite { protected String getDatatype(ReadGraph graph, Variable r) { try { Datatype dt = r.getPossibleDatatype(graph); - return dt != null ? dt.toSingleLineString() : "undefined"; + return dt != null ? dt.toSingleLineString() : "undefined"; //$NON-NLS-1$ } catch (Exception e) { return e.getMessage(); } @@ -616,9 +616,9 @@ public class VariableDebugger extends Composite { } private String getVariableRef(ReadGraph graph, Variable r) throws DatabaseException { - String ret = "" + String ret = "" //$NON-NLS-1$ //$NON-NLS-2$ + getVariableName(graph, r) - + ""; + + ""; //$NON-NLS-1$ // if (graph.isInstanceOf(r, L0.Literal)) { // ret += " " // + "(edit value)" @@ -645,11 +645,11 @@ public class VariableDebugger extends Composite { // } catch (Exception e) { // e.printStackTrace(); // } - content.append(""); - content.append("").append(getVariableRef(graph, property)).append(""); - content.append("").append(getValue(graph, property)).append(""); - content.append("").append(getDatatype(graph, property)).append(""); - content.append(""); + content.append(""); //$NON-NLS-1$ + content.append("").append(getVariableRef(graph, property)).append(""); //$NON-NLS-1$ //$NON-NLS-2$ + content.append("").append(getValue(graph, property)).append(""); //$NON-NLS-1$ //$NON-NLS-2$ + content.append("").append(getDatatype(graph, property)).append(""); //$NON-NLS-1$ //$NON-NLS-2$ + content.append(""); //$NON-NLS-1$ } protected String getRVIString(ReadGraph graph, Variable var) throws DatabaseException { @@ -657,7 +657,7 @@ public class VariableDebugger extends Composite { try { return var.getRVI(graph).toString(graph); } catch (Throwable e) { - return "No RVI"; + return "No RVI"; //$NON-NLS-1$ } } @@ -669,9 +669,9 @@ public class VariableDebugger extends Composite { StringBuilder content = new StringBuilder(); // Generate HTML -page - content.append("").append(getHead()).append("\n"); - content.append("\n"); - content.append("
\n"); + content.append("").append(getHead()).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + content.append("\n"); //$NON-NLS-1$ + content.append("
\n"); //$NON-NLS-1$ for (String uri : uris) { //System.out.println("URI: " + uri); Variable var = Variables.getPossibleVariable(graph, uri); @@ -690,14 +690,14 @@ public class VariableDebugger extends Composite { } // Begin #top DIV - content.append("
\n"); - content.append("\n"); - content.append("\n"); - content.append("\n"); - content.append("\n"); - content.append("\n"); - content.append("
URI").append(uri).append("
RVI").append(rviString).append("
Class").append(var.getClass().getCanonicalName()).append("
Solver node").append(node).append("
\n"); - content.append("
\n"); + content.append("
\n"); //$NON-NLS-1$ + content.append("\n"); //$NON-NLS-1$ + content.append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + content.append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + content.append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + content.append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + content.append("
URI").append(uri).append("
RVI").append(rviString).append("
Class").append(var.getClass().getCanonicalName()).append("
Solver node").append(node).append("
\n"); //$NON-NLS-1$ + content.append("
\n"); //$NON-NLS-1$ // Close #top DIV // Content @@ -709,7 +709,7 @@ public class VariableDebugger extends Composite { } } catch (DatabaseException e) { // This may happen if the Variable implementation is broken - ErrorLogger.defaultLogError("Broken variable child retrieval implementation or serious modelling error encountered. See exception for details.", e); + ErrorLogger.defaultLogError("Broken variable child retrieval implementation or serious modelling error encountered. See exception for details.", e); //$NON-NLS-1$ } TreeMap map2 = new TreeMap(); @@ -720,37 +720,37 @@ public class VariableDebugger extends Composite { } } catch (DatabaseException e) { // This may happen if the Variable implementation is broken - ErrorLogger.defaultLogError("Broken variable property retrieval implementation or serious modelling error encountered. See exception for details.", e); + ErrorLogger.defaultLogError("Broken variable property retrieval implementation or serious modelling error encountered. See exception for details.", e); //$NON-NLS-1$ } - content.append("\n
\n"); - content.append("\n"); + content.append("\n
\n"); //$NON-NLS-1$ + content.append("
\n"); //$NON-NLS-1$ - content.append(""); + content.append(""); //$NON-NLS-1$ for (Variable child : map.values()) { - content.append(""); + content.append(""); //$NON-NLS-1$ //$NON-NLS-2$ } - content.append(""); + content.append(""); //$NON-NLS-1$ for (Variable property : map2.values()) { updateProperty(content, graph, property); } // Close #data - content.append("\n\n"); + content.append("\n\n"); //$NON-NLS-1$ } // Close #mainContent - content.append("\n"); - content.append("\n"); + content.append("\n"); //$NON-NLS-1$ + content.append("\n"); //$NON-NLS-1$ // Update content return content.toString(); } private String getHead() { - String result = ""; + String result = ""; //$NON-NLS-1$ if (cssPath != null) { - result = ""; + result = ""; //$NON-NLS-1$ //$NON-NLS-2$ } return result; } diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebuggerView.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebuggerView.java index 6edd79ad2..48234434e 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebuggerView.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebuggerView.java @@ -35,7 +35,7 @@ import org.simantics.utils.ui.LayoutUtils; public class VariableDebuggerView extends ViewPart { - public static final String VIEW_ID = "org.simantics.debug.variableDebugger"; + public static final String VIEW_ID = "org.simantics.debug.variableDebugger"; //$NON-NLS-1$ private ResourceInput input; @@ -115,7 +115,7 @@ public class VariableDebuggerView extends ViewPart { // class RefreshAction extends Action { public RefreshAction() { - super("Refresh", BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif")); + super(Messages.VariableDebuggerView_Refresh, BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif")); //$NON-NLS-2$ } @Override public void run() { @@ -125,7 +125,7 @@ public class VariableDebuggerView extends ViewPart { class BackAction extends Action { public BackAction() { - super("Back", Action.AS_PUSH_BUTTON); + super(Messages.VariableDebuggerView_Back, Action.AS_PUSH_BUTTON); setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK)); setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED)); } @@ -137,7 +137,7 @@ public class VariableDebuggerView extends ViewPart { class ForwardAction extends Action { public ForwardAction() { - super("Forward", Action.AS_PUSH_BUTTON); + super(Messages.VariableDebuggerView_Forward, Action.AS_PUSH_BUTTON); setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD)); setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED)); } @@ -149,8 +149,8 @@ public class VariableDebuggerView extends ViewPart { class HomeAction extends Action { public HomeAction() { - super("Home", Action.AS_PUSH_BUTTON); - setToolTipText("Navigate to root library"); + super(Messages.VariableDebuggerView_Home, Action.AS_PUSH_BUTTON); + setToolTipText(Messages.VariableDebuggerView_HomeTT); setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_HOME_NAV)); setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_HOME_NAV_DISABLED)); } diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebugger.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebugger.java index fef011b8d..c8a89fa9e 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebugger.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebugger.java @@ -19,6 +19,7 @@ import java.util.Set; import javax.swing.SwingUtilities; import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.browser.Browser; import org.eclipse.swt.layout.GridData; @@ -114,7 +115,7 @@ public class GraphicalDebugger extends GraphDebugger { public GraphvizComponent2 createGraph(Composite parent) { graph = new Graph(); - graph.setRankdir("LR"); + graph.setRankdir("LR"); //$NON-NLS-1$ graphVizComponent = new GraphvizComponent2(parent, SWT.NONE); SwingUtilities.invokeLater(new Runnable() { @@ -195,8 +196,8 @@ public class GraphicalDebugger extends GraphDebugger { if (n == null) { n = new Node(graph); if (!r.isPersistent()) { - n.setShape("box"); - n.setFontColor("blue"); + n.setShape("box"); //$NON-NLS-1$ + n.setFontColor("blue"); //$NON-NLS-1$ } nodeMap.map(r, n); } @@ -205,20 +206,20 @@ public class GraphicalDebugger extends GraphDebugger { @SuppressWarnings("unused") protected void appendLabel(Node node, String text) { - String label = node.get("label"); + String label = node.get("label"); //$NON-NLS-1$ if (true) { if (label == null || label.length() == 0) label = text;//escape(text); else { label = label.substring(1,label.length()-1); - label += "
"+text; + label += "
"+text; //$NON-NLS-1$ } - label = "<" + label + ">"; + label = "<" + label + ">"; //$NON-NLS-1$ //$NON-NLS-2$ } else { if (label == null || label.length() == 0) label = text; else { - label += " "+text; + label += " "+text; //$NON-NLS-1$ } } @@ -232,7 +233,7 @@ public class GraphicalDebugger extends GraphDebugger { L0 = Layer0.getInstance(g); graph = new Graph(); - graph.setRankdir("LR"); + graph.setRankdir("LR"); //$NON-NLS-1$ nodeMap.clear(); edgeMap.clear(); @@ -266,8 +267,8 @@ public class GraphicalDebugger extends GraphDebugger { continue; Node node = getResourceRef(g, r); if (r.equals(getDebuggerLocation())) { - node.setFillColor("#aaffaa"); - node.setStyle("filled"); + node.setFillColor("#aaffaa"); //$NON-NLS-1$ + node.setStyle("filled"); //$NON-NLS-1$ } //Node node = getOrCreate(r); processed.add(r); @@ -279,10 +280,10 @@ public class GraphicalDebugger extends GraphDebugger { uri = g.syncRequest(new ResourceToPossibleURI(r)); } catch (Exception e) { e.printStackTrace(); - uri = "Cannot get URI: " + e.getMessage(); + uri = "Cannot get URI: " + e.getMessage(); //$NON-NLS-1$ } if (uri != null) - appendLabel(node, "URI: " + uri); + appendLabel(node, "URI: " + uri); //$NON-NLS-1$ //content.append("\t\t
" + uri + "

"); Collection statements = g.getStatements(r, L0.IsWeaklyRelatedTo); @@ -298,12 +299,12 @@ public class GraphicalDebugger extends GraphDebugger { map.add(predicate, new Resource[] {subject, obj}); } catch (Throwable e) { e.printStackTrace(); - ErrorLogger.defaultLogError("Cannot find statement " + subject + " " + predicate + " " + obj, e); + ErrorLogger.defaultLogError("Cannot find statement " + subject + " " + predicate + " " + obj, e); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } ClusteringSupport support = g.getSession().getService(ClusteringSupport.class); //content.append("

" + " ["+ r.getResourceId() + "-" + support.getCluster(r) + "] " + "

\n"); - appendLabel(node, " ["+ r.getResourceId() + "-" + support.getCluster(r) + "]"); + appendLabel(node, " ["+ r.getResourceId() + "-" + support.getCluster(r) + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //content.append("
Child
Child
").append(getVariableRef(graph, child)).append("
").append(getVariableRef(graph, child)).append("
PropertyValueDatatype
PropertyValueDatatype
\n"); //content.append(""); @@ -324,7 +325,7 @@ public class GraphicalDebugger extends GraphDebugger { //content.append(""); for(Statement stm : statements) { if(stm.getSubject().equals(stm.getObject())) { - updateTag(node, g, r, stm.getPredicate(), "Tag"); + updateTag(node, g, r, stm.getPredicate(), "Tag"); //$NON-NLS-1$ map.remove(stm.getPredicate()); } } @@ -334,7 +335,7 @@ public class GraphicalDebugger extends GraphDebugger { for(Statement stm : statements) { Resource predicate = stm.getPredicate(); if(g.isInstanceOf(stm.getPredicate(), L0.OrderedSet)) { - updateTag(node, g, r, stm.getPredicate(), "Ordered Set"); + updateTag(node, g, r, stm.getPredicate(), "Ordered Set"); //$NON-NLS-1$ map.remove(stm.getPredicate()); } Resource inverse = g.getPossibleInverse(predicate); @@ -366,7 +367,7 @@ public class GraphicalDebugger extends GraphDebugger { for(Resource pred : preds) { String str = htmlEscape(getResourceName(g, pred)); if(str == null) - str = ""; + str = ""; //$NON-NLS-1$ strmap.put(pred, str); } Arrays.sort(preds, new Comparator() { @@ -429,10 +430,10 @@ public class GraphicalDebugger extends GraphDebugger { if(!stmSubject.equals(subj)) { Node asserted = getResourceRef(graph, stmSubject); Edge e = new Edge(this.graph, objects[i].node, asserted); - e.setLabel("Asserted in"); + e.setLabel(Messages.GraphicalDebugger_AssertedIn); - objects[i].node.setFillColor("#ffaaaa"); - objects[i].node.setStyle("filled"); + objects[i].node.setFillColor("#ffaaaa"); //$NON-NLS-1$ + objects[i].node.setStyle("filled"); //$NON-NLS-1$ } } @@ -506,7 +507,7 @@ public class GraphicalDebugger extends GraphDebugger { cur = OrderedSetUtils.next(graph, subj, cur); } catch(DatabaseException e) { Edge edge = new Edge(this.graph, node, node); - edge.setLabel("Broken Ordered Set"); + edge.setLabel(Messages.GraphicalDebugger_BrockenOrderedSet); //list.add("BROKEN ORDERED SET:
" + e.getMessage() + ""); // Resource inv = graph.getPossibleInverse(subj); // for(Statement stat : graph.getStatements(cur, L0.IsRelatedTo)) { @@ -528,7 +529,7 @@ public class GraphicalDebugger extends GraphDebugger { } for (int i = 0; i < list.size() ; ++i) { Edge e = new Edge(this.graph, node, list.get(i)); - e.setLabel("Oredered set item " + i); + e.setLabel(NLS.bind(Messages.GraphicalDebugger_OrderedSetItem , i)); } // Output table rows diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebuggerEditor.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebuggerEditor.java index 4c87b8a6d..9e89ef328 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebuggerEditor.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebuggerEditor.java @@ -38,7 +38,7 @@ import org.simantics.utils.ui.LayoutUtils; public class GraphicalDebuggerEditor extends ResourceEditorPart { - public static final String EDITOR_ID = "org.simantics.debug.graphicalDebuggerEditor"; + public static final String EDITOR_ID = "org.simantics.debug.graphicalDebuggerEditor"; //$NON-NLS-1$ private GraphicalDebugger debugger; private IAction backAction; @@ -135,7 +135,7 @@ public class GraphicalDebuggerEditor extends ResourceEditorPart { class RefreshAction extends Action { public RefreshAction() { - super("Refresh", BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif")); + super(Messages.GraphicalDebuggerEditor_Refresh, BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif")); //$NON-NLS-2$ } @Override public void run() { @@ -145,8 +145,8 @@ public class GraphicalDebuggerEditor extends ResourceEditorPart { class FindAction extends Action { public FindAction() { - super("Find", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_blue.png")); - setToolTipText("Find Resource"); + super(Messages.GraphicalDebuggerEditor_Find, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_blue.png")); //$NON-NLS-2$ + setToolTipText(Messages.GraphicalDebuggerEditor_FindTT); } @Override public void run() { @@ -156,8 +156,8 @@ public class GraphicalDebuggerEditor extends ResourceEditorPart { class AddStatementAction extends Action { public AddStatementAction() { - super("AddStatement", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); - setToolTipText("Add Statement Between Existing Resources"); + super(Messages.GraphicalDebuggerEditor_AddStatement, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); //$NON-NLS-2$ + setToolTipText(Messages.GraphicalDebuggerEditor_AddStatementTT); } @Override public void run() { @@ -170,8 +170,8 @@ public class GraphicalDebuggerEditor extends ResourceEditorPart { } class AddResourceAction extends Action { public AddResourceAction() { - super("AddResource", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); - setToolTipText("Add New Related Resource"); + super(Messages.GraphicalDebuggerEditor_AddResource, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); //$NON-NLS-2$ + setToolTipText(Messages.GraphicalDebuggerEditor_AddResourceTT); } @Override public void run() { @@ -184,8 +184,8 @@ public class GraphicalDebuggerEditor extends ResourceEditorPart { } class BackAction extends Action { public BackAction() { - super("Back", Action.AS_PUSH_BUTTON); - setToolTipText("Back"); + super(Messages.GraphicalDebuggerEditor_Back, Action.AS_PUSH_BUTTON); + setToolTipText(Messages.GraphicalDebuggerEditor_BackTT); setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK)); setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED)); } @@ -198,8 +198,8 @@ public class GraphicalDebuggerEditor extends ResourceEditorPart { class ForwardAction extends Action { public ForwardAction() { - super("Forward", Action.AS_PUSH_BUTTON); - setToolTipText("Forward"); + super(Messages.GraphicalDebuggerEditor_Forward, Action.AS_PUSH_BUTTON); + setToolTipText(Messages.GraphicalDebuggerEditor_ForwardTT); setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD)); setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED)); } @@ -212,7 +212,7 @@ public class GraphicalDebuggerEditor extends ResourceEditorPart { class DecreaseDepthAction extends Action { public DecreaseDepthAction() { - super("Decrease", Action.AS_PUSH_BUTTON); + super(Messages.GraphicalDebuggerEditor_Decrease, Action.AS_PUSH_BUTTON); setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK)); setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED)); } @@ -224,7 +224,7 @@ public class GraphicalDebuggerEditor extends ResourceEditorPart { class IncreaseDepthAction extends Action { public IncreaseDepthAction() { - super("Increase", Action.AS_PUSH_BUTTON); + super(Messages.GraphicalDebuggerEditor_Increase, Action.AS_PUSH_BUTTON); setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD)); setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED)); } diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebuggerView.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebuggerView.java index 1c17001f0..a47f48e23 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebuggerView.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebuggerView.java @@ -32,7 +32,7 @@ import org.simantics.utils.ui.LayoutUtils; public class GraphicalDebuggerView extends ViewPart { - public static final String VIEW_ID = "org.simantics.debug.graphicalDebugger"; + public static final String VIEW_ID = "org.simantics.debug.graphicalDebugger"; //$NON-NLS-1$ // private final boolean DEFAULT_RECYCLE_VIEW = true; @@ -128,7 +128,7 @@ public class GraphicalDebuggerView extends ViewPart { // class RefreshAction extends Action { public RefreshAction() { - super("Refresh", BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif")); + super(Messages.GraphicalDebuggerView_Refresh, BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif")); //$NON-NLS-2$ } @Override public void run() { @@ -138,7 +138,7 @@ public class GraphicalDebuggerView extends ViewPart { class BackAction extends Action { public BackAction() { - super("Back", Action.AS_PUSH_BUTTON); + super(Messages.GraphicalDebuggerView_Back, Action.AS_PUSH_BUTTON); setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK)); setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED)); } @@ -150,7 +150,7 @@ public class GraphicalDebuggerView extends ViewPart { class ForwardAction extends Action { public ForwardAction() { - super("Forward", Action.AS_PUSH_BUTTON); + super(Messages.GraphicalDebuggerView_Forward, Action.AS_PUSH_BUTTON); setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD)); setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED)); } @@ -162,8 +162,8 @@ public class GraphicalDebuggerView extends ViewPart { class HomeAction extends Action { public HomeAction() { - super("Home", Action.AS_PUSH_BUTTON); - setToolTipText("Navigate to root library"); + super(Messages.GraphicalDebuggerView_Home, Action.AS_PUSH_BUTTON); + setToolTipText(Messages.GraphicalDebuggerView_HomeTT); setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_HOME_NAV)); setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_HOME_NAV_DISABLED)); } @@ -175,8 +175,8 @@ public class GraphicalDebuggerView extends ViewPart { class DecreaseDepthAction extends Action { public DecreaseDepthAction() { - super("Decrease", Action.AS_PUSH_BUTTON); - setToolTipText("Decrease Depth"); + super(Messages.GraphicalDebuggerView_Decrease, Action.AS_PUSH_BUTTON); + setToolTipText(Messages.GraphicalDebuggerView_DecreaseTT); setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK)); setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED)); } @@ -188,8 +188,8 @@ public class GraphicalDebuggerView extends ViewPart { class IncreaseDepthAction extends Action { public IncreaseDepthAction() { - super("Increase", Action.AS_PUSH_BUTTON); - setToolTipText("Increase Depth"); + super(Messages.GraphicalDebuggerView_Increase, Action.AS_PUSH_BUTTON); + setToolTipText(Messages.GraphicalDebuggerView_IncreaseTT); setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD)); setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED)); } diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/Messages.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/Messages.java new file mode 100644 index 000000000..12721b4ee --- /dev/null +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/Messages.java @@ -0,0 +1,39 @@ +package org.simantics.debug.ui.graph; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.debug.ui.graph.messages"; //$NON-NLS-1$ + public static String GraphicalDebugger_AssertedIn; + public static String GraphicalDebugger_BrockenOrderedSet; + public static String GraphicalDebugger_OrderedSetItem; + public static String GraphicalDebuggerEditor_AddResource; + public static String GraphicalDebuggerEditor_AddResourceTT; + public static String GraphicalDebuggerEditor_AddStatement; + public static String GraphicalDebuggerEditor_AddStatementTT; + public static String GraphicalDebuggerEditor_Back; + public static String GraphicalDebuggerEditor_BackTT; + public static String GraphicalDebuggerEditor_Decrease; + public static String GraphicalDebuggerEditor_Find; + public static String GraphicalDebuggerEditor_FindTT; + public static String GraphicalDebuggerEditor_Forward; + public static String GraphicalDebuggerEditor_ForwardTT; + public static String GraphicalDebuggerEditor_Increase; + public static String GraphicalDebuggerEditor_Refresh; + public static String GraphicalDebuggerView_Back; + public static String GraphicalDebuggerView_Decrease; + public static String GraphicalDebuggerView_DecreaseTT; + public static String GraphicalDebuggerView_Forward; + public static String GraphicalDebuggerView_Home; + public static String GraphicalDebuggerView_HomeTT; + public static String GraphicalDebuggerView_Increase; + public static String GraphicalDebuggerView_IncreaseTT; + public static String GraphicalDebuggerView_Refresh; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/messages.properties b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/messages.properties new file mode 100644 index 000000000..9565a601b --- /dev/null +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/messages.properties @@ -0,0 +1,25 @@ +GraphicalDebugger_AssertedIn=Asserted in +GraphicalDebugger_BrockenOrderedSet=Broken Ordered Set +GraphicalDebugger_OrderedSetItem=Ordered set item {0} +GraphicalDebuggerEditor_AddResource=AddResource +GraphicalDebuggerEditor_AddResourceTT=Add New Related Resource +GraphicalDebuggerEditor_AddStatement=AddStatement +GraphicalDebuggerEditor_AddStatementTT=Add Statement Between Existing Resources +GraphicalDebuggerEditor_Back=Back +GraphicalDebuggerEditor_BackTT=Back +GraphicalDebuggerEditor_Decrease=Decrease +GraphicalDebuggerEditor_Find=Find +GraphicalDebuggerEditor_FindTT=Find Resource +GraphicalDebuggerEditor_Forward=Forward +GraphicalDebuggerEditor_ForwardTT=Forward +GraphicalDebuggerEditor_Increase=Increase +GraphicalDebuggerEditor_Refresh=Refresh +GraphicalDebuggerView_Back=Back +GraphicalDebuggerView_Decrease=Decrease +GraphicalDebuggerView_DecreaseTT=Decrease Depth +GraphicalDebuggerView_Forward=Forward +GraphicalDebuggerView_Home=Home +GraphicalDebuggerView_HomeTT=Navigate to root library +GraphicalDebuggerView_Increase=Increase +GraphicalDebuggerView_IncreaseTT=Increase Depth +GraphicalDebuggerView_Refresh=Refresh diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/Activator.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/Activator.java index c69746d92..70aa09803 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/Activator.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/Activator.java @@ -20,7 +20,7 @@ import org.osgi.framework.BundleContext; public class Activator extends AbstractUIPlugin { // The plug-in ID - public static final String PLUGIN_ID = "org.simantics.debug.ui"; + public static final String PLUGIN_ID = "org.simantics.debug.ui"; //$NON-NLS-1$ // The shared instance private static Activator plugin; diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/DebugUtils.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/DebugUtils.java index 306f7f961..67ebb19ee 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/DebugUtils.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/DebugUtils.java @@ -44,7 +44,7 @@ public class DebugUtils { if (stm != null) { String label = NameUtils.getSafeLabel(graph, r); if (!label.isEmpty() && !stm.isAsserted(r)) - name += " (" + label + ")"; + name += " (" + label + ")"; //$NON-NLS-1$ //$NON-NLS-2$ } return name; } @@ -80,14 +80,14 @@ public class DebugUtils { public static void addResource(Session s, GraphDebugger debugger) throws DatabaseException { Shell shell = debugger.getShell(); - SearchResourceDialog rld = new SearchResourceDialog(s, false, shell, "Create New Resource"); + SearchResourceDialog rld = new SearchResourceDialog(s, false, shell, Messages.DebugUtils_CreateNewResource); rld.setBlockOnOpen(true); rld.setResourceFilter(ResourceSearch.FILTER_TYPES); Resource subject_ = debugger.getDebuggerLocation(); if (subject_ == null) { rld.setBlockOnOpen(true); - rld.setMessage("Select Subject"); + rld.setMessage(Messages.DebugUtils_SelectSubject); rld.setInitialSelections(new Object[] {}); if (rld.open()!=org.eclipse.jface.window.Window.OK) return; if (rld.getResult()==null) return; @@ -97,13 +97,13 @@ public class DebugUtils { rld.setBlockOnOpen(true); rld.setResourceFilter(ResourceSearch.FILTER_RELATIONS); - rld.setMessage("Select Predicate"); + rld.setMessage(Messages.DebugUtils_SelectPredicate); rld.setInitialSelections(new Object[] {}); if (rld.open()!=org.eclipse.jface.window.Window.OK) return; if (rld.getResult()==null) return; final Resource predicate = ((Container)rld.getResult()[0]).get(); - rld.setMessage("Select Type of New Object Instance"); + rld.setMessage(Messages.DebugUtils_SelectTypeOfNewObjectInstance); rld.setResourceFilter(ResourceSearch.FILTER_TYPES); rld.setInitialSelections(new Object[] {}); if (rld.open()!=org.eclipse.jface.window.Window.OK) return; @@ -127,12 +127,12 @@ public class DebugUtils { @SuppressWarnings("unchecked") public static void addStatement(Session s, GraphDebugger debugger) throws DatabaseException { Shell shell = debugger.getShell(); - SearchResourceDialog rld = new SearchResourceDialog(s, false, shell, "Create New Statement"); + SearchResourceDialog rld = new SearchResourceDialog(s, false, shell, Messages.DebugUtils_CreateNewStatement); Resource subject_ = debugger.getDebuggerLocation(); if (subject_ == null) { rld.setBlockOnOpen(true); - rld.setMessage("Select Subject"); + rld.setMessage(Messages.DebugUtils_SelectSubject); rld.setInitialSelections(new Object[] {}); if (rld.open()!=org.eclipse.jface.window.Window.OK) return; if (rld.getResult()==null) return; @@ -142,14 +142,14 @@ public class DebugUtils { rld.setBlockOnOpen(true); rld.setResourceFilter(ResourceSearch.FILTER_RELATIONS); - rld.setMessage("Select Predicate"); + rld.setMessage(Messages.DebugUtils_SelectPredicate); rld.setInitialSelections(new Object[] {}); if (rld.open()!=org.eclipse.jface.window.Window.OK) return; if (rld.getResult()==null) return; final Resource predicate = ((Container)rld.getResult()[0]).get(); rld.setResourceFilter(ResourceSearch.FILTER_ALL); - rld.setMessage("Select Object"); + rld.setMessage(Messages.DebugUtils_SelectObject); rld.setInitialSelections(new Object[] {}); if (rld.open()!=org.eclipse.jface.window.Window.OK) return; if (rld.getResult()==null) return; @@ -165,7 +165,7 @@ public class DebugUtils { public static void find(Session s, GraphDebugger debugger) { Shell shell = debugger.getShell(); - SearchResourceDialog rld = new SearchResourceDialog(s, false, shell, "Select Resource to View"); + SearchResourceDialog rld = new SearchResourceDialog(s, false, shell, Messages.DebugUtils_SelectResourceToView); rld.setBlockOnOpen(true); if (rld.open()!=org.eclipse.jface.window.Window.OK) return; if (rld.getResult()==null) return; diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/GraphDebuggerAdapter.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/GraphDebuggerAdapter.java index e61a955fb..71ae91414 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/GraphDebuggerAdapter.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/GraphDebuggerAdapter.java @@ -24,7 +24,7 @@ import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter; public class GraphDebuggerAdapter extends AbstractResourceEditorAdapter { public GraphDebuggerAdapter() { - super("Graph Debugger View", SimanticsUI.getImageDescriptor("icons/etool16/bug.png")); + super(Messages.GraphDebuggerAdapter_GraphDebuggerView, SimanticsUI.getImageDescriptor("icons/etool16/bug.png")); //$NON-NLS-1$ } @Override diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/GraphDebuggerEditorAdapter.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/GraphDebuggerEditorAdapter.java index 1ef8a2543..6039f8287 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/GraphDebuggerEditorAdapter.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/GraphDebuggerEditorAdapter.java @@ -25,7 +25,7 @@ import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter; public class GraphDebuggerEditorAdapter extends AbstractResourceEditorAdapter { public GraphDebuggerEditorAdapter() { - super("Graph Debugger", SimanticsUI.getImageDescriptor("icons/etool16/bug.png")); + super(Messages.GraphDebuggerEditorAdapter_GraphDebugger, SimanticsUI.getImageDescriptor("icons/etool16/bug.png")); //$NON-NLS-2$ } @Override diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/GraphicalDebuggerEditorAdapter.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/GraphicalDebuggerEditorAdapter.java index 600520a23..d98edc4c4 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/GraphicalDebuggerEditorAdapter.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/GraphicalDebuggerEditorAdapter.java @@ -23,7 +23,7 @@ import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter; public class GraphicalDebuggerEditorAdapter extends AbstractResourceEditorAdapter { public GraphicalDebuggerEditorAdapter() { - super("Graphical Debugger", SimanticsUI.getImageDescriptor("icons/etool16/bug.png")); + super(Messages.GraphicalDebuggerEditorAdapter_GraphicalDebugger, SimanticsUI.getImageDescriptor("icons/etool16/bug.png")); //$NON-NLS-1$ } @Override diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/Messages.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/Messages.java new file mode 100644 index 000000000..35479a841 --- /dev/null +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/Messages.java @@ -0,0 +1,26 @@ +package org.simantics.debug.ui.internal; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.debug.ui.internal.messages"; //$NON-NLS-1$ + public static String DebugUtils_CreateNewResource; + public static String DebugUtils_CreateNewStatement; + public static String DebugUtils_SelectObject; + public static String DebugUtils_SelectPredicate; + public static String DebugUtils_SelectResourceToView; + public static String DebugUtils_SelectSubject; + public static String DebugUtils_SelectTypeOfNewObjectInstance; + public static String GraphDebuggerAdapter_GraphDebuggerView; + public static String GraphDebuggerEditorAdapter_GraphDebugger; + public static String GraphicalDebuggerEditorAdapter_GraphicalDebugger; + public static String SearchResourceHandler_OpenResource; + public static String TGEditorAdapter_OntologyViewer; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/SearchResourceHandler.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/SearchResourceHandler.java index bf3616645..49917f909 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/SearchResourceHandler.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/SearchResourceHandler.java @@ -41,7 +41,7 @@ public class SearchResourceHandler extends AbstractHandler { public Object execute(ExecutionEvent event) throws ExecutionException { Shell shell = HandlerUtil.getActiveShellChecked(event); Session session = Simantics.getSession(); - SearchResourceDialog rld = new SearchResourceDialog(session, false, shell, "Open Resource"); + SearchResourceDialog rld = new SearchResourceDialog(session, false, shell, Messages.SearchResourceHandler_OpenResource); rld.setResourceFilter(ResourceSearch.FILTER_ALL); rld.setBlockOnOpen(true); rld.open(); diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/TGEditorAdapter.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/TGEditorAdapter.java index a941ecbc3..84d50b88e 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/TGEditorAdapter.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/TGEditorAdapter.java @@ -25,10 +25,10 @@ import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter; */ public class TGEditorAdapter extends AbstractResourceEditorAdapter { - public static final String EDITOR_ID = "org.simantics.modeling.ui.pgraphEditor"; + public static final String EDITOR_ID = "org.simantics.modeling.ui.pgraphEditor"; //$NON-NLS-1$ public TGEditorAdapter() { - super("Ontology Viewer", SimanticsUI.getImageDescriptor("icons/etool16/bug.png")); + super(Messages.TGEditorAdapter_OntologyViewer, SimanticsUI.getImageDescriptor("icons/etool16/bug.png")); //$NON-NLS-1$ } @Override diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/messages.properties b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/messages.properties new file mode 100644 index 000000000..9240ce0c7 --- /dev/null +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/messages.properties @@ -0,0 +1,12 @@ +DebugUtils_CreateNewResource=Create New Resource +DebugUtils_CreateNewStatement=Create New Statement +DebugUtils_SelectObject=Select Object +DebugUtils_SelectPredicate=Select Predicate +DebugUtils_SelectResourceToView=Select Resource to View +DebugUtils_SelectSubject=Select Subject +DebugUtils_SelectTypeOfNewObjectInstance=Select Type of New Object Instance +GraphDebuggerAdapter_GraphDebuggerView=Graph Debugger View +GraphDebuggerEditorAdapter_GraphDebugger=Graph Debugger +GraphicalDebuggerEditorAdapter_GraphicalDebugger=Graphical Debugger +SearchResourceHandler_OpenResource=Open Resource +TGEditorAdapter_OntologyViewer=Ontology Viewer diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/messages.properties b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/messages.properties index dbdce7c4f..a37e47dc4 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/messages.properties +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/messages.properties @@ -9,6 +9,64 @@ # Contributors: # VTT Technical Research Centre of Finland - initial API and implementation ############################################################################### +GraphDebugger_Cancel=Cancel +GraphDebugger_ConfirmActionsDots=Confirm action... +GraphDebugger_ConfirmActionsDotsMsg=This action will remove the selected statement.\nAre you sure you want to proceed with this action? +GraphDebugger_Continue=Continue +GraphDebugger_EditValue=Edit Value +GraphDebugger_EnterResourceIDorURI=Enter resource ID (RID) or URI +GraphDebugger_InputNewPropertyValue=Input new property value. For numeric vector values, separate numbers with comma (','). +GraphDebugger_LabelDragResource=Drag a resource here to examine it in this debugger\! +GraphDebugger_Lookup=&Lookup +GraphDebugger_StatusIndexLookpuFailed=Index & cluster -based lookup failed. See Error Log. +GraphDebugger_StatusInvalidInput=Invalid input, expected transient resource ID +GraphDebugger_StatusInvalidInputExpectIdxClusterIds=Invalid input, expected index & cluster IDs +GraphDebugger_StatusInvalidInputResIdORURIExpected=Invalid input, resource ID or URI expected +GraphDebugger_StatusInvalidPrefixedInput=Invalid '$'-prefixed input, expected resource ID +GraphDebugger_StatusResourceforURI=Resource for URI ''{0}'' not found +GraphDebugger_StatusResourceIDFailed=Resource ID lookup failed. See Error Log. +GraphDebugger_StatusTransientResourceID=Transient resource ID lookup failed. See Error Log. +GraphDebugger_StatusURIlookupFailed=URI lookup failed. See Error Log. +GraphDebuggerEditor_AddResourceTT=Add New Related Resource +GraphDebuggerEditor_AddStatement=AddStatement +GraphDebuggerEditor_AddStatementTT=Add Statement Between Existing Resources +GraphDebuggerEditor_Back=Back +GraphDebuggerEditor_BackTT=Back +GraphDebuggerEditor_Find=Find +GraphDebuggerEditor_FindTT=Find Resource +GraphDebuggerEditor_Forward=Forward +GraphDebuggerEditor_ForwardTT=Forward +GraphDebuggerEditor_Refresh=Refresh +GraphDebuggerEditor_RefreshTT=Refresh -Name_adaption_problem =

GraphDebugger: name adaption problem in {0}

-Name_formulation_problem =

GraphDebugger: unknown name formulation problem in {0}

\ No newline at end of file + +GraphDebuggerEditor_AddResource=AddResource +GraphDebuggerView_AddResource=AddResource +GraphDebuggerView_AddResourceTT=Add New Related Resource +GraphDebuggerView_AddStatement=AddStatement +GraphDebuggerView_AddStatementTT=Add Statement Between Existing Resources +GraphDebuggerView_Back=Back +GraphDebuggerView_BackTT=Back +GraphDebuggerView_Find=Find +GraphDebuggerView_FindTT=Find Resource +GraphDebuggerView_Forward=Forward +GraphDebuggerView_ForwardTT=Forward +GraphDebuggerView_Home=Home +GraphDebuggerView_HomeTT=Navigate to root library +GraphDebuggerView_Refresh=Refresh +SearchResourceDialog_ActivatorResourceLabelProviderFailed=Resource label provider failed unexpectedly. +SearchResourceDialog_EnterNameResURIOrId=Enter name, resource URI or ID +SearchResourceDialog_SeperatorLblPreviouslySelected=Previously selected above, others below +SearchResourceDialog_ShowInBrowser=Show In Browser +SessionDebuggerView_ActivatorUnexpectedException=Unexpected exception while applying command +SessionDebuggerView_ActivatorUnexpectedIOException=Unexpected I/O exception while applying command {0}{1} +SessionDebuggerView_Shell=Shell +SessionDebuggerView_WroteCommand=Wrote command ''{0}'' output to file {1} +VariableDebugger_DragResourceToDebugger=\ \ Drag a resource or a variable here to examine it in this debugger\! +VariableDebugger_Lookup=Lookup +VariableDebugger_TextToolTip=Amount of Screen/Listener Updates Received for Shown Variable +VariableDebuggerView_Back=Back +VariableDebuggerView_Forward=Forward +VariableDebuggerView_Home=Home +VariableDebuggerView_HomeTT=Navigate to root library +VariableDebuggerView_Refresh=Refresh
PredicateObject
Tags