]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebugger.java
Externalize strings in org.simantics.debug.ui
[simantics/platform.git] / bundles / org.simantics.debug.ui / src / org / simantics / debug / ui / graph / GraphicalDebugger.java
index fef011b8d4efdcc754d314d23f8df5003ce53b59..c8a89fa9e619327ce221c7465f8161e4b8675b96 100644 (file)
@@ -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 += "<br/>"+text;
+                               label += "<br/>"+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<div class=\"monospaced\">" + uri + "</div><br/>");
 
             Collection<Statement> 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("<h3>" + " ["+ r.getResourceId() + "-" + support.getCluster(r) + "] " + "</h3>\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("<table>\n");
             //content.append("<tr><th>Predicate</th><th>Object</th></tr>");
@@ -324,7 +325,7 @@ public class GraphicalDebugger extends GraphDebugger {
             //content.append("<tr><td class=\"subtitle\" colspan=\"2\">Tags</td></tr>");
             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 = "<null>";
+                    str = "<null>"; //$NON-NLS-1$
                 strmap.put(pred, str);
             }
             Arrays.sort(preds, new Comparator<Resource>() {
@@ -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("<span style=\"color:red;font-weight:bold\">BROKEN ORDERED SET:<br/></span><span style=\"color:red\">" + e.getMessage() + "</span>");
 //                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