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;
import org.simantics.utils.Container;
import org.simantics.utils.FileUtils;
import org.simantics.utils.datastructures.BijectionMap;
-import org.simantics.utils.datastructures.Callback;
import org.simantics.utils.strings.AlphanumComparator;
import org.simantics.utils.ui.ErrorLogger;
import org.simantics.utils.ui.PathUtils;
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;
*/
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);
* When given to setStatus, indicates that the message shouldn't be touched
* since <code>null</code> 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);
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();
}
}
- 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);
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);
}
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();
}
});
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);
@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);
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 {
}
} 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 {
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);
}
}
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 ) );
// 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);
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);
@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;
// 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;
}
g.denyStatement(s, p, o);
}
- }, new Callback<DatabaseException>() {
-
- @Override
- public void run(DatabaseException parameter) {
- refreshBrowser();
- }
-
- });
- } else if (location.startsWith("about:-edit-value")) {
- String target = location.replace("about:-edit-value", "");
+ }, parameter -> refreshBrowser()
+ );
+ } 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() {
public void run() {
InputDialog dialog = new InputDialog(
getShell(),
- "Edit Value",
+ Messages.GraphDebugger_EditValue,
null,
previousValue,
new IInputValidator() {
{
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);
//modifier.modify( g, htmlEscape( value ) );
modifier.modify( g, value );
}
- }, new Callback<DatabaseException>() {
- @Override
- public void run(DatabaseException parameter) {
- if (parameter != null)
- ErrorLogger.defaultLogError(parameter);
- refreshBrowser();
- }
+ }, parameter -> {
+ if (parameter != null)
+ ErrorLogger.defaultLogError(parameter);
+ refreshBrowser();
});
return;
}
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", "<br/>");
+ return s.replace("&", "&").replace("<", "<").replace(">", ">").replace("\n", "<br/>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
}
/**
// 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);
}
if(name.isEmpty()) {
- name = "<empty value>";
+ name = "<empty value>"; //$NON-NLS-1$
}
}
//if(name.isEmpty())
name = DebugUtils.getSafeLabel(graph, r);
if (name.isEmpty())
- name = "<empty name>";
+ name = "<empty name>"; //$NON-NLS-1$
}
// ClusteringSupport support = graph.getSession().getService(ClusteringSupport.class);
// if(name == null)
try {
Layer0 L0 = Layer0.getInstance(graph);
if (graph.isInstanceOf(r, L0.Assertion)) {
- Resource pred = graph.getSingleObject(r, L0.HasPredicate);
+ Resource pred = graph.getPossibleObject(r, L0.HasPredicate);
// 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( 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 = "<a href=\"simantics:browser-link" + getLinkString(r) + "\">"
+ String ret = "<a href=\"simantics:browser-link" + getLinkString(r) + "\">" //$NON-NLS-1$ //$NON-NLS-2$
+ name
- + "</a>";
+ + "</a>"; //$NON-NLS-1$
if (graph.isInstanceOf(r, L0.Literal)) {
- ret += " <a class=\"edit-link\" href=\"simantics:browser-edit-value" + getLinkString(r) + "\">"
- + "(edit)"
- + "</a>";
+ ret += " <a class=\"edit-link\" href=\"simantics:browser-edit-value" + getLinkString(r) + "\">" //$NON-NLS-1$ //$NON-NLS-2$
+ + "(edit)" //$NON-NLS-1$
+ + "</a>"; //$NON-NLS-1$
}
return ret;
}
private String getStatementRemoveRef(Resource s, Resource p, Resource o) {
- return "<a href=\"simantics:browser-remove" + getStatementString(s, p, o)
- + "\" title=\"Remove this statement\">X</a>";
+ return "<a href=\"simantics:browser-remove" + getStatementString(s, p, o) //$NON-NLS-1$
+ + "\" title=\"Remove this statement\">X</a>"; //$NON-NLS-1$
}
private void updatePred(StringBuffer content, ReadGraph graph, Resource subj, Resource pred, List<Resource[]> stats) throws DatabaseException {
// 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$
}
}
// Output table rows
for (int i = 0; i < objects.length; ++i) {
- content.append("<tr>");
+ content.append("<tr>"); //$NON-NLS-1$
// Predicate column
if (i == 0)
- content.append("<td rowspan=\"").append(objects.length).append("\" valign=\"top\">").append(getResourceRef(graph, pred)).append("</td>");
+ content.append("<td rowspan=\"").append(objects.length).append("\" valign=\"top\">").append(getResourceRef(graph, pred)).append("</td>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// Object column
- if (objects[i][3] == null) content.append("<td>");
- else content.append("<td class=\"acquired\">");
+ if (objects[i][3] == null) content.append("<td>"); //$NON-NLS-1$
+ else content.append("<td class=\"acquired\">"); //$NON-NLS-1$
content.append(objects[i][2]);
if (objects[i][3] != null)
content.append(objects[i][3]);
- content.append("</td>");
+ content.append("</td>"); //$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("<td>").append(vg.toString()).append("</td>");
+ content.append("<td>").append(vg.toString()).append("</td>"); //$NON-NLS-1$ //$NON-NLS-2$
} else {
- content.append("<td>DB</td>");
+ content.append("<td>DB</td>"); //$NON-NLS-1$
}
// Statement remove -link column
// Only allowed for non-acquired statements.
if (objects[i][3] == null) {
- content.append("<td class=\"remove\">");
+ content.append("<td class=\"remove\">"); //$NON-NLS-1$
content.append(getStatementRemoveRef(subj, pred, links.getRight(objects[i][0])));
- content.append("</td>");
+ content.append("</td>"); //$NON-NLS-1$
}
- content.append("</tr>");
+ content.append("</tr>"); //$NON-NLS-1$
}
}
// Generate output content from statements
String ref = getResourceRef(graph, tag);
- content.append("<tr>");
- content.append("<td rowspan=\"1\" colspan=\"3\" valign=\"top\">").append(ref).append("</td>");
+ content.append("<tr>"); //$NON-NLS-1$
+ content.append("<td rowspan=\"1\" colspan=\"3\" valign=\"top\">").append(ref).append("</td>"); //$NON-NLS-1$ //$NON-NLS-2$
//content.append("<td>" + name + "</td>");
- content.append("<td class=\"remove\">");
+ content.append("<td class=\"remove\">"); //$NON-NLS-1$
content.append(getStatementRemoveRef(subj, tag, subj));
- content.append("</td>");
- content.append("</tr>");
+ content.append("</td>"); //$NON-NLS-1$
+ content.append("</tr>"); //$NON-NLS-1$
}
try {
cur = OrderedSetUtils.next(graph, subj, cur);
} catch(DatabaseException e) {
- list.add("<span style=\"color:red;font-weight:bold\">BROKEN ORDERED SET:<br/></span><span style=\"color:red\">" + e.getMessage() + "</span>");
+ list.add("<span style=\"color:red;font-weight:bold\">BROKEN ORDERED SET:<br/></span><span style=\"color:red\">" + e.getMessage() + "</span>"); //$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$
}
}
}
// Output table rows
for (int i = 0; i < list.size() ; ++i) {
- content.append("<tr>");
+ content.append("<tr>"); //$NON-NLS-1$
// Predicate column
if (i == 0)
- content.append("<td rowspan=\"").append(list.size()).append("\" valign=\"top\">Ordered Set Elements</td>");
+ content.append("<td rowspan=\"").append(list.size()).append("\" valign=\"top\">Ordered Set Elements</td>"); //$NON-NLS-1$ //$NON-NLS-2$
// Object column
- content.append("<td>");
+ content.append("<td>"); //$NON-NLS-1$
content.append(list.get(i));
- content.append("</td>");
+ content.append("</td>"); //$NON-NLS-1$
// Statement remove -link column
// Only allowed for non-acquired statements.
content.append(getStatementRemoveRef(subj, pred, links.getRight(objects[i][0])));
content.append("</td>");
}*/
- content.append("</tr>");
+ content.append("</tr>"); //$NON-NLS-1$
}
}
// Output table rows
for (int i = 0; i < list.size() ; ++i) {
- content.append("<tr>");
+ content.append("<tr>"); //$NON-NLS-1$
// Predicate column
if (i == 0)
- content.append("<td rowspan=\"").append(list.size()).append("\" valign=\"top\">Linked List Elements</td>");
+ content.append("<td rowspan=\"").append(list.size()).append("\" valign=\"top\">Linked List Elements</td>"); //$NON-NLS-1$ //$NON-NLS-2$
// Object column
- content.append("<td>");
+ content.append("<td>"); //$NON-NLS-1$
content.append(list.get(i));
- content.append("</td><td>DB</td>");
+ content.append("</td><td>DB</td>"); //$NON-NLS-1$
// Statement remove -link column
// Only allowed for non-acquired statements.
content.append(getStatementRemoveRef(subj, pred, links.getRight(objects[i][0])));
content.append("</td>");
}*/
- content.append("</tr>");
+ content.append("</tr>"); //$NON-NLS-1$
}
}
StringBuffer content = new StringBuffer();
// Generate HTML -page
- content.append("<html>\n<head>\n")
+ content.append("<html>\n<head>\n") //$NON-NLS-1$
.append(getHead())
- .append("\n</head>\n")
- .append("<body>\n")
- .append("<div id=\"mainContent\">\n\n");
+ .append("\n</head>\n") //$NON-NLS-1$
+ .append("<body>\n") //$NON-NLS-1$
+ .append("<div id=\"mainContent\">\n\n"); //$NON-NLS-1$
for (Resource r : resources) {
if (r == null)
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("<div id=\"top\">\n");
- content.append("<table class=\"top\">\n");
+ content.append("<div id=\"top\">\n"); //$NON-NLS-1$
+ content.append("<table class=\"top\">\n"); //$NON-NLS-1$
if (uri != null) {
- content.append("<tr><td class=\"top_key\">URI</td><td class=\"top_value\"><span id=\"uri\">").append(uri).append("</span></td></tr>\n");
+ content.append("<tr><td class=\"top_key\">URI</td><td class=\"top_value\"><span id=\"uri\">").append(uri).append("</span></td></tr>\n"); //$NON-NLS-1$ //$NON-NLS-2$
}
XSupport xs = graph.getService(XSupport.class);
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("<tr><td class=\"top_key\">Identifiers</td><td class=\"top_value\">");
- content.append("<span id=\"resource_id\">")
- .append(" RID = $").append(r.getResourceId())
- .append(" Resource Key = ").append(ss.getTransientId(r))
- .append(" CID = ").append(support.getCluster(r));
- content.append("</span></td>");
+ content.append("<tr><td class=\"top_key\">Identifiers</td><td class=\"top_value\">"); //$NON-NLS-1$
+ content.append("<span id=\"resource_id\">") //$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("</span></td>"); //$NON-NLS-1$
if (immutable)
- content.append("<td class=\"remove\">[IMMUTABLE]</td>");
- content.append("</tr>\n");
+ content.append("<td class=\"remove\">[IMMUTABLE]</td>"); //$NON-NLS-1$
+ content.append("</tr>\n"); //$NON-NLS-1$
boolean isClusterSet = support.isClusterSet(r);
Resource parentSet = support.getClusterSetOfCluster(r);
String parentSetURI = parentSet != null ? graph.getPossibleURI(parentSet) : null;
- content.append("<tr><td class=\"top_key\">Clustering</td><td class=\"top_value\">");
- content.append("<span id=\"resource_id\">");
+ content.append("<tr><td class=\"top_key\">Clustering</td><td class=\"top_value\">"); //$NON-NLS-1$
+ content.append("<span id=\"resource_id\">"); //$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("</span></td>");
+ content.append("</span></td>"); //$NON-NLS-1$
if (isClusterSet)
- content.append("<td class=\"remove\">[CLUSTER SET]</td>");
- content.append("</tr>\n");
+ content.append("<td class=\"remove\">[CLUSTER SET]</td>"); //$NON-NLS-1$
+ content.append("</tr>\n"); //$NON-NLS-1$
// If the resource has a value, show it.
String resourceValue = getResourceValue(graph, r);
if (resourceValue != null) {
content
- .append("<tr><td class=\"top_key\">Attached value</td><td class=\"top_value\">")
+ .append("<tr><td class=\"top_key\">Attached value</td><td class=\"top_value\">") //$NON-NLS-1$
.append(htmlEscape(resourceValue))
- .append("</td></tr>\n");
+ .append("</td></tr>\n"); //$NON-NLS-1$
}
// Close #top
- content.append("</table>\n");
- content.append("</div>\n");
+ content.append("</table>\n"); //$NON-NLS-1$
+ content.append("</div>\n"); //$NON-NLS-1$
- content.append("\n<div id=\"data\">\n");
- content.append("<table>\n")
- .append("<tr><th>Predicate</th><th>Object</th><th>Graph</th></tr>")
- .append("<tr><td class=\"subtitle\" colspan=\"3\">Basic information</td></tr>");
+ content.append("\n<div id=\"data\">\n"); //$NON-NLS-1$
+ content.append("<table>\n") //$NON-NLS-1$
+ .append("<tr><th>Predicate</th><th>Object</th><th>Graph</th></tr>") //$NON-NLS-1$
+ .append("<tr><td class=\"subtitle\" colspan=\"3\">Basic information</td></tr>"); //$NON-NLS-1$
boolean isOrderedSet = graph.isInstanceOf(r, L0.OrderedSet);
boolean isLinkedList = graph.isInstanceOf(r, L0.List);
updatePred(content, graph, r, pred, map.remove(pred));
// TAGS
- content.append("<tr><td class=\"subtitle\" colspan=\"3\">Tags</td></tr>");
+ content.append("<tr><td class=\"subtitle\" colspan=\"3\">Tags</td></tr>"); //$NON-NLS-1$
for(Statement stm : statements) {
if(stm.getSubject().equals(stm.getObject())) {
updateTag(content, graph, r, stm.getPredicate());
}
// ORDERED SETS
- content.append("<tr><td class=\"subtitle\" colspan=\"3\">Ordered Sets</td></tr>");
+ content.append("<tr><td class=\"subtitle\" colspan=\"3\">Ordered Sets</td></tr>"); //$NON-NLS-1$
for(Statement stm : statements) {
Resource predicate = stm.getPredicate();
if(graph.isInstanceOf(stm.getPredicate(), L0.OrderedSet)) {
}
// IS RELATED TO
- content.append("<tr><td class=\"subtitle\" colspan=\"3\">Is Related To</td></tr>");
+ content.append("<tr><td class=\"subtitle\" colspan=\"3\">Is Related To</td></tr>"); //$NON-NLS-1$
// ELEMENTS OF ORDERED SET
if(isOrderedSet) {
try {
updateOrderedSet(content, graph, r);
} catch (ValidationException e) {
- content.append("<td colspan=\"3\"><span style=\"color:red;font-weight:bold\">BROKEN ORDERED SET:<br/></span><span style=\"color:red\">").append(e.getMessage()).append("</span></td>");
+ content.append("<td colspan=\"3\"><span style=\"color:red;font-weight:bold\">BROKEN ORDERED SET:<br/></span><span style=\"color:red\">").append(e.getMessage()).append("</span></td>"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
try {
updateLinkedList(content, graph, r);
} catch (ValidationException e) {
- content.append("<td colspan=\"3\"><span style=\"color:red;font-weight:bold\">BROKEN LINKED LIST:<br/></span><span style=\"color:red\">").append(e.getMessage()).append("</span></td>");
+ content.append("<td colspan=\"3\"><span style=\"color:red;font-weight:bold\">BROKEN LINKED LIST:<br/></span><span style=\"color:red\">").append(e.getMessage()).append("</span></td>"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
for(Resource pred : preds) {
String str = htmlEscape( getResourceName(graph, pred) );
if(str == null)
- str = "<null>";
+ str = "<null>"; //$NON-NLS-1$
strmap.put(pred, str);
}
Arrays.sort(preds, new Comparator<Resource>() {
updatePred(content, graph, r, pred, map.get(pred));
// OTHER STATEMENTS
- content.append("<tr><td class=\"subtitle\" colspan=\"3\">Other statements</td></tr>");
+ content.append("<tr><td class=\"subtitle\" colspan=\"3\">Other statements</td></tr>"); //$NON-NLS-1$
for(Resource pred : preds)
if(!graph.isSubrelationOf(pred, L0.IsRelatedTo))
updatePred(content, graph, r, pred, map.get(pred));
- content.append("</table>\n");
+ content.append("</table>\n"); //$NON-NLS-1$
}
// Close #data
- content.append("</div>\n\n");
+ content.append("</div>\n\n"); //$NON-NLS-1$
// Close #mainContent
- content.append("</div>\n");
- content.append("</body>\n</html>\n");
+ content.append("</div>\n"); //$NON-NLS-1$
+ content.append("</body>\n</html>\n"); //$NON-NLS-1$
// Update content
final String finalContent = content.toString();
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);
}
return NameUtils.getSafeName(g, r);
} catch(Throwable throwable) {
ErrorLogger.defaultLogError(throwable);
- return "<font color=\"red\"><i>"+throwable.getClass().getName()+"</i> "+throwable.getMessage()+"</font>";
+ return "<font color=\"red\"><i>"+throwable.getClass().getName()+"</i> "+throwable.getMessage()+"</font>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
// }
private String getHead() {
- String result = "";
+ String result = ""; //$NON-NLS-1$
if (cssPath != null) {
- result = "<link href=\"" + cssPath + "\" rel=\"stylesheet\" type=\"text/css\">";
+ result = "<link href=\"" + cssPath + "\" rel=\"stylesheet\" type=\"text/css\">"; //$NON-NLS-1$ //$NON-NLS-2$
}
return result;
}