X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.debug.ui%2Fsrc%2Forg%2Fsimantics%2Fdebug%2Fui%2FGraphDebugger.java;h=559b0e70275fe9ce3430eabc5a68ccd662202621;hp=c3b3ab8b94792ea4dc12942eae7455ed26568d91;hb=7e18cf26899ede3bb984f88c70d70faa1d61e514;hpb=34d0a75321b7f7d139fe101ccae5d0538b04408e 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..559b0e702 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); @@ -495,7 +496,7 @@ public class GraphDebugger extends Composite { public Browser createBrowser(Composite parent) { try { - browser = new Browser(parent, SWT.MOZILLA); + browser = new Browser(parent, SWT.WEBKIT); } catch (SWTError e) { //System.out.println("Could not instantiate Browser: " + e.getMessage()); browser = new Browser(parent, SWT.NONE); @@ -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; }